$npx -y skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-doctypesUse 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 lin
| 1 | # DocType JSON Design |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | ## Quick Reference |
| 6 | |
| 7 | ### DocType JSON Top-Level Properties |
| 8 | |
| 9 | | Property | Type | Purpose | |
| 10 | |----------|------|---------| |
| 11 | | `name` | str | DocType identifier (singular, e.g. "Sales Invoice") | |
| 12 | | `module` | str | App module this DocType belongs to | |
| 13 | | `is_submittable` | bool | Enables Draft -> Submitted -> Cancelled workflow | |
| 14 | | `is_tree` | bool | Enables NestedSet hierarchy (lft/rgt columns) | |
| 15 | | `is_virtual` | bool | No database table; data from custom backend | |
| 16 | | `issingle` | bool | Single-instance settings document | |
| 17 | | `istable` | bool | Child table DocType (embedded in parent) | |
| 18 | | `is_calendar_and_gantt` | bool | Enables calendar/gantt views | |
| 19 | | `track_changes` | bool | Stores version history on every save | |
| 20 | | `track_seen` | bool | Tracks which users viewed the document | |
| 21 | | `track_views` | bool | Counts total document views | |
| 22 | | `allow_rename` | bool | Permits renaming after creation | |
| 23 | | `allow_copy` | bool | Enables "Duplicate" action | |
| 24 | | `allow_import` | bool | Enables Data Import for this DocType | |
| 25 | | `naming_rule` | str | Naming method selector (see Naming section) | |
| 26 | | `autoname` | str | Naming pattern string | |
| 27 | | `title_field` | str | Field used as display title | |
| 28 | | `search_fields` | str | Comma-separated fields for search results | |
| 29 | | `show_title_field_in_link` | bool | Display title instead of name in Link fields | |
| 30 | | `image_field` | str | Field containing image for avatar display | |
| 31 | | `sort_field` | str | Default sort column | |
| 32 | | `sort_order` | str | "ASC" or "DESC" | |
| 33 | | `default_print_format` | str | Print Format name | |
| 34 | | `max_attachments` | int | Attachment limit | |
| 35 | |
| 36 | ### Common Fieldtypes (Quick Lookup) |
| 37 | |
| 38 | | Fieldtype | Stores | DB Column | |
| 39 | |-----------|--------|-----------| |
| 40 | | Data | Text up to 140 chars | VARCHAR(140) | |
| 41 | | Link | Reference to another DocType | VARCHAR(140) | |
| 42 | | Dynamic Link | Reference to any DocType | VARCHAR(140) | |
| 43 | | Select | Single choice from options | VARCHAR(140) | |
| 44 | | Table | Child table rows | Separate table | |
| 45 | | Table MultiSelect | Multi-select link rows | Separate table | |
| 46 | | Check | Boolean 0/1 | TINYINT | |
| 47 | | Int | Whole number | INT | |
| 48 | | Float | Decimal (9 places) | DECIMAL | |
| 49 | | Currency | Money value (6 decimals) | DECIMAL | |
| 50 | | Date | Calendar date | DATE | |
| 51 | | Datetime | Date + time | DATETIME | |
| 52 | | Text Editor | Rich text (HTML) | LONGTEXT | |
| 53 | | Attach | File reference | VARCHAR(140) | |
| 54 | | Small Text | Short multi-line text | TEXT | |
| 55 | | Long Text | Unlimited text | LONGTEXT | |
| 56 | |
| 57 | > Full fieldtype reference with all 35+ types: [references/fieldtypes.md](references/fieldtypes.md) |
| 58 | |
| 59 | ### Essential Field Properties |
| 60 | |
| 61 | | Property | Type | Purpose | |
| 62 | |----------|------|---------| |
| 63 | | `reqd` | bool | Field is mandatory | |
| 64 | | `unique` | bool | Database UNIQUE constraint | |
| 65 | | `search_index` | bool | Database INDEX for faster queries | |
| 66 | | `in_list_view` | bool | Show in list view columns | |
| 67 | | `in_standard_filter` | bool | Show as filter in list view | |
| 68 | | `in_preview` | bool | Show in document preview | |
| 69 | | `allow_on_submit` | bool | Editable after submission | |
| 70 | | `read_only` | bool | Not editable by user | |
| 71 | | `hidden` | bool | Not visible on form | |
| 72 | | `depends_on` | str | Visibility condition (e.g. `eval:doc.status=="Active"`) | |
| 73 | | `mandatory_depends_on` | str | Conditional mandatory | |
| 74 | | `read_only_depends_on` | str | Conditional read-only | |
| 75 | | `fetch_from` | str | Auto-populate from linked doc (e.g. `customer.customer_name`) | |
| 76 | | `fetch_if_empty` | bool | Only fetch when field is empty | |
| 77 | | `options` | str | Fieldtype-specific (DocType name, select options, etc.) | |
| 78 | | `default` | str | Default value (supports `__user`, `Today`, etc.) | |
| 79 | | `description` | str | Help text below field | |
| 80 | | `collapsible` | bool | Section starts collapsed (Section Break only) | |
| 81 | |
| 82 | ## Decision Tree: Which DocType Type? |
| 83 | |
| 84 | ``` |
| 85 | Need to store data? |
| 86 | ├─ YES: Need multiple records? |
| 87 | │ ├─ YES: Need submit/cancel workflow? |
| 88 | │ │ ├─ YES → Standard DocType + is_submittable=1 |
| 89 | │ │ |