frappe-agent-architect
Use when designing multi-app Frappe architectures, deciding whether to split functionality into separate apps, or implementing cross-app communication…
Use when implementing document Workflows, approval chains, or state-based transitions in Frappe. Prevents stuck documents from missing transitions, broken approval chains, and permission errors on workflow actions. Covers Workflow DocType, Workflow State, Workflow Action,
$ npx -y skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-impl-workflow --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/frappe-impl-workflowContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when implementing document Workflows, approval chains, or state-based transitions in Frappe. Prevents stuck documents from missing transitions, broken approval chains, and permission errors on workflow actions. Covers Workflow DocType, Workflow State, Workflow Action,
name: frappe-impl-workflow description: > Use when implementing document Workflows, approval chains, or state-based transitions in Frappe. Prevents stuck documents from missing transitions, broken approval chains, and permission errors on workflow actions. Covers Workflow DocType, Workflow State, Workflow Action, transition rules, allowed roles, conditions, workflow_state field, apply_workflow. Keywords: workflow, approval, transition, Workflow State, Workflow Action, state machine, approval chain, workflow_state, approval chain, document approval, multi-step approval, workflow stuck, status transitions.. license: MIT compatibility: "Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16." metadata: author: OpenAEC-Foundation version: "2.0"
Step-by-step guide for implementing document workflows in Frappe. Covers design, setup, testing, and common approval chain patterns.
1. □ Design states and transitions on paper/diagram first 2. □ Create Workflow State records (master list) 3. □ Create Workflow Action Master records (Approve, Reject, etc.) 4. □ Create the Workflow DocType record 5. □ Add states with correct doc_status values 6. □ Add transitions with roles, actions, and conditions 7. □ Set allow_edit roles per state 8. □ Configure email notifications (optional) 9. □ Test every transition path with test users 10. □ Verify self-approval blocking works as expected
Before touching the UI, map out your workflow on paper.
**ALWAYS** start by listing every distinct document stage:
Example — Purchase Order Approval: Draft → Pending Review → Pending Approval → Approved → Submitted → Cancelled
For submittable DocTypes, ALWAYS assign `doc_status` correctly:
| Stage | doc_status | Meaning | |-------|:-:|---------| | All "in-progress" states | 0 | Document is Draft, editable | | Final approved/active state | 1 | Document is Submitted, locked | | Cancelled state | 2 | Document is Cancelled |
**NEVER** assign `doc_status = 1` to intermediate approval states. A submitted document cannot return to draft. Once submitted, the only forward path is another submitted state or cancellation.
For each state, define: What actions are possible? Who can perform them? Any conditions?
Draft →[Submit for Review / Creator]→ Pending Review Pending Review →[Approve / Reviewer]→ Pending Approval Pending Review →[Reject / Reviewer]→ Draft Pending Approval →[Approve / Manager]→ Approved Pending Approval →[Reject / Manager]→ Draft Approved →[Submit / Manager]→ Submitted (doc_status=1) Submitted →[Cancel / Manager]→ Cancelled (doc_status=2)
Navigate to **Workflow State** list or create via API:
# Create states with appropriate styles
states = [
{"workflow_state_name": "Draft", "style": ""},
{"workflow_state_name": "Pending Review", "style": "Primary"},
{"workflow_state_name": "Pending Approval", "style": "Warning"},
{"workflow_state_name": "Approved", "style": "Success"},
{"workflow_state_name": "Submitted", "style": "Info"},
{"workflow_state_name": "Rejected", "style": "Danger"},
{"workflow_state_name": "Cancelled", "style": "Inverse"},
]
for s in states:
if not frappe.db.exists("Workflow State", s["workflow_state_name"]):
frappe.get_doc({"doctype": "Workflow State", **s}).insert()Available styles: `Primary`, `Success`, `Warning`, `Danger`, `Info`, `Inverse` (or empty for default).
actions = ["Submit for Review", "Approve", "Reject", "Send Back", "Cancel"]
for action in actions:
if not frappe.db.exists("Workflow Action Master", action):
frappe.get_doc({
"doctype": "Workflow Action Master",
"workflow_action_name": action
}).insert()Navigate to **Setup > Workflow > New Workflow**:
1. Set **Workflow Name** (e.g., "Purchase Order Approval") 2. Set **Document Type** (e.g., "Purchase Order") 3. Check **Is Active** 4. Add states in the **States** table 5. Add transitions in the **Transitions** table
workflow = frappe.get_doc({
"doctype": "Workflow",
"workflow_name": "Purchase Order Approval",
"document_type": "Purchase Order",
"is_active": 1,
"send_email_alert": 1,
"states": [
{"state": "Draft", "doc_status": "0", "allow_edit": "Purchase User"},
{"state": "Pending Approval", "doc_status": "0", "allow_edit": "Purchase Manager"},
{"state": "Approved", "doc_status": "1", "allow_edit": "Purchase Manager"},
{"state": "Rejected", "doc_status": "0", "allow_edit": "Purchase User"},
{"state": "Cancelled", "doc_status": "2"},
],
"transitions": [
{
"state": "Draft",
"action": "Submit for Review",
"next_state": "Pending Approval",
"allowed": "Purchase User",
"allow_self_approval": 1,
},
{
"state": "Pending Approval",
"action": "Approve",
"next_state": "Approved",
"allowed": "Purchase Manager",
"allow_self_approval": 0,
},
{
"state": "Pending Approval",
"action": "Reject",
"next_state": "Rejected",
"allowed": "Purchase Manager",
},
{
"state": "Rejected",
"action": "Submit for Review",
"next_state": "Pending Approval",
"allowed": "Purchase User",
},
{
"state": "Approved",
"action": "Cancel",
"next_state": "Cancelle60 deterministic Claude AI skills for Frappe Framework & ERPNext v14-v16 development and operations
Repo: Impertio-Studio/Frappe_Claude_Skill_Package
Use when designing multi-app Frappe architectures, deciding whether to split functionality into separate apps, or implementing cross-app communication…
Use when debugging Frappe errors, using bench console for live inspection, analyzing tracebacks, or reading Frappe log files. Prevents wasted debugging time…
Use when receiving vague or unclear ERPNext/Frappe development requests that need interpretation. Transforms requirements like 'make invoice auto-calculate' or…
Use when migrating a Frappe app between major versions, detecting breaking API changes, or resolving post-migration errors. Prevents failed migrations from…
Use when reviewing or validating Frappe/ERPNext code against best practices and common pitfalls. Checks generated code before deployment, validates against all…
Use when building ERPNext/Frappe API integrations (v14/v15/v16) including REST API, RPC API, authentication, webhooks, and rate limiting. Covers external API…