proteum 2.2.9 → 2.4.1
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/AGENTS.md +10 -4
- package/README.md +58 -15
- package/agents/project/AGENTS.md +53 -10
- package/agents/project/DOCUMENTATION.md +1326 -0
- package/agents/project/app-root/AGENTS.md +2 -2
- package/agents/project/diagnostics.md +12 -7
- package/agents/project/optimizations.md +1 -0
- package/agents/project/root/AGENTS.md +24 -9
- package/agents/project/tests/AGENTS.md +7 -0
- package/agents/project/tests/e2e/AGENTS.md +13 -0
- package/agents/project/tests/e2e/REAL_WORLD_JOURNEY_TESTS.md +192 -0
- package/cli/commands/connect.ts +40 -4
- package/cli/commands/dev.ts +148 -25
- package/cli/commands/diagnose.ts +138 -5
- package/cli/commands/doctor.ts +24 -4
- package/cli/commands/explain.ts +134 -6
- package/cli/commands/mcp.ts +133 -0
- package/cli/commands/orient.ts +93 -3
- package/cli/commands/perf.ts +118 -13
- package/cli/commands/runtime.ts +234 -0
- package/cli/commands/trace.ts +116 -21
- package/cli/mcp/router.ts +1010 -0
- package/cli/presentation/commands.ts +93 -26
- package/cli/presentation/devSession.ts +2 -0
- package/cli/presentation/help.ts +1 -1
- package/cli/runtime/commands.ts +215 -24
- package/cli/runtime/devSessions.ts +328 -2
- package/cli/runtime/mcpDaemon.ts +288 -0
- package/cli/runtime/ports.ts +151 -0
- package/cli/utils/agentOutput.ts +46 -0
- package/cli/utils/agents.ts +194 -51
- package/cli/utils/appRoots.ts +232 -0
- package/common/dev/diagnostics.ts +1 -1
- package/common/dev/inspection.ts +22 -7
- package/common/dev/mcpPayloads.ts +1150 -0
- package/common/dev/mcpServer.ts +287 -0
- package/docs/agent-routing.md +137 -0
- package/docs/dev-commands.md +2 -0
- package/docs/dev-sessions.md +4 -1
- package/docs/diagnostics.md +70 -24
- package/docs/mcp.md +206 -0
- package/docs/migrate-from-2.1.3.md +14 -6
- package/docs/request-tracing.md +12 -6
- package/package.json +11 -3
- package/server/app/devMcp.ts +204 -0
- package/server/services/router/http/cache.ts +116 -0
- package/server/services/router/http/index.ts +94 -35
- package/server/services/router/index.ts +8 -11
- package/server/services/router/request/ip.test.cjs +0 -1
- package/tests/agents-utils.test.cjs +92 -14
- package/tests/cli-mcp-command.test.cjs +262 -0
- package/tests/codex-mcp-usage.test.cjs +307 -0
- package/tests/dev-sessions.test.cjs +113 -0
- package/tests/dev-transpile-watch.test.cjs +117 -9
- package/tests/eslint-rules.test.cjs +0 -1
- package/tests/inspection.test.cjs +66 -0
- package/tests/mcp.test.cjs +873 -0
- package/tests/router-cache-config.test.cjs +73 -0
- package/vitest.config.mjs +9 -0
|
@@ -0,0 +1,1326 @@
|
|
|
1
|
+
# Documentation-Driven Coding Instructions
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This repository uses `/docs` as an operational memory system for coding agents.
|
|
6
|
+
|
|
7
|
+
Do not treat `/docs` as a generic wiki.
|
|
8
|
+
|
|
9
|
+
Treat `/docs` as the source of truth for:
|
|
10
|
+
|
|
11
|
+
- product intent
|
|
12
|
+
- user expectations
|
|
13
|
+
- business rules
|
|
14
|
+
- feature behavior
|
|
15
|
+
- acceptance criteria
|
|
16
|
+
- architecture boundaries
|
|
17
|
+
- auth and permission rules
|
|
18
|
+
- implementation status
|
|
19
|
+
- past fixes
|
|
20
|
+
- performance benchmarks
|
|
21
|
+
- testing expectations
|
|
22
|
+
- release and rollback requirements
|
|
23
|
+
|
|
24
|
+
Your job is to read the smallest relevant documentation set before coding, implement according to that source of truth, and update the relevant docs after the change.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# 1. Core operating rule
|
|
29
|
+
|
|
30
|
+
Before changing code, identify the task type.
|
|
31
|
+
|
|
32
|
+
Then read only the relevant documentation pack.
|
|
33
|
+
|
|
34
|
+
Do not read every file in `/docs` unless the task explicitly requires broad review.
|
|
35
|
+
|
|
36
|
+
Do not code from assumptions when a source-of-truth document exists.
|
|
37
|
+
|
|
38
|
+
Do not duplicate rules across documents. Link to the source of truth when needed.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# 2. Always read these first
|
|
43
|
+
|
|
44
|
+
For every non-trivial task, start with:
|
|
45
|
+
|
|
46
|
+
```txt
|
|
47
|
+
docs/00-start-here.md
|
|
48
|
+
docs/02-reading-rules.md
|
|
49
|
+
docs/implementation/05-definition-of-done.md
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then read the specific docs for the affected feature, architecture area, fix history, or operation.
|
|
53
|
+
|
|
54
|
+
If these files do not exist, create them only when the task requires them or when missing documentation blocks implementation.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
# 3. Task-based reading rules
|
|
59
|
+
|
|
60
|
+
## New feature
|
|
61
|
+
|
|
62
|
+
Before implementing a new feature, read:
|
|
63
|
+
|
|
64
|
+
```txt
|
|
65
|
+
docs/00-start-here.md
|
|
66
|
+
docs/product/user-expectations.md
|
|
67
|
+
docs/implementation/05-definition-of-done.md
|
|
68
|
+
docs/implementation/02-feature-backlog.md
|
|
69
|
+
docs/features/<feature>/README.md
|
|
70
|
+
docs/features/<feature>/scenarios.feature
|
|
71
|
+
docs/features/<feature>/acceptance.md
|
|
72
|
+
docs/features/<feature>/api-contract.md if API behavior changes
|
|
73
|
+
docs/features/<feature>/data-contract.md if data changes
|
|
74
|
+
docs/features/<feature>/ui-contract.md if UI changes
|
|
75
|
+
docs/features/<feature>/permissions.md if access rules change
|
|
76
|
+
docs/features/<feature>/performance.md if performance-sensitive
|
|
77
|
+
docs/architecture/boundaries.md
|
|
78
|
+
related docs/fixes/
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
After implementation, update:
|
|
82
|
+
|
|
83
|
+
```txt
|
|
84
|
+
docs/implementation/02-feature-backlog.md
|
|
85
|
+
docs/features/<feature>/acceptance.md
|
|
86
|
+
docs/testing/regression-tests.md if a regression test was added
|
|
87
|
+
docs/decisions/ if a major decision changed
|
|
88
|
+
docs/fixes/ if a bug or regression was fixed
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Bug fix
|
|
94
|
+
|
|
95
|
+
Before fixing a bug, read:
|
|
96
|
+
|
|
97
|
+
```txt
|
|
98
|
+
docs/00-start-here.md
|
|
99
|
+
affected feature docs
|
|
100
|
+
docs/fixes/ related to the affected area
|
|
101
|
+
docs/testing/regression-tests.md
|
|
102
|
+
docs/architecture/<affected-area>.md
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
After fixing the bug, update:
|
|
106
|
+
|
|
107
|
+
```txt
|
|
108
|
+
docs/fixes/YYYY-MM-DD-short-bug-name.md
|
|
109
|
+
docs/testing/regression-tests.md
|
|
110
|
+
affected feature edge-cases.md if a new edge case was discovered
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
A bug fix is incomplete if:
|
|
114
|
+
|
|
115
|
+
```txt
|
|
116
|
+
the root cause is not documented
|
|
117
|
+
the implemented solution is not documented
|
|
118
|
+
the regression test is not linked
|
|
119
|
+
future agents cannot tell what pattern must not return
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Performance issue
|
|
125
|
+
|
|
126
|
+
Before fixing a performance issue, read:
|
|
127
|
+
|
|
128
|
+
```txt
|
|
129
|
+
docs/architecture/performance.md
|
|
130
|
+
docs/testing/performance-tests.md
|
|
131
|
+
affected feature performance.md
|
|
132
|
+
related docs/fixes/*performance*
|
|
133
|
+
docs/architecture/observability.md
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Before coding, capture a baseline benchmark.
|
|
137
|
+
|
|
138
|
+
Document:
|
|
139
|
+
|
|
140
|
+
```txt
|
|
141
|
+
environment
|
|
142
|
+
dataset
|
|
143
|
+
benchmark command
|
|
144
|
+
commit before
|
|
145
|
+
p50 / p95 / p99 where possible
|
|
146
|
+
query count where relevant
|
|
147
|
+
bundle size where relevant
|
|
148
|
+
queue latency where relevant
|
|
149
|
+
memory where relevant
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
After fixing performance, update:
|
|
153
|
+
|
|
154
|
+
```txt
|
|
155
|
+
docs/fixes/YYYY-MM-DD-performance-name.md
|
|
156
|
+
docs/testing/performance-tests.md
|
|
157
|
+
affected feature performance.md
|
|
158
|
+
docs/architecture/performance.md if global budgets changed
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
A performance fix is incomplete without:
|
|
162
|
+
|
|
163
|
+
```txt
|
|
164
|
+
benchmark before
|
|
165
|
+
benchmark after
|
|
166
|
+
dataset
|
|
167
|
+
environment
|
|
168
|
+
command
|
|
169
|
+
solution implemented
|
|
170
|
+
trade-offs
|
|
171
|
+
regression threshold
|
|
172
|
+
benchmark or test path
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Auth, scopes, roles, tenancy, or permissions
|
|
178
|
+
|
|
179
|
+
Before changing auth or permissions, read:
|
|
180
|
+
|
|
181
|
+
```txt
|
|
182
|
+
docs/implementation/03-auth-scope-matrix.md
|
|
183
|
+
docs/architecture/auth-and-permissions.md
|
|
184
|
+
docs/product/user-expectations.md
|
|
185
|
+
docs/fixes/ auth-related notes
|
|
186
|
+
affected feature permissions.md
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
After changing auth or permissions, update:
|
|
190
|
+
|
|
191
|
+
```txt
|
|
192
|
+
docs/implementation/03-auth-scope-matrix.md
|
|
193
|
+
docs/architecture/auth-and-permissions.md
|
|
194
|
+
docs/testing/regression-tests.md
|
|
195
|
+
docs/fixes/ if a bug was fixed
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Never trust client-provided tenant, workspace, account, or organization identifiers when the server has a resolved context.
|
|
199
|
+
|
|
200
|
+
Never enforce security only in the UI.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Data model or persistence change
|
|
205
|
+
|
|
206
|
+
Before changing data model or persistence behavior, read:
|
|
207
|
+
|
|
208
|
+
```txt
|
|
209
|
+
docs/architecture/data-model.md
|
|
210
|
+
affected feature data-contract.md
|
|
211
|
+
docs/compliance/data-map.md
|
|
212
|
+
docs/compliance/export-delete-anonymize.md
|
|
213
|
+
docs/operations/migrations.md
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
After changing data behavior, update:
|
|
217
|
+
|
|
218
|
+
```txt
|
|
219
|
+
affected feature data-contract.md
|
|
220
|
+
docs/architecture/data-model.md if system-wide
|
|
221
|
+
docs/compliance/data-map.md
|
|
222
|
+
docs/operations/migrations.md if migration risk changed
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Document:
|
|
226
|
+
|
|
227
|
+
```txt
|
|
228
|
+
ownership rules
|
|
229
|
+
tenant/workspace isolation
|
|
230
|
+
soft delete / hard delete behavior
|
|
231
|
+
audit behavior
|
|
232
|
+
export behavior
|
|
233
|
+
delete/anonymize behavior
|
|
234
|
+
indexing expectations
|
|
235
|
+
query expectations
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## API, controller, tool, webhook, or public endpoint change
|
|
241
|
+
|
|
242
|
+
Before changing an API-like surface, read:
|
|
243
|
+
|
|
244
|
+
```txt
|
|
245
|
+
affected feature api-contract.md
|
|
246
|
+
docs/architecture/errors.md
|
|
247
|
+
docs/architecture/auth-and-permissions.md
|
|
248
|
+
docs/implementation/03-auth-scope-matrix.md
|
|
249
|
+
docs/testing/test-strategy.md
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
After the change, update:
|
|
253
|
+
|
|
254
|
+
```txt
|
|
255
|
+
affected feature api-contract.md
|
|
256
|
+
docs/implementation/02-feature-backlog.md
|
|
257
|
+
docs/testing/regression-tests.md if relevant
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Document:
|
|
261
|
+
|
|
262
|
+
```txt
|
|
263
|
+
input schema
|
|
264
|
+
output schema
|
|
265
|
+
auth requirements
|
|
266
|
+
required scopes
|
|
267
|
+
error behavior
|
|
268
|
+
rate limits
|
|
269
|
+
idempotency rules
|
|
270
|
+
audit behavior
|
|
271
|
+
examples
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## UI behavior change
|
|
277
|
+
|
|
278
|
+
Before changing UI behavior, read:
|
|
279
|
+
|
|
280
|
+
```txt
|
|
281
|
+
affected feature ui-contract.md
|
|
282
|
+
docs/product/user-expectations.md
|
|
283
|
+
docs/product/personas.md
|
|
284
|
+
docs/architecture/boundaries.md
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
After the change, update:
|
|
288
|
+
|
|
289
|
+
```txt
|
|
290
|
+
affected feature ui-contract.md
|
|
291
|
+
affected feature acceptance.md
|
|
292
|
+
docs/testing/test-strategy.md if testing approach changed
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Document user states:
|
|
296
|
+
|
|
297
|
+
```txt
|
|
298
|
+
empty
|
|
299
|
+
loading
|
|
300
|
+
success
|
|
301
|
+
error
|
|
302
|
+
forbidden
|
|
303
|
+
limit reached
|
|
304
|
+
archived/deleted
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Do not rely on client-side UI to enforce security.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Worker, queue, async job, or scheduler change
|
|
312
|
+
|
|
313
|
+
Before changing async behavior, read:
|
|
314
|
+
|
|
315
|
+
```txt
|
|
316
|
+
docs/architecture/workers-and-queues.md
|
|
317
|
+
docs/architecture/observability.md
|
|
318
|
+
docs/operations/env.md
|
|
319
|
+
docs/testing/performance-tests.md if latency matters
|
|
320
|
+
related docs/fixes/
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
After the change, update:
|
|
324
|
+
|
|
325
|
+
```txt
|
|
326
|
+
docs/architecture/workers-and-queues.md
|
|
327
|
+
docs/testing/regression-tests.md
|
|
328
|
+
docs/fixes/ if a worker bug was fixed
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Document:
|
|
332
|
+
|
|
333
|
+
```txt
|
|
334
|
+
queue name
|
|
335
|
+
job name
|
|
336
|
+
trigger
|
|
337
|
+
retry behavior
|
|
338
|
+
dead-letter behavior
|
|
339
|
+
logging behavior
|
|
340
|
+
idempotency behavior
|
|
341
|
+
failure visibility
|
|
342
|
+
user-visible status if relevant
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Do not hide failed user-visible work inside background jobs.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Integration or webhook change
|
|
350
|
+
|
|
351
|
+
Before changing integrations or webhooks, read:
|
|
352
|
+
|
|
353
|
+
```txt
|
|
354
|
+
docs/architecture/integrations.md
|
|
355
|
+
docs/architecture/workers-and-queues.md
|
|
356
|
+
docs/operations/env.md
|
|
357
|
+
docs/fixes/ integration-related notes
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
After the change, update:
|
|
361
|
+
|
|
362
|
+
```txt
|
|
363
|
+
docs/architecture/integrations.md
|
|
364
|
+
docs/architecture/workers-and-queues.md
|
|
365
|
+
docs/operations/env.md
|
|
366
|
+
docs/fixes/ if a provider or webhook bug was fixed
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Document:
|
|
370
|
+
|
|
371
|
+
```txt
|
|
372
|
+
provider
|
|
373
|
+
credentials/env requirements
|
|
374
|
+
webhook verification
|
|
375
|
+
retry behavior
|
|
376
|
+
failure behavior
|
|
377
|
+
data mapping
|
|
378
|
+
rate limits
|
|
379
|
+
manual recovery steps
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Release, deploy, migration, or rollback change
|
|
385
|
+
|
|
386
|
+
Before release-related work, read:
|
|
387
|
+
|
|
388
|
+
```txt
|
|
389
|
+
docs/implementation/05-definition-of-done.md
|
|
390
|
+
docs/implementation/02-feature-backlog.md
|
|
391
|
+
docs/operations/release-checklist.md
|
|
392
|
+
docs/operations/rollback.md
|
|
393
|
+
docs/operations/migrations.md
|
|
394
|
+
docs/testing/smoke-tests.md
|
|
395
|
+
docs/testing/regression-tests.md
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
After release-related work, update:
|
|
399
|
+
|
|
400
|
+
```txt
|
|
401
|
+
docs/implementation/02-feature-backlog.md
|
|
402
|
+
docs/operations/release-checklist.md
|
|
403
|
+
docs/operations/rollback.md
|
|
404
|
+
docs/fixes/ if the release fixed an incident
|
|
405
|
+
docs/decisions/ if the release changed a major decision
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Privacy, compliance, export, deletion, anonymization, or audit
|
|
411
|
+
|
|
412
|
+
Before touching personal or customer data behavior, read:
|
|
413
|
+
|
|
414
|
+
```txt
|
|
415
|
+
docs/compliance/data-map.md
|
|
416
|
+
docs/compliance/privacy-baseline.md
|
|
417
|
+
docs/compliance/retention.md
|
|
418
|
+
docs/compliance/export-delete-anonymize.md
|
|
419
|
+
docs/compliance/audit.md
|
|
420
|
+
affected feature data-contract.md
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
After the change, update:
|
|
424
|
+
|
|
425
|
+
```txt
|
|
426
|
+
docs/compliance/data-map.md
|
|
427
|
+
docs/compliance/export-delete-anonymize.md
|
|
428
|
+
docs/compliance/audit.md
|
|
429
|
+
affected feature data-contract.md
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Read compliance docs when touching:
|
|
433
|
+
|
|
434
|
+
```txt
|
|
435
|
+
user profiles
|
|
436
|
+
tenant/workspace membership
|
|
437
|
+
contacts
|
|
438
|
+
documents
|
|
439
|
+
messages
|
|
440
|
+
billing data
|
|
441
|
+
candidate/customer records
|
|
442
|
+
activity history
|
|
443
|
+
audit logs
|
|
444
|
+
external integrations
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
# 4. How to use feature docs
|
|
450
|
+
|
|
451
|
+
Feature docs are the source of truth for user-visible behavior.
|
|
452
|
+
|
|
453
|
+
Expected feature docs:
|
|
454
|
+
|
|
455
|
+
```txt
|
|
456
|
+
docs/features/<feature-name>/
|
|
457
|
+
README.md
|
|
458
|
+
scenarios.feature
|
|
459
|
+
acceptance.md
|
|
460
|
+
data-contract.md
|
|
461
|
+
api-contract.md
|
|
462
|
+
ui-contract.md
|
|
463
|
+
permissions.md
|
|
464
|
+
edge-cases.md
|
|
465
|
+
performance.md
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Do not create all files automatically.
|
|
469
|
+
|
|
470
|
+
Create only the files needed by the feature.
|
|
471
|
+
|
|
472
|
+
## Feature README
|
|
473
|
+
|
|
474
|
+
Use `README.md` to understand:
|
|
475
|
+
|
|
476
|
+
```txt
|
|
477
|
+
purpose
|
|
478
|
+
users
|
|
479
|
+
user-visible outcome
|
|
480
|
+
business rules
|
|
481
|
+
main flows
|
|
482
|
+
out of scope
|
|
483
|
+
related product expectations
|
|
484
|
+
related architecture docs
|
|
485
|
+
related fixes
|
|
486
|
+
known risks
|
|
487
|
+
performance budget
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## BDD scenarios
|
|
491
|
+
|
|
492
|
+
BDD belongs in:
|
|
493
|
+
|
|
494
|
+
```txt
|
|
495
|
+
docs/features/<feature>/scenarios.feature
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
Use BDD for:
|
|
499
|
+
|
|
500
|
+
```txt
|
|
501
|
+
user flows
|
|
502
|
+
business rules
|
|
503
|
+
permissions
|
|
504
|
+
billing gates
|
|
505
|
+
AI-agent behavior
|
|
506
|
+
public pages
|
|
507
|
+
compliance-sensitive behavior
|
|
508
|
+
workflow state transitions
|
|
509
|
+
performance expectations that affect user experience
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Do not use BDD for:
|
|
513
|
+
|
|
514
|
+
```txt
|
|
515
|
+
tiny utility functions
|
|
516
|
+
formatting helpers
|
|
517
|
+
private component internals
|
|
518
|
+
low-level ORM mapping
|
|
519
|
+
simple getters/setters
|
|
520
|
+
implementation-only refactors
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
BDD scenarios should describe observable behavior, not implementation internals.
|
|
524
|
+
|
|
525
|
+
## ATDD acceptance
|
|
526
|
+
|
|
527
|
+
ATDD belongs in:
|
|
528
|
+
|
|
529
|
+
```txt
|
|
530
|
+
docs/features/<feature>/acceptance.md
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
Use it as the release gate for the feature.
|
|
534
|
+
|
|
535
|
+
Acceptance criteria should cover:
|
|
536
|
+
|
|
537
|
+
```txt
|
|
538
|
+
happy path
|
|
539
|
+
empty state
|
|
540
|
+
error state
|
|
541
|
+
unauthorized user
|
|
542
|
+
wrong tenant/workspace access
|
|
543
|
+
audit behavior where relevant
|
|
544
|
+
user-facing copy
|
|
545
|
+
performance budget
|
|
546
|
+
past fixes reviewed
|
|
547
|
+
regression tests added
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
# 5. Architecture docs
|
|
553
|
+
|
|
554
|
+
Architecture docs define system-wide rules.
|
|
555
|
+
|
|
556
|
+
They do not replace feature docs.
|
|
557
|
+
|
|
558
|
+
Read architecture docs when behavior crosses features or affects boundaries.
|
|
559
|
+
|
|
560
|
+
Important architecture docs:
|
|
561
|
+
|
|
562
|
+
```txt
|
|
563
|
+
docs/architecture/overview.md
|
|
564
|
+
docs/architecture/boundaries.md
|
|
565
|
+
docs/architecture/data-model.md
|
|
566
|
+
docs/architecture/auth-and-permissions.md
|
|
567
|
+
docs/architecture/integrations.md
|
|
568
|
+
docs/architecture/workers-and-queues.md
|
|
569
|
+
docs/architecture/errors.md
|
|
570
|
+
docs/architecture/observability.md
|
|
571
|
+
docs/architecture/performance.md
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
## Boundary rules
|
|
575
|
+
|
|
576
|
+
When coding, respect these boundaries unless a documented ADR changes them.
|
|
577
|
+
|
|
578
|
+
Pages/UI may:
|
|
579
|
+
|
|
580
|
+
```txt
|
|
581
|
+
render user-facing state
|
|
582
|
+
call approved APIs
|
|
583
|
+
show empty/error states
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Pages/UI must not:
|
|
587
|
+
|
|
588
|
+
```txt
|
|
589
|
+
enforce security only on the client
|
|
590
|
+
own business rules
|
|
591
|
+
perform hidden sensitive actions
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
Controllers/API handlers may:
|
|
595
|
+
|
|
596
|
+
```txt
|
|
597
|
+
parse and validate input
|
|
598
|
+
resolve request context
|
|
599
|
+
call services/domain modules
|
|
600
|
+
return DTOs
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
Controllers/API handlers must not:
|
|
604
|
+
|
|
605
|
+
```txt
|
|
606
|
+
contain deep domain logic
|
|
607
|
+
trust client-provided tenant/workspace IDs
|
|
608
|
+
duplicate service logic
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
Services/domain modules may:
|
|
612
|
+
|
|
613
|
+
```txt
|
|
614
|
+
own business rules
|
|
615
|
+
enforce permissions
|
|
616
|
+
call persistence layer
|
|
617
|
+
emit audit events
|
|
618
|
+
return narrow DTOs
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
Services/domain modules must not:
|
|
622
|
+
|
|
623
|
+
```txt
|
|
624
|
+
depend on UI state
|
|
625
|
+
read request context implicitly unless documented
|
|
626
|
+
return oversized payloads when narrow DTOs are enough
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
Workers/jobs may:
|
|
630
|
+
|
|
631
|
+
```txt
|
|
632
|
+
process async tasks
|
|
633
|
+
retry safe jobs
|
|
634
|
+
record job failures
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Workers/jobs must not:
|
|
638
|
+
|
|
639
|
+
```txt
|
|
640
|
+
hide failed user-visible work
|
|
641
|
+
perform sensitive actions without explicit authorization
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
# 6. Implementation docs
|
|
647
|
+
|
|
648
|
+
Implementation docs control delivery state.
|
|
649
|
+
|
|
650
|
+
Important files:
|
|
651
|
+
|
|
652
|
+
```txt
|
|
653
|
+
docs/implementation/00-implementation-baseline.md
|
|
654
|
+
docs/implementation/01-mvp-scope.md
|
|
655
|
+
docs/implementation/02-feature-backlog.md
|
|
656
|
+
docs/implementation/03-auth-scope-matrix.md
|
|
657
|
+
docs/implementation/04-framework-contract.md
|
|
658
|
+
docs/implementation/05-definition-of-done.md
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
## Feature backlog
|
|
662
|
+
|
|
663
|
+
When implementing or changing a feature, keep this updated:
|
|
664
|
+
|
|
665
|
+
```txt
|
|
666
|
+
docs/implementation/02-feature-backlog.md
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Each feature row should include, where applicable:
|
|
670
|
+
|
|
671
|
+
```txt
|
|
672
|
+
feature
|
|
673
|
+
group
|
|
674
|
+
priority
|
|
675
|
+
status
|
|
676
|
+
area
|
|
677
|
+
owner
|
|
678
|
+
featureDocsPath
|
|
679
|
+
dataDependencies
|
|
680
|
+
apiDependencies
|
|
681
|
+
uiDependencies
|
|
682
|
+
testPath
|
|
683
|
+
requiresWorker
|
|
684
|
+
requiresIntegration
|
|
685
|
+
requiresHumanValidation
|
|
686
|
+
implementedAt
|
|
687
|
+
commitSha
|
|
688
|
+
blockedReason
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
Use these statuses:
|
|
692
|
+
|
|
693
|
+
```txt
|
|
694
|
+
specified
|
|
695
|
+
blocked
|
|
696
|
+
in_progress
|
|
697
|
+
implemented
|
|
698
|
+
tested
|
|
699
|
+
released
|
|
700
|
+
deprecated
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
Do not leave implementation status implicit.
|
|
704
|
+
|
|
705
|
+
## Definition of done
|
|
706
|
+
|
|
707
|
+
Before claiming a task is complete, check:
|
|
708
|
+
|
|
709
|
+
```txt
|
|
710
|
+
docs/implementation/05-definition-of-done.md
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
At minimum, verify:
|
|
714
|
+
|
|
715
|
+
```txt
|
|
716
|
+
Product
|
|
717
|
+
[ ] User-visible flow works.
|
|
718
|
+
[ ] Empty state works.
|
|
719
|
+
[ ] Error state works.
|
|
720
|
+
[ ] User expectations are respected.
|
|
721
|
+
|
|
722
|
+
Security
|
|
723
|
+
[ ] Auth is enforced server-side.
|
|
724
|
+
[ ] Tenant/workspace isolation is tested.
|
|
725
|
+
[ ] Scopes/roles are enforced.
|
|
726
|
+
[ ] Sensitive values are not logged.
|
|
727
|
+
[ ] Web-only actions remain web-only.
|
|
728
|
+
|
|
729
|
+
Data
|
|
730
|
+
[ ] Data model changes are documented.
|
|
731
|
+
[ ] Mutations are audited where required.
|
|
732
|
+
[ ] Personal-data behavior is documented where relevant.
|
|
733
|
+
|
|
734
|
+
Testing
|
|
735
|
+
[ ] Unit tests updated.
|
|
736
|
+
[ ] Integration tests updated.
|
|
737
|
+
[ ] E2E tests updated for changed user-visible behavior.
|
|
738
|
+
[ ] Regression tests added for fixed bugs.
|
|
739
|
+
|
|
740
|
+
Performance
|
|
741
|
+
[ ] Relevant performance budget checked.
|
|
742
|
+
[ ] Before/after benchmarks documented for performance fixes.
|
|
743
|
+
[ ] Regression threshold defined for performance fixes.
|
|
744
|
+
|
|
745
|
+
Documentation
|
|
746
|
+
[ ] Feature docs updated.
|
|
747
|
+
[ ] Backlog updated.
|
|
748
|
+
[ ] ADR added if a major decision changed.
|
|
749
|
+
[ ] Fix note added if a regression or important bug was fixed.
|
|
750
|
+
[ ] Performance fix note added if performance changed.
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
# 7. Fix notes
|
|
756
|
+
|
|
757
|
+
Past fixes are regression-prevention memory.
|
|
758
|
+
|
|
759
|
+
They are not a generic changelog.
|
|
760
|
+
|
|
761
|
+
Create a fix note in:
|
|
762
|
+
|
|
763
|
+
```txt
|
|
764
|
+
docs/fixes/YYYY-MM-DD-short-bug-name.md
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
when a bug:
|
|
768
|
+
|
|
769
|
+
```txt
|
|
770
|
+
affected user trust
|
|
771
|
+
affected security
|
|
772
|
+
affected billing
|
|
773
|
+
affected permissions
|
|
774
|
+
affected data integrity
|
|
775
|
+
affected performance
|
|
776
|
+
was hard to diagnose
|
|
777
|
+
could easily be reintroduced by a coding agent
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
## Fix note template
|
|
781
|
+
|
|
782
|
+
````md
|
|
783
|
+
# Fix: <Short bug name>
|
|
784
|
+
|
|
785
|
+
## Date
|
|
786
|
+
|
|
787
|
+
YYYY-MM-DD
|
|
788
|
+
|
|
789
|
+
## Severity
|
|
790
|
+
|
|
791
|
+
Low / Medium / High / Critical
|
|
792
|
+
|
|
793
|
+
## Status
|
|
794
|
+
|
|
795
|
+
Fixed
|
|
796
|
+
|
|
797
|
+
## Affected area
|
|
798
|
+
|
|
799
|
+
auth / billing / dashboard / public route / worker / integration / database / UI
|
|
800
|
+
|
|
801
|
+
## Problem
|
|
802
|
+
|
|
803
|
+
What went wrong?
|
|
804
|
+
|
|
805
|
+
## User impact
|
|
806
|
+
|
|
807
|
+
What did the user experience?
|
|
808
|
+
|
|
809
|
+
## Expected behavior
|
|
810
|
+
|
|
811
|
+
What should have happened?
|
|
812
|
+
|
|
813
|
+
## Actual behavior
|
|
814
|
+
|
|
815
|
+
What happened instead?
|
|
816
|
+
|
|
817
|
+
## Root cause
|
|
818
|
+
|
|
819
|
+
Why did it happen?
|
|
820
|
+
|
|
821
|
+
## Solution implemented
|
|
822
|
+
|
|
823
|
+
Describe the actual implemented solution.
|
|
824
|
+
|
|
825
|
+
## Code changes
|
|
826
|
+
|
|
827
|
+
```txt
|
|
828
|
+
path/to/file
|
|
829
|
+
path/to/test
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
## Alternatives considered
|
|
833
|
+
|
|
834
|
+
### Alternative 1
|
|
835
|
+
|
|
836
|
+
Rejected because...
|
|
837
|
+
|
|
838
|
+
### Alternative 2
|
|
839
|
+
|
|
840
|
+
Accepted because...
|
|
841
|
+
|
|
842
|
+
## Regression test
|
|
843
|
+
|
|
844
|
+
```txt
|
|
845
|
+
tests/regression/<area>/<bug-name>.test.ts
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
## New rule added
|
|
849
|
+
|
|
850
|
+
What should future agents follow?
|
|
851
|
+
|
|
852
|
+
## Agent warning
|
|
853
|
+
|
|
854
|
+
What pattern must not be reintroduced?
|
|
855
|
+
|
|
856
|
+
## Related docs
|
|
857
|
+
|
|
858
|
+
- docs/features/<feature>/
|
|
859
|
+
- docs/architecture/<area>.md
|
|
860
|
+
````
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
864
|
+
# 8. Performance fix notes
|
|
865
|
+
|
|
866
|
+
Performance fixes require evidence.
|
|
867
|
+
|
|
868
|
+
Create a performance fix note in:
|
|
869
|
+
|
|
870
|
+
```txt
|
|
871
|
+
docs/fixes/YYYY-MM-DD-performance-name.md
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
A performance fix must include:
|
|
875
|
+
|
|
876
|
+
```txt
|
|
877
|
+
problem
|
|
878
|
+
user impact
|
|
879
|
+
baseline benchmark before
|
|
880
|
+
environment
|
|
881
|
+
dataset
|
|
882
|
+
benchmark command
|
|
883
|
+
root cause
|
|
884
|
+
solution implemented
|
|
885
|
+
benchmark after
|
|
886
|
+
trade-offs
|
|
887
|
+
regression threshold
|
|
888
|
+
test or benchmark path
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
## Performance fix template
|
|
892
|
+
|
|
893
|
+
````md
|
|
894
|
+
# Fix: <Performance problem>
|
|
895
|
+
|
|
896
|
+
## Date
|
|
897
|
+
|
|
898
|
+
YYYY-MM-DD
|
|
899
|
+
|
|
900
|
+
## Severity
|
|
901
|
+
|
|
902
|
+
Low / Medium / High / Critical
|
|
903
|
+
|
|
904
|
+
## Status
|
|
905
|
+
|
|
906
|
+
Fixed
|
|
907
|
+
|
|
908
|
+
## Affected area
|
|
909
|
+
|
|
910
|
+
page / API / database / worker / integration / frontend
|
|
911
|
+
|
|
912
|
+
## Problem
|
|
913
|
+
|
|
914
|
+
What was slow or inefficient?
|
|
915
|
+
|
|
916
|
+
## User impact
|
|
917
|
+
|
|
918
|
+
What did users experience?
|
|
919
|
+
|
|
920
|
+
## Expected behavior
|
|
921
|
+
|
|
922
|
+
What performance budget should apply?
|
|
923
|
+
|
|
924
|
+
## Actual behavior
|
|
925
|
+
|
|
926
|
+
What was the measured behavior before the fix?
|
|
927
|
+
|
|
928
|
+
## Baseline benchmark before fix
|
|
929
|
+
|
|
930
|
+
### Environment
|
|
931
|
+
|
|
932
|
+
```txt
|
|
933
|
+
Environment:
|
|
934
|
+
Date:
|
|
935
|
+
Commit before:
|
|
936
|
+
Runtime:
|
|
937
|
+
Database:
|
|
938
|
+
Dataset:
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
### Benchmark command
|
|
942
|
+
|
|
943
|
+
```bash
|
|
944
|
+
<command>
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
### Results before
|
|
948
|
+
|
|
949
|
+
| Metric | Before |
|
|
950
|
+
| ------------------ | -----: |
|
|
951
|
+
| p50 | |
|
|
952
|
+
| p95 | |
|
|
953
|
+
| p99 | |
|
|
954
|
+
| DB queries/request | |
|
|
955
|
+
| Slowest query | |
|
|
956
|
+
| Bundle size | |
|
|
957
|
+
| Queue latency p95 | |
|
|
958
|
+
| Memory peak | |
|
|
959
|
+
|
|
960
|
+
## Root cause
|
|
961
|
+
|
|
962
|
+
Explain the cause.
|
|
963
|
+
|
|
964
|
+
## Solution implemented
|
|
965
|
+
|
|
966
|
+
List the exact changes.
|
|
967
|
+
|
|
968
|
+
## Benchmark after fix
|
|
969
|
+
|
|
970
|
+
### Environment
|
|
971
|
+
|
|
972
|
+
Same as before unless stated otherwise.
|
|
973
|
+
|
|
974
|
+
### Results after
|
|
975
|
+
|
|
976
|
+
| Metric | Before | After | Change |
|
|
977
|
+
| ------------------ | -----: | ----: | -----: |
|
|
978
|
+
| p50 | | | |
|
|
979
|
+
| p95 | | | |
|
|
980
|
+
| p99 | | | |
|
|
981
|
+
| DB queries/request | | | |
|
|
982
|
+
| Slowest query | | | |
|
|
983
|
+
| Bundle size | | | |
|
|
984
|
+
| Queue latency p95 | | | |
|
|
985
|
+
| Memory peak | | | |
|
|
986
|
+
|
|
987
|
+
## Trade-offs
|
|
988
|
+
|
|
989
|
+
What changed negatively or became more constrained?
|
|
990
|
+
|
|
991
|
+
## Regression threshold
|
|
992
|
+
|
|
993
|
+
This fix is considered regressed if:
|
|
994
|
+
|
|
995
|
+
```txt
|
|
996
|
+
<metric> > <threshold>
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
## Regression benchmark
|
|
1000
|
+
|
|
1001
|
+
```txt
|
|
1002
|
+
tests/performance/<benchmark>.test.ts
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
## New rule added
|
|
1006
|
+
|
|
1007
|
+
What should future agents follow?
|
|
1008
|
+
|
|
1009
|
+
## Agent warning
|
|
1010
|
+
|
|
1011
|
+
What pattern must not be reintroduced?
|
|
1012
|
+
````
|
|
1013
|
+
|
|
1014
|
+
---
|
|
1015
|
+
|
|
1016
|
+
# 9. Decision docs
|
|
1017
|
+
|
|
1018
|
+
Use ADRs for choices that future agents must not casually undo.
|
|
1019
|
+
|
|
1020
|
+
Create ADRs in:
|
|
1021
|
+
|
|
1022
|
+
```txt
|
|
1023
|
+
docs/decisions/ADR-0001-short-name.md
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
Create an ADR when:
|
|
1027
|
+
|
|
1028
|
+
```txt
|
|
1029
|
+
a major technical choice is made
|
|
1030
|
+
a product boundary is frozen
|
|
1031
|
+
a security or privacy rule is established
|
|
1032
|
+
a framework/integration choice is made
|
|
1033
|
+
a costly-to-reverse decision is made
|
|
1034
|
+
a previous decision is replaced
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
Do not create ADRs for tiny implementation details.
|
|
1038
|
+
|
|
1039
|
+
## ADR template
|
|
1040
|
+
|
|
1041
|
+
```md
|
|
1042
|
+
# ADR-0001 - <Decision>
|
|
1043
|
+
|
|
1044
|
+
## Status
|
|
1045
|
+
|
|
1046
|
+
Proposed / Accepted / Deprecated / Replaced
|
|
1047
|
+
|
|
1048
|
+
## Date
|
|
1049
|
+
|
|
1050
|
+
YYYY-MM-DD
|
|
1051
|
+
|
|
1052
|
+
## Context
|
|
1053
|
+
|
|
1054
|
+
What problem forced this decision?
|
|
1055
|
+
|
|
1056
|
+
## Decision
|
|
1057
|
+
|
|
1058
|
+
What did we choose?
|
|
1059
|
+
|
|
1060
|
+
## Consequences
|
|
1061
|
+
|
|
1062
|
+
### Positive
|
|
1063
|
+
|
|
1064
|
+
### Negative
|
|
1065
|
+
|
|
1066
|
+
## Alternatives considered
|
|
1067
|
+
|
|
1068
|
+
## What future agents must not do
|
|
1069
|
+
|
|
1070
|
+
## Related docs
|
|
1071
|
+
|
|
1072
|
+
- ...
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
---
|
|
1076
|
+
|
|
1077
|
+
# 10. Testing docs
|
|
1078
|
+
|
|
1079
|
+
Testing docs explain how to prove behavior.
|
|
1080
|
+
|
|
1081
|
+
Important files:
|
|
1082
|
+
|
|
1083
|
+
```txt
|
|
1084
|
+
docs/testing/test-strategy.md
|
|
1085
|
+
docs/testing/fixtures.md
|
|
1086
|
+
docs/testing/smoke-tests.md
|
|
1087
|
+
docs/testing/regression-tests.md
|
|
1088
|
+
docs/testing/performance-tests.md
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
Use this mapping:
|
|
1092
|
+
|
|
1093
|
+
```txt
|
|
1094
|
+
BDD scenario
|
|
1095
|
+
-> acceptance checklist
|
|
1096
|
+
-> automated test
|
|
1097
|
+
-> regression test if bug occurred
|
|
1098
|
+
-> performance benchmark if performance changed
|
|
1099
|
+
-> fix note if historical problem was solved
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
When adding or changing tests, update:
|
|
1103
|
+
|
|
1104
|
+
```txt
|
|
1105
|
+
docs/testing/regression-tests.md
|
|
1106
|
+
docs/testing/performance-tests.md
|
|
1107
|
+
docs/testing/fixtures.md if test data changes
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
Do not create inconsistent ad hoc fixtures when a documented fixture exists.
|
|
1111
|
+
|
|
1112
|
+
---
|
|
1113
|
+
|
|
1114
|
+
# 11. Clean documentation rules
|
|
1115
|
+
|
|
1116
|
+
## Rule 1 - Every doc needs a purpose
|
|
1117
|
+
|
|
1118
|
+
Every new or significantly updated doc should include:
|
|
1119
|
+
|
|
1120
|
+
```md
|
|
1121
|
+
# Title
|
|
1122
|
+
|
|
1123
|
+
## Purpose
|
|
1124
|
+
|
|
1125
|
+
## When to read this
|
|
1126
|
+
|
|
1127
|
+
## When to update this
|
|
1128
|
+
|
|
1129
|
+
## Source of truth for
|
|
1130
|
+
|
|
1131
|
+
## Last reviewed
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
## Rule 2 - Do not duplicate source of truth
|
|
1135
|
+
|
|
1136
|
+
Use these locations:
|
|
1137
|
+
|
|
1138
|
+
```txt
|
|
1139
|
+
Business rule -> feature README
|
|
1140
|
+
Permission rule -> feature permissions.md or auth-scope matrix
|
|
1141
|
+
System boundary -> architecture/boundaries.md
|
|
1142
|
+
Historical bug -> fixes/
|
|
1143
|
+
Implementation status -> feature backlog
|
|
1144
|
+
Acceptance criteria -> feature acceptance.md
|
|
1145
|
+
Performance budget -> architecture/performance.md or feature performance.md
|
|
1146
|
+
Privacy/data behavior -> compliance/
|
|
1147
|
+
Architecture decision -> decisions/ADR-xxxx.md
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
When another document needs the same information, link to the source instead of copying it.
|
|
1151
|
+
|
|
1152
|
+
## Rule 3 - Prefer short, specific docs
|
|
1153
|
+
|
|
1154
|
+
Prefer:
|
|
1155
|
+
|
|
1156
|
+
```txt
|
|
1157
|
+
short specific docs
|
|
1158
|
+
clear tables
|
|
1159
|
+
templates
|
|
1160
|
+
checklists
|
|
1161
|
+
examples
|
|
1162
|
+
links to related docs
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
Avoid:
|
|
1166
|
+
|
|
1167
|
+
```txt
|
|
1168
|
+
long essays
|
|
1169
|
+
mixed product + implementation + history docs
|
|
1170
|
+
unclear ownership
|
|
1171
|
+
duplicated requirements
|
|
1172
|
+
stale maybe-later notes
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
## Rule 4 - Archive stale docs
|
|
1176
|
+
|
|
1177
|
+
Do not let stale docs guide coding.
|
|
1178
|
+
|
|
1179
|
+
Move deprecated docs to:
|
|
1180
|
+
|
|
1181
|
+
```txt
|
|
1182
|
+
docs/_archive/deprecated-docs/
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
Add this note:
|
|
1186
|
+
|
|
1187
|
+
```md
|
|
1188
|
+
# Deprecated
|
|
1189
|
+
|
|
1190
|
+
This document is archived and must not guide current implementation.
|
|
1191
|
+
|
|
1192
|
+
Current source of truth:
|
|
1193
|
+
- ...
|
|
1194
|
+
```
|
|
1195
|
+
|
|
1196
|
+
## Rule 5 - Important fixes require fix notes
|
|
1197
|
+
|
|
1198
|
+
A fix note is required when the bug affected:
|
|
1199
|
+
|
|
1200
|
+
```txt
|
|
1201
|
+
trust
|
|
1202
|
+
security
|
|
1203
|
+
billing
|
|
1204
|
+
permissions
|
|
1205
|
+
data integrity
|
|
1206
|
+
performance
|
|
1207
|
+
privacy
|
|
1208
|
+
public routes
|
|
1209
|
+
external integrations
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
## Rule 6 - Performance fixes require benchmarks
|
|
1213
|
+
|
|
1214
|
+
Do not claim a performance improvement without before/after evidence.
|
|
1215
|
+
|
|
1216
|
+
## Rule 7 - BDD and ATDD stay at feature level
|
|
1217
|
+
|
|
1218
|
+
BDD belongs in:
|
|
1219
|
+
|
|
1220
|
+
```txt
|
|
1221
|
+
docs/features/<feature>/scenarios.feature
|
|
1222
|
+
```
|
|
1223
|
+
|
|
1224
|
+
ATDD belongs in:
|
|
1225
|
+
|
|
1226
|
+
```txt
|
|
1227
|
+
docs/features/<feature>/acceptance.md
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
Do not scatter Given/When/Then scenarios across unrelated docs unless they are regression examples.
|
|
1231
|
+
|
|
1232
|
+
---
|
|
1233
|
+
|
|
1234
|
+
# 12. Documentation update rules
|
|
1235
|
+
|
|
1236
|
+
Update docs only when:
|
|
1237
|
+
|
|
1238
|
+
```txt
|
|
1239
|
+
behavior changed
|
|
1240
|
+
a decision changed
|
|
1241
|
+
a bug was fixed
|
|
1242
|
+
a performance solution was implemented
|
|
1243
|
+
a rule was learned
|
|
1244
|
+
a feature moved status
|
|
1245
|
+
a data/privacy behavior changed
|
|
1246
|
+
a release/rollback/migration risk changed
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
Do not update docs just to restate code.
|
|
1250
|
+
|
|
1251
|
+
Do not create empty placeholder docs unless they are needed as a source of truth for imminent work.
|
|
1252
|
+
|
|
1253
|
+
---
|
|
1254
|
+
|
|
1255
|
+
# 13. Output expectations when coding
|
|
1256
|
+
|
|
1257
|
+
When completing a coding task, report:
|
|
1258
|
+
|
|
1259
|
+
```txt
|
|
1260
|
+
What changed
|
|
1261
|
+
Which docs were read
|
|
1262
|
+
Which docs were updated
|
|
1263
|
+
Which tests were run
|
|
1264
|
+
Which acceptance criteria were satisfied
|
|
1265
|
+
Whether any fix note was added
|
|
1266
|
+
Whether any performance benchmark was added
|
|
1267
|
+
Any remaining open questions or blockers
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
If docs were not updated, explain why no documentation update was necessary.
|
|
1271
|
+
|
|
1272
|
+
If a relevant source-of-truth doc was missing, either create it or state that the task was completed with an explicit assumption.
|
|
1273
|
+
|
|
1274
|
+
---
|
|
1275
|
+
|
|
1276
|
+
# 14. Hard stops
|
|
1277
|
+
|
|
1278
|
+
Stop and surface the issue instead of guessing when:
|
|
1279
|
+
|
|
1280
|
+
```txt
|
|
1281
|
+
the feature has no acceptance criteria
|
|
1282
|
+
the task conflicts with user expectations
|
|
1283
|
+
the task conflicts with auth/scope matrix
|
|
1284
|
+
the task would bypass tenant/workspace isolation
|
|
1285
|
+
the task touches personal data but compliance docs are missing
|
|
1286
|
+
the task changes billing/security/OAuth/account deletion without a documented web-only or approval rule
|
|
1287
|
+
the task fixes performance but no benchmark can be captured
|
|
1288
|
+
the task depends on a blocked feature backlog item
|
|
1289
|
+
the task contradicts an accepted ADR
|
|
1290
|
+
```
|
|
1291
|
+
|
|
1292
|
+
When possible, document the blocker in the relevant backlog, acceptance, ADR, or fix note.
|
|
1293
|
+
|
|
1294
|
+
---
|
|
1295
|
+
|
|
1296
|
+
# 15. Final principle
|
|
1297
|
+
|
|
1298
|
+
The `/docs` folder exists to give coding agents the right context at the right moment.
|
|
1299
|
+
|
|
1300
|
+
Before coding:
|
|
1301
|
+
|
|
1302
|
+
```txt
|
|
1303
|
+
read the smallest relevant doc pack
|
|
1304
|
+
```
|
|
1305
|
+
|
|
1306
|
+
During coding:
|
|
1307
|
+
|
|
1308
|
+
```txt
|
|
1309
|
+
follow feature docs, architecture boundaries, auth rules, and acceptance criteria
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
After coding:
|
|
1313
|
+
|
|
1314
|
+
```txt
|
|
1315
|
+
update backlog, acceptance, tests, fix notes, performance notes, or decisions when relevant
|
|
1316
|
+
```
|
|
1317
|
+
|
|
1318
|
+
Before claiming done:
|
|
1319
|
+
|
|
1320
|
+
```txt
|
|
1321
|
+
check the definition of done
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
Do not turn documentation into a second codebase.
|
|
1325
|
+
|
|
1326
|
+
Keep it clean, current, linked, and operational.
|