prizmkit 1.1.54 → 1.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/VERSION.json +3 -3
- package/bundled/rules/_rules-metadata.json +6 -1
- package/bundled/rules/general/cohesive-modeling.md +27 -0
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/app-planner/SKILL.md +114 -4
- package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +609 -0
- package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +285 -0
- package/bundled/skills/app-planner/references/rules/backend/question-bank.md +249 -0
- package/bundled/skills/app-planner/references/rules/backend/template.md +173 -0
- package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +373 -0
- package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +211 -0
- package/bundled/skills/app-planner/references/rules/database/question-bank.md +184 -0
- package/bundled/skills/app-planner/references/rules/database/template.md +158 -0
- package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +810 -0
- package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +188 -0
- package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +302 -0
- package/bundled/skills/app-planner/references/rules/frontend/template.md +320 -0
- package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +639 -0
- package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +290 -0
- package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +232 -0
- package/bundled/skills/app-planner/references/rules/mobile/template.md +175 -0
- package/bundled/skills/prizm-kit/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +47 -6
- package/bundled/skills/prizmkit-init/references/config-schema.md +7 -3
- package/bundled/skills/prizmkit-init/references/rules/layer-detection.md +41 -0
- package/package.json +1 -1
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
# Derivation Rules — Backend Auto-Derivation Rule Mapping
|
|
2
|
+
|
|
3
|
+
> This file defines the mapping "Phase 2 answers → rule blocks auto-injected into backend-rules.md". The AI reads this file in Phase 3 — **do not ask the user again**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Phase 2 Answer Direct-Fill Table (copy user answer text directly into placeholders)
|
|
8
|
+
|
|
9
|
+
| Template Placeholder | Source | Example Fill |
|
|
10
|
+
|---------------------|--------|-------------|
|
|
11
|
+
| `{{ project_name }}` | Phase 0 auto-read | `robot-svc` |
|
|
12
|
+
| `{{ generated_at }}` | Phase 4, AI writes current date | `2026-05-24` |
|
|
13
|
+
| `{{ language }}` | Q1 answer | `TypeScript/Node.js` |
|
|
14
|
+
| `{{ runtime_version }}` | Q2 answer | `Node.js 22 LTS` |
|
|
15
|
+
| `{{ framework }}` | Q3 answer | `FastAPI` |
|
|
16
|
+
| `{{ architecture }}` | Q4 answer | `Classic three-tier` |
|
|
17
|
+
| `{{ api_style }}` | Q5 answer | `RESTful` |
|
|
18
|
+
| `{{ api_docs }}` | Q6 answer | `OpenAPI auto-generated` |
|
|
19
|
+
| `{{ orm }}` | Q7 answer | `Prisma` |
|
|
20
|
+
| `{{ database }}` | Q8 answer | `PostgreSQL` |
|
|
21
|
+
| `{{ auth_scheme }}` | Q9 answer | `JWT` |
|
|
22
|
+
| `{{ cache }}` | Q10 answer | `Redis` |
|
|
23
|
+
| `{{ mq }}` | Q11 answer | `Kafka` |
|
|
24
|
+
| `{{ container }}` | Q12 answer | `Docker + Compose` |
|
|
25
|
+
| `{{ test_requirement }}` | Q13 answer | `Unit + Integration` |
|
|
26
|
+
| `{{ test_framework }}` | Q14 answer | `pytest` |
|
|
27
|
+
| `{{ mock_strategy }}` | Q15 answer | `Mock external, testcontainers for DB` |
|
|
28
|
+
| `{{ logging }}` | Q16 answer | `Structured JSON + centralized` |
|
|
29
|
+
| `{{ monitoring }}` | Q17 answer | `OpenTelemetry + Prometheus + Grafana` |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Trigger Map
|
|
34
|
+
|
|
35
|
+
> **Matching rule**: The AI should use **substring match** against the user's selected option text. The trigger text in the left column is a canonical substring present in the corresponding option. For example, "Node.js" matches "TypeScript/Node.js", "Nest.js" matches "Express + Nest.js".
|
|
36
|
+
|
|
37
|
+
| Trigger (Phase 2 Answer) | Inject Rule Block ID | Inject Into Placeholder |
|
|
38
|
+
|--------------------------|---------------------|------------------------|
|
|
39
|
+
| Q1 = Node.js | `D-NODE-01`, `D-NODE-02` | `{{ tech_stack_rules }}` |
|
|
40
|
+
| Q1 = Python | `D-PYTHON-01`, `D-PYTHON-02` | `{{ tech_stack_rules }}` |
|
|
41
|
+
| Q1 = Go | `D-GO-01`, `D-GO-02` | `{{ tech_stack_rules }}` |
|
|
42
|
+
| Q1 = Java | `D-JAVA-01` | `{{ tech_stack_rules }}` |
|
|
43
|
+
| Q1 = Rust | `D-RUST-01` | `{{ tech_stack_rules }}` |
|
|
44
|
+
| Q3 = FastAPI | `D-FASTAPI-01` | `{{ tech_stack_rules }}` |
|
|
45
|
+
| Q3 = Nest.js | `D-NEST-01` | `{{ tech_stack_rules }}` |
|
|
46
|
+
| Q3 = Gin | `D-GIN-01` | `{{ tech_stack_rules }}` |
|
|
47
|
+
| Q3 = Spring Boot | `D-SPRING-01` | `{{ tech_stack_rules }}` |
|
|
48
|
+
| Q4 = Domain-Driven Design | `D-DDD-01` | `{{ arch_rules }}` |
|
|
49
|
+
| Q4 = Clean Architecture | `D-CLEAN-01` | `{{ arch_rules }}` |
|
|
50
|
+
| Q4 = Classic three-tier | `D-CLASSIC-01` | `{{ arch_rules }}` |
|
|
51
|
+
| Q4 = Simple MVC | `D-MVC-01` | `{{ arch_rules }}` |
|
|
52
|
+
| Q5 = RESTful | `D-REST-01` | `{{ api_rules }}` |
|
|
53
|
+
| Q5 = GraphQL | `D-GRAPHQL-01` | `{{ api_rules }}` |
|
|
54
|
+
| Q5 = gRPC | `D-GRPC-01` | `{{ api_rules }}` |
|
|
55
|
+
| Q5 = REST + gRPC hybrid | `D-HYBRID-01` | `{{ api_rules }}` |
|
|
56
|
+
| Q6 = OpenAPI | `D-OPENAPI-BACKEND-01` | `{{ api_rules }}` |
|
|
57
|
+
| Q6 = Hand-written | `D-MARKDOWN-DOCS-01` | `{{ api_rules }}` |
|
|
58
|
+
| Q7 = Prisma | `D-PRISMA-01` | `{{ data_rules }}` |
|
|
59
|
+
| Q7 = SQLAlchemy | `D-SQLALCHEMY-01` | `{{ data_rules }}` |
|
|
60
|
+
| Q7 = GORM | `D-GORM-01` | `{{ data_rules }}` |
|
|
61
|
+
| Q7 = Raw SQL | `D-RAW-SQL-01` | `{{ data_rules }}` |
|
|
62
|
+
| Q7 = sqlc | `D-SQLC-01` | `{{ data_rules }}` |
|
|
63
|
+
| Q7 = jOOQ | `D-JOOQ-01` | `{{ data_rules }}` |
|
|
64
|
+
| Q7 = sqlx | `D-SQLX-01` | `{{ data_rules }}` |
|
|
65
|
+
| Q7 = Django ORM | `D-DJANGO-ORM-01` | `{{ data_rules }}` |
|
|
66
|
+
| Q8 = MongoDB | `D-MONGO-01` | `{{ data_rules }}` |
|
|
67
|
+
| Q8 = MySQL | `D-MYSQL-01` | `{{ data_rules }}` |
|
|
68
|
+
| Q8 = SQLite | `D-SQLITE-01` | `{{ data_rules }}` |
|
|
69
|
+
| Q9 = JWT | `D-JWT-01` | `{{ auth_rules }}` |
|
|
70
|
+
| Q9 = OAuth2 | `D-OAUTH-01` | `{{ auth_rules }}` |
|
|
71
|
+
| Q9 = Session | `D-SESSION-01` | `{{ auth_rules }}` |
|
|
72
|
+
| Q9 = API Key | `D-APIKEY-01` | `{{ auth_rules }}` |
|
|
73
|
+
| Q10 = Redis | `D-REDIS-01` | `{{ cache_rules }}` |
|
|
74
|
+
| Q10 = Memcached | `D-MEMCACHED-01` | `{{ cache_rules }}` |
|
|
75
|
+
| Q10 = In-memory cache | `D-MEMORY-CACHE-01` | `{{ cache_rules }}` |
|
|
76
|
+
| Q11 = RabbitMQ | `D-RABBITMQ-01` | `{{ mq_rules }}` |
|
|
77
|
+
| Q11 = Kafka | `D-KAFKA-01` | `{{ mq_rules }}` |
|
|
78
|
+
| Q11 = Redis Stream | `D-BULLMQ-01` | `{{ mq_rules }}` |
|
|
79
|
+
| Q12 = Docker | `D-DOCKER-01` | `{{ deploy_rules }}` |
|
|
80
|
+
| Q12 = Kubernetes | `D-K8S-01` | `{{ deploy_rules }}` |
|
|
81
|
+
| Q13 = Unit tests + Integration tests | `D-TEST-STRATEGY-01` | `{{ test_rules }}` |
|
|
82
|
+
| Q13 = Unit tests only | `D-TEST-STRATEGY-02` | `{{ test_rules }}` |
|
|
83
|
+
| Q13 = Critical path integration tests only | `D-TEST-STRATEGY-03` | `{{ test_rules }}` |
|
|
84
|
+
| Q15 = testcontainers | `D-TEST-MOCK-01` | `{{ test_rules }}` |
|
|
85
|
+
| Q15 = including database | `D-TEST-MOCK-02` | `{{ test_rules }}` |
|
|
86
|
+
| Q15 = real environments | `D-TEST-MOCK-03` | `{{ test_rules }}` |
|
|
87
|
+
| Q16 = Structured JSON logging | `D-OBS-LOG-01` | `{{ observability_rules }}` |
|
|
88
|
+
| Q16 = local files | `D-OBS-LOG-02` | `{{ observability_rules }}` |
|
|
89
|
+
| Q16 = Simple text | `D-OBS-LOG-03` | `{{ observability_rules }}` |
|
|
90
|
+
| Q17 = OpenTelemetry + Prometheus + Grafana | `D-OBS-METRICS-01` | `{{ observability_rules }}` |
|
|
91
|
+
| Q18 = Forbid | `D-AI-DEP-STRICT-01` | `{{ ai_dependency_rule }}` |
|
|
92
|
+
| Q18 = declare reason in PR | `D-AI-DEP-ANNOUNCE-01` | `{{ ai_dependency_rule }}` |
|
|
93
|
+
| Q18 = Fully allowed | `D-AI-DEP-LOOSE-01` | `{{ ai_dependency_rule }}` |
|
|
94
|
+
| Q19 = Must list all callers | `D-AI-BREAK-STRICT-01` | `{{ ai_breaking_change_rule }}` |
|
|
95
|
+
| Q19 = Not required | `D-AI-BREAK-LOOSE-01` | `{{ ai_breaking_change_rule }}` |
|
|
96
|
+
| Q20 = Forbid | `D-AI-CONFIG-STRICT-01` | `{{ ai_config_rule }}` |
|
|
97
|
+
| Q20 = Allowed to modify | `D-AI-CONFIG-SYNC-01` | `{{ ai_config_rule }}` |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Rule Block Definitions
|
|
102
|
+
|
|
103
|
+
### D-NODE-01
|
|
104
|
+
**Trigger**: Q1 = Node.js | **Inject into**: `{{ tech_stack_rules }}`
|
|
105
|
+
|
|
106
|
+
- Language: TypeScript/Node.js, use ES modules.
|
|
107
|
+
- Lock runtime version in `package.json` `engines` field.
|
|
108
|
+
- Async handling uses `async/await`. Forbid callback hell.
|
|
109
|
+
- Uncaught exceptions must register a `process.on('unhandledRejection')` global handler.
|
|
110
|
+
- Environment variables read via `process.env`, centralized in one `env.ts` file for validation and export.
|
|
111
|
+
|
|
112
|
+
### D-NODE-02
|
|
113
|
+
**Trigger**: Q1 = Node.js | **Inject into**: `{{ tech_stack_rules }}`
|
|
114
|
+
|
|
115
|
+
- Package manager locked to `pnpm` (recommended). Commit `pnpm-lock.yaml`.
|
|
116
|
+
- `package.json` declares `"type": "module"`.
|
|
117
|
+
- CI validates `engines` field matches `.nvmrc`.
|
|
118
|
+
|
|
119
|
+
### D-PYTHON-01
|
|
120
|
+
**Trigger**: Q1 = Python | **Inject into**: `{{ tech_stack_rules }}`
|
|
121
|
+
|
|
122
|
+
- Use Python 3.11+, `pyproject.toml` manages project metadata and dependencies.
|
|
123
|
+
- Virtual environment management: recommend `uv` or `poetry`.
|
|
124
|
+
- Async uses `async/await` + `asyncio`.
|
|
125
|
+
- Type annotations: all public functions must annotate parameters and return types. CI runs `mypy --strict`.
|
|
126
|
+
|
|
127
|
+
### D-PYTHON-02
|
|
128
|
+
**Trigger**: Q1 = Python | **Inject into**: `{{ tech_stack_rules }}`
|
|
129
|
+
|
|
130
|
+
- Code formatting unified to `ruff format` + `ruff check`.
|
|
131
|
+
- Forbid bare `except:` — must specify exception type.
|
|
132
|
+
- Forbid mutable default arguments (`def fn(items=[])`).
|
|
133
|
+
|
|
134
|
+
### D-GO-01
|
|
135
|
+
**Trigger**: Q1 = Go | **Inject into**: `{{ tech_stack_rules }}`
|
|
136
|
+
|
|
137
|
+
- Use Go 1.22+, `go.mod` manages dependencies.
|
|
138
|
+
- Error handling: never ignore errors (`_ = fn()`). Must handle explicitly or comment why.
|
|
139
|
+
- Forbid using `panic` as a regular error handling mechanism (initialization phase excepted).
|
|
140
|
+
- Context must be propagated between functions. Forbid bare `context.Background()` for business logic.
|
|
141
|
+
|
|
142
|
+
### D-GO-02
|
|
143
|
+
**Trigger**: Q1 = Go | **Inject into**: `{{ tech_stack_rules }}`
|
|
144
|
+
|
|
145
|
+
- Project layout follows `cmd/` + `internal/` + `pkg/` standard structure.
|
|
146
|
+
- `internal/` organized by business domain (`internal/user/`), not by technical layer.
|
|
147
|
+
- Exported interfaces in `pkg/`, internal implementations in `internal/`.
|
|
148
|
+
|
|
149
|
+
### D-JAVA-01
|
|
150
|
+
**Trigger**: Q1 = Java | **Inject into**: `{{ tech_stack_rules }}`
|
|
151
|
+
|
|
152
|
+
- Use Java 21 LTS. Gradle or Maven manages dependencies.
|
|
153
|
+
- Lombok used with caution. Prefer hand-written getters/setters/builders.
|
|
154
|
+
- All DTOs use `record` type (Java 14+).
|
|
155
|
+
- Forbid writing business logic in entities. Entities are data mappings only.
|
|
156
|
+
|
|
157
|
+
### D-RUST-01
|
|
158
|
+
**Trigger**: Q1 = Rust | **Inject into**: `{{ tech_stack_rules }}`
|
|
159
|
+
|
|
160
|
+
- Use Rust stable channel. `Cargo.toml` locks MSRV.
|
|
161
|
+
- Error handling uses `anyhow` (application layer) / `thiserror` (library layer). Forbid bare unwrap (except in tests).
|
|
162
|
+
- Forbid holding `MutexGuard` across `.await` in async functions.
|
|
163
|
+
- `clippy` must pass with zero warnings in CI.
|
|
164
|
+
|
|
165
|
+
### D-FASTAPI-01
|
|
166
|
+
**Trigger**: Q3 = FastAPI | **Inject into**: `{{ tech_stack_rules }}`
|
|
167
|
+
|
|
168
|
+
- Use Pydantic v2 for request/response models. All models annotate `model_config = ConfigDict(from_attributes=True)`.
|
|
169
|
+
- Dependency injection uses `Depends()`. Keep controller functions concise.
|
|
170
|
+
- Exception handling uses FastAPI's `HTTPException` or custom exception handlers.
|
|
171
|
+
- Background tasks use `BackgroundTasks` or Celery. No heavy work in request threads.
|
|
172
|
+
|
|
173
|
+
### D-NEST-01
|
|
174
|
+
**Trigger**: Q3 = Nest.js | **Inject into**: `{{ tech_stack_rules }}`
|
|
175
|
+
|
|
176
|
+
- Modules organized by business domain (UserModule, OrderModule). Forbid giant AppModule.
|
|
177
|
+
- DTOs validated with `class-validator` decorators. Response DTOs use `class-transformer` to exclude sensitive fields.
|
|
178
|
+
- Exceptions use Nest's built-in `HttpException` series.
|
|
179
|
+
- Guards handle authorization. Interceptors handle response wrapping.
|
|
180
|
+
|
|
181
|
+
### D-GIN-01
|
|
182
|
+
**Trigger**: Q3 = Gin | **Inject into**: `{{ tech_stack_rules }}`
|
|
183
|
+
|
|
184
|
+
- Handlers return a unified format: `{ code, message, data }`.
|
|
185
|
+
- Middleware for logging, recovery, auth, rate limiting. Don't repeat these in handlers.
|
|
186
|
+
- Parameter binding uses `ShouldBindJSON` / `ShouldBindQuery`. Forbid manual parsing.
|
|
187
|
+
- Use `gin.Context` to propagate traceId and user info. Don't create new maps.
|
|
188
|
+
|
|
189
|
+
### D-SPRING-01
|
|
190
|
+
**Trigger**: Q3 = Spring Boot | **Inject into**: `{{ tech_stack_rules }}`
|
|
191
|
+
|
|
192
|
+
- Controllers only do parameter validation and response formatting. No business logic in controllers.
|
|
193
|
+
- Service layer must be interface-based. Use `@Autowired` or constructor injection.
|
|
194
|
+
- Global exception handling with `@ControllerAdvice` + `@ExceptionHandler`.
|
|
195
|
+
- Configuration uses `@ConfigurationProperties` binding. Forbid `System.getenv` in code.
|
|
196
|
+
|
|
197
|
+
### D-DDD-01
|
|
198
|
+
**Trigger**: Q4 = Domain-Driven Design | **Inject into**: `{{ arch_rules }}`
|
|
199
|
+
|
|
200
|
+
- Directory organized by aggregate root: `src/<domain>/handler/`, `src/<domain>/usecase/`, `src/<domain>/repository/`.
|
|
201
|
+
- Aggregate roots communicate via domain events or service layer. No direct cross-domain calls.
|
|
202
|
+
- Value Objects must be immutable.
|
|
203
|
+
- Repository interfaces defined in domain layer, implementations in infrastructure layer.
|
|
204
|
+
|
|
205
|
+
### D-CLEAN-01
|
|
206
|
+
**Trigger**: Q4 = Clean Architecture | **Inject into**: `{{ arch_rules }}`
|
|
207
|
+
|
|
208
|
+
- Layers: Entity → Usecase → Interface Adapter → Framework.
|
|
209
|
+
- Dependency rule: inner layers don't depend on outer layers.
|
|
210
|
+
- DTOs convert between layers — entities don't return directly to controllers.
|
|
211
|
+
- Database, cache, third-party APIs are all outer infrastructure.
|
|
212
|
+
|
|
213
|
+
### D-CLASSIC-01
|
|
214
|
+
**Trigger**: Q4 = Classic three-tier | **Inject into**: `{{ arch_rules }}`
|
|
215
|
+
|
|
216
|
+
- Three layers with strict separation:
|
|
217
|
+
- Controller: request parsing, validation, response formatting. No business logic.
|
|
218
|
+
- Service: all business logic, transaction management, authorization checks.
|
|
219
|
+
- Repository: data access only. No business logic. Returns domain objects, not DB rows.
|
|
220
|
+
- Forbid: controller calling repository directly. Service calling other service's repository.
|
|
221
|
+
- Each layer in its own directory: `controller/`, `service/`, `repository/`.
|
|
222
|
+
|
|
223
|
+
### D-MVC-01
|
|
224
|
+
**Trigger**: Q4 = Simple MVC | **Inject into**: `{{ arch_rules }}`
|
|
225
|
+
|
|
226
|
+
- Simplified structure for small projects. Models contain data + business logic.
|
|
227
|
+
- Controllers handle routing and orchestration. Views are API responses (JSON).
|
|
228
|
+
- No separate repository layer -- models handle their own persistence.
|
|
229
|
+
- Forbid using this pattern for projects with > 5 business domains. Re-evaluate when the team grows beyond 3 developers.
|
|
230
|
+
|
|
231
|
+
### D-REST-01
|
|
232
|
+
**Trigger**: Q5 = REST | **Inject into**: `{{ api_rules }}`
|
|
233
|
+
|
|
234
|
+
- URLs use plural nouns, no verbs. Resource nesting: `/users/{id}/orders`.
|
|
235
|
+
- Query params standardized: `page`, `pageSize`, `sortBy`, `sortOrder`, `filter[]`.
|
|
236
|
+
- Response body optionally wrapped: `{ data, meta: { page, pageSize, total }, error }`.
|
|
237
|
+
- HATEOAS not required, but at minimum return pagination metadata.
|
|
238
|
+
|
|
239
|
+
### D-GRAPHQL-01
|
|
240
|
+
**Trigger**: Q5 = GraphQL | **Inject into**: `{{ api_rules }}`
|
|
241
|
+
|
|
242
|
+
- Choose Schema-first or Code-first and be consistent across the project.
|
|
243
|
+
- Queries must limit depth and complexity (prevent malicious queries).
|
|
244
|
+
- DataLoader must be used for batching N+1 requests (create a new DataLoader instance per request).
|
|
245
|
+
- Mutations return the changed object. Don't make a separate follow-up Query.
|
|
246
|
+
|
|
247
|
+
### D-GRPC-01
|
|
248
|
+
**Trigger**: Q5 = gRPC | **Inject into**: `{{ api_rules }}`
|
|
249
|
+
|
|
250
|
+
- `.proto` files placed in `proto/` directory as the single source of truth.
|
|
251
|
+
- Forbid manually modifying generated code.
|
|
252
|
+
- All RPCs must have a deadline/timeout. No infinite waits.
|
|
253
|
+
- Errors use gRPC status codes + details (not HTTP status code conventions).
|
|
254
|
+
|
|
255
|
+
### D-HYBRID-01
|
|
256
|
+
**Trigger**: Q5 = REST + gRPC hybrid | **Inject into**: `{{ api_rules }}`
|
|
257
|
+
|
|
258
|
+
- REST for external-facing APIs (browser, mobile clients). gRPC for internal microservice communication.
|
|
259
|
+
- REST routes defined in `api/rest/`. gRPC services in `api/grpc/`.
|
|
260
|
+
- Shared business logic extracted to service layer -- both REST handlers and gRPC handlers call the same services.
|
|
261
|
+
- Forbid: REST handler calling gRPC handler directly or vice versa. All go through service layer.
|
|
262
|
+
|
|
263
|
+
### D-OPENAPI-BACKEND-01
|
|
264
|
+
**Trigger**: Q6 = OpenAPI | **Inject into**: `{{ api_rules }}`
|
|
265
|
+
|
|
266
|
+
- OpenAPI spec auto-generated from code annotations/decorators. Forbid hand-written YAML/JSON specs.
|
|
267
|
+
- API doc endpoints: `GET /docs` (Swagger UI) / `GET /redoc`.
|
|
268
|
+
- Request/response models must appear in docs. Schema changes auto-reflect in docs.
|
|
269
|
+
|
|
270
|
+
### D-MARKDOWN-DOCS-01
|
|
271
|
+
**Trigger**: Q6 = Hand-written | **Inject into**: `{{ api_rules }}`
|
|
272
|
+
|
|
273
|
+
- Hand-written API docs must be updated in the same PR as API changes. Forbid docs that diverge from implementation.
|
|
274
|
+
- Document request/response examples for every endpoint. Use realistic example values, not placeholder text.
|
|
275
|
+
- Cross-reference by endpoint path. Each endpoint docs section must include: HTTP method, path, request body schema, response body schema, error codes.
|
|
276
|
+
- Docs file located at `docs/api.md` or similar centralized location. Forbid scattering API docs across multiple files.
|
|
277
|
+
|
|
278
|
+
### D-PRISMA-01
|
|
279
|
+
**Trigger**: Q7 = Prisma | **Inject into**: `{{ data_rules }}`
|
|
280
|
+
|
|
281
|
+
- `schema.prisma` is the single source of truth for the database. Manual SQL changes must be reverse-synced to schema.
|
|
282
|
+
- Use `prisma migrate dev` to generate migrations. Commit migration files to the repository.
|
|
283
|
+
- Queries use `include`/`select` to explicitly specify relations. Avoid `select: {}` for full loading.
|
|
284
|
+
- Transactions use `prisma.$transaction` or interactive transaction API.
|
|
285
|
+
|
|
286
|
+
### D-SQLALCHEMY-01
|
|
287
|
+
**Trigger**: Q7 = SQLAlchemy | **Inject into**: `{{ data_rules }}`
|
|
288
|
+
|
|
289
|
+
- Use SQLAlchemy 2.0+ style (`select(User).where(...)` not `User.query`).
|
|
290
|
+
- Separate Model from Schema — ORM models do not return directly to API.
|
|
291
|
+
- Session management: one session per request, managed via DI or middleware.
|
|
292
|
+
- Relation loading uses `selectinload` to avoid N+1. Forbid default lazy loading.
|
|
293
|
+
|
|
294
|
+
### D-GORM-01
|
|
295
|
+
**Trigger**: Q7 = GORM | **Inject into**: `{{ data_rules }}`
|
|
296
|
+
|
|
297
|
+
- Models defined in `internal/<domain>/model/`, isolated from handlers.
|
|
298
|
+
- Forbid `.Find(&users)` without conditions — must explicitly `Where` + `Limit`.
|
|
299
|
+
- Migrations use a standalone migration tool (golang-migrate). Don't use GORM AutoMigrate for production databases.
|
|
300
|
+
- Preloading uses `Preload` with explicit field specification. No default full preloading.
|
|
301
|
+
|
|
302
|
+
### D-RAW-SQL-01
|
|
303
|
+
**Trigger**: Q7 = Raw SQL | **Inject into**: `{{ data_rules }}`
|
|
304
|
+
|
|
305
|
+
- SQL files centralized in `sql/` or `queries/` directory. Forbid scattering in code.
|
|
306
|
+
- All SQL must be parameterized queries. CI scans for string-concatenated SQL.
|
|
307
|
+
- Each SQL file annotated with: author, purpose, corresponding EXPLAIN output.
|
|
308
|
+
- Query results mapped to typed DTOs. Forbid `interface{}`/`map[string]any`.
|
|
309
|
+
|
|
310
|
+
### D-SQLC-01
|
|
311
|
+
**Trigger**: Q7 = sqlc | **Inject into**: `{{ data_rules }}`
|
|
312
|
+
|
|
313
|
+
- sqlc generates type-safe Go code from SQL. All SQL queries version-controlled in `queries/` directory.
|
|
314
|
+
- Forbid hand-written SQL strings in Go code. All queries must be defined in `.sql` files.
|
|
315
|
+
- Generated code must not be manually edited. CI validates generated code matches SQL source.
|
|
316
|
+
- Migration files managed separately (golang-migrate or atlas). sqlc reads the current schema for type generation.
|
|
317
|
+
|
|
318
|
+
### D-JOOQ-01
|
|
319
|
+
**Trigger**: Q7 = jOOQ | **Inject into**: `{{ data_rules }}`
|
|
320
|
+
|
|
321
|
+
- jOOQ type-safe SQL DSL for Java. Generated classes via code-gen from database schema.
|
|
322
|
+
- Forbid mixing raw JDBC queries with jOOQ. All queries use jOOQ DSL, not string concatenation.
|
|
323
|
+
- jOOQ code generation integrated into Gradle/Maven build. Generated classes committed to repository.
|
|
324
|
+
- Schema changes require re-running code generation. CI validates code-gen is up to date.
|
|
325
|
+
|
|
326
|
+
### D-SQLX-01
|
|
327
|
+
**Trigger**: Q7 = sqlx | **Inject into**: `{{ data_rules }}`
|
|
328
|
+
|
|
329
|
+
- sqlx async PostgreSQL/SQLite driver for Rust. Migrations via `sqlx migrate`.
|
|
330
|
+
- Forbid `sqlx::query()` with raw string SQL — use compile-time checked `sqlx::query!()` or `sqlx::query_as!()` macros.
|
|
331
|
+
- Migration files in `migrations/` directory. CI runs `sqlx migrate run --dry-run` to validate.
|
|
332
|
+
- Database pool configured via `sqlx::PgPool` with connection timeout and max connections.
|
|
333
|
+
|
|
334
|
+
### D-DJANGO-ORM-01
|
|
335
|
+
**Trigger**: Q7 = Django ORM | **Inject into**: `{{ data_rules }}`
|
|
336
|
+
|
|
337
|
+
- Django ORM models defined in `models.py`. Forbid raw SQL in views or services.
|
|
338
|
+
- Migrations generated via `python manage.py makemigrations` and committed to repository.
|
|
339
|
+
- Query optimization: use `select_related()` for FK joins, `prefetch_related()` for M2M joins. Forbid N+1 queries.
|
|
340
|
+
- Queryset filtering uses Django ORM methods. Forbid `.raw()` SQL queries unless performance-critical with documented reason.
|
|
341
|
+
|
|
342
|
+
### D-MONGO-01
|
|
343
|
+
**Trigger**: Q8 = MongoDB | **Inject into**: `{{ data_rules }}`
|
|
344
|
+
|
|
345
|
+
- MongoDB document model: schema validation via JSON Schema (`$jsonSchema` validator on collections).
|
|
346
|
+
- Indexing strategy for query patterns: create indexes for all query filter fields. Use `explain()` to verify index usage.
|
|
347
|
+
- Aggregation pipeline standards: stages must be documented with purpose comments. Forbid complex pipelines without EXPLAIN.
|
|
348
|
+
- No-SQL injection prevention: validate and sanitize all user input in queries. Use parameterized query operators (`$eq`, `$gt`), forbid `$where` with user input.
|
|
349
|
+
- Collection design with embedded vs. reference trade-offs: embed for read-together data, reference for independently-accessed data.
|
|
350
|
+
- The relational-database-oriented F5 fixed rules (migration files, SELECT syntax, normalization) do NOT apply. Skip F5.1-F5.3 of the fixed rules content.
|
|
351
|
+
|
|
352
|
+
### D-MYSQL-01
|
|
353
|
+
**Trigger**: Q8 = MySQL | **Inject into**: `{{ data_rules }}`
|
|
354
|
+
|
|
355
|
+
- MySQL 8.0+ with InnoDB engine default. Use `utf8mb4` charset for all tables.
|
|
356
|
+
- Forbid `utf8mb3` (deprecated). Forbid MyISAM engine (no transaction support).
|
|
357
|
+
- Index types: BTREE for range queries, HASH for exact-match lookups (memory tables only).
|
|
358
|
+
- Connection pool: configure `wait_timeout` and `interactive_timeout` to prevent stale connections.
|
|
359
|
+
- Migration files use the same tooling as PostgreSQL (golang-migrate, Flyway, Alembic). Schema differences documented in README.
|
|
360
|
+
|
|
361
|
+
### D-SQLITE-01
|
|
362
|
+
**Trigger**: Q8 = SQLite | **Inject into**: `{{ data_rules }}`
|
|
363
|
+
|
|
364
|
+
- SQLite for local development and single-instance deployments. WAL mode enabled by default.
|
|
365
|
+
- Forbid SQLite for multi-instance production deployments (no concurrent write support).
|
|
366
|
+
- Forbid concurrent write access across multiple processes. Use a single writer pattern.
|
|
367
|
+
- Migration files still version-controlled. Test with the same SQLite version as production.
|
|
368
|
+
- No connection pool needed (single connection). Close connections explicitly after each operation.
|
|
369
|
+
|
|
370
|
+
### D-JWT-01
|
|
371
|
+
**Trigger**: Q9 = JWT | **Inject into**: `{{ auth_rules }}`
|
|
372
|
+
|
|
373
|
+
- Access token TTL ≤ 15min. Refresh token TTL ≤ 7d.
|
|
374
|
+
- Token payload contains no sensitive info (passwords, phone numbers). Only userId + role.
|
|
375
|
+
- Secret read from environment variables. Forbid hardcoding.
|
|
376
|
+
- Token blacklist (logout/password change invalidation) implemented with Redis.
|
|
377
|
+
|
|
378
|
+
### D-OAUTH-01
|
|
379
|
+
**Trigger**: Q9 = OAuth2 | **Inject into**: `{{ auth_rules }}`
|
|
380
|
+
|
|
381
|
+
- Don't implement your own OAuth2 Provider (unless it's the project's core business).
|
|
382
|
+
- Third-party login (Google/GitHub) uses their official SDK or OpenID Connect.
|
|
383
|
+
- `state` parameter must be used and validated to prevent CSRF.
|
|
384
|
+
- `redirect_uri` must be whitelist-validated.
|
|
385
|
+
|
|
386
|
+
### D-SESSION-01
|
|
387
|
+
**Trigger**: Q9 = Session | **Inject into**: `{{ auth_rules }}`
|
|
388
|
+
|
|
389
|
+
- Session storage uses Redis, not memory (loses data on restart, not shared across instances).
|
|
390
|
+
- Session ID generated with `crypto.randomUUID()`, not auto-increment IDs.
|
|
391
|
+
- Cookie settings: `HttpOnly` + `Secure` (production) + `SameSite=Lax`.
|
|
392
|
+
- Session ID must be rotated after successful login (prevent Session Fixation).
|
|
393
|
+
|
|
394
|
+
### D-APIKEY-01
|
|
395
|
+
**Trigger**: Q9 = API Key | **Inject into**: `{{ auth_rules }}`
|
|
396
|
+
|
|
397
|
+
- API keys for service-to-service communication. Not for end-user auth.
|
|
398
|
+
- Keys stored hashed (SHA-256) in database. Plaintext shown once at creation.
|
|
399
|
+
- Key format: `sk_<random_32_bytes_base64url>` with prefix for easy identification in logs.
|
|
400
|
+
- Key validation: constant-time comparison to prevent timing attacks.
|
|
401
|
+
- Keys must have expiration (default 365d). Must be rotatable without downtime.
|
|
402
|
+
|
|
403
|
+
### D-REDIS-01
|
|
404
|
+
**Trigger**: Q10 = Redis | **Inject into**: `{{ cache_rules }}`
|
|
405
|
+
|
|
406
|
+
- Cache key naming: `<service>:<resource>:<id>` (`user-service:user:123`).
|
|
407
|
+
- All cache entries must have TTL. Forbid never-expiring keys.
|
|
408
|
+
- Cache update pattern: update DB first → then invalidate cache (Cache-Aside pattern).
|
|
409
|
+
- Penetration prevention: cache null values too (short TTL). Avalanche prevention: add random jitter to TTL.
|
|
410
|
+
|
|
411
|
+
### D-MEMCACHED-01
|
|
412
|
+
**Trigger**: Q10 = Memcached | **Inject into**: `{{ cache_rules }}`
|
|
413
|
+
|
|
414
|
+
- Key naming: `<service>:<resource>:<id>`. Max key length 250 bytes.
|
|
415
|
+
- TTL mandatory. Default TTL 300s. Forbid keys without expiration.
|
|
416
|
+
- Memcached is a simple KV store -- no complex data structures. For lists/sets, serialize in application.
|
|
417
|
+
- No persistence -- data lost on restart. Do not store data that cannot be regenerated.
|
|
418
|
+
|
|
419
|
+
### D-MEMORY-CACHE-01
|
|
420
|
+
**Trigger**: Q10 = In-memory cache | **Inject into**: `{{ cache_rules }}`
|
|
421
|
+
|
|
422
|
+
- In-memory cache suitable for single-instance deployments only.
|
|
423
|
+
- Use LRU eviction with max size limit. Forbid unbounded caches (memory leak risk).
|
|
424
|
+
- Cache invalidation via TTL only. No distributed invalidation (single instance).
|
|
425
|
+
- Warning: cache lost on restart. Not shared across instances. Upgrade to Redis before multi-instance deployment.
|
|
426
|
+
|
|
427
|
+
### D-RABBITMQ-01
|
|
428
|
+
**Trigger**: Q11 = RabbitMQ | **Inject into**: `{{ mq_rules }}`
|
|
429
|
+
|
|
430
|
+
- Each message body must contain `messageId` (dedup) + `traceId` (tracing).
|
|
431
|
+
- Consumers must be idempotent.
|
|
432
|
+
- Failed messages nack'd and routed to dead letter queue for manual handling.
|
|
433
|
+
- Connection heartbeat and auto-recovery must be configured.
|
|
434
|
+
|
|
435
|
+
### D-KAFKA-01
|
|
436
|
+
**Trigger**: Q11 = Kafka | **Inject into**: `{{ mq_rules }}`
|
|
437
|
+
|
|
438
|
+
- Messages must contain key (partition basis) and headers (traceId, messageId).
|
|
439
|
+
- Consumer group ID matches service name.
|
|
440
|
+
- Idempotency via messageId + database dedup table.
|
|
441
|
+
- Producer sets `acks=all` + `idempotence=true` to prevent message loss/duplication.
|
|
442
|
+
|
|
443
|
+
### D-BULLMQ-01
|
|
444
|
+
**Trigger**: Q11 = Redis Stream | **Inject into**: `{{ mq_rules }}`
|
|
445
|
+
|
|
446
|
+
- Lightweight task queue suitable for delayed tasks, email sending, notifications.
|
|
447
|
+
- Jobs must define timeout. On failure, configure retry (exponential backoff, max 3 retries).
|
|
448
|
+
- Job progress updated via `job.progress()` for long-running tasks.
|
|
449
|
+
|
|
450
|
+
### D-DOCKER-01
|
|
451
|
+
**Trigger**: Q12 = Docker | **Inject into**: `{{ deploy_rules }}`
|
|
452
|
+
|
|
453
|
+
- Dockerfile uses multi-stage builds. Final image excludes build tools.
|
|
454
|
+
- Base image uses `-slim` or `-alpine` variants.
|
|
455
|
+
- Health check: `HEALTHCHECK` points to `/health` endpoint.
|
|
456
|
+
- `.dockerignore` excludes node_modules, .git, log files.
|
|
457
|
+
|
|
458
|
+
### D-K8S-01
|
|
459
|
+
**Trigger**: Q12 = Kubernetes | **Inject into**: `{{ deploy_rules }}`
|
|
460
|
+
|
|
461
|
+
- Must configure liveness and readiness probes (pointing to `/health` and `/health/ready`).
|
|
462
|
+
- Resource limits (requests/limits) must be set.
|
|
463
|
+
- Sensitive config via Secret, non-sensitive via ConfigMap.
|
|
464
|
+
- Pod anti-affinity: same-type pods not scheduled on the same node (high availability).
|
|
465
|
+
|
|
466
|
+
### D-AI-DEP-STRICT-01
|
|
467
|
+
**Trigger**: Q18 = Forbid | **Inject into**: `{{ ai_dependency_rule }}`
|
|
468
|
+
|
|
469
|
+
- AI must not modify dependency manifest files on its own.
|
|
470
|
+
- If a new dependency is truly needed, AI must list in the PR description: package name, version, purpose, alternative comparison.
|
|
471
|
+
|
|
472
|
+
### D-AI-DEP-ANNOUNCE-01
|
|
473
|
+
**Trigger**: Q18 = declare reason in PR | **Inject into**: `{{ ai_dependency_rule }}`
|
|
474
|
+
|
|
475
|
+
- AI may introduce new dependencies, but must explicitly declare in the PR description: package name, version, reason, bundle size/license impact.
|
|
476
|
+
|
|
477
|
+
### D-AI-DEP-LOOSE-01
|
|
478
|
+
**Trigger**: Q18 = Fully allowed | **Inject into**: `{{ ai_dependency_rule }}`
|
|
479
|
+
|
|
480
|
+
- AI may add dependencies autonomously, but must run all tests after adding and document new dependencies in PR description.
|
|
481
|
+
- CI must validate no dependency conflicts or security vulnerabilities introduced.
|
|
482
|
+
|
|
483
|
+
### D-AI-BREAK-STRICT-01
|
|
484
|
+
**Trigger**: Q19 = Must list all callers | **Inject into**: `{{ ai_breaking_change_rule }}`
|
|
485
|
+
|
|
486
|
+
- Before modifying a public function/type/utility, AI must grep the entire repository and list all references.
|
|
487
|
+
- Breaking changes must include a migration guide.
|
|
488
|
+
|
|
489
|
+
### D-AI-BREAK-LOOSE-01
|
|
490
|
+
**Trigger**: Q19 = Not required | **Inject into**: `{{ ai_breaking_change_rule }}`
|
|
491
|
+
|
|
492
|
+
- No formal caller analysis required before modifying shared modules.
|
|
493
|
+
- AI should still exercise caution: read the module before modifying and run related tests after changes.
|
|
494
|
+
|
|
495
|
+
### D-AI-CONFIG-STRICT-01
|
|
496
|
+
**Trigger**: Q20 = Forbid | **Inject into**: `{{ ai_config_rule }}`
|
|
497
|
+
|
|
498
|
+
- AI must not modify environment variables, Docker config, CI/CD config, or infrastructure config.
|
|
499
|
+
- If changes are truly needed, AI must list the change proposal and impact in the response. Human executes.
|
|
500
|
+
|
|
501
|
+
### D-AI-CONFIG-SYNC-01
|
|
502
|
+
**Trigger**: Q20 = Allowed to modify | **Inject into**: `{{ ai_config_rule }}`
|
|
503
|
+
|
|
504
|
+
- AI may modify config files but must sync `.env.example` and announce changes in PR description.
|
|
505
|
+
- New environment variables must be documented with description and default value.
|
|
506
|
+
|
|
507
|
+
### D-OBS-LOG-01
|
|
508
|
+
**Trigger**: Q16 = Structured JSON logging | **Inject into**: `{{ observability_rules }}`
|
|
509
|
+
|
|
510
|
+
- Log format: JSON with fields `timestamp`, `level`, `message`, `traceId`, `userId`, `service`, `path`, `method`, `duration_ms`.
|
|
511
|
+
- Centralized collection via ELK (Elasticsearch + Logstash + Kibana) or Grafana Loki.
|
|
512
|
+
- Log levels: ERROR (requires alert), WARN (requires investigation), INFO (key business events), DEBUG (development only).
|
|
513
|
+
- Forbid logging sensitive data (passwords, tokens, national IDs). Must mask.
|
|
514
|
+
|
|
515
|
+
### D-OBS-LOG-02
|
|
516
|
+
**Trigger**: Q16 = local files | **Inject into**: `{{ observability_rules }}`
|
|
517
|
+
|
|
518
|
+
- Log format: JSON with fields `timestamp`, `level`, `message`, `traceId`.
|
|
519
|
+
- Log rotation: daily rotation, retain 7 days. Use logrotate or built-in rotation.
|
|
520
|
+
- Log levels same as D-OBS-LOG-01.
|
|
521
|
+
- Forbid logging sensitive data.
|
|
522
|
+
|
|
523
|
+
### D-OBS-LOG-03
|
|
524
|
+
**Trigger**: Q16 = Simple text | **Inject into**: `{{ observability_rules }}`
|
|
525
|
+
|
|
526
|
+
- Plain-text logging must include timestamp and level prefix per line. Format: `[YYYY-MM-DD HH:MM:SS] [LEVEL] message`.
|
|
527
|
+
- Forbid intermixing structured and unstructured formats. Choose one format and apply consistently.
|
|
528
|
+
- Plain-text acceptable for single-instance deployments only. Upgrade to structured JSON before multi-instance or production deployment.
|
|
529
|
+
- Log levels: ERROR, WARN, INFO, DEBUG. Forbid logging sensitive data (passwords, tokens, national IDs).
|
|
530
|
+
|
|
531
|
+
### D-OBS-METRICS-01
|
|
532
|
+
**Trigger**: Q17 = OpenTelemetry + Prometheus + Grafana | **Inject into**: `{{ observability_rules }}`
|
|
533
|
+
|
|
534
|
+
- OpenTelemetry SDK auto-instruments HTTP/gRPC/database calls.
|
|
535
|
+
- Custom metrics: request count, request duration (p50/p95/p99), error rate, DB query duration.
|
|
536
|
+
- Prometheus scrapes `/metrics` endpoint. Grafana dashboards for: request latency, error rate, DB connection pool, cache hit rate.
|
|
537
|
+
- Alerting rules: error rate > 5% for 5min triggers alert, p95 latency > 500ms for 5min triggers warning.
|
|
538
|
+
|
|
539
|
+
### D-TEST-STRATEGY-01
|
|
540
|
+
**Trigger**: Q13 = Unit tests + Integration tests | **Inject into**: `{{ test_rules }}`
|
|
541
|
+
|
|
542
|
+
- Testing tiers: unit tests (service/repository layers) + integration tests (API endpoints + DB).
|
|
543
|
+
- Unit tests: fast (<100ms each), no external deps. Mock all I/O.
|
|
544
|
+
- Integration tests: use test database or testcontainers. Test realistic scenarios.
|
|
545
|
+
- Coverage targets: service layer >= 80%, controller layer >= 60%.
|
|
546
|
+
- CI runs all tests. Integration tests run against a fresh DB instance each time.
|
|
547
|
+
|
|
548
|
+
### D-TEST-STRATEGY-02
|
|
549
|
+
**Trigger**: Q13 = Unit tests only | **Inject into**: `{{ test_rules }}`
|
|
550
|
+
|
|
551
|
+
- Unit tests only. Coverage target: service layer >= 80%.
|
|
552
|
+
- External deps mocked. No database or network access in tests.
|
|
553
|
+
- Recommend adding integration tests for critical data-access paths before production.
|
|
554
|
+
|
|
555
|
+
### D-TEST-STRATEGY-03
|
|
556
|
+
**Trigger**: Q13 = Critical path integration tests only | **Inject into**: `{{ test_rules }}`
|
|
557
|
+
|
|
558
|
+
- Integration tests for critical business paths only (auth, payment, core CRUD).
|
|
559
|
+
- Coverage targets not enforced project-wide. Critical paths must have >= 1 test each.
|
|
560
|
+
- Non-critical code: tests optional but encouraged.
|
|
561
|
+
|
|
562
|
+
### D-TEST-MOCK-01
|
|
563
|
+
**Trigger**: Q15 = testcontainers | **Inject into**: `{{ test_rules }}`
|
|
564
|
+
|
|
565
|
+
- External APIs (payment gateways, email services, third-party SDKs): mocked.
|
|
566
|
+
- Database: use testcontainers (dockerized Postgres/MySQL/Redis) for integration tests.
|
|
567
|
+
- Testcontainers lifecycle: start before test suite, stop after. Use singleton container pattern to share across tests.
|
|
568
|
+
- Test data: seeded per test file, cleaned up after each test. Forbid shared mutable test data.
|
|
569
|
+
|
|
570
|
+
### D-TEST-MOCK-02
|
|
571
|
+
**Trigger**: Q15 = including database | **Inject into**: `{{ test_rules }}`
|
|
572
|
+
|
|
573
|
+
- All external deps including database are mocked.
|
|
574
|
+
- Use in-memory doubles or mock libraries for database.
|
|
575
|
+
- Forbid tests that depend on a running database instance.
|
|
576
|
+
- Warning: mocked DB may miss real DB behavior (constraint violations, type coercion). Add at least a few integration tests before production.
|
|
577
|
+
|
|
578
|
+
### D-TEST-MOCK-03
|
|
579
|
+
**Trigger**: Q15 = real environments | **Inject into**: `{{ test_rules }}`
|
|
580
|
+
|
|
581
|
+
- Prefer real environments over mocking. Tests run against dedicated test infrastructure.
|
|
582
|
+
- Test database is a shared instance (not per-developer).
|
|
583
|
+
- Test data isolation: each test creates its own data and cleans up.
|
|
584
|
+
- Requires CI access to test infrastructure. Tests may be slower but more realistic.
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
## Template Placeholder Coverage Self-Check
|
|
589
|
+
|
|
590
|
+
This table verifies every template placeholder has at least one derivation rule or fixed-rule source. The AI should use this in Phase 4 to confirm all `{{ }}` placeholders are resolvable.
|
|
591
|
+
|
|
592
|
+
| Placeholder | Has Derivation Rules? | Has Fixed Rules? | Source |
|
|
593
|
+
|------------|----------------------|-------------------|--------|
|
|
594
|
+
| `{{ tech_stack_rules }}` | Yes | No | D-NODE-01/02, D-PYTHON-01/02, D-GO-01/02, D-JAVA-01, D-RUST-01, D-FASTAPI-01, D-NEST-01, D-GIN-01, D-SPRING-01 |
|
|
595
|
+
| `{{ arch_rules }}` | Yes | No | D-DDD-01, D-CLEAN-01, D-CLASSIC-01, D-MVC-01 |
|
|
596
|
+
| `{{ api_rules }}` | Yes | No | D-REST-01, D-GRAPHQL-01, D-GRPC-01, D-HYBRID-01, D-OPENAPI-BACKEND-01, D-MARKDOWN-DOCS-01 |
|
|
597
|
+
| `{{ data_rules }}` | Yes | No | D-PRISMA-01, D-SQLALCHEMY-01, D-GORM-01, D-RAW-SQL-01, D-SQLC-01, D-JOOQ-01, D-SQLX-01, D-DJANGO-ORM-01, D-MONGO-01, D-MYSQL-01, D-SQLITE-01 |
|
|
598
|
+
| `{{ auth_rules }}` | Yes | No | D-JWT-01, D-OAUTH-01, D-SESSION-01, D-APIKEY-01 |
|
|
599
|
+
| `{{ cache_rules }}` | Yes | No | D-REDIS-01, D-MEMCACHED-01, D-MEMORY-CACHE-01 |
|
|
600
|
+
| `{{ mq_rules }}` | Yes | No | D-RABBITMQ-01, D-KAFKA-01, D-BULLMQ-01 |
|
|
601
|
+
| `{{ deploy_rules }}` | Yes | No | D-DOCKER-01, D-K8S-01 |
|
|
602
|
+
| `{{ observability_rules }}` | Yes | No | D-OBS-LOG-01, D-OBS-LOG-02, D-OBS-LOG-03, D-OBS-METRICS-01 |
|
|
603
|
+
| `{{ test_rules }}` | Yes | No | D-TEST-STRATEGY-01/02/03, D-TEST-MOCK-01/02/03 |
|
|
604
|
+
| `{{ ai_dependency_rule }}` | Yes | No | D-AI-DEP-STRICT-01, D-AI-DEP-ANNOUNCE-01, D-AI-DEP-LOOSE-01 |
|
|
605
|
+
| `{{ ai_breaking_change_rule }}` | Yes | No | D-AI-BREAK-STRICT-01, D-AI-BREAK-LOOSE-01 |
|
|
606
|
+
| `{{ ai_config_rule }}` | Yes | No | D-AI-CONFIG-STRICT-01, D-AI-CONFIG-SYNC-01 |
|
|
607
|
+
| `{{ FIXED_RULES_* }}` | No | Yes | `references/fixed-rules.md` |
|
|
608
|
+
| `{{ deny_list_summary }}` | N/A | N/A | AI auto-generates in Phase 4 |
|
|
609
|
+
| `{{ recommended_libs }}` | N/A | N/A | AI auto-generates in Phase 4 |
|