Frappe Core Workflow logo

Frappe Core Workflow

Organization
Impertio-Studio
frappe-core-workflow

Use when creating or modifying Frappe Workflows, defining states and transitions, adding action conditions, or troubleshooting workflow permission errors. Prevents stuck documents from misconfigured transitions, missing state permissions, and circular workflow paths. Covers Workflow DocType, workflow states, transitions, actions, conditions (Python expressions), workflow permissions, workflow_state field, Workflow Action DocType. Keywords: workflow, states, transitions, actions, conditions, workflow_state, Workflow Action, approval, document workflow, approval process, document stuck, cannot change status, workflow not moving, who can approve..

Overview

PublisherImpertio-Studio
RepositoryFrappe_Claude_Skill_Package
Skill namefrappe-core-workflow
Stars
180
Forks
53
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Impertio-Studio on GitHub. Read the source before you install it.

Installation

Install the Frappe Core Workflow AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package.git /tmp/Frappe_Claude_Skill_Package
mkdir -p .claude/skills
cp -r /tmp/Frappe_Claude_Skill_Package/skills/source/core/frappe-core-workflow .claude/skills/frappe-core-workflow
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Frappe Core Workflow in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Frappe Core Workflow on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Frappe Core Workflow is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Workflow Engine

The Frappe Workflow engine is a state machine that controls document lifecycle through configurable states, transitions, and role-based permissions. It governs when and how documents change status, who can perform actions, and what side effects occur on each transition.

Quick Reference

Workflow DocType            → Defines the state machine for a specific DocType
├── states (child table)    → Workflow Document State rows
│   ├── state               → Link to Workflow State
│   ├── doc_status          → 0 (Draft), 1 (Submitted), 2 (Cancelled)
│   ├── allow_edit          → Role that can edit in this state
│   ├── update_field        → Field to update when entering state
│   ├── update_value        → Value to set (literal or expression)
│   └── next_action_email_template → Email Template link
└── transitions (child table) → Workflow Transition rows
    ├── state               → Source state (Link to Workflow State)
    ├── action              → Link to Workflow Action Master
    ├── next_state          → Target state (Link to Workflow State)
    ├── allowed             → Role that can perform this action
    ├── allow_self_approval → Check (default: 1)
    ├── condition           → Python expression (optional)
    └── transition_tasks    → Link to Workflow Transition Tasks

Key Fields on Workflow DocType

FieldTypePurpose
workflow_nameDataUnique identifier
document_typeLink → DocTypeTarget DocType
is_activeCheckOnly ONE workflow per DocType can be active
workflow_state_fieldDataDefault: workflow_state
override_statusCheckPrevent workflow from overriding list view status
send_email_alertCheckEmail notifications with next possible actions

How the Engine Works

1. Activation and Field Creation

When a Workflow is saved with is_active = 1:

  • All other workflows for the same DocType are deactivated automatically
  • A hidden Custom Field (workflow_state_field, default workflow_state) is created on the target DocType if it does not exist
  • The field is type Link to Workflow State, with hidden=1, allow_on_submit=1, no_copy=1
  • Existing documents with empty workflow state get their state set based on their current docstatus

2. State Resolution

Every document under a workflow has a workflow_state field. The engine resolves available transitions by:

  1. Reading current workflow_state from the document
  2. Filtering workflow.transitions where transition.state == current_state
  3. Filtering by user roles: transition.allowed in frappe.get_roles()
  4. Evaluating transition.condition via frappe.safe_eval() (if set)
  5. Returning matching transitions as available actions

3. Applying a Transition

When apply_workflow(doc, action) is called:

  1. Load document from DB (fresh read)
  2. Get available transitions for current user
  3. Find transition matching the requested action
  4. Check self-approval: blocked if allow_self_approval=0 AND user is document owner
  5. Set workflow_state_field to transition.next_state
  6. If update_field is set on the target state, update that field
  7. Execute transition tasks (sync first, then async via frappe.enqueue)
  8. Handle docstatus change based on source/target state doc_status values
  9. Save/Submit/Cancel document accordingly
  10. Add workflow comment

Workflow and DocStatus Interaction

CRITICAL: The workflow engine controls docstatus transitions. You NEVER call doc.submit() or doc.cancel() directly on a workflow-controlled document. The workflow does it.

DocStatus Transition Rules

Source doc_statusTarget doc_statusEngine ActionValid?
0 (Draft)0 (Draft)doc.save()YES
0 (Draft)1 (Submitted)doc.submit()YES
1 (Submitted)1 (Submitted)doc.save()YES
1 (Submitted)2 (Cancelled)doc.cancel()YES
2 (Cancelled)ANYBLOCKEDNO
1 (Submitted)0 (Draft)BLOCKEDNO
0 (Draft)2 (Cancelled)BLOCKEDNO

ALWAYS define your states so that docstatus only moves forward: 0→0, 0→1, 1→1, 1→2. NEVER create a transition from a cancelled state or from submitted back to draft.

Non-Submittable DocTypes

If the target DocType is NOT submittable, ALL states MUST have doc_status = 0. The engine validates this and throws an error if any state has doc_status = 1 or 2 on a non-submittable DocType.

Workflow States

Workflow State is a separate DocType used as a master list. Each state has:

FieldPurpose
stateDisplay name of the state
styleCSS class for badge display (Primary, Success, Warning, Danger, Info, Inverse)
iconFont Awesome icon class

State Row Fields (Workflow Document State)

FieldPurpose
stateLink to Workflow State
doc_statusSelect: 0, 1, or 2
allow_editLink to Role — ONLY this role can edit the document in this state
update_fieldField to update when document enters this state
update_valueValue to set (string or Python expression if evaluate_as_expression=1)
is_optional_stateCheck — optional states are skipped in get_next_possible_transitions
send_emailCheck (default 1) — send email notification on entering this state
next_action_email_templateLink to Email Template
messageText message for the email notification

Workflow Transitions

Each transition row defines one possible action:

FieldPurpose
stateSource state (MUST exist in states table)
actionLink to Workflow Action Master (e.g., "Approve", "Reject", "Review")
next_stateTarget state (MUST exist in states table)
allowedLink to Role — ONLY users with this role see this action
allow_self_approvalCheck (default 1) — if 0, document owner cannot perform this action
conditionPython expression evaluated with frappe.safe_eval()
transition_tasksLink to Workflow Transition Tasks (v15+)

Condition Expressions

Conditions are Python expressions evaluated in a sandboxed environment. Available globals:

python
# Available in condition expressions:
frappe.db.get_value(doctype, name, fieldname)
frappe.db.get_list(doctype, filters, fields)
frappe.session.user
frappe.session.roles  # NOT available — use frappe.get_roles() outside conditions
frappe.utils.now_datetime()
frappe.utils.add_to_date(date, **kwargs)
frappe.utils.get_datetime(datetime_str)
frappe.utils.now()
doc.fieldname  # Access any field on the document (as dict)

Example conditions:

python
doc.grand_total > 50000
doc.department == "HR"
doc.grand_total > 50000 and doc.department != "Finance"

Workflow Actions

Workflow Action Master

Simple DocType with just a workflow_action_name field. Common actions: Approve, Reject, Review, Send Back, Cancel. Create these first before defining transitions.

Workflow Action DocType

Tracks pending actions for users. Created automatically when a document enters a state with outgoing transitions.

FieldPurpose
statusOpen or Completed
reference_doctypeThe DocType of the document
reference_nameThe document name
workflow_stateCurrent workflow state
userAssigned user
permitted_rolesTable MultiSelect of roles that can act
completed_byUser who completed the action
completed_by_roleRole used to complete

Workflow Actions appear in the user's "Workflow Action" list and can be acted on via email links.

Self-Approval Control

python
def has_approval_access(user, doc, transition):
    return (user == "Administrator"
            or transition.get("allow_self_approval")
            or user != doc.get("owner"))
  • Administrator ALWAYS has approval access regardless of settings
  • If allow_self_approval = 1 (default): document owner CAN approve
  • If allow_self_approval = 0: document owner CANNOT approve their own document

Decision Tree

Need workflow on a DocType?
├── Is DocType submittable?
│   ├── YES → States can use doc_status 0, 1, 2
│   └── NO  → ALL states MUST have doc_status = 0
├── Define states → Create Workflow State records first
├── Define transitions → Need Workflow Action Master records first
├── Who can edit in each state? → Set allow_edit per state
├── Need conditional transitions?
│   └── Use Python expressions with doc.field access
├── Need to block self-approval?
│   └── Set allow_self_approval = 0 on specific transitions
└── Need email notifications?
    └── Set send_email_alert on Workflow + email templates on states

Common Errors

ErrorCauseFix
WorkflowStateErrorDocument has no workflow_state setEnsure workflow sets initial state on creation
WorkflowTransitionErrorAction not valid for current state/roleVerify transitions table covers all needed paths
WorkflowPermissionErrorUser lacks role for transition, or self-approval blockedCheck allowed role and allow_self_approval
"Illegal Document Status"Invalid docstatus transition (e.g., 0→2)Fix state doc_status values
"Cannot cancel before submitting"Transition from draft (0) to cancelled (2)Add intermediate submitted (1) state

See Also

  • API Reference — Complete workflow Python API
  • Examples — Workflow configuration examples
  • Anti-Patterns — Common mistakes and how to avoid them
  • frappe-impl-workflow — Step-by-step implementation guide

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Frappe Core Workflow AI skill do?

Use when creating or modifying Frappe Workflows, defining states and transitions, adding action conditions, or troubleshooting workflow permission errors. Prevents stuck documents from misconfigured transitions, missing state permissions, and circular workflow paths. Covers Workflow DocType, workflow states, transitions, actions, conditions (Python expressions), workflow permissions, workflow_state field, Workflow Action DocType. Keywords: workflow, states, transitions, actions, conditions, workflow_state, Workflow Action, approval, document workflow, approval process, document stuck, canno...

Why use Frappe Core Workflow on TypingMind?

Because you install it once and use it with any model. Frappe Core Workflow is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Frappe Core Workflow in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package/tree/main/skills/source/core/frappe-core-workflow. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Frappe Core Workflow?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Frappe Core Workflow?

As many as you like. As long as a model supports skills, you can use Frappe Core Workflow with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Frappe Core Workflow AI skill free?

Yes. It is published on GitHub by Impertio-Studio under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇