openaec-foundation/frappe_claude_skill_package/frappe-impl-controllers
Claude Code and agent skill by openaec-foundation/frappe_claude_skill_package
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when building Document Controllers in a custom Frappe app: file creation, lifecycle hooks, validation, autoname, submittable workflows, controller override, child table controllers, flags system, migration from hooks.py and Server Scripts. Keywords: how to implement controller, which hook to use, validate vs on_update, override controller, submittable document, autoname, flags, extend_doctype_class, controller testing, child table controller, which hook to use, when does validate run, how to override save, document lifecycle.
Install
npx vskill@latest install openaec-foundation/frappe_claude_skill_package/frappe-impl-controllersSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as openaec-foundation/frappe_claude_skill_package/frappe-impl-controllers.
Document Controllers — Implementation Workflows
Step-by-step workflows for building server-side DocType logic with full Python power. For exact syntax, see frappe-syntax-controllers.
Version: v14/v15/v16 | v15+: Supports auto-generated type annotations
Quick Decision: Controller vs Server Script?
Rule: ALWAYS use Controllers when you need a custom app. ALWAYS use Server Scripts for no-code prototyping.
Workflow 1: Create a New Controller
Step 1: Create DocType via Frappe UI or bench new-doctype
Step 2: File is auto-generated at:
Step 3: Implement the controller class:
Step 4: Run bench restart (or bench watch for hot-reload in dev)
Naming convention: DocType "Sales Order" → class SalesOrder, file sales_order.py
Workflow 2: Choose the Right Hook
See references/decision-tree.md for all hooks with execution order.
CRITICAL: validate vs on_update
| Aspect | validate | on_update | |
|---|---|---|---|
| When | Before DB write | After DB write | |
self.x = y saved? | YES | NO — use db_set | |
| Can abort with throw? | YES | Already saved | |
get_doc_before_save() | Available | Available | |
| Use for | Validation, calculations | Notifications, linked docs |
Workflow 3: Validation with Error Collection
Workflow 4: Detect Field Changes
Rule: ALWAYS use self.flags to pass data between hooks. NEVER rely on external state.
Workflow 5: Custom Naming (autoname)
Alternative — before_naming:
Workflow 6: Submittable Document
Rule: NEVER duplicate validation between validate and before_submit. validate ALWAYS runs before before_submit.
Workflow 7: Override Standard ERPNext Controller
Method A: Full Override (hooks.py)
Method B: Event Handler (Safer, no class override)
Method C: extend_doctype_class (v16+)
Rule: ALWAYS call super().validate() in override. NEVER skip parent methods — standard ERPNext logic depends on it.
Workflow 8: Whitelisted Methods (Client-Callable)
Client-side call:
Workflow 9: Flags System
Workflow 10: Testing Controllers
Run: bench run-tests --module myapp.module.doctype.my_doctype.test_my_doctype
Execution Order Reference
INSERT
SAVE (existing)
SUBMIT
Anti-Pattern Quick Check
| Do NOT | Do Instead | |
|---|---|---|
self.x = y in on_update | frappe.db.set_value(...) | |
self.save() in on_update | Causes infinite loop | |
frappe.db.commit() in hooks | Let framework handle | |
| Heavy ops in validate | Use frappe.enqueue() in on_update | |
Skip super().validate() | ALWAYS call parent first | |
frappe.get_doc() in loops | Use frappe.get_cached_doc() | |
| Hardcoded thresholds | Use Settings DocType |
See references/anti-patterns.md for complete list.
Related Skills
frappe-syntax-controllers— Exact hook signatures and APIfrappe-errors-controllers— Error handling patternsfrappe-impl-serverscripts— When Server Script sufficesfrappe-syntax-hooks— hooks.py configurationfrappe-core-database—frappe.db.*operations
See references/decision-tree.md for all hooks.See references/workflows.md for extended patterns.See references/examples.md for complete working examples.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/source/impl/frappe-impl-controllers/SKILL.md
Popularity
- Repository stars
- 88
- Repository forks
- 25
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 28 Apr 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/openaec-foundation/frappe_claude_skill_package/frappe-impl-controllers)