frappe-doctype-builder
Build Frappe DocTypes with fields, permissions, and naming configurations. Use this skill when creating or modifying DocType structures.
When & Why to Use This Skill
This Claude skill is a specialized tool for the Frappe framework that automates the creation and modification of DocTypes. It streamlines the development process by generating complete JSON schemas, configuring diverse field types, and setting up complex permission structures, ensuring adherence to Frappe and ERPNext best practices for database design and application architecture.
Use Cases
- Rapid Prototyping: Quickly generate new Master or Transaction DocTypes with predefined naming series and module configurations.
- Complex Schema Design: Build intricate data models using advanced field types such as Child Tables, Link fields, and Geolocation without manual JSON editing.
- Permission Configuration: Define granular Role-Based Access Control (RBAC) for different user roles, including read, write, create, and submit permissions.
- Dynamic UI Logic: Implement field dependencies and visibility rules using 'depends_on' and 'mandatory_depends_on' logic within the DocType structure.
- Development Boilerplate: Generate the complete file structure for a DocType, including Python controllers and JavaScript files, along with migration instructions.
| name | frappe-doctype-builder |
|---|---|
| description | Build Frappe DocTypes with fields, permissions, and naming configurations. Use this skill when creating or modifying DocType structures. |
Frappe DocType Builder Skill
Build complete DocType definitions with proper field types, permissions, and configurations.
When to Use This Skill
Claude should invoke this skill when:
- User wants to create a new DocType
- User needs to add fields to an existing DocType
- User asks about DocType structure or design
- User wants to modify DocType properties
- User needs help with DocType JSON schema
Capabilities
1. DocType JSON Generation
Create complete DocType JSON files with:
- Metadata (name, module, naming, permissions)
- Fields with proper types and options
- Permissions for different roles
- Form layout and sections
- Naming series configuration
2. Field Type Expertise
Support all Frappe field types:
- Data: Short text fields
- Text: Long text with editor options
- Int: Integer numbers
- Float: Decimal numbers
- Currency: Money values
- Date: Date picker
- Datetime: Date and time
- Time: Time picker
- Link: Reference to another DocType
- Select: Dropdown with options
- Check: Boolean checkbox
- Table: Child table
- Attach: File upload
- Attach Image: Image upload with preview
- Signature: Signature capture
- HTML: Custom HTML content
- Markdown Editor: Markdown content
- Code: Code editor with syntax highlighting
- Dynamic Link: Polymorphic references
- Rating: Star rating
- Color: Color picker
- Geolocation: GPS coordinates
3. DocType Patterns
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
}
Child Table:
{
"name": "Sales Order Item",
"module": "Selling",
"istable": 1,
"editable_grid": 1
}
Settings DocType:
{
"name": "System Settings",
"module": "Core",
"issingle": 1
}
4. Common Field Patterns
Naming Series:
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Naming Series",
"options": "CUST-.YYYY.-\nCUST-",
"reqd": 1
}
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
}
5. Permission Configuration
{
"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
}
]
}
6. Advanced Features
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"
}
Output Format
When building a DocType, provide:
- Complete JSON structure
- Explanation of key fields
- Permission rationale
- Controller method suggestions (if needed)
- Migration instructions
Best Practices
- Naming: Use clear, descriptive field names in snake_case
- Required Fields: Mark essential fields as required
- Defaults: Provide sensible default values
- Permissions: Start restrictive, expand as needed
- Indexing: Add database indexes for frequently queried fields
- Validation: Use field properties for basic validation
- Organization: Group related fields with sections and column breaks
Integration with Controllers
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 deletion
Example Usage Flow
- User asks: "Create a Customer DocType with name, email, and phone"
- Skill generates:
- Complete DocType JSON
- Appropriate field types
- Basic permissions
- Naming configuration
- Output includes:
- JSON file content
- Where to save it (
apps/<app>/doctype/customer/customer.json) - Migration command (
bench --site <site> migrate) - Next steps for customization
File Structure
Generated files should follow:
apps/
└── <app_name>/
└── <module_name>/
└── doctype/
└── <doctype_name>/
├── __init__.py
├── <doctype_name>.json
├── <doctype_name>.py
└── <doctype_name>.js
Remember: This skill is model-invoked. Claude will use it autonomously when detecting DocType-related tasks.