opencode-skills-collection 4.1.2 → 4.1.4

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.

Potentially problematic release.


This version of opencode-skills-collection might be problematic. Click here for more details.

Files changed (99) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +31 -1
  2. package/bundled-skills/ai-agent-evaluation-benchmarking/SKILL.md +124 -0
  3. package/bundled-skills/ai-agent-tool-routing/SKILL.md +136 -0
  4. package/bundled-skills/ai-code-generation-guardrails/SKILL.md +142 -0
  5. package/bundled-skills/ai-prompt-regression-testing/SKILL.md +130 -0
  6. package/bundled-skills/antigravity-maintainer-batch-release/SKILL.md +26 -8
  7. package/bundled-skills/cline-pilot/README.md +138 -0
  8. package/bundled-skills/cline-pilot/SKILL.md +301 -0
  9. package/bundled-skills/cline-pilot/assets/global-memory-bank-prompt.en.md +66 -0
  10. package/bundled-skills/cline-pilot/assets/global-memory-bank-prompt.md +56 -0
  11. package/bundled-skills/cline-pilot/references/cold-start.md +58 -0
  12. package/bundled-skills/cline-pilot/references/decision-log.example.md +9 -0
  13. package/bundled-skills/cline-pilot/references/local-config.example.md +26 -0
  14. package/bundled-skills/cline-pilot/references/project-profiles.example.md +10 -0
  15. package/bundled-skills/cline-pilot/scripts/session_report.py +151 -0
  16. package/bundled-skills/cross-chain-relayer-audit/SKILL.md +136 -0
  17. package/bundled-skills/deep-research-framework/SKILL.md +81 -0
  18. package/bundled-skills/defi-yield-strategy-allocator/SKILL.md +124 -0
  19. package/bundled-skills/dropthehassle-publish/SKILL.md +151 -0
  20. package/bundled-skills/five-axis-code-review/SKILL.md +78 -0
  21. package/bundled-skills/git-commit-message/SKILL.md +76 -0
  22. package/bundled-skills/idea-to-blueprint/LICENSE +21 -0
  23. package/bundled-skills/idea-to-blueprint/SKILL.md +260 -0
  24. package/bundled-skills/idea-to-blueprint/assets/AGENTS.md.template +38 -0
  25. package/bundled-skills/idea-to-blueprint/assets/CLAUDE.md.template +38 -0
  26. package/bundled-skills/idea-to-blueprint/assets/DECISIONS.md.template +14 -0
  27. package/bundled-skills/idea-to-blueprint/assets/PROGRESS.md.template +47 -0
  28. package/bundled-skills/idea-to-blueprint/assets/session-prompt.md +23 -0
  29. package/bundled-skills/idea-to-blueprint/references/architecture-decisions.md +202 -0
  30. package/bundled-skills/idea-to-blueprint/references/blueprint-template.md +259 -0
  31. package/bundled-skills/idea-to-blueprint/references/code-quality-and-review.md +216 -0
  32. package/bundled-skills/idea-to-blueprint/references/design-minimal.md +96 -0
  33. package/bundled-skills/idea-to-blueprint/references/edge-case-catalog.md +239 -0
  34. package/bundled-skills/idea-to-blueprint/references/intake-questions.md +105 -0
  35. package/bundled-skills/idea-to-blueprint/references/research-protocol.md +196 -0
  36. package/bundled-skills/idea-to-blueprint/references/session-protocol.md +133 -0
  37. package/bundled-skills/idea-to-blueprint/references/stories-ac-tests.md +194 -0
  38. package/bundled-skills/idea-to-blueprint/references/ux-writing-guide.md +128 -0
  39. package/bundled-skills/idea-to-blueprint/scripts/lint_blueprint.py +460 -0
  40. package/bundled-skills/liuguang-banlan-ui/SKILL.md +22 -18
  41. package/bundled-skills/liuguang-banlan-ui/assets/starter/launcher.css +2 -2
  42. package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/index.html +5 -4
  43. package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/theme-config.js +3 -10
  44. package/bundled-skills/liuguang-banlan-ui/assets/starter/obsidian/theme.css +48 -62
  45. package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/index.html +5 -4
  46. package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/theme-config.js +27 -35
  47. package/bundled-skills/liuguang-banlan-ui/assets/starter/opal/theme.css +48 -62
  48. package/bundled-skills/liuguang-banlan-ui/assets/starter/shared/spectral-field.js +135 -148
  49. package/bundled-skills/liuguang-banlan-ui/references/style-contract.md +26 -7
  50. package/bundled-skills/liuguang-banlan-ui/references/verification.md +19 -7
  51. package/bundled-skills/liuguang-banlan-ui/scripts/measure_preview.py +78 -47
  52. package/bundled-skills/liuguang-banlan-ui/scripts/serve_preview.py +35 -0
  53. package/bundled-skills/liuguang-banlan-ui/scripts/validate_manifest.py +34 -3
  54. package/bundled-skills/liuguang-banlan-ui/tests/test_measure_preview.py +119 -0
  55. package/bundled-skills/liuguang-banlan-ui/tests/test_serve_preview.py +38 -0
  56. package/bundled-skills/liuguang-banlan-ui/tests/test_validate_manifest.py +73 -0
  57. package/bundled-skills/loki-mode/examples/todo-app-generated/frontend/package-lock.json +12 -12
  58. package/bundled-skills/loki-mode/examples/todo-app-generated/frontend/package.json +1 -1
  59. package/bundled-skills/meeting-notes/SKILL.md +80 -0
  60. package/bundled-skills/repo-foundation/SKILL.md +166 -0
  61. package/bundled-skills/repo-foundation/references/LICENSE.md +21 -0
  62. package/bundled-skills/repo-foundation/references/bootstrap.md +63 -0
  63. package/bundled-skills/repo-foundation/references/companion.md +9 -0
  64. package/bundled-skills/repo-foundation/references/continuity.md +50 -0
  65. package/bundled-skills/repo-foundation/references/evolution.md +60 -0
  66. package/bundled-skills/repo-foundation/references/migration-examples.md +53 -0
  67. package/bundled-skills/repo-foundation/references/shared-contracts.md +48 -0
  68. package/bundled-skills/repo-foundation/references/verification.md +50 -0
  69. package/bundled-skills/repo-native-refactor/SKILL.md +225 -0
  70. package/bundled-skills/repo-native-refactor/references/LICENSE.md +21 -0
  71. package/bundled-skills/repo-native-refactor/references/deterministic-tooling.md +101 -0
  72. package/bundled-skills/repo-native-refactor/references/error-reliability.md +117 -0
  73. package/bundled-skills/repo-native-refactor/references/finding-taxonomy.md +181 -0
  74. package/bundled-skills/repo-native-refactor/references/refactor-examples.md +77 -0
  75. package/bundled-skills/repo-native-refactor/references/repository-prose.md +157 -0
  76. package/bundled-skills/repo-native-refactor/references/repository-rehabilitation.md +94 -0
  77. package/bundled-skills/repo-native-refactor/references/semantic-risk.md +187 -0
  78. package/bundled-skills/repo-native-refactor/references/shared-contracts.md +48 -0
  79. package/bundled-skills/repo-native-refactor/references/testing-integrity.md +103 -0
  80. package/bundled-skills/smart-contract-formal-verification/SKILL.md +136 -0
  81. package/bundled-skills/smart-contract-upgrade-governance/SKILL.md +130 -0
  82. package/bundled-skills/soroban-contract-audit/SKILL.md +136 -0
  83. package/bundled-skills/soroban-liquidity-pool/SKILL.md +118 -0
  84. package/bundled-skills/soroban-oracle-data-feed-audit/SKILL.md +118 -0
  85. package/bundled-skills/soroban-storage-ttl-lifecycle/SKILL.md +118 -0
  86. package/bundled-skills/soroban-token-minter/SKILL.md +124 -0
  87. package/bundled-skills/stellar-anchor-integration/SKILL.md +136 -0
  88. package/bundled-skills/stellar-asset-clawback-compliance/SKILL.md +118 -0
  89. package/bundled-skills/stellar-escrow-timelock/SKILL.md +118 -0
  90. package/bundled-skills/stellar-multisig-threshold-coordinator/SKILL.md +112 -0
  91. package/bundled-skills/tech-writing-proofread/SKILL.md +78 -0
  92. package/bundled-skills/typescript-expert/scripts/ts_diagnostic.py +40 -19
  93. package/bundled-skills/waf-setup/SKILL.md +1 -1
  94. package/bundled-skills/web3-rate-limiting-circuit-breaker/SKILL.md +130 -0
  95. package/bundled-skills/web3-transaction-relayer-pool/SKILL.md +124 -0
  96. package/bundled-skills/youtube-summarizer/SKILL.md +3 -3
  97. package/bundled-skills/zk-proof-verification-pipeline/SKILL.md +124 -0
  98. package/package.json +1 -1
  99. package/skills_index.json +1059 -0
@@ -0,0 +1,38 @@
1
+ # {{PRODUCT_NAME}} — agent instructions
2
+
3
+ You are building this product one epic per fresh session. Nothing is remembered between sessions; the repo is the memory.
4
+
5
+ ## Read in this order, every session
6
+ 1. `docs/PROGRESS.md` — where we are, evidence, deviations, preconditions
7
+ 2. `docs/BLUEPRINT.md` — sections 12–16 (architecture, stack, conventions, quality, edge cases, delivery plan), 18 (session protocol), 21 (glossary), and the epic you were asked to build in section 17 plus every flow/screen/copy ID it references
8
+ 3. `docs/DECISIONS.md` — why things are the way they are
9
+ 4. `docs/REVIEW-CHECKLIST.md` — the standard every story is reviewed against before it is DONE
10
+
11
+ ## Rules
12
+ - Follow `docs/BLUEPRINT.md` §18 (session protocol) exactly: orient → verify preconditions → plan → build story by story with tests first → verify gates → update PROGRESS/DECISIONS → print handoff.
13
+ - Quality gate: `{{CHECK_COMMAND}}` must be green before every commit and at handoff. It runs format, lint, typecheck, tests and the architecture fitness functions; it must exit non-zero on any failure. **Never weaken, skip or bypass a gate rule to make a change pass** — if it must change, that is a DR entry plus a follow-up story.
14
+ - Self-review before handoff: walk the review checklist in `docs/REVIEW-CHECKLIST.md` (BLUEPRINT §14.4) over your own diff, story by story, reading the diff rather than your memory of writing it. Fix what fails. Report `reviewed: n items, n fixed, n accepted with reason` in the handoff — never a bare tick.
15
+ - Search the repo for an existing implementation before writing a new helper, mapper or utility. Duplicated logic is the most common defect in agent-written code, and you cannot see what you did not read.
16
+ - Every external symbol you use must trace to a pinned dependency in BLUEPRINT §13.1. If you are not certain a function, parameter or config key exists in the pinned version, check the docs — do not write it from memory.
17
+ - Tests assert concrete expected values and observable behaviour, never internal call sequences. A test that only checks a type, a length or that nothing threw is not a test. Each one must be seen failing before the implementation.
18
+ - Keep each story's diff within {{DIFF_LIMIT_LINES}} changed lines. If it will not fit, say so in the plan — the story is mis-sized and needs an amendment, not a bigger diff.
19
+ - Copy strings come from the copy tables (`CP-*` IDs) in the blueprint. Never improvise user-facing text.
20
+ - Acceptance criteria are the spec. If an AC is wrong, impossible or ambiguous: do not silently deviate — record an Amendment (BLUEPRINT §18) and, for user-visible/money/data/security changes, ask first.
21
+ - Anything not in the blueprint or PROGRESS.md is a decision → `docs/DECISIONS.md` (DR-nn) in the same commit. New dependency = DR entry.
22
+ - Stay inside the epic's scope. Ideas for later go to PROGRESS.md "Parking lot".
23
+ - Re-check every `[VERIFY-AT-BUILD]` item your epic depends on before relying on it; record the result.
24
+ - Commit format: `type(scope): message [E03-S02]`. Branch: `epic/E03` (or trunk if the blueprint says so).
25
+ - Never mark a story or epic DONE without an evidence line per AC in PROGRESS.md.
26
+
27
+ ## Commands
28
+ - Quality gate: `{{CHECK_COMMAND}}`
29
+ - Tests only: `{{TEST_COMMAND}}`
30
+ - Dev server: `{{DEV_COMMAND}}`
31
+ - Migrate: `{{MIGRATE_COMMAND}}`
32
+ - Deploy staging: `{{DEPLOY_STAGING_COMMAND}}` (see BLUEPRINT §13.8)
33
+
34
+ ## Conventions (summary — full text in BLUEPRINT §13)
35
+ - Language/runtime: {{RUNTIME_AND_VERSION}} · Framework: {{FRAMEWORK_AND_VERSION}} · DB: {{DB_AND_VERSION}}
36
+ - Strict typing on; no untyped escapes; typed errors; no swallowed exceptions; structured logs without PII.
37
+ - Tests: unit next to code / integration in `{{INTEGRATION_TEST_DIR}}` / e2e in `{{E2E_DIR}}`; factories in `{{FACTORIES_DIR}}`.
38
+ - Locale: {{LOCALE_RULES_ONE_LINE, e.g. "RTL, Persian digits in UI, Jalali dates in UI, UTC in storage, Toman with unit label"}}
@@ -0,0 +1,14 @@
1
+ # DECISIONS — {{PRODUCT_NAME}}
2
+
3
+ > One entry per decision, newest last. Blueprint decision records are copied here in E00 so this is the single place to look.
4
+ > Format: context → options → decision → consequences. Keep each under 15 lines.
5
+
6
+ ## DR-01 — {{Title, e.g. "Stack: <language/framework>"}}
7
+ - Date: {{YYYY-MM-DD}} · Epic: E00 · Source: BLUEPRINT §4 / §13
8
+ - Context:
9
+ - Options considered:
10
+ - Decision:
11
+ - Consequences / follow-ups:
12
+ - Evidence: [VERIFIED — S-nn, date]
13
+
14
+ ## DR-02 —
@@ -0,0 +1,47 @@
1
+ # PROGRESS — {{PRODUCT_NAME}}
2
+
3
+ > State file, not a diary. The agent reads this first in every session and updates it before handoff.
4
+ > Source of truth for *what* to build: `docs/BLUEPRINT.md`. For *why*: `docs/DECISIONS.md`.
5
+
6
+ ## Current position
7
+ - Active epic: E00 — Foundation
8
+ - Last green `check` commit: (none yet)
9
+ - Staging URL: (set in E00)
10
+ - Blockers: none
11
+
12
+ ## Epic status
13
+ | Epic | Title | Status | Started | Done | Notes |
14
+ |---|---|---|---|---|---|
15
+ | E00 | Foundation | NOT STARTED | | | |
16
+ | E01 | {{EPIC_01_TITLE}} | NOT STARTED | | | |
17
+ <!-- one row per epic from BLUEPRINT §16. Status values: NOT STARTED · IN PROGRESS · DONE · BLOCKED -->
18
+
19
+ ## Story status and AC evidence
20
+ <!-- For each story: status + one evidence line per AC. Evidence = passing test name in `check`, or manual check with date and observation. -->
21
+ ### E00
22
+ - E00-S01 — NOT STARTED
23
+ - AC-1: —
24
+ - AC-2: —
25
+
26
+ ## VERIFY-AT-BUILD results
27
+ | Item | Needed by | Checked (date) | Result | Notes |
28
+ |---|---|---|---|---|
29
+ | {{e.g. INT-sms sandbox reachable}} | E02 | | | |
30
+
31
+ ## Deviations and amendments
32
+ | # | Date | Epic/Story | What changed | Why | Amendment ID (BLUEPRINT §18) |
33
+ |---|---|---|---|---|---|
34
+
35
+ ## Accepted risks (skipped edge cases / tests) — each needs an owner and a revisit trigger
36
+ | # | Story | Edge case / test | Reason | Owner | Revisit when |
37
+ |---|---|---|---|---|---|
38
+
39
+ ## Parking lot (ideas out of scope — do NOT build)
40
+ -
41
+
42
+ ## Preconditions for the next epic
43
+ - (filled by the agent at handoff: env vars, accounts, credentials, manual steps the user must do)
44
+
45
+ ## Session log (one line per session)
46
+ | Date | Epic | Outcome | Final commit |
47
+ |---|---|---|---|
@@ -0,0 +1,23 @@
1
+ # Session prompt template (one per epic — Appendix A of the blueprint)
2
+
3
+ Fill the placeholders per epic and paste as the FIRST message of a fresh Claude Code / Codex session opened in the repo root.
4
+
5
+ ---
6
+
7
+ You are starting **Epic {{EPIC_ID}} — {{EPIC_TITLE}}** of {{PRODUCT_NAME}}. This is a fresh session: you remember nothing from previous sessions. The repo is the memory.
8
+
9
+ Read, in order: `AGENTS.md` (or `CLAUDE.md`), `docs/PROGRESS.md` (all of it), then `docs/BLUEPRINT.md` sections 12, 13, 14, 15, 16, 18, 21 and **Epic {{EPIC_ID}}** in section 17, plus every flow (F-*), screen (SCR-*), copy (CP-*), entity (ENT-*), API (API-*), integration (INT-*) and edge case (EC-*) ID that epic references, and `docs/REVIEW-CHECKLIST.md`.
10
+
11
+ Then follow the session protocol in BLUEPRINT §18 exactly:
12
+
13
+ 1. **Orient** — confirm preconditions: previous epics DONE in PROGRESS.md; clean `git status` on main; `{{CHECK_COMMAND}}` green; required env vars present; every `[VERIFY-AT-BUILD]` item this epic depends on re-checked and recorded. If anything fails, stop and report — do not build.
14
+ 2. **Plan** — restate the goal and stories in ≤ 15 lines; list the tests you will write per story and the tasks; flag any AC that is ambiguous or references a missing ID (treat as a blueprint defect, do not guess). {{APPROVAL_MODE: "Wait for my 'go' before building." | "Do not wait — plan, then build without stopping unless a precondition fails or an amendment needs my approval."}}
15
+ 3. **Build** — story by story in order: tests first (they must fail), implement, keep `{{CHECK_COMMAND}}` green, copy only from CP-* IDs, one commit per story with `[E{{EPIC_ID}}-Snn]` in the message, PROGRESS.md evidence line per AC, DR-nn in DECISIONS.md for every decision the blueprint does not make.
16
+ 4. **Verify** — full `check`, epic-level flow tests, regression of all previous epics, CI green, staging deploy + smoke if the DoD requires it. Then **self-review**: walk `docs/REVIEW-CHECKLIST.md` (BLUEPRINT §14.4) over the epic's diff, story by story, reading the diff rather than recalling what you wrote — check correctness against each AC, module boundaries, failure paths, test meaning (would a test fail if the logic were wrong?), authorization per object, behaviour at 100x data, observability, copy IDs, and diff size. Fix what fails; do not batch it. Walk the epic's Definition of Done line by line with evidence.
17
+ 5. **Handoff** — update PROGRESS.md (status, evidence, deviations, accepted risks, VERIFY-AT-BUILD results, next epic preconditions, session log line), DECISIONS.md, and the Amendments log if anything changed; final commit; then print the ≤ 20-line handoff summary from BLUEPRINT §18 and tell me it is safe to terminate.
18
+
19
+ Rules that override everything: never mark DONE without evidence; never improvise user-facing text; never silently change an AC; never touch scope outside this epic; never weaken the quality gate to get to green; never use an API you have not verified exists in the pinned version; when in doubt, record and ask.
20
+
21
+ ---
22
+
23
+ Notes for the human: set the model to the strongest available and the effort/thinking level to maximum if the tool exposes it. Terminate the session after the handoff summary, then open a new one for the next epic.
@@ -0,0 +1,202 @@
1
+ # Architecture and technology decisions
2
+
3
+ Contents: 1 Why this is a separate track · 2 Step 1 drivers · 3 Step 2 candidate styles · 4 Step 3 the default and its exit triggers · 5 Step 4 boundaries · 6 Step 5 fitness functions · 7 Step 6 the cross-cutting decision list · 8 Step 7 technology selection · 9 Decision record format · 10 What to research and cite · 11 Anti-patterns · 12 Output into the blueprint
4
+
5
+ ## 1. Why this is a separate track
6
+
7
+ A stack table answers "what will we use". It does not answer the two questions a fresh build session actually needs: **what shape is this system** and **why is it that shape rather than the obvious alternative**. Without the second answer, the first agent that hits friction re-decides — and now the codebase has two architectures.
8
+
9
+ Architecture here means the decisions that are expensive to reverse: the module boundaries, what talks to what and how, where state lives, how the system fails. Everything else is code, and code is cheap. So the ordering rule for the whole track is: **derive the drivers from the product, choose the shape from the drivers, choose the technology from the shape** — never the reverse. Picking a framework first and reverse-engineering a justification is the most common way a blueprint goes wrong, and it is invisible in the finished document unless you look for it.
10
+
11
+ ## 2. Step 1 — Derive the architecture drivers
12
+
13
+ Before naming any technology, write the drivers: the quality attributes that this specific product must have, ranked, each with a *measurable* target. Vague drivers ("scalable", "secure", "fast") produce vague architectures.
14
+
15
+ Derive them from what you already know, not from a generic list:
16
+
17
+ | Source | Yields |
18
+ |---|---|
19
+ | Personas' context (device, network, patience) | latency and offline targets, payload budgets |
20
+ | Scale ceiling of v1 (stated in Scope, in numbers) | concurrency, data volume, throughput targets |
21
+ | The core loop and its failure cost | availability target, consistency requirements, recovery time |
22
+ | Money, identity, health, minors, personal data in scope | security and auditability requirements, data-residency questions |
23
+ | Market and hosting reality | deployability constraints, dependency on reachable services |
24
+ | Team shape (solo + agents, or a real team) | operability ceiling — how much system one person can run at 3am |
25
+ | Regulatory flags from research | audit trail, retention, consent, export/delete |
26
+ | The business's likely next 12 months | which axes must stay open (new channel, new market, new tenant model) |
27
+
28
+ Write 5–8 drivers, ranked, in this form:
29
+
30
+ ```
31
+ AD-1 Operability by one maintainer — target: full local run with one command; one deploy unit; any
32
+ production issue diagnosable from logs + error tracking without attaching a debugger. Rank 1
33
+ because [solo builder with agent sessions; nobody is on call].
34
+ AD-2 Correctness of money handling — target: no partial writes; every payment state transition
35
+ idempotent and auditable; reconciliation possible from stored events alone.
36
+ AD-3 p95 under 400 ms on the core read path at [stated ceiling] rows, on mid-range Android over 3G.
37
+ ...
38
+ ```
39
+
40
+ Then state the **explicit non-drivers** — the attributes you are deliberately not optimising for, each with a reason. "Not multi-region. Not sub-100ms. Not 1000 concurrent writers. Not multi-tenant." This is what keeps the architecture from growing to meet imaginary requirements, and it is the section future sessions will thank you for.
41
+
42
+ Ranked drivers with targets and named non-drivers are the contract the rest of this track is scored against.
43
+
44
+ ## 3. Step 2 — Candidate architecture styles
45
+
46
+ List 2–3 realistic candidates for the shape of the system and score them against the ranked drivers. Realistic means: appropriate to the scale ceiling and buildable by the team that exists. Candidates typically come from — modular monolith; layered monolith; monolith plus a small number of extracted workers; serverless functions; service-oriented split; client-heavy with a thin backend (BaaS); bot/worker plus queue; CLI/local-first with sync.
47
+
48
+ Score explicitly:
49
+
50
+ ```
51
+ | Driver (rank) | Modular monolith | Monolith + worker | Services |
52
+ |---|---|---|---|
53
+ | AD-1 operability (1) | 3 | 3 | 1 |
54
+ | AD-2 correctness (2) | 3 | 3 | 1 — needs sagas |
55
+ | ... | | | |
56
+ | Total (weighted) | 27 | 25 | 14 |
57
+ ```
58
+
59
+ Then write the decision as a DR, including what the loser would have bought you and at what price. A candidate that scores lower can still be chosen if a driver demands it — say so explicitly rather than letting the table decide silently.
60
+
61
+ ## 4. Step 3 — The default, and the triggers that would change it
62
+
63
+ For nearly everything this skill produces — a v1 built by an agent, one deploy target, a scale ceiling in the thousands not millions — the answer is a **modular monolith**: one deployable unit, strict internal module boundaries, one database, one `check`, one deploy. The current industry discussion has converged on this as the sane starting point, with distributed architectures justified by *organisational* scale far more often than by traffic, and a visible movement of teams consolidating back after paying for complexity they did not need. Verify the current state of that discussion rather than asserting it.
64
+
65
+ The reason it is the default here is narrower than the general argument: a fresh-session agent is far more reliable inside one repo with one command and local function calls than across a distributed system where a failure could be in any of four places and the reproduction requires orchestration.
66
+
67
+ But "default" is not "always", and a blueprint that says only "we chose a modular monolith" has not done the work. Write the **exit triggers**: the specific, observable conditions under which this decision should be revisited, so a future session knows whether it is allowed to change the shape.
68
+
69
+ ```
70
+ This decision holds until one of:
71
+ - a module needs independent scaling with a measured >5x load difference on the core path
72
+ - a module needs a different runtime/language for a capability the main stack cannot provide
73
+ - more than [n] people work on the codebase and merge contention is measured, not felt
74
+ - an availability requirement appears that one deploy unit cannot meet
75
+ Until then, extraction is out of scope, and the module boundaries in §5 are what make extraction
76
+ cheap if it ever becomes necessary.
77
+ ```
78
+
79
+ The corollary: because extraction is not planned, boundaries are enforced *now* (§5, §6). A modular monolith without enforced boundaries is just a monolith, and it degrades into one within a few sessions.
80
+
81
+ ## 5. Step 4 — Module boundaries
82
+
83
+ This is the part that most affects what an agent produces, because it decides where new code goes. Specify:
84
+
85
+ 1. **The modules**, each with: the business capability it owns, the entities it owns, its public interface (the functions/types other modules may call), and one sentence on what it must never know about.
86
+ 2. **The dependency rule**, stated as a direction, e.g. "feature modules may depend on `core` and `shared`; `core` depends on nothing internal; no feature module imports another feature module's internals — only its public interface"; and where the composition happens.
87
+ 3. **Data ownership** — one module owns each table; cross-module reads go through the owner's interface, not through a join into someone else's tables. Where that rule is relaxed (reporting, admin), say so explicitly.
88
+ 4. **The seams that matter later** — which boundaries are the plausible extraction points, and what makes them cheap (no shared transaction, no direct table access, an interface that could become an HTTP call).
89
+ 5. **Where new code goes by default**, in one sentence per common case, so an agent does not have to decide: "a new endpoint goes in the feature module that owns the entity; a helper used by two features goes in `shared` only after the second use, never on the first."
90
+
91
+ Derive the modules from the domain (bounded contexts from the research and flows), not from technical layers. Modules named `controllers`, `services`, `utils` are layers, and they let anything depend on anything.
92
+
93
+ ## 6. Step 5 — Fitness functions
94
+
95
+ A decision written down and never enforced is documentation, and it decays. For each architectural rule that can be checked mechanically, specify the automated check that enforces it — an architecture test in `check`, failing CI when violated. This is what makes the boundary real across many sessions.
96
+
97
+ Typical set:
98
+
99
+ - Dependency direction: no import from `core` into a feature module; no feature-to-feature internal imports.
100
+ - Layer rules: no database access outside the data layer of the owning module; no HTTP framework types in domain code.
101
+ - Public interface: only the module's index/public file is importable from outside.
102
+ - Entity ownership: no query against a table your module does not own.
103
+ - Contract: API responses match the OpenAPI/schema file; a breaking change without a version bump fails.
104
+ - Whatever else the DRs decided: "every state change emits an event", "no synchronous call to a third party inside a request handler".
105
+
106
+ Name the library or technique per language and verify it exists and is maintained (§10). Where no tool exists, write the rule as a test using the language's own module system, or as a lint rule with an explicit path pattern, and say which.
107
+
108
+ Every ADR that can be enforced carries a **Compliance** line saying how — this is the practice from Richards & Ford's addition to Nygard's original format, and it is the difference between an architecture and a wish.
109
+
110
+ ## 7. Step 6 — The cross-cutting decisions list
111
+
112
+ Walk this list explicitly. Each item is either a DR or one line saying "not applicable, because…". Silence on any of them is a decision the first agent will make for you, differently each time.
113
+
114
+ **Data** — relational vs other, and why; the ownership model; identifiers (sequential vs UUID/ULID, and whether IDs are exposed); soft delete vs hard delete and the audit trail; timestamps and time zone storage rule; money representation (integer minor units, never floats) and currency; migration policy (forward-only, reviewed, reversible how); seed and fixture strategy; retention and deletion (a real requirement when personal data is in scope).
115
+
116
+ **Time and correctness** — synchronous vs queued work and where the boundary is; idempotency strategy for anything externally triggered (payment callbacks, webhooks, retries) and the key it uses; transaction boundaries; what is allowed to be eventually consistent and what is not; concurrency control (optimistic version column vs locking) on contended records; scheduled jobs and how a missed run is handled.
117
+
118
+ **Interfaces** — API style and the contract file as source of truth; versioning policy and what counts as breaking; error shape (a single documented error envelope with codes, not ad-hoc strings); pagination convention; validation location; whether the client is thin or holds state.
119
+
120
+ **Identity and access** — authentication mechanism and session/token lifetime, refresh, and revocation; the role × permission matrix; the object-level authorization rule; how the admin surface is separated; how a session ends everywhere.
121
+
122
+ **Failure** — timeout, retry and backoff policy per external dependency; circuit-breaking or its explicit absence; what degrades vs what blocks; the fallback per integration; what is queued for later vs dropped; how a partial failure of a multi-step operation is recovered.
123
+
124
+ **Operations** — environments and how they differ; configuration and secret loading with fail-fast validation at startup; logging format and levels and the PII redaction rule; metrics and health endpoints; error tracking; backup and restore (including a stated, tested restore procedure — an untested backup is not a backup); deploy and rollback steps; where state lives that is not in the database (uploads, caches) and its durability.
125
+
126
+ **Frontend, when there is one** — rendering strategy (server-rendered / SPA / hybrid) and why, tied to the personas' devices and network; state management approach; data fetching and caching; form/validation approach shared with the backend contract; asset and font loading (a real decision when a locale needs a specific font and a CDN may be unreachable); offline behaviour.
127
+
128
+ ## 8. Step 7 — Technology selection, and how to justify it
129
+
130
+ Only now name technologies. Each choice is scored against the criteria in `research-protocol.md` §6 (weighted for a coding agent as the primary author) **plus** the architecture drivers from §2 — a stack that scores well generically but cannot meet AD-2 loses.
131
+
132
+ Every row of the stack table answers four things, and a row missing any of them is not finished:
133
+
134
+ 1. **What** — the exact package/runtime, with a pinned version, verified this session.
135
+ 2. **Why** — the *deciding* reason, tied to a driver or an agent criterion. Not "popular", not "modern". "Chosen for AD-1: single binary deploy, no runtime to manage" is a reason; "great developer experience" is not.
136
+ 3. **What lost, and what it would have bought** — the runner-up in one clause, and the thing you gave up. This is what stops a future session re-litigating it, and it is the honest part: every choice costs something.
137
+ 4. **Evidence** — `[VERIFIED — S-nn, date]` for the version, maintenance status, license, and any capability claim ("supports RTL", "has a maintained Jalali library", "sandbox available").
138
+
139
+ Also write, because they are the parts that actually prevent hallucination:
140
+
141
+ - **Forbidden choices** — packages and services explicitly not to use, with the reason (archived, unmaintained, license, unreachable from the target market, superseded API). An agent that knows what is banned is much safer than one that only knows what is blessed.
142
+ - **The dependency policy** — adding a package requires a DR entry; the bar for what justifies one; where the boundary is between "use a library" and "write 30 lines".
143
+ - **Version drift rule** — the pinned versions are what the blueprint was verified against; a session that finds a version has moved records it and re-verifies rather than silently upgrading.
144
+
145
+ ## 9. Decision record format
146
+
147
+ One record per decision, in the blueprint's section 4 for cross-cutting decisions and inline in section 12 for architectural ones. Short — a record nobody reads is worse than none. Based on the widely used Nygard/MADR shape plus the compliance line:
148
+
149
+ ```
150
+ ### DR-07 — Idempotency keys on all payment callbacks
151
+ **Status** Accepted — 2026-09-06 · Supersedes: none
152
+ **Drivers** AD-2 (correctness of money handling), AD-5 (recoverability)
153
+ **Context** The gateway may deliver a callback more than once and does not guarantee ordering
154
+ [VERIFIED — S-12, 2026-09-06]. Duplicate processing would double-credit an order.
155
+ **Options** (a) dedupe on gateway transaction ID at the DB level; (b) application-level lock;
156
+ (c) accept duplicates and reconcile nightly.
157
+ **Decision** (a). A unique constraint on `payment.gateway_txn_id` plus an upsert; the handler is
158
+ a pure function of the callback payload.
159
+ **Consequences** Callback handling becomes safe to retry, and replays are free. Cost: the gateway
160
+ transaction ID becomes part of our schema and a gateway change would require a migration.
161
+ Rejected (c) because reconciliation needs a human and this product has none.
162
+ **Compliance** Integration test `payments/callback_replay_test` sends the same callback 3x and
163
+ asserts one payment row and one ledger entry. Runs in `check`.
164
+ **Reversibility** Medium — one-way once production rows exist; migration path noted.
165
+ ```
166
+
167
+ Rules: one decision per record; IDs never reused; a superseded record stays in the document with its status changed and a pointer to the new one, because the record of *why we changed our mind* is often more valuable than the current answer.
168
+
169
+ ## 10. What to research and cite
170
+
171
+ Nothing in this file is a fact about the world; it is a procedure. The facts come from this session's searches, each tagged and logged:
172
+
173
+ 1. **Version, maintenance and license** of every component named — and whether the project is archived, in maintenance mode, or has a deprecation notice on the exact feature you plan to use. Read the page; snippets lie about archived projects.
174
+ 2. **Capability claims** — the specific one you are relying on, from the official docs: RTL support, the locale/calendar library, the driver for your database, the ORM's support for the relation shape your data model needs, the framework's support for the rendering strategy you chose.
175
+ 3. **Framework's recommended architecture** — the official "how to structure a project" guidance for the framework, because the blessed path is where the documentation and the agent's reliability are. Deviating from it is itself a DR.
176
+ 4. **Fitness-function tooling** for the language — a maintained architecture-testing library, or the lint mechanism that will stand in for one.
177
+ 5. **Hosting and runtime reality** — supported runtime versions on the chosen host, build and start commands, database and object-storage options, region reachability from the target market, and what the plan the user can actually buy includes.
178
+ 6. **The current state of the architecture-style discussion** if the blueprint asserts anything about it (the modular-monolith default in §4, service-decomposition thresholds, any "most teams" claim). Cite the year, or drop the claim.
179
+ 7. **Category-specific architectural requirements** — payments (callbacks, reconciliation, PCI-adjacent constraints), messaging platforms (bot API limits, webhook vs polling), mobile stores, anything with an audit requirement.
180
+
181
+ Where a claim cannot be verified, it is `[ASSUMED — reason]` or `[UNKNOWN → OQ-nn]` with a proposed default. Never an unmarked assertion — an unmarked wrong version number in a stack table produces an entire session of code against an API that does not exist.
182
+
183
+ ## 11. Anti-patterns to avoid in the document
184
+
185
+ - **Technology-first justification.** The stack chosen before the drivers, then rationalised. Detect it by asking whether any driver in §2 could have changed the answer; if not, the drivers are decoration.
186
+ - **Resume architecture.** Complexity that serves the builder's interest rather than the product's — a queue with one job, a cache with no measured hot path, services for a single-person team.
187
+ - **"Scalable" as a driver.** Unquantified, so unfalsifiable, so it justifies anything. Replace with numbers from the scale ceiling.
188
+ - **Boundaries with no enforcement.** Modules described in prose and violated in week two.
189
+ - **Deferred decisions.** "We'll decide the auth model when we get there" hands the decision to whichever agent gets there first. Decide, record reversibility, move on.
190
+ - **Both-options prose.** "We could use X or Y" is not a decision. If the choice genuinely depends on an unknown, it is an OQ with a proposed default, not an open sentence.
191
+ - **Copying a reference architecture wholesale** from a blog post for a system three orders of magnitude larger than this one.
192
+
193
+ ## 12. Output into the blueprint
194
+
195
+ - **Section 12.0** — Architecture drivers `AD-n` with targets and ranks, plus the explicit non-drivers.
196
+ - **Section 12.1** — Style decision: candidates, the scoring table, the decision, the exit triggers.
197
+ - **Section 12.2** — Module map, boundaries, dependency rule, data ownership, where-new-code-goes.
198
+ - **Section 12.3–12.9** — Component diagram, data model, API contracts, auth model, integrations, environments/config/secrets, observability, security baseline, performance budgets (as in the template).
199
+ - **Section 12.10** — Fitness functions: the rule, the check, where it runs.
200
+ - **Section 4.2 and inline** — DRs in the §9 format, each naming drivers, losers, consequences, compliance and reversibility.
201
+ - **Section 13** — The stack table where every row carries what/why/loser/evidence, plus forbidden choices and the dependency policy.
202
+ - **Epic 00** — Stories that create the module skeleton and the fitness functions, so the boundaries exist before there is any code to violate them.
@@ -0,0 +1,259 @@
1
+ # Blueprint template
2
+
3
+ Contents: 1 Conventions the linter relies on · 2 ID schemes · 3 Section skeleton with depth targets · 4 Table formats · 5 Writing order and chunking · 6 Self-review before lint
4
+
5
+ The blueprint is one markdown file. Sections are numbered and appear in this order; drop a section only when it plainly does not apply (a CLI tool has no copy table for SMS templates) and say so in one line where it would have been.
6
+
7
+ ## 1. Conventions the linter relies on
8
+
9
+ - Every top-level section heading contains its **English anchor** in parentheses when the prose language is not English: `## 5. پرسوناها (Personas)`. In English documents the heading itself is the anchor.
10
+ - Epic headings: `## Epic 03 — <Title>` (two-digit number, em dash). Epic 00 is always "Foundation".
11
+ - Story headings inside an epic: `### E03-S02 — <Title>`.
12
+ - Inside each story these bold labels appear, in this order: `**Story**`, `**Context**`, `**Scope**`, `**Acceptance Criteria**`, `**Edge cases**`, `**Tests**`, `**Tasks**`, `**Story DoD**`.
13
+ - Each epic ends with `**Definition of Done**` and `**Session handoff checklist**`.
14
+ - Evidence tags exactly as defined in `research-protocol.md` §2. Unknowns route to `OQ-nn` entries that exist in the Open Questions section.
15
+ - No placeholder text anywhere: no TODO, TBD, TBA, FIXME, XXX, "lorem", "???", "[insert", "to be defined". If something is undecided it is an `[UNKNOWN → OQ-nn]` with a proposed default.
16
+
17
+ ## 2. ID schemes
18
+
19
+ | Thing | Pattern | Example |
20
+ |---|---|---|
21
+ | Source | `S-nn` | S-14 |
22
+ | Persona | `P<n>` (anti-persona `AP<n>`) | P2, AP1 |
23
+ | Goal / metric | `G<n>` / `M<n>` | G3, M3.1 |
24
+ | Flow | `F-nn` | F-03 |
25
+ | Screen / surface | `SCR-nn` (never `S-nn`, which is a source) | SCR-07 |
26
+ | Copy line | `CP-<screen>-<n>` | CP-SCR07-3 |
27
+ | Entity | `ENT-<Name>` | ENT-Order |
28
+ | API endpoint | `API-nn` | API-12 |
29
+ | Integration | `INT-<name>` | INT-payments |
30
+ | Edge case (global register) | `EC-<cat>-nn` | EC-PAY-04 |
31
+ | Epic | `E<nn>` | E03 |
32
+ | Story | `E<nn>-S<nn>` | E03-S02 |
33
+ | Acceptance criterion | `AC-<n>` (scoped to the story) | E03-S02 AC-4 |
34
+ | Task | `E<nn>-S<nn>-T<n>` | E03-S02-T3 |
35
+ | Test | `T-<story>-<n>` or the real test name once written | T-E03S02-2 |
36
+ | Open question | `OQ-nn` | OQ-07 |
37
+ | Decision record | `DR-nn` | DR-05 |
38
+ | Risk | `R-nn` | R-03 |
39
+
40
+ IDs never change once assigned; if a story is dropped, its ID is retired with a one-line note, not reused.
41
+
42
+ ## 3. Section skeleton with depth targets
43
+
44
+ "Depth" is a floor, not a ceiling. Page estimates assume a whole product.
45
+
46
+ ### 0. Cover and how to use this document (How to use) — 1 page
47
+ Title, version, date, author, target agents (Claude Code / Codex), model/effort used for research. Then:
48
+ - Who reads what: humans read 1–7, 19–21; build sessions read 12–18 plus the epic in play; both read the Glossary.
49
+ - The language convention (prose vs machine text vs product copy).
50
+ - The evidence legend (all five tags).
51
+ - Status of this document: DRAFT / APPROVED, and the rule that changes go through the Amendments log (section 18).
52
+ - Table of contents.
53
+
54
+ ### 1. Executive summary (Executive summary) — ½–1 page
55
+ What it is, for whom, the outcome sentence, how it is delivered (platform), what makes it different (from positioning), what v1 includes, what it excludes, and the build plan in one line ("13 epics, ~13 sessions, first releasable milestone after E05").
56
+
57
+ ### 2. Idea interpretation and scope (Scope) — 1–2 pages
58
+ The user's idea as written (quoted verbatim in their language, short). Your interpretation. In-scope capabilities for v1 (bulleted, each tied to a persona and later to epics). Explicitly out of scope with reason (Non-goals live here). Scale ceiling of v1 stated in numbers.
59
+
60
+ ### 3. Research findings (Research) — 4–10 pages
61
+ 3.1 Domain overview and how the job is done today. 3.2 Benchmark: feature matrix, per-competitor cards, best-in-class per flow table, anti-patterns to avoid. 3.3 Gap and positioning statement. 3.4 Regulatory and platform-policy flags (as OQ pointers). 3.5 UX benchmark observations. Every row and claim carries an evidence tag.
62
+
63
+ ### 4. Assumptions and decision records (Assumptions & Decisions) — 1–3 pages
64
+ 4.1 Assumptions table: `# | Assumption | Why | Impact if wrong`. 4.2 Decision records `DR-nn` in the format from `architecture-decisions.md` §9: status, drivers served, context, options, decision, consequences (including what the rejected option would have bought), **compliance** (the automated check that enforces it, or "manual — reviewed against checklist item X"), and **reversibility** (one-way / medium / cheap). One record per decision, short. Covers stack, architecture style, auth model, data model shape, design system, currency, calendar, hosting. A superseded record stays in the document with its status changed and a pointer forward — why the team changed its mind is often worth more than the current answer.
65
+
66
+ ### 5. Personas (Personas) — 2–5 pages
67
+ For each `P<n>` (3–5 typical): name and one-line role; context (where/when/on what device/network they use it); goals and the outcome they want; jobs-to-be-done; current pains and workarounds; tech comfort and reading tolerance; language, register and formality expectation (drives copy voice); accessibility considerations; trust concerns; key scenarios (2–4 short narratives that later map to flows); success looks like (what they say when it works). Anti-personas `AP<n>`: who we do not design for and why. End with a persona × capability matrix (which persona needs what).
68
+
69
+ ### 6. Goals, non-goals and success metrics (Goals & Metrics) — 1–2 pages
70
+ Goals `G<n>` as measurable outcomes tied to personas. Metrics `M<n.m>`: leading and lagging, definition, measurement method (event, query, survey), target with `[ASSUMED]` when hypothetical, and which epic instruments it. Non-goals with a one-clause reason each.
71
+
72
+ ### 7. User flows (Flows) — 3–8 pages
73
+ See `design-minimal.md` §3 for the format. One `F-nn` per core job, per persona where they differ. Each flow: trigger, preconditions, numbered steps (screen, user action, system response, copy IDs), decision points, failure branches with recovery, exit, metric. Include first-run, core loop, payment (if any), recovery/re-authentication, admin flows, and account deletion.
74
+
75
+ ### 8. Information architecture and screen inventory (Screens) — 3–8 pages
76
+ Navigation model; screen table `SCR-nn | purpose | personas | entry points | components | states (empty/loading/error/success/offline) | copy IDs | edge cases`. A one-paragraph description per screen of what is on it and what the single primary action is.
77
+
78
+ ### 9. Design direction (Design) — 2–4 pages
79
+ Reference-based or chosen (say which, with reason). Design tokens (colour, type scale with Persian/Latin font stacks, spacing, radius, breakpoints), component list from the chosen system with the RTL notes, iconography direction, motion policy, dark-mode decision, accessibility baseline (standard and level, verified), do/don't list of patterns for this product (from `design-minimal.md` §2).
80
+
81
+ ### 10. UX writing guide (UX Writing) — 2–3 pages
82
+ Voice, tone matrix per persona and moment, terminology rules and the product glossary of UI terms (Persian ↔ English), formatting rules (numbers, dates, currency, phone), Persian pack rules when applicable, message formulas (error, empty, success, confirmation, loading, notification). See `ux-writing-guide.md`.
83
+
84
+ ### 11. Copy tables (Copy) — 5–20 pages
85
+ One table per screen and one per message channel (SMS, email, push, in-app notification, bot messages): `CP-id | element | copy (product language) | English gloss | persona intent | state/variant | max length | notes`. Every state of every screen in the inventory has a line. Error variants are enumerated, not "error message".
86
+
87
+ ### 12. Architecture (Architecture) — 6–12 pages
88
+ Full procedure in `architecture-decisions.md`. Order matters: drivers, then shape, then technology — never the reverse.
89
+
90
+ 12.0 **Architecture drivers** `AD-n`: 5–8 quality attributes ranked, each with a measurable target and the reason for its rank, derived from personas, the scale ceiling, the failure cost of the core loop, regulatory flags and hosting reality. Then the **explicit non-drivers** with a reason each.
91
+ 12.1 **Architecture style decision**: 2–3 candidates scored against the ranked drivers (scoring table), the decision, what the runner-up would have bought and at what price, and the **exit triggers** — the observable conditions under which a future session may revisit the shape.
92
+ 12.2 **Module map and boundaries**: modules by business capability with owned entities and public interfaces; the dependency-direction rule; data ownership (one module owns each table); the plausible extraction seams; and a "where new code goes by default" line per common case.
93
+ 12.3 Component diagram (fenced ASCII or Mermaid) and one paragraph per component.
94
+ 12.4 Data model: `ENT-*` with fields (name, type, constraints, nullable, default), relations, indexes, ID scheme, money representation, time-zone storage rule, soft-delete/audit policy, retention and deletion policy, and the migration policy.
95
+ 12.5 API contracts: `API-nn | method path | purpose | auth | request | response | errors` (or the OpenAPI file it will live in, with the rule that the file is the source of truth), plus the versioning policy, the single error envelope, and the pagination convention.
96
+ 12.6 Auth and authorization model with the role × permission matrix and the object-level authorization rule.
97
+ 12.7 Integrations: one card per `INT-*` from research, each with its timeout, retry, idempotency key and fallback.
98
+ 12.8 Environments, configuration and secrets, with fail-fast validation at startup.
99
+ 12.9 Observability (logs without PII, metrics, error tracking, health checks), security baseline, performance budgets, and backup/restore with a stated restore procedure.
100
+ 12.10 **Fitness functions**: each architectural rule that can be enforced mechanically, the automated check that enforces it, and where it runs. A boundary with no fitness function is a boundary that will be gone in three sessions.
101
+ 12.11 The cross-cutting decision list from `architecture-decisions.md` §7, each item either a DR reference or one line saying why it does not apply.
102
+
103
+ ### 13. Tech stack and engineering conventions (Tech Stack) — 3–5 pages
104
+ 13.1 Stack table: every row answers *what* (pinned version), *why* (the deciding reason, tied to an `AD-n` driver or an agent criterion — never "popular" or "modern"), *what lost and what it would have bought*, and *evidence*. A row missing any of the four is unfinished.
105
+ 13.2 Forbidden choices with reasons (archived, unmaintained, license, unreachable from the market, superseded API). An agent that knows what is banned is safer than one that only knows what is blessed.
106
+ 13.3 Repository layout, matching the module map in 12.2.
107
+ 13.4 The `check` command, its components and expected runtime.
108
+ 13.5 Formatting/lint/type strictness settings, including which escape hatches are banned and how an exception is justified inline.
109
+ 13.6 Testing conventions (layout, naming, fixtures, factories, test DB strategy, e2e tooling).
110
+ 13.7 Git conventions (branches, commit format with story IDs, PR/merge rule).
111
+ 13.8 CI/CD and deployment procedure, plus rollback.
112
+ 13.9 Error handling, logging and configuration conventions.
113
+ 13.10 Dependency policy (adding a package requires a DR entry) and the version-drift rule: pinned versions are what this document was verified against; a session that finds a version has moved records it and re-verifies rather than silently upgrading.
114
+
115
+ ### 14. Quality strategy, review and metrics (Quality) — 4–8 pages
116
+ Full procedure in `code-quality-and-review.md`. This section is what makes "done" mean the same thing in session 1 and session 14.
117
+
118
+ 14.1 **The two layers**: what the machine decides (the gate) versus what a human judges (the review), and the rule that anything objective a reviewer has to remember is a gate gap that gets a story.
119
+ 14.2 **The gate**: every component of `check` with its command and threshold — format, lint, types, tests, coverage floor, schema-drift check, dependency audit and secret scan, architecture fitness functions, budgets, accessibility and locale checks. State the expected runtime and the rule that the gate is never weakened to make a change pass (and if it is, that is a DR).
120
+ 14.3 **Test strategy**: pyramid shape, the 3–5 named critical e2e paths, and the test-*quality* rules — behaviour not implementation, concrete assertions, red-before-green, determinism, mutation testing on the critical modules where a maintained tool exists (name it, or say none exists). State explicitly that the coverage number is a floor against regression and never a story goal.
121
+ 14.4 **Review checklist**: the checklist from `code-quality-and-review.md` §11, embedded verbatim and adapted to this product. Both the agent's self-review and the human's review use this one list.
122
+ 14.5 **Reviewing agent-written code**: the specific failure profile (invented APIs, duplication of code the agent could not see, security defects behind clean syntax, volume outrunning review capacity), the rule that every external symbol traces to a pinned dependency, and the human-author-of-record rule.
123
+ 14.6 **Metrics table**: `M-id | metric | definition | data source | instrumented by (epic) | starting target | what a move in it would prompt`. Delivery metrics, review-process metrics, codebase-health metrics (rework/churn, duplication trend, revert rate, escaped defects, flaky count, `check` runtime). Every figure sourced or tagged `[ASSUMED]`.
124
+ 14.7 **Anti-metrics**: the explicit list of what this product will not measure and why (LOC, commit/PR counts, points as productivity, coverage as a goal), plus the rule that no metric here measures an individual.
125
+ 14.8 **Definition of green, definition of done**, and the manual verification policy — what a human checks by hand, when, and how it is recorded.
126
+
127
+ ### 15. Edge-case register (Edge Cases) — 3–8 pages
128
+ Global, cross-cutting edge cases `EC-<cat>-nn` grouped by category from `edge-case-catalog.md`, each with: description, expected behaviour, which stories cover it (filled as stories are written), which copy lines it uses. Story-level edge cases reference these where they exist rather than restating them.
129
+
130
+ ### 16. Delivery plan — sprints and epic order (Delivery Plan) — 1–2 pages
131
+ 16.1 Epic order table: `Order | Epic | Goal | Depends on | Stories | Size (S/M/L) | Why now`. 16.2 Sprint table: `Sprint | Epics | Milestone (e.g., "closed beta") | Exit criteria`. One epic = one session by default; a sprint = 1–3 epics ending in something releasable or demonstrable. 16.3 Critical path and what can be reordered without risk.
132
+
133
+ ### 17. Epics and stories (Epics) — 20–60 pages
134
+ Preceded by one line stating that everything from here is in English for the coding agent. Then `## Epic 00 — Foundation` through the last epic, each following the epic template in `stories-ac-tests.md` §5. Epic 00 always contains the repo bootstrap, tooling, `check`, CI, docs files (BLUEPRINT/PROGRESS/DECISIONS/AGENTS/CLAUDE), environment templates, a hello-world vertical slice with one unit, one integration and one e2e smoke test, and the deployment skeleton to staging.
135
+
136
+ ### 18. Session protocol for Claude Code / Codex (Session Protocol) — 2–4 pages
137
+ The full per-session runbook from `session-protocol.md`, the PROGRESS.md and DECISIONS.md formats, the Amendments log (how the blueprint itself gets changed from a build session), termination rules, recovery from a crashed session, and the `[VERIFY-AT-BUILD]` re-check rule.
138
+
139
+ ### 19. Risks and mitigations (Risks) — 1–2 pages
140
+ `R-nn | risk | likelihood | impact | mitigation | owner | trigger to revisit`. Only risks specific to this product and market. Legal/regulatory items point to OQs.
141
+
142
+ ### 20. Open questions (Open Questions) — ½–2 pages
143
+ `OQ-nn | question | why it matters | owner (user/legal/vendor/design/engineering) | blocking? (which epic) | proposed default if unanswered`. Every `[UNKNOWN → OQ-nn]` in the document has a row here.
144
+
145
+ ### 21. Glossary (Glossary) — 1–2 pages
146
+ Term | definition | Persian/English equivalent | where used. Includes UI terminology decisions (the *one* word used for each concept in the product).
147
+
148
+ ### 22. Sources (Sources) — 1–3 pages
149
+ `S-nn | title | URL | accessed | supports`. Every `S-nn` referenced in the document appears; nothing appears that was not read.
150
+
151
+ ### Appendix A — Session prompts (Appendix Session Prompts)
152
+ One copy-paste prompt per epic, generated from `assets/session-prompt.md`, with the epic ID and the section numbers filled in.
153
+
154
+ ### Appendix B — Files to create in Epic 0 (Appendix Epic 0 Files)
155
+ The literal content of `docs/PROGRESS.md`, `docs/DECISIONS.md`, `AGENTS.md`, `CLAUDE.md`, `.env.example`, and the `check` script for this product, so Epic 0 copies rather than invents.
156
+
157
+ ## 4. Table formats (copy exactly)
158
+
159
+ Assumptions
160
+ ```
161
+ | # | Assumption | Why this was assumed | Impact if wrong |
162
+ |---|---|---|---|
163
+ ```
164
+ Stack
165
+ ```
166
+ | Layer | Technology | Pinned version | Deciding reason (driver / agent criterion) | Runner-up — why it lost, what it would have bought | Evidence |
167
+ |---|---|---|---|---|---|
168
+ ```
169
+ Architecture drivers
170
+ ```
171
+ | ID | Driver | Measurable target | Rank | Why this rank | Source (persona / scale ceiling / regulation / hosting) |
172
+ |---|---|---|---|---|---|
173
+ ```
174
+ Architecture style scoring
175
+ ```
176
+ | Driver (rank) | <Candidate A> | <Candidate B> | <Candidate C> |
177
+ |---|---|---|---|
178
+ ```
179
+ Fitness functions
180
+ ```
181
+ | ID | Architectural rule it enforces | Automated check | Where it runs | Fails the build? |
182
+ |---|---|---|---|---|
183
+ ```
184
+ Metrics
185
+ ```
186
+ | ID | Metric | Definition | Data source | Instrumented by | Starting target | What a move in it would prompt |
187
+ |---|---|---|---|---|---|---|
188
+ ```
189
+ Copy
190
+ ```
191
+ | ID | Element | Copy (fa) | English gloss | Persona intent | State / variant | Max length | Notes |
192
+ |---|---|---|---|---|---|---|---|
193
+ ```
194
+ Screens
195
+ ```
196
+ | ID | Screen | Purpose | Personas | Entry points | Primary action | States covered | Copy IDs | Edge cases |
197
+ |---|---|---|---|---|---|---|---|---|
198
+ ```
199
+ Epic order
200
+ ```
201
+ | Order | Epic | Goal | Depends on | Stories | Size | Why now, not earlier/later |
202
+ |---|---|---|---|---|---|---|
203
+ ```
204
+ Open questions
205
+ ```
206
+ | ID | Question | Why it matters | Owner | Blocking? | Proposed default if unanswered |
207
+ |---|---|---|---|---|---|
208
+ ```
209
+ Sources
210
+ ```
211
+ | ID | Title | URL | Accessed | Supports |
212
+ |---|---|---|---|---|
213
+ ```
214
+
215
+ ## 5. Writing order and chunking
216
+
217
+ Write in this order, one write operation per numbered item, appending to the same file:
218
+
219
+ 1. Cover, how-to-use, TOC (section 0)
220
+ 2. Sections 1–2
221
+ 3. Section 3 (research) — may need two chunks
222
+ 4. Sections 4–6
223
+ 5. Section 7 (flows)
224
+ 6. Sections 8–9
225
+ 7. Section 10
226
+ 8. Section 11 (copy tables) — one chunk per 3–5 screens
227
+ 9. Section 12 — **two chunks**: 12.0–12.2 (drivers, style decision, module map) first, then 12.3–12.11
228
+ 10. Section 13, then section 14 as its own chunk (the review checklist and metric table are long)
229
+ 11. Section 15
230
+ 12. Section 16
231
+ 13. Section 17 — **one chunk per epic**
232
+ 14. Section 18
233
+ 15. Sections 19–22
234
+ 16. Appendices
235
+
236
+ Why this order: flows before screens, screens before copy, copy before stories (stories reference copy IDs), architecture before stack conventions, everything before epics (epics reference all of it). Writing epics last means every AC can point at an existing ID instead of inventing one.
237
+
238
+ After each chunk, re-read the previous chunk's IDs you referenced; mismatched IDs are the most common defect in long documents.
239
+
240
+ ## 6. Self-review before lint
241
+
242
+ Read as a stranger in a fresh session and check:
243
+
244
+ - Could I build Epic 03 with only sections 12–18 and the Glossary? What did I have to guess?
245
+ - Does every persona appear in at least one story, and does every story name a persona that exists?
246
+ - Does every screen in the inventory have every state in the copy table?
247
+ - Does every integration have a fallback and a sandbox statement?
248
+ - Does every `[VERIFY-AT-BUILD]` appear in the session protocol's re-check list?
249
+ - Is there any sentence where two options are left open? Decide it.
250
+ - Are all numbers sourced or tagged `[ASSUMED]`?
251
+ - Does the epic order respect every "Depends on"?
252
+ - Could any architecture driver in 12.0 have changed the style decision in 12.1? If not, the drivers are decoration — rewrite them with real targets.
253
+ - Does every stack row name what the runner-up would have bought? A row with no cost stated is a row that was not decided.
254
+ - Does every boundary rule in 12.2 have a fitness function in 12.10, or an explicit line saying why it cannot be enforced?
255
+ - Does every component of `check` in 14.2 name a tool that was verified to exist for this stack this session?
256
+ - Is the review checklist in 14.4 present verbatim, and does the Story DoD require it?
257
+ - Does any metric in 14.6 measure an individual? Remove it.
258
+
259
+ Then run the linter.