一键导入
architecture
Layered architecture rules — one-way imports, module boundaries, file organization.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Layered architecture rules — one-way imports, module boundaries, file organization.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | architecture |
| description | Layered architecture rules — one-way imports, module boundaries, file organization. |
Reference skill for generator teammates. Read this before designing or scaffolding any module.
Dependencies flow strictly downward. No layer may import from a layer above it.
Types — shared domain types, enums, constants (no dependencies)
Config — environment loading, validated settings (depends on Types)
Repository — data access, queries, persistence (depends on Types, Config)
Service — business logic, orchestration (depends on Repository, Types, Config)
API — request handling, routing, serialization (depends on Service, Types)
UI — components, pages, hooks (depends on API types, local Types)
Violations (e.g., Repository importing from Service, UI importing from Repository) are blocking defects and must be fixed before merge.
Python (Pydantic):
class CreateOrderRequest(BaseModel):
customer_id: CustomerId
items: list[OrderItemInput]
class CreateOrderResponse(BaseModel):
order_id: OrderId
status: OrderStatus
created_at: datetime
TypeScript (interface):
interface CreateOrderRequest {
customerId: CustomerId;
items: OrderItemInput[];
}
interface CreateOrderResponse {
orderId: OrderId;
status: OrderStatus;
createdAt: string; // ISO 8601
}
All API errors return a consistent envelope:
{
"error": {
"code": "ORDER_NOT_FOUND",
"message": "Order abc-123 not found",
"details": {}
}
}
Use cursor-based pagination for lists:
{
"items": [...],
"nextCursor": "opaque-string-or-null",
"total": 142
}
Parameterize {service} with the feature or bounded context name.
backend/
src/
types/ — domain types, enums, error classes
config/ — env schema, settings loader
repository/ — DB models, queries, migrations
service/ — business logic, domain operations
api/ — routes, controllers, serializers
tests/
unit/
integration/
frontend/
src/
types/ — shared TypeScript interfaces
config/ — env, feature flags, constants
hooks/ — data-fetching and state hooks
components/ — reusable UI primitives
app/ — pages, layouts, routing
tests/
unit/
e2e/
uuid4). Never auto-increment integers for domain entities.created_at and updated_at (set by DB trigger or ORM hook).deleted_at TIMESTAMPTZ NULL instead of hard deletes. Queries filter WHERE deleted_at IS NULL.Every service must ship a .env.example with all variables documented:
# Database connection
DATABASE_URL=postgresql://user:pass@localhost:5432/dbname
# Auth
JWT_SECRET=change-me-in-production
JWT_EXPIRES_IN=3600
# External services
STRIPE_API_KEY=sk_test_...
No variable may be added to code without a corresponding entry in .env.example.
prisma migrate dev for local, prisma migrate deploy for CI/prod..env.exampleAutonomous build loop with Karpathy ratcheting, GAN evaluator, and session chaining. Iterates story groups until all features pass or stopping criteria met.
Socratic interview to create a Business Requirements Document. First step in the SDLC pipeline.
Generate system architecture, machine-readable schemas, and UI mockups. Spawns planner + ui-designer concurrently.
Evaluation patterns — sprint contract format, three-layer verification, scoring rubric references.
Standard GitHub issue workflow. Branch, reproduce, fix, test, PR.
Generate production code and tests for a story group using agent teams for parallel execution.