Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

frappe-syntax-customappFrappe 语法 自定义应用程序

Agent Skill

frappe-syntax-customapp 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

661

周安装

27

GitHub Stars

87

下载量

214
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:frappe-syntax-customapp(Frappe 语法 自定义应用程序)
来源仓库:https://github.com/openaec-foundation/erpnext_anthropic_claude_development_skill_package
仓库路径:skills/frappe-syntax-customapp
安装命令:
npx skills add https://github.com/openaec-foundation/erpnext_anthropic_claude_development_skill_package --skill frappe-syntax-customapp
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/openaec-foundation/erpnext_anthropic_claude_development_skill_package --skill frappe-syntax-customapp

简介

frappe-syntax-customapp 用于查找、检索和筛选相关信息,适合快速定位候选结果。

  • 适用于根据关键词或任务场景从来源线索中获取信息的场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围和维护状态,注意可能触发联网或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Frappe Custom App Syntax

Deterministic syntax reference for building Frappe custom apps — scaffolding, configuration, modules, patches, and fixtures.

Decision Tree

What do you need?
├─ Brand new app from scratch → bench new-app
├─ Extend existing ERPNext behavior → bench new-app + required_apps = ["frappe", "erpnext"]
├─ Install existing app from Git → bench get-app <url>
└─ Add functionality to an installed app
   ├─ New data model → Add module to modules.txt + create DocType
   ├─ New fields on existing DocType → Fixtures (Custom Field)
   ├─ Modify field properties → Fixtures (Property Setter)
   └─ Data migration → Patch in patches.txt

New app vs extend existing?
├─ Independent functionality → New app
├─ Tightly coupled to one app → New app with required_apps dependency
└─ Small customization (fields, properties) → Extend via fixtures in existing custom app

Creating an App

# Create new app (interactive prompts for title, description, publisher, etc.)
bench new-app my_custom_app

# Install on site
bench --site mysite install-app my_custom_app

# Get existing app from Git
bench get-app https://github.com/org/my_custom_app

# Build frontend assets
bench build --app my_custom_app

# Run migrations (patches + fixtures + schema sync)
bench --site mysite migrate

App Directory Structure

[v15+] pyproject.toml (Primary)

apps/my_custom_app/
├── pyproject.toml                     # Build configuration (flit)
├── README.md
├── my_custom_app/                     # Inner Python package
│   ├── __init__.py                    # MUST contain __version__
│   ├── hooks.py                       # Frappe integration hooks
│   ├── modules.txt                    # Module registration
│   ├── patches.txt                    # Migration scripts
│   ├── patches/                       # Patch files
│   │   └── __init__.py
│   ├── my_custom_app/                 # Default module (same name as app)
│   │   ├── __init__.py
│   │   └── doctype/
│   ├── public/                        # Static assets → /assets/my_custom_app/
│   │   ├── css/
│   │   └── js/
│   ├── templates/                     # Jinja templates
│   │   └── includes/
│   └── www/                           # Portal pages (URL = directory path)
└── .git/

[v14] setup.py (Legacy)

apps/my_custom_app/
├── setup.py                           # Build configuration (setuptools)
├── MANIFEST.in
├── requirements.txt                   # Python dependencies
├── dev-requirements.txt               # Dev dependencies (developer_mode only)
├── package.json                       # Node dependencies
├── my_custom_app/
│   ├── __init__.py
│   ├── hooks.py
│   ├── modules.txt
│   ├── patches.txt
│   └── [same inner structure as v15]
└── .git/

Critical Files

init.py (REQUIRED)

# my_custom_app/__init__.py
__version__ = "0.0.1"

CRITICAL: Without __version__, the flit build FAILS and the app CANNOT be installed.

pyproject.toml [v15+]

[build-system]
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "my_custom_app"
authors = [
    { name = "Your Company", email = "dev@example.com" }
]
description = "Description of your app"
requires-python = ">=3.10"
readme = "README.md"
dynamic = ["version"]
dependencies = []            # Python packages ONLY — NEVER Frappe/ERPNext

[tool.bench.frappe-dependencies]
frappe = ">=15.0.0,<16.0.0"
erpnext = ">=15.0.0,<16.0.0"  # Only if app extends ERPNext

CRITICAL rules for pyproject.toml:

  • name MUST match the inner directory name exactly
  • dynamic = ["version"] is REQUIRED — flit reads __version__ from __init__.py
  • NEVER put frappe or erpnext in [project] dependencies (they are not on PyPI)
  • ALWAYS put Frappe app dependencies in [tool.bench.frappe-dependencies]

setup.py [v14] (Legacy)

from setuptools import setup, find_packages

setup(
    name="my_custom_app",
    version="0.0.1",
    description="Description of your app",
    author="Your Company",
    author_email="dev@example.com",
    packages=find_packages(),
    zip_safe=False,
    include_package_data=True,
    install_requires=[],
)

hooks.py (Minimal Skeleton)

app_name = "my_custom_app"
app_title = "My Custom App"
app_publisher = "Your Company"
app_description = "Description"
app_email = "dev@example.com"
app_license = "MIT"

required_apps = ["frappe"]  # Or ["frappe", "erpnext"] if extending ERPNext

fixtures = [
    {"dt": "Custom Field", "filters": [["module", "=", "My Custom App"]]},
    {"dt": "Property Setter", "filters": [["module", "=", "My Custom App"]]},
]

Modules

modules.txt

My Custom App
Integrations
Settings
Reports

Rules:

  • One module name per line — NEVER leave empty lines or trailing spaces
  • Module name uses spaces; directory name uses underscores (My Custom Appmy_custom_app/)
  • Every DocType MUST belong to a registered module
  • ALWAYS include __init__.py in every module directory

Module Directory Structure

my_custom_app/
├── my_custom_app/       # "My Custom App" module
│   ├── __init__.py
│   └── doctype/
├── integrations/        # "Integrations" module
│   ├── __init__.py
│   └── doctype/
├── settings/            # "Settings" module
│   ├── __init__.py
│   └── doctype/
└── reports/             # "Reports" module
    ├── __init__.py
    └── report/

DocType Directory (within a module)

doctype/my_doctype/
├── __init__.py              # Empty (REQUIRED)
├── my_doctype.json          # DocType definition (generated by UI)
├── my_doctype.py            # Python controller
├── my_doctype.js            # Client script
├── test_my_doctype.py       # Unit tests
└── my_doctype_dashboard.py  # Dashboard config

Patches (Migration Scripts)

patches.txt with INI Sections

[pre_model_sync]
# Runs BEFORE schema sync — old fields still available
myapp.patches.v1_0.backup_old_data

[post_model_sync]
# Runs AFTER schema sync — new fields available
myapp.patches.v1_0.populate_new_fields
myapp.patches.v1_0.cleanup_data

Patch Implementation

# myapp/patches/v1_0/populate_new_fields.py
import frappe

def execute():
    """Populate new fields with default values."""
    batch_size = 1000
    offset = 0

    while True:
        records = frappe.get_all(
            "MyDocType",
            filters={"new_field": ["is", "not set"]},
            fields=["name"],
            limit_page_length=batch_size,
            limit_start=offset,
        )
        if not records:
            break

        for record in records:
            frappe.db.set_value(
                "MyDocType", record.name,
                "new_field", "default_value",
                update_modified=False,
            )

        frappe.db.commit()
        offset += batch_size

Pre vs Post Model Sync

SituationSectionReason
Migrate data from old field[pre_model_sync]Old field still exists
Rename field + preserve data[pre_model_sync]Old name still available
Populate new required fields[post_model_sync]New field already exists
General data cleanup[post_model_sync]No schema dependency

Re-running a Patch

# Patches run ONCE. To re-run, make the line unique with a comment:
myapp.patches.v1_0.my_patch #2024-01-15

bench migrate Workflow

  1. before_migrate hooks execute
  2. [pre_model_sync] patches execute
  3. Database schema sync (DocType JSON → tables)
  4. [post_model_sync] patches execute
  5. Fixtures sync
  6. after_migrate hooks execute

Fixtures

hooks.py Configuration

fixtures = [
    "Category",                                              # All records
    {"dt": "Custom Field", "filters": [["module", "=", "My Custom App"]]},
    {"dt": "Property Setter", "filters": [["module", "=", "My Custom App"]]},
    {"dt": "Role", "filters": [["name", "like", "MyApp%"]]},
]

Exporting and Importing

# Export fixtures to JSON files
bench --site mysite export-fixtures --app my_custom_app

# Import happens automatically during bench migrate or install-app

Fixtures vs Patches

WhatFixturesPatches
Custom FieldsYESNO
Property SettersYESNO
Roles, WorkflowsYESNO
Data transformationNOYES
One-time migrationNOYES
Seed configuration dataYESNO

Fixture Ordering

ALWAYS order fixtures so dependencies come first:

fixtures = [
    "Workflow State",   # FIRST — Workflow depends on states
    "Workflow",         # SECOND
]

Version Differences

Aspectv14v15+v16+
Build configsetup.pypyproject.tomlpyproject.toml
Build backendsetuptoolsflit_coreflit_core
Dependencies filerequirements.txtpyproject.tomlpyproject.toml
Python minimum>=3.10>=3.10>=3.14
INI patchesYESYESYES

Migration v14 to v15

  1. Create pyproject.toml with flit_core build-system
  2. Move dependencies from requirements.txt to [project] dependencies
  3. Verify __version__ in __init__.py
  4. Optionally remove: setup.py, MANIFEST.in, requirements.txt
  5. Test with bench get-app and bench install-app

Critical Rules

ALWAYS

  1. Define __version__ in __init__.py — flit build fails without it
  2. Add dynamic = ["version"] in pyproject.toml
  3. Register EVERY module in modules.txt
  4. Include __init__.py in EVERY Python directory
  5. Put Frappe dependencies in [tool.bench.frappe-dependencies], NEVER in [project] dependencies
  6. Use batch processing and error handling in patches
  7. Set module field on Custom Fields and Property Setters for correct fixture export
  8. Order fixtures by dependency (states before workflows)

NEVER

  1. Put frappe or erpnext in pip dependencies (not on PyPI — install fails)
  2. Create patches without try/except and logging
  3. Include user data or transactional data (Sales Invoice, User) in fixtures
  4. Hardcode site-specific values in patches
  5. Process large datasets without batching and periodic frappe.db.commit()
  6. Use spaces in directory names (spaces in modules.txt only)
  7. Change module names after DocTypes have been created in production

Reference Files

FileContents
structure.mdComplete directory structure for v14 and v15
pyproject-toml.mdFull pyproject.toml and setup.py configuration
modules.mdModule organization, naming, workspaces
patches.mdPatch syntax, pre/post model sync, batch processing
fixtures.mdFixture configuration, filters, common DocTypes
examples.mdComplete minimal and ERPNext extension app examples
anti-patterns.mdTop 10 mistakes and corrections

See Also

  • frappe-syntax-hooks — Full hooks.py reference
  • frappe-syntax-controllers — DocType controller methods
  • frappe-impl-customapp — Implementation patterns and workflows

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.3%
按下载量换算82

Claude

27.27%
按下载量换算58

Cursor

18.41%
按下载量换算39

Gemini CLI

8.34%
按下载量换算18

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills