一键导入
frappe-doctype-builder
Build Frappe DocTypes with fields, permissions, and naming configurations. Use this skill when creating or modifying DocType structures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build Frappe DocTypes with fields, permissions, and naming configurations. Use this skill when creating or modifying DocType structures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Plan and design a DocType architecture / data model for a new Frappe feature like a seasoned lead developer — interview the user, map entities, propose DocType names and links, and draw a flowchart of how the doctypes connect. Use this skill when the user says any of "help me plan a doctype architecture", "design a data model for", "what doctypes do I need for", "model a feature", "I want to build <feature>", "I need to implement an evaluation system", "issuing certificates", "design the schema for", "how should I structure my doctypes", "map the entities for", "plan the doctypes for a <X> system" (CRM, helpdesk, ticketing, LMS, booking, approval, subscription, inventory, etc.). It GRILLS the user with staged questions, proposes sensible defaults, keeps a running model, scans the existing app codebase to REUSE or EXTEND existing doctypes (adding fields / Custom Fields) before creating new ones, then produces a Mermaid diagram + per-DocType spec tables and offers to hand off to frappe-doctype-builder to genera
Create custom API endpoints and whitelisted methods for Frappe applications. Use when building REST APIs or custom endpoints.
Generate JavaScript client-side form scripts for Frappe DocTypes. Use when creating form customizations, field validations, custom buttons, or client-side logic for Frappe/ERPNext forms.
Generate data migration scripts for Frappe. Use when migrating data from legacy systems, transforming data structures, or importing large datasets.
Generate API documentation, user guides, and technical documentation for Frappe apps. Use when documenting APIs, creating user guides, or generating OpenAPI specs.
Generate code to integrate Frappe with external REST APIs. Use when connecting to third-party services, payment gateways, or external data sources.
| name | frappe-doctype-builder |
| description | Build Frappe DocTypes with fields, permissions, and naming configurations. Use this skill when creating or modifying DocType structures. |
Build complete DocType definitions with proper field types, permissions, and configurations.
These Frappe conventions apply to everything this skill generates, and override any conflicting example below.
bench (never ./env/bin/bench or a full path). Always pass --site <site> explicitly — never run a bare bench migrate / bench run-tests. Run bench start in the background and only if it isn't already running. Don't run discovery commands (which bench, bench --version).apps/<app>/<app>/<module>/doctype/<name>/<name>.json — the app name appears twice (directory + Python package) — with an empty __init__.py alongside. Never mkdir the folder; write the JSON and run bench --site <site> migrate to create the structure. Don't add creation, modified, owner, modified_by, or docstatus as fields — Frappe manages them.frappe.qb.get_query() over raw frappe.db.sql(). Use frappe.db.get_all() for server logic (ignores permissions) and frappe.db.get_list() for user-facing APIs (enforces them). Never use frappe.db.set_value() on a field with validation or lifecycle logic — load the doc and doc.save() so controller hooks run. Batch-fetch related records; never query inside a loop (N+1).frappe.db.commit() in controllers, request handlers, background jobs, or patches — Frappe auto-commits on success and rolls back on uncaught errors. Flush manually only to make a write visible to a subsequent frappe.enqueue() (or pass enqueue_after_commit=True).@frappe.whitelist() parameter so Frappe validates and casts it, and pass methods=[...] to pin the HTTP verb.Upstream data-model planning (which DocTypes to create, how they relate, reuse vs extend) is done by the
frappe-doctype-architectskill; this skill emits the JSON from that plan.
Claude should invoke this skill when:
Create complete DocType JSON files with:
Support all Frappe field types:
Master DocType:
{
"name": "Customer",
"module": "CRM",
"autoname": "naming_series:",
"naming_rule": "By naming series",
"track_changes": 1,
"is_submittable": 0
}
Transaction DocType:
{
"name": "Sales Order",
"module": "Selling",
"is_submittable": 1,
"autoname": "naming_series:",
"track_changes": 1
}
A submittable DocType (is_submittable: 1) automatically gets a docstatus field — 0 Draft, 1 Submitted, 2 Cancelled. Do not declare docstatus as a field.
Child Table:
{
"name": "Sales Order Item",
"module": "Selling",
"istable": 1,
"editable_grid": 1
}
A child DocType needs "istable": 1 and an empty __init__.py in its folder; it carries no permissions block (it inherits the parent's).
Settings DocType:
{
"name": "System Settings",
"module": "Core",
"issingle": 1
}
Naming Series field (pairs with autoname: "naming_series:"):
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Naming Series",
"options": "CUST-.YYYY.-\nCUST-",
"reqd": 1
}
Pick exactly one. Do not conflate naming series with an expression — they are distinct mechanisms.
autoname: "naming_series:" plus a naming_series Select field whose options use the dotted series syntax (CUST-.YYYY.-). User-configurable per document.autoname: "field:fieldname". The document name is taken from that field's value (e.g. field:email).autoname: "hash". Use for child/join rows that are never referenced by a readable name.autoname: "format:EXP-{####}" with naming_rule: "Expression". A fixed format string (no Select field involved).autoname: "autoincrement". Integer primary key.autoname: "prompt". User types the name manually.Status Field:
{
"fieldname": "status",
"fieldtype": "Select",
"label": "Status",
"options": "Draft\nSubmitted\nCancelled",
"default": "Draft"
}
Link Field:
{
"fieldname": "customer",
"fieldtype": "Link",
"label": "Customer",
"options": "Customer",
"reqd": 1
}
Child Table:
{
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
"options": "Sales Order Item",
"reqd": 1
}
Computed Field:
{
"fieldname": "total",
"fieldtype": "Currency",
"label": "Total Amount",
"read_only": 1
}
Fetch From (denormalized copy):
{
"fieldname": "customer_name",
"fieldtype": "Data",
"label": "Customer Name",
"fetch_from": "customer.customer_name",
"read_only": 1
}
"options": "Customer"). Use when the related DocType is fixed.reference_doctype (fieldtype: Link, options: DocType) that names the target DocType, plus a reference_name (fieldtype: Dynamic Link, options: reference_doctype) that holds the record name. Use when a row can point at different DocTypes."istable": 1, no permissions block — it inherits the parent's) when rows are owned by exactly one parent and never queried on their own. The parent holds a Table field pointing to it.Link field back to the owner when rows have their own lifecycle, permissions, or need to be queried independently.fetch_fromfetch_from copies a value from a linked record into a read-only field. Single hop only: <link_field_on_this_doctype>.<field_on_linked_doctype> (e.g. customer.customer_name). Never a two-dot grandparent expression. It is a denormalized cached copy, not a live join.
{
"permissions": [
{
"role": "Sales User",
"read": 1,
"write": 1,
"create": 1,
"delete": 0,
"submit": 0,
"cancel": 0
},
{
"role": "Sales Manager",
"read": 1,
"write": 1,
"create": 1,
"delete": 1,
"submit": 1,
"cancel": 1
}
]
}
Dependent Fields:
{
"fieldname": "customer_group",
"fieldtype": "Link",
"options": "Customer Group",
"depends_on": "eval:doc.customer"
}
Mandatory Depends On:
{
"fieldname": "tax_id",
"fieldtype": "Data",
"label": "Tax ID",
"mandatory_depends_on": "eval:doc.country=='United States'"
}
Read Only Depends On:
{
"fieldname": "posted_date",
"fieldtype": "Date",
"read_only_depends_on": "eval:doc.docstatus==1"
}
When building a DocType, provide:
After creating DocType JSON, suggest controller methods:
validate() - Pre-save validationbefore_save() - Modify values before savingon_submit() - Actions when document is submittedon_cancel() - Actions when document is cancelledon_trash() - Actions before deletionapps/<app>/<app>/<module>/doctype/customer/customer.json)bench --site <site> migrate — never mkdir the doctype folder)Generated files should follow (the app name appears twice — directory + Python package):
apps/
└── <app>/
└── <app>/
└── <module>/
└── doctype/
└── <doctype_name>/
├── __init__.py
├── <doctype_name>.json
├── <doctype_name>.py
└── <doctype_name>.js
Never mkdir the doctype folder by hand — write the JSON and run bench --site <site> migrate, which creates the structure.
Remember: This skill is model-invoked. Claude will use it autonomously when detecting DocType-related tasks.