frappe-syntax-doctypes
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "frappe-syntax-doctypes":https://skillpi.com/zh/skills/deepskill-2ed9e2ca5e64d63d7cd59b54c72ce6d3155ded10d5d83f85800f948361da90d0。安装前核对上游来源和版本:https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
在创建或修改 DocType JSON 定义时使用的参考,包含字段类型选择、命名规则配置、添加子表与设置树形结构等要点,旨在防止因字段类型选择错误、命名规则损坏或子表链接配置不当导致的无效 DocType。涵盖 DocType JSON 架构、字段类型及属性、autoname/命名模式、子表(Table 字段类型)、树形 DocType、虚拟 DocType、单例 DocType 和相关关键词与使用场景。
介绍来源: third_party · Impertio-Studio · 2.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: frappe-syntax-doctypes
description: >
Use when creating or modifying DocType JSON definitions, choosing fieldtypes, configuring naming rules, adding child tables, or setting up tree structures.
Prevents invalid DocType configurations from wrong fieldtype choices, broken naming rules, and misconfigured child table links.
Covers DocType JSON schema, all fieldtypes and their properties, autoname/naming_rule patterns, child table (Table fieldtype), tree DocTypes, virtual DocTypes, Single DocTypes.
Keywords: DocType, fieldtype, naming_rule, autoname, child table, tree, virtual DocType, Single, JSON definition, Custom Field, Customize Form, add field without code, hierarchy, tree view, field types list..
license: MIT
compatibility: "Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16."
metadata:
author: OpenAEC-Foundation
version: "2.0"DocType JSON Design
DocTypes are the foundation of every Frappe application. A DocType defines both the data model (database schema) and the view (form layout). ALWAYS design DocTypes before writing any controller logic.
Quick Reference
DocType JSON Top-Level Properties
| Property | Type | Purpose |
|---|---|---|
name |
str | DocType identifier (singular, e.g. "Sales Invoice") |
module |
str | App module this DocType belongs to |
is_submittable |
bool | Enables Draft -> Submitted -> Cancelled workflow |
is_tree |
bool | Enables NestedSet hierarchy (lft/rgt columns) |
is_virtual |
bool | No database table; data from custom backend |
issingle |
bool | Single-instance settings document |
istable |
bool | Child table DocType (embedded in parent) |
is_calendar_and_gantt |
bool | Enables calendar/gantt views |
track_changes |
bool | Stores version history on every save |
track_seen |
bool | Tracks which users viewed the document |
track_views |
bool | Counts total document views |
allow_rename |
bool | Permits renaming after creation |
allow_copy |
bool | Enables "Duplicate" action |
allow_import |
bool | Enables Data Import for this DocType |
naming_rule |
str | Naming method selector (see Naming section) |
autoname |
str | Naming pattern string |
title_field |
str | Field used as display title |
search_fields |
str | Comma-separated fields for search results |
show_title_field_in_link |
bool | Display title instead of name in Link fields |
image_field |
str | Field containing image for avatar display |
sort_field |
str | Default sort column |
sort_order |
str | "ASC" or "DESC" |
default_print_format |
str | Print Format name |
max_attachments |
int | Attachment limit |
Common Fieldtypes (Quick Lookup)
| Fieldtype | Stores | DB Column |
|---|---|---|
| Data | Text up to 140 chars | VARCHAR(140) |
| Link | Reference to another DocType | VARCHAR(140) |
| Dynamic Link | Reference to any DocType | VARCHAR(140) |
| Select | Single choice from options | VARCHAR(140) |
| Table | Child table rows | Separate table |
| Table MultiSelect | Multi-select link rows | Separate table |
| Check | Boolean 0/1 | TINYINT |
| Int | Whole number | INT |
| Float | Decimal (9 places) | DECIMAL |
| Currency | Money value (6 decimals) | DECIMAL |
| Date | Calendar date | DATE |
| Datetime | Date + time | DATETIME |
| Text Editor | Rich text (HTML) | LONGTEXT |
| Attach | File reference | VARCHAR(140) |
| Small Text | Short multi-line text | TEXT |
| Long Text | Unlimited text | LONGTEXT |
Full fieldtype reference with all 35+ types: references/fieldtypes.md
Essential Field Properties
| Property | Type | Purpose |
|---|---|---|
reqd |
bool | Field is mandatory |
unique |
bool | Database UNIQUE constraint |
search_index |
bool | Database INDEX for faster queries |
in_list_view |
bool | Show in list view columns |
in_standard_filter |
bool | Show as filter in list view |
in_preview |
bool | Show in document preview |
allow_on_submit |
bool | Editable after submission |
read_only |
bool | Not editable by user |
hidden |
bool | Not visible on form |
depends_on |
str | Visibility condition (e.g. eval:doc.status=="Active") |
mandatory_depends_on |
str | Conditional mandatory |
read_only_depends_on |
str | Conditional read-only |
fetch_from |
str | Auto-populate from linked doc (e.g. customer.customer_name) |
fetch_if_empty |
bool | Only fetch when field is empty |
options |
str | Fieldtype-specific (DocType name, select options, etc.) |
default |
str | Default value (supports __user, Today, etc.) |
description |
str | Help text below field |
collapsible |
bool | Section starts collapsed (Section Break only) |
Decision Tree: Which DocType Type?
Need to store data?
├─ YES: Need multiple records?
│ ├─ YES: Need submit/cancel workflow?
│ │ ├─ YES → Standard DocType + is_submittable=1
│ │ └─ NO: Need hierarchy/tree?
│ │ ├─ YES → Tree DocType (is_tree=1)
│ │ └─ NO: Embedded in parent?
│ │ ├─ YES → Child DocType (istable=1)
│ │ └─ NO → Standard DocType
│ └─ NO: Single config/settings → Single DocType (issingle=1)
└─ NO: Data from external source → Virtual DocType (is_virtual=1)
Naming Rules
ALWAYS set naming_rule on the DocType. The autoname field holds the pattern.
| naming_rule Value | autoname Pattern | Example Output |
|---|---|---|
| Set by User | (empty) | User types name manually |
| Autoincrement | (empty) | 1, 2, 3 |
| By Fieldname | field:{fieldname} |
Value of that field |
| By Naming Series | naming_series: |
INV-2024-00001 (from series field) |
| Expression | PRE-.##### |
PRE-00001, PRE-00002 |
| Expression (Old Style) | {prefix}-{YYYY}-{#####} |
INV-2024-00001 |
| Random | hash |
Random 10-char string |
| UUID | (empty) | 550e8400-e29b-... |
| By Script | (custom) | Controller autoname() decides |
NEVER use Autoincrement in production -- gaps appear when records are deleted. Use Expression or Naming Series instead.
Full naming reference: references/naming.md
Child Table Design
A Child DocType is a DocType with istable=1. It ALWAYS belongs to a parent.
Parent side -- add a field with:
fieldtype:Table(orTable MultiSelect)options: Child DocType name
Child records automatically get:
parent-- name of the parent documentparenttype-- DocType of the parentparentfield-- fieldname of the Table field in parentidx-- row order (1-based)
# Adding child rows programmatically
doc = frappe.get_doc("Sales Invoice", "INV-001")
doc.append("items", {
"item_code": "ITEM-001",
"qty": 5,
"rate": 100.0
})
doc.save()
NEVER create a Child DocType without
istable=1. NEVER reference a non-child DocType in a Table field.
Table vs Table MultiSelect
| Aspect | Table | Table MultiSelect |
|---|---|---|
| UI | Full editable grid with "Add Row" | Tag-style picker, no "Add Row" |
| Child DocType | Full child with many fields | Typically 1 Link field only |
| Use case | Line items, detail rows | Multi-select references |
Single DocType (Settings Pattern)
Set issingle=1. Data is stored in tabSingles as key-value pairs, NOT in a dedicated table.
# Access Single DocType
settings = frappe.get_single("My Settings")
value = settings.some_field
# Or directly
value = frappe.db.get_single_value("My Settings", "some_field")
- NEVER expect a list view for Single DocTypes -- they have exactly one instance.
- ALWAYS use for app-wide configuration (API keys, default values, feature toggles).
Tree DocType (NestedSet)
Set is_tree=1. Frappe adds lft, rgt, parent_{doctype_fieldname}, old_parent columns automatically.
- ALWAYS define a
parent_fieldin the DocType JSON (e.g.parent_accountfor Chart of Accounts). - The NestedSet model uses
lft/rgtintegers for efficient subtree queries. - NEVER manually edit
lft/rgtvalues. Usefrappe.utils.nestedset.rebuild_tree()if corrupted.
# Get all descendants
descendants = frappe.get_all("Account",
filters={"lft": [">", node.lft], "rgt": ["<", node.rgt]})
# Get ancestors (path to root)
ancestors = frappe.get_all("Account",
filters={"lft": ["<", node.lft], "rgt": [">", node.rgt]},
order_by="lft asc")
Virtual DocType
Set is_virtual=1. No database table is created. ALWAYS implement these controller methods:
class MyVirtualDoc(Document):
def db_insert(self, *args, **kwargs):
# Persist to your custom backend
pass
def load_from_db(self):
# Load document data from your source
pass
def db_update(self, *args, **kwargs):
# Update in your custom backend
pass
def delete(self):
# Remove from your custom backend
pass
@staticmethod
def get_list(args):
# Return list of documents
pass
@staticmethod
def get_count(args):
# Return total count
pass
@staticmethod
def get_stats(args):
# Return statistics
pass
NEVER use
frappe.db.*calls for Virtual DocType data -- they only work with the site database, not your custom backend.
Customization APIs
Custom Fields (Programmatic)
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
# Dict format: {DocType: [field_dicts]}
create_custom_fields({
"Sales Invoice": [
dict(fieldname="custom_tracking", label="Tracking ID",
fieldtype="Data", insert_after="naming_series")
],
"Purchase Order": [
dict(fieldname="custom_vendor_ref", label="Vendor Ref",
fieldtype="Data", insert_after="supplier")
]
}, update=True)
Property Setter (Programmatic)
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
# Change a field property on an existing DocType
make_property_setter("Sales Invoice", "customer", "reqd", 1, "Check")
make_property_setter("Sales Invoice", "posting_date", "default", "Today", "Text")
Full customization reference: references/customization.md
Data Masking (v16+)
Fields with mask=1 hide sensitive values from users without mask permission at the field's permlevel. The server replaces values with patterns like XXXXXXXX before sending to the client. Administrator ALWAYS sees unmasked values.
{ "fieldname": "phone", "fieldtype": "Data", "options": "Phone", "mask": 1, "permlevel": 1 }
Full masking reference: references/data-masking.md
Python Type Stubs
Frappe auto-generates type annotations in controller files via TypeExporter. Fields get DF.* types inside a TYPE_CHECKING guard:
if TYPE_CHECKING:
from frappe.types import DF
customer: DF.Link
items: DF.Table[SalesInvoiceItem]
status: DF.Literal["Draft", "Submitted", "Paid"]
NEVER modify code between # begin: auto-generated types and # end: auto-generated types.
Full type stubs reference: references/type-stubs.md
Critical Rules
- ALWAYS name DocTypes in singular form ("Sales Invoice", not "Sales Invoices").
- ALWAYS use the
tabprefix mentally -- the DB table istabSales Invoice. - NEVER exceed 140 characters for Data/Link/Select field values.
- ALWAYS set
search_index=1on fields used in frequent filters orget_listcalls. - ALWAYS set
in_standard_filter=1on fields users frequently filter by. - NEVER use
allow_on_submit=1on child table fields that affect calculations without recalculating totals. - ALWAYS set
fetch_if_empty=1alongsidefetch_fromunless you want to overwrite user edits. - NEVER define
depends_onwith raw Python -- useeval:doc.fieldname == "value"syntax.
See Also
- references/fieldtypes.md -- Complete fieldtype reference
- references/naming.md -- All naming methods with examples
- references/examples.md -- Real DocType JSON examples
- references/anti-patterns.md -- Common schema design mistakes
- references/customization.md -- Custom Fields and Property Setter APIs
- references/data-masking.md -- Field-level data masking for privacy (v16+)
- references/type-stubs.md -- Python type hints, DF types, TypeExporter
版本历史
-
v3.1.1
GitHub ↗
原版更新说明
## What's new Expanded Keywords in all skill descriptions with user-friendly, non-technical discovery terms. Skills are now easier to find when users describe problems in plain language instead of technical terminology. Examples of added terms: - Symptom-based: "app is slow", "nothing shows", "container won't start" - Beginner-friendly: "how do I start", "what is", "getting started" - Error messages: literal error text users would paste - Alternative names: common synonyms and abbreviations No skill content was changed. Only the Keywords line in SKILL.md frontmatter was expanded.
-
v3.1.0
GitHub ↗
原版更新说明
## What's new - package.json with agents.skills[] manifest for external discovery (60 skills) - agents/openai.yaml for OpenAI Codex - GitHub topic agentskills added - SKILLS_LOG.md added to .gitignore - Em-dashes replaced with colons in 31 SKILL.md section headings Enables discovery via npx skills add, skills.sh, LobeHub, and other platforms.
-
v3.0.0
GitHub ↗
原版更新说明
## Summary - **60 deterministic skills** for Frappe Framework v14-v16 (up from 53 in v2.0) - **~95% surface area coverage** (up from ~85%) - 7 new skills + 12 existing skills extended with new reference files ## New Skills (7) | Skill | Category | Coverage | |-------|----------|----------| | `frappe-core-translation` | core | i18n, _(), __(), CSV/PO files, string extraction | | `frappe-core-utils` | core | 140+ date, number, string, validation functions | | `frappe-syntax-print` | syntax | Print formats, PDF generation, Letter Head | | `frappe-syntax-query-builder` | syntax | frappe.qb, joins, aggregation, cross-DB | | `frappe-impl-workspace` | impl | Workspace builder, number cards, charts | | `frappe-core-logging` | core | frappe.logger(), Error Log, Sentry integration | | `frappe-core-search` | core | Link search, global search, SQLiteSearch FTS5 | ## Extended Skills (12) 13 new reference files added to existing skills covering: Controls API, Tree View, Portal Generators, Print Format decision tree, Email system, Module/Workspace shipping, complete Document API, custom bench commands, request lifecycle, advanced debugging (VS Code DAP), Frappe Packages, data masking (v16+), and Python type stubs. ## Stats | Category | Count | |----------|:-----:| | syntax/ | 13 | | core/ | 11 | | impl/ | 14 | | errors/ | 7 | | ops/ | 8 | | agents/ | 5 | | testing/ | 2 | | **Total** | **60** | ## Install ```bash git clone https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package.git cp -r Frappe_Claude_Skill_Package/skills/source/* ~/.claude/skills/ ```
-
v2.0.0
GitHub ↗
原版更新说明
## Frappe Claude Skill Package v2.0.0 Massive upgrade from 28 ERPNext-specific skills to **53 Frappe Framework skills** covering ~85% of the Frappe surface area. ### What's New - **25 new skills** across 3 new categories (ops, testing, agents) - **28 existing skills** fully rewritten with fresh research - **Renamed** from `erpnext-*` to `frappe-*` (all skills are Frappe Framework, not ERPNext-specific) - **7 categories**: syntax (11), core (7), impl (13), errors (7), ops (8), agents (5), testing (2) ### New Categories - **ops/** — Bench CLI, deployment, backup, performance, upgrades, frontend build, cloud - **testing/** — Unit/integration tests, CI/CD with GitHub Actions - **3 new agents** — debugger, migrator, architect ### Key Improvements - All skills verified against official Frappe docs (March 2026) - v16 features documented: `extend_doctype_class`, data masking, type annotations - MIT license (was LGPL-3.0) - Deterministic language throughout (ALWAYS/NEVER) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
-
v1.1.0
GitHub ↗
原版更新说明
V16 compatibility update and documentation improvements. ## Added - USAGE.md with platform-specific guides (Claude.ai, Claude Code, API) - Complete README overhaul with quick start guide ## Changed - All 28 skills updated for ERPNext/Frappe V16 compatibility - Agent Skills now follow standard skill structure - Improved validation: 28/28 skills pass all checks ## Fixed - V16-specific syntax changes in 9 skills - Agent SKILL.md files now under 500 lines
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
2.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- Comprehensive guide covering all major aspects of Frappe DocType design including JSON schema, fieldtypes, naming rules, child tables, tree structures, virtual/single DocTypes
- Provides practical decision trees and quick reference tables for common scenarios
- Includes critical rules and best practices to prevent common configuration errors
亮点
- Trigger keywords comprehensively cover all major DocType-related concepts
- Clear description of when to use the skill with specific use cases
- Well-defined scope covering creation, modification, field type selection, naming rules, etc.
亮点
- Excellent document structure with clear hierarchical organization
- Includes quick reference tables, decision trees, code examples, and critical rules
- Frontmatter is complete with name, description, license, compatibility, and metadata
待提升项
-
引用文件缺失 原报告严重程度:轻微
SKILL.md references multiple external files in the 'See Also' section that were not included in the ZIP package
改进建议:Ensure all referenced markdown files (fieldtypes.md, naming.md, examples.md, etc.) are included in the skill package or provide inline content for critical information
亮点
- Provides specific, actionable patterns and rules for reliable DocType configuration
- Includes concrete code examples for common operations like adding child rows and custom fields
- Covers edge cases and anti-patterns to avoid common pitfalls
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
保存或修改文件
先确认输出目录和同名文件是否会被覆盖;重要文件保留备份,优先写入新的输出目录。
主文档提及 · 第 154 行 -
管理员或提升权限
确认确有必要再提升权限;不要关闭防护、绕过证书验证或扩大整个系统的访问权限。
主文档提及 · 第 276 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。