scaffold-app
Bootstrap a new ArchiPy service layout (configs, models, repositories, logics, services, helpers, manage.py). Use for "new service/project", "start an archipy app", or "set up the project structure".
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- scaffold-app
- description
- Bootstrap a new ArchiPy service layout (configs, models, repositories, logics, services, helpers, manage.py). Use for "new service/project", "start an archipy app", or "set up the project structure".
03 SKILL.md 正文
Scaffold ArchiPy App
Read first
Read these plugin rules in full before generating files (paths relative to this skill directory; Claude Code: ${CLAUDE_SKILL_DIR}/../../rules/):
../../rules/architecture-for-apps.mdc../../rules/config-and-di.mdc
Before writing files
- Inspect the workspace for
pyproject.toml, existing packages, config, and source layout. - Infer the package name and installed extras when they already exist.
- Ask only for unresolved choices:
- Python package name
- ArchiPy extras to install
- Optional first domain name (default
user)
- If files already exist, merge compatible additions and preserve project conventions. Never replace an existing application tree without explicit approval.
Steps
- Ensure project uses
uvand Python 3.14+. - Install:
uv add "archipy[<extras>]" - Create layout:
<package>/
├── configs/
│ ├── __init__.py
│ ├── app_config.py # AppConfig(BaseConfig) + set_global
│ └── containers.py # DI stub (if dependency-injection extra)
├── models/
│ ├── __init__.py
│ ├── dtos/<domain>/
│ │ ├── domain/v1/
│ │ └── repository/
│ ├── entities/
│ └── errors/
├── helpers/ # optional — prefer archipy.helpers first
│ ├── __init__.py
│ ├── utils/__init__.py
│ ├── decorators/__init__.py
│ └── interceptors/__init__.py
├── repositories/
│ └── <domain>/
│ ├── adapters/
│ └── <domain>_repository.py
├── logics/
│ └── <domain>/
└── services/
└── <domain>/v1/
manage.py # when fastapi (or HTTP) requested
features/ # optional — /scaffold-bdd
.env.example
- Write
app_config.pywithcustomize()settingself.FASTAPI.PROJECT_NAME(and related defaults) +BaseConfig.set_global. - Add a minimal domain DTO + error following
../scaffold-models/SKILL.md. - When extras include
fastapi(or user wants HTTP): emit rootmanage.py:create_app()usesAppUtils.create_fastapi_app()and includes domain routers.uvicorn.run("manage:create_app", factory=True, **AppUtils.uvicorn_config(config))— host and port come fromconfig.FASTAPI(SERVE_HOST,SERVE_PORT), the server settings fromconfig.UVICORN(archipy >= 5.25.0). Never hardcode host/port.
- Document next steps:
/scaffold-domain,/scaffold-models,/scaffold-adapter,/scaffold-bdd,/scaffold-health-checks,/docs-quickstart.
Do not
- Double quotes, Google-style docstrings,
X | Ytyping. - No secrets in code; list env keys in
.env.example. - Do not copy ArchiPy library maintainer tooling (library BDD internals).
- Never hardcode host/port; never hand-roll bare
FastAPI()when AppUtils is in use. - Do not invent a top-level app
adapters/package — domain adapters live underrepositories/<domain>/adapters/. - There is no decorator named
atomic— UoW means a real*_sqlalchemy_atomicon logics.
Verify
- Run the repository's formatter and linter on generated Python.
- Import the package and app factory without starting network services.
- Run existing targeted tests, if present.
- Run the
archipy-reviewersubagent on the changes and fix every Must fix finding it reports. - Report created/updated files, installed extras, and commands run.
Docs
04 同仓库更多 Skills
scaffold-utils
Add or wire pure helpers/utils, preferring ArchiPy utils (datetime, JWT, password, file, string). Use for "add a helper/util function", "format dates", "hash passwords", or "generate tokens".
scaffold-service
Scaffold a thin FastAPI router or gRPC servicer under services/{domain}/v{n}/ with AppUtils bootstrap. Use for "add an endpoint/route/API", "expose via REST/gRPC", or "new API version".
scaffold-observability
Configure ArchiPy 5.x OpenTelemetry traces, metrics, logs, and instrumentation. Use for "add tracing/metrics/OTel", "Prometheus/Pushgateway", or migrating off Sentry, Elastic APM, or old Prometheus.
scaffold-models
Scaffold ArchiPy models under models/: domain/repository DTOs, errors, optional entities and types. Use for "add DTO/schema/request/response model", "new error type", or "SQLAlchemy entity".
scaffold-logic
Scaffold an ArchiPy logic (use case) under logics/{domain}/ with a unit-of-work decorator and DTO I/O. Use for "add business logic", "new use case", "transactional operation", or "service layer method".
scaffold-interceptor
Add or wire cross-cutting FastAPI/gRPC interceptors or middleware, preferring ArchiPy's. Use for "add middleware", "request ID/logging/auth interceptor", or "gRPC interceptor".