@nurix/etna 0.18.23 → 0.18.24

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.
Files changed (62) hide show
  1. package/data/harness-index.json +1 -5
  2. package/data/harnesses/code/CLAUDE.md +3 -0
  3. package/data/harnesses/code/harness.json +2 -2
  4. package/data/harnesses/etna/CLAUDE.md +5 -14
  5. package/data/harnesses/etna/harness.json +2 -2
  6. package/package.json +1 -1
  7. package/data/harnesses/mobile/.prettierignore +0 -12
  8. package/data/harnesses/mobile/.prettierrc.json +0 -3
  9. package/data/harnesses/mobile/.vscode/settings.json +0 -10
  10. package/data/harnesses/mobile/CLAUDE.md +0 -151
  11. package/data/harnesses/mobile/agents/brainstorm.md +0 -35
  12. package/data/harnesses/mobile/agents/change-review.md +0 -251
  13. package/data/harnesses/mobile/agents/lld-mode.md +0 -56
  14. package/data/harnesses/mobile/agents/maintenance.md +0 -216
  15. package/data/harnesses/mobile/agents/performance-review.md +0 -223
  16. package/data/harnesses/mobile/harness.json +0 -11
  17. package/data/harnesses/mobile/hooks/generate-ownership-index.mjs +0 -148
  18. package/data/harnesses/mobile/hooks/hooks.json +0 -16
  19. package/data/harnesses/mobile/rules/database.md +0 -38
  20. package/data/harnesses/mobile/rules/general.md +0 -49
  21. package/data/harnesses/mobile/rules/nomenclature.md +0 -34
  22. package/data/harnesses/mobile/rules/nustack.md +0 -150
  23. package/data/harnesses/mobile/rules/react-native.md +0 -132
  24. package/data/harnesses/mobile/rules/testing.md +0 -25
  25. package/data/harnesses/mobile/rules/typescript.md +0 -40
  26. package/data/harnesses/mobile/skills/boundary/SKILL.md +0 -69
  27. package/data/harnesses/mobile/skills/boundary/references/index.md +0 -16
  28. package/data/harnesses/mobile/skills/boundary/references/mechanisms.md +0 -99
  29. package/data/harnesses/mobile/skills/boundary/references/packs/async-messaging.md +0 -81
  30. package/data/harnesses/mobile/skills/boundary/references/packs/auth.md +0 -93
  31. package/data/harnesses/mobile/skills/boundary/references/packs/build-config-runtime.md +0 -93
  32. package/data/harnesses/mobile/skills/boundary/references/packs/cloudflare.md +0 -93
  33. package/data/harnesses/mobile/skills/boundary/references/packs/frontend.md +0 -93
  34. package/data/harnesses/mobile/skills/boundary/references/packs/generic-tail.md +0 -55
  35. package/data/harnesses/mobile/skills/boundary/references/packs/persistence.md +0 -93
  36. package/data/harnesses/mobile/skills/boundary/references/packs/wire-api.md +0 -87
  37. package/data/harnesses/mobile/skills/brainstorm/README.md +0 -162
  38. package/data/harnesses/mobile/skills/brainstorm/SKILL.md +0 -152
  39. package/data/harnesses/mobile/skills/brainstorm/exit-artifacts.md +0 -66
  40. package/data/harnesses/mobile/skills/brainstorm/templates/backlog.md +0 -39
  41. package/data/harnesses/mobile/skills/brainstorm/templates/build.md +0 -37
  42. package/data/harnesses/mobile/skills/brainstorm/templates/decisions.md +0 -29
  43. package/data/harnesses/mobile/skills/brainstorm/templates/doctrine.md +0 -31
  44. package/data/harnesses/mobile/skills/brainstorm/templates/domain-model.md +0 -25
  45. package/data/harnesses/mobile/skills/brainstorm/templates/evidence.md +0 -24
  46. package/data/harnesses/mobile/skills/brainstorm/templates/glossary.md +0 -20
  47. package/data/harnesses/mobile/skills/brainstorm/templates/milestones.md +0 -43
  48. package/data/harnesses/mobile/skills/brainstorm/templates/non-goals.md +0 -17
  49. package/data/harnesses/mobile/skills/brainstorm/templates/plan-doc.md +0 -61
  50. package/data/harnesses/mobile/skills/brainstorm/templates/questions.md +0 -36
  51. package/data/harnesses/mobile/skills/brainstorm/templates/references.md +0 -28
  52. package/data/harnesses/mobile/skills/brainstorm/templates/rejected.md +0 -33
  53. package/data/harnesses/mobile/skills/brainstorm/templates/source-of-truth.md +0 -49
  54. package/data/harnesses/mobile/skills/brainstorm/templates/state.md +0 -1
  55. package/data/harnesses/mobile/skills/brainstorm/templates/tech.md +0 -23
  56. package/data/harnesses/mobile/skills/brainstorm/templates/thesis.md +0 -21
  57. package/data/harnesses/mobile/skills/documentation/SKILL.md +0 -172
  58. package/data/harnesses/mobile/skills/documentation/references/examples.md +0 -203
  59. package/data/harnesses/mobile/skills/documentation/references/style-guide.md +0 -315
  60. package/data/harnesses/mobile/skills/documentation/references/templates.md +0 -1091
  61. package/data/harnesses/mobile/skills/workflow-mapper/SKILL.md +0 -451
  62. package/data/harnesses/mobile/skills/workflow-mapper/references/patterns.md +0 -214
@@ -1,28 +0,0 @@
1
- # References
2
-
3
- This file collects **external prior art** — repos, docs, papers, talks — with one-line pointers to what we use each for. Reference implementations beat invented solutions: if someone has already solved the problem you're about to design, the right move is to link it here and use it, not re-derive.
4
-
5
- References are not bookmarks. Every entry should answer the question "what specific pattern, idea, or implementation do we lift from this?" A reference without that grounding decays into noise. If you can't write the one-line "what we use it for", you probably don't need the entry.
6
-
7
- References to **source materials** copied into `./plan/sources/` during the session also live here — point at the local copy, not the original location. This keeps the brainstorm self-contained.
8
-
9
- When a referenced thing changes (renames, moves, deprecation), **update or remove the entry**. A stale reference that no longer points at what the description claims is worse than no reference — it teaches the reader to distrust the file.
10
-
11
- ---
12
-
13
- ## Internal repos / paths
14
-
15
- - `~/path/to/repo` — [what pattern we borrow]
16
- - `~/path/to/another` — [what pattern we borrow]
17
-
18
- ## Source materials (this session)
19
-
20
- - `./plan/sources/[file]` — [original location, why it's relevant]
21
-
22
- ## External docs
23
-
24
- - `https://example.com/foo` — [what we use it for]
25
-
26
- ## Papers / talks
27
-
28
- - [Title] — [link or citation] — [the specific idea we're applying]
@@ -1,33 +0,0 @@
1
- # Rejected alternatives
2
-
3
- This file captures **paths that were considered and rejected**, with the reason for rejection. Its purpose is to prevent re-litigation: when someone proposes the same alternative six weeks later, this file answers "we already looked at that; here's why we didn't go that way."
4
-
5
- Each entry needs four load-bearing parts: **Considered** (what was proposed, in concrete terms), **Evidence on the table** (what prior art, findings, or arguments were in front of the decider when they declined — this is what separates an informed rejection from an unexamined one), **Rejected because** (the specific reason — "didn't fit" is useless to future-you; name the constraint, the cost, the risk), and **Re-evaluate if** (what would need to change for the rejected path to become viable again). The re-evaluate field stops the rejection from looking permanent when it isn't — most rejections are scope-conditional, not absolute.
6
-
7
- This file is **eager**, not lazy (the memory contract): it materializes the moment the user knowingly declines a presented option, in the same turn — an informed rejection that lives only in the transcript is a leak.
8
-
9
- This is one of the four places inside the brainstorm folder where past tense and "we considered X" framing is permitted (the others: `decisions.md`, `references.md`, git history). The whole point of this file is to capture the path-not-taken so future architects don't have to re-discover it.
10
-
11
- If circumstances change and a rejected path becomes attractive again, **do not silently revive it**. Add a new question to `questions.md` that references the rejection here, and resolve it explicitly. The new decision can override the rejection — but it should override, not pretend the rejection never happened.
12
-
13
- ---
14
-
15
- ## R1 — [Rejected option]
16
-
17
- **Considered.** [What was proposed.]
18
-
19
- **Evidence on the table.** [The prior art, findings, or arguments in front of the decider at the moment of declining — cite the evidence note or basis file if one carries it.]
20
-
21
- **Rejected because.** [The reason. Be specific.]
22
-
23
- **Re-evaluate if.** [What would change to make this viable.]
24
-
25
- **Came up during.** [Q-number or D-number for context.]
26
-
27
- ---
28
-
29
- ## R2 — [Rejected option]
30
-
31
- (same format)
32
-
33
- ---
@@ -1,49 +0,0 @@
1
- # [Thing] — source of truth
2
-
3
- > This is a **source-of-truth doc**: the standing, canonical reference for [thing]. Write it like a
4
- > README — present tense, reader-first, the thing described as it _is_. It is **not a plan** (no steps,
5
- > status, or sequencing — those go to `docs/history/plans/`) and **not the brainstorm record** (no
6
- > `Q-N`/`D-N` codes, no "Why / How to apply" ledger, no rejected alternatives — those stay in the harvested
7
- > record at `docs/history/brainstorms/{topic}/` and any ADs). One document; if a section outgrows it, link out, don't sprawl.
8
- >
9
- > **Placement.** In a repo with a feature-doc system this lands as `docs/features/{slug}.md` and carries
10
- > that system's frontmatter (`owns:` / `module:` / `keywords:` / `status:`). Cross-cutting → `docs/architecture/{slug}.md`.
11
- > No doc taxonomy → a `Readme.md` at the topic's home.
12
-
13
- ## What it is
14
-
15
- [One paragraph, present tense: what the thing is, what it does, who uses it. Distilled from `thesis.md`.]
16
-
17
- ## How it works
18
-
19
- [The model — entities, relationships, the main flow — lifted from `domain-model.md` into plain,
20
- reader-first description. Prose and tables; a diagram only if it earns its tokens.]
21
-
22
- ## Parts
23
-
24
- [One row per component / module / piece: name · role · what it owns · what it depends on.]
25
-
26
- | Part | Role | Owns | Depends on |
27
- | --- | --- | --- | --- |
28
- | | | | |
29
-
30
- ## Why it's shaped this way
31
-
32
- [The load-bearing decisions, folded into present-tense rationale — "the index is single-writer because
33
- concurrent writes corrupted it," not "we decided X over Y." No decision codes, no options-considered
34
- table. The full rationale and the roads not taken live in the brainstorm record and ADs — cite them,
35
- don't reproduce them.]
36
-
37
- ## Constraints & non-goals
38
-
39
- [Accepted tradeoffs phrased as current fact ("a 5-second lag is accepted for predictable throughput")
40
- and what is explicitly out of scope.]
41
-
42
- ## Open questions
43
-
44
- [One line pointing at `docs/history/brainstorms/{topic}/questions.md` if any remain open. Omit if none.]
45
-
46
- ---
47
-
48
- _Distilled from `docs/history/brainstorms/{topic}/`. That record holds the rationale, the rejected alternatives,
49
- and the provenance for everything above._
@@ -1 +0,0 @@
1
- STATE: open MODE: dump COMPLEXITY: medium SESSION STARTED: YYYY-MM-DD SESSION CLOSED: CURRENT TOPIC: (one line — updated on every topic shift) LAST SYNC: never SYNC IN FLIGHT: no
@@ -1,23 +0,0 @@
1
- # Tech
2
-
3
- This file holds the **technology choices** for the idea. It is seeded at bootstrap from the harness's opinionated stack (e.g. `.claude/rules/general.md` recommended-packages table) when one exists — those rows arrive as defaults, not decisions.
4
-
5
- Its job afterward is to be a **lens**: when a conversation move conflicts with a row here, the sync (or the skill, in the moment) surfaces it — _"you just proposed local component stores; the stack says Redux Toolkit — deviating or steering back?"_ A confirmed deviation gets recorded below with its why; an unconfirmed conflict becomes an open question.
6
-
7
- ## Stack
8
-
9
- | Layer | Choice | Source |
10
- | ------------ | ------------------ | --------------------------- |
11
- | [e.g. UI] | [react ^19] | harness default |
12
- | [e.g. state] | [@reduxjs/toolkit] | harness default |
13
- | [layer] | [choice] | decided this session — D[n] |
14
-
15
- ## Deviations
16
-
17
- Each deviation from a harness default carries a why:
18
-
19
- ### [Choice] instead of [default]
20
-
21
- **Why.** [Constraint, requirement, or incident that justifies the deviation.]
22
-
23
- **Scope.** [Whole project, or only a named module/surface.]
@@ -1,21 +0,0 @@
1
- # Thesis
2
-
3
- This file is the **running narrative of what we are designing** — the single place a cold reader (or the next session) goes to understand the idea as it currently stands. It is rewritten freely as the idea evolves; it always describes the _current_ shape, never the journey (writing posture per `build.md`'s mode).
4
-
5
- Keep it prose-first. If a section outgrows this file at high complexity, it may move to a numbered deep-dive doc (`01-foo.md`) at the session root with a one-line pointer left here.
6
-
7
- ## What this is
8
-
9
- [2–5 paragraphs. What the thing is, who it's for, what it does. Distilled from the basis at `start` and kept current by the loop.]
10
-
11
- ## Aspect map
12
-
13
- The thinking dimensions for _this_ idea — proposed by the skill from the basis, edited by the user at `start`. The sync agent audits coverage against this list: an aspect with no content anywhere becomes an open question.
14
-
15
- - [ ] [aspect — e.g. users & jobs]
16
- - [ ] [aspect — e.g. domain model]
17
- - [ ] [aspect — e.g. architecture]
18
- - [ ] [aspect — e.g. tech]
19
- - [ ] [aspect — e.g. risks]
20
-
21
- Check an aspect only when it has real content in the pillars, not when it has merely been mentioned.
@@ -1,172 +0,0 @@
1
- ---
2
- name: documentation
3
- description: Template & generator library for technical docs — the skill agents call to produce a doc from a template. Use to (1) document a feature or module (the feature doc is the feature's LLD — low-level design — written in LLD Mode), (2) create or update a changelog entry, (3) document data flows or Redux state, (4) add to protected files, (5) record or revise an architecture decision (an AD), (6) create or update the project root README, (7) create or update a plan, (8) derive a feature doc's `owns:` frontmatter (the code-path globs it owns) from code, (9) scaffold a standard doc (README, structure.md, CHANGELOG, backlog, memory) from its template, (10) document an operations procedure (setup, deployment, maintenance) or a one-shot migration runbook, (11) write a steering doc (system overview, domain model, glossary, non-goals, security overview, testing strategy), (12) catalog the API surface or the environment/config registry, or (13) co-author any technical doc. Baselining / reconciling a repo's docs to the installed harness version is the **`maintenance` agent (baseline mode)** (which calls this skill for each template) — this skill does not orchestrate baseline. Triggers on "document this", "create docs", "update changelog", "add to protected files", "AD", "ADR", "architecture decision", "root README", "plan", "feature doc", "LLD", "glossary", "domain model", "runbook", "API reference".
4
- ---
5
-
6
- # Technical Documentation Skill
7
-
8
- **This skill is a template & generator library, not an orchestrator.** It supplies the templates, the frontmatter-derivation generator, and the co-authoring workflow that _agents_ call to produce individual docs. It does **not** baseline, audit, or reconcile a repo's doc tree — that is the **`maintenance` agent (baseline mode)**, which calls this skill for each template it scaffolds. Reach here to generate _one_ doc from a template; reach for the `maintenance` agent (baseline mode) to bring a whole repo into shape.
9
-
10
- Document contracts and architecture, not implementation details. Show function signatures and API shapes — never paste full implementations (they rot fast). Use ASCII diagrams over prose for flows. Only document state at persistence boundaries (Redux persistence, DB schemas, API shapes), not component-level or transient state. Mark deprecated fields with `// UNUSED:` comments. Breaking changes belong in changelogs only, not module docs.
11
-
12
- ---
13
-
14
- ## The Two Natures
15
-
16
- Every document is exactly one of two things. Decide which before writing a word — every rule in this skill derives from the split.
17
-
18
- | | **Truth document** | **Record** |
19
- | --- | --- | --- |
20
- | States | Absolutes — how the system is, **now** | What happened — a dated account of activity |
21
- | Named by | Topic: `auth.md`, `AD-003-persistence.md` | Date: `YYYY-MM-DD-slug.md` (or append position) |
22
- | On change | Body rewritten in place the moment reality changes | Never edited — frozen at completion or append-only |
23
- | Read to | Act correctly today | Trace provenance, diagnose, audit |
24
- | Lives in | `docs/features/`, `docs/architecture/`, `docs/operations/`, `docs/tests/`, READMEs | `docs/history/` (plans, changelog, brainstorms, research, migrations), `docs/research/`, `docs/memory/` |
25
-
26
- The two guarantees are complementary and both break on mixing: a reader holding a **truth document** must never need history to interpret it; a reader holding a **record** must be able to trust it was never rewritten. So the natures never share a document body.
27
-
28
- - **Truth documents never narrate history.** No migration/fold stories, no dated "shipped/verified on YYYY-MM-DD" markers, no "was X → now Y" journeys, no provenance asides ("ex-`@nurix/X`, folded 2026-06-12"). When the system changes, the change-story goes to `docs/history/` (a changelog entry) and the truth document simply becomes correct in present tense. When you find historical narration in a truth document, rewrite it to the present-tense fact and let the record carry the story.
29
- - **Records are never edited to match the present.** A completed plan stays wrong-in-hindsight; a changelog entry describes close-time state; a scope change gets a *new* dated record that links back, never an edit to a frozen one.
30
- - **The one bridge — head is truth, tail is provenance.** An **Architecture Decision (AD)** ends with a **Decision Changelog**: the single sanctioned dated-history section inside a truth document, because for a decision the journey (what each revision reversed, and what triggered it) is part of the reasoning. The AD body stays current-truth-only; the tail carries the dates and links to the plans that implemented each revision. No other truth document carries dated history.
31
- - **Truth documents cite records for the _why_, never the _when_.** `Provenance: AD-002` is good; "decided in AD-002 and shipped 2026-06-13" is not. Routing/index docs point only to truth documents — never to a plan or changelog entry as the "read first" source.
32
-
33
- **No empty stubs.** Never leave a template section as an empty placeholder — omit any section with nothing real to say (each template declares its required core; everything else is optional). Write an explicit "None" only where the absence itself is information (e.g., a plan's Cross-Module Contracts Affected, an LLD's Ownership Conflicts). An empty table stub reads as "not yet researched"; an omitted section reads as "doesn't apply" — keep those meanings distinct.
34
-
35
- **No redirect docs.** When moving a doc to a new location, delete the old file entirely. Update all references (cross-doc links, memory files) to point to the new path. Never leave a stub file that says "Moved to X" — redirect docs rot, clutter the repo, and create false search hits.
36
-
37
- ---
38
-
39
- ## Decision Tree
40
-
41
- ```
42
- User request
43
- │
44
- ├─ "Baseline/reconcile docs" ──────▶ maintenance agent (baseline mode) (it calls this skill per template)
45
- │
46
- ├─ "Document feature/module (LLD)" ▶ Feature (LLD) Template
47
- │
48
- ├─ "Create/update changelog" ──────▶ Changelog Template (record)
49
- │
50
- ├─ "Document data flow" ───────────▶ Feature Template (Architecture section)
51
- │
52
- ├─ "Document Redux/state" ─────────▶ Feature Template (State section)
53
- │
54
- ├─ "Add to protected files" ───────▶ Protected Files Template
55
- │
56
- ├─ "Record/revise architecture
57
- │ decision" ────────────────────▶ AD Template (one per subject; revisions update it in place)
58
- │
59
- ├─ "System at a glance" ───────────▶ System Overview Template
60
- │
61
- ├─ "Domain model / glossary /
62
- │ non-goals" ───────────────────▶ Steering Templates
63
- │
64
- ├─ "Catalog the API surface" ──────▶ API Reference Template
65
- │
66
- ├─ "Document env vars / config" ───▶ Environment Registry Template
67
- │
68
- ├─ "Security / threat model" ──────▶ Security Overview Template
69
- │
70
- ├─ "Testing strategy" ─────────────▶ Testing Strategy Template
71
- │
72
- ├─ "Recurring procedure/setup" ────▶ Operations Procedure Template
73
- │
74
- ├─ "One-shot migration/upgrade" ───▶ Migration Runbook Template (record)
75
- │
76
- ├─ "Create/update root README" ────▶ Project Root README Template
77
- │
78
- ├─ "Create/update plan" ───────────▶ Plan Template (record)
79
- │
80
- ├─ "Update existing doc" ──────────▶ Preserve existing structure
81
- │
82
- └─ No template matches ────────────▶ Co-Authoring Workflow (below)
83
- ```
84
-
85
- ---
86
-
87
- ## Naming & Lifecycle
88
-
89
- | Document | Nature | Name | Lifecycle |
90
- | --- | --- | --- | --- |
91
- | Feature (LLD) | Truth | `kebab-case.md` | Living; `status:` `draft` → `active` → `deprecated` |
92
- | Architecture Decision | Truth | `AD-NNN-kebab-case.md` | Living; `Proposed` → `Accepted` → `Deprecated`; revisions rewrite the body + append to its Decision Changelog |
93
- | Steering docs (overview, domain model, glossary, non-goals, security, testing strategy) | Truth | fixed names | Living |
94
- | API reference / environment registry | Truth | fixed names | Living |
95
- | Operations procedure | Truth | `kebab-case.md` | Living |
96
- | Protected files | Truth | `protected-files.md` | Living |
97
- | Plan | Record | `YYYY-MM-DD-kebab-case.md` | Freezes at `Complete` / `Abandoned` |
98
- | Changelog entry | Record | `YYYY-MM-DD-kebab-case.md` | Frozen; master index append-only |
99
- | Migration runbook | Record | `YYYY-MM-DD-kebab-case.md` | Freezes once executed, outcome stamped |
100
- | Research | Record | `history/research/{topic}/` | Frozen snapshot |
101
- | Memory | Record | `{agent-name}.md` | Append-only dated ledger |
102
-
103
- ---
104
-
105
- ## Frontmatter Derivation
106
-
107
- When creating or updating a feature doc, derive its **`owns:` frontmatter** — the code-path globs it is canonical for — from the source the doc describes. Code ownership lives in each feature doc's `owns:` frontmatter (the SessionStart hook unions them into the injected ownership index); there is no hand-maintained ownership map.
108
-
109
- ### When to run
110
-
111
- - **Baseline / reconcile** — for every feature doc whose code paths aren't yet declared in its `owns:` frontmatter (the `maintenance` agent (baseline mode) calls this)
112
- - **New feature doc** — when creating a doc via the Feature template, project its `owns:` globs
113
- - **Doc update** — when the documented scope changes, update the doc's `owns:` globs
114
-
115
- ### How to derive the frontmatter
116
-
117
- A feature doc's launch-map frontmatter is `owns:` (required), `module:` (optional), `keywords:` (required), and `status:` (required). An optional `last-reviewed:` date (stamped whenever the doc is substantively reviewed or updated) gives the `maintenance` agent a staleness signal to rank its audits by — it is tooling metadata, never narrated in the body.
118
-
119
- **1. `owns:`** (the path scope)
120
-
121
- Read the doc's content. Extract every source file path it references (file listings, function locations, component paths). Group them into the narrowest glob patterns that cover all referenced files without overlapping another doc's `owns:` globs at equal specificity. A doc may own several globs.
122
-
123
- | Doc references | Glob |
124
- | ------------------------------------ | ------------------------- |
125
- | Multiple files under one directory | `src/feature/**` |
126
- | Specific files in a shared directory | List each file explicitly |
127
- | A single entry-point file | The exact file path |
128
-
129
- Glob each pattern against the codebase; drop any that match nothing.
130
-
131
- **2. `module:`**
132
-
133
- The single bounded-context label this feature belongs to, or omit it for a cross-cutting feature that belongs to no single context. A module is a label, not a folder — features sharing a `module:` value are what ties that module to code (a filter over the generated ownership index).
134
-
135
- **3. `keywords:` & `status:`**
136
-
137
- `keywords:` are the discovery terms topic→doc lookup rides. `status:` is `active`, `draft`, or `deprecated` — it steers the model toward live docs and away from draft/deprecated ones.
138
-
139
- A doc's dependencies on other docs are expressed inline in its prose (links); cross-cutting contracts are diagnosed by the `boundary` skill from source, not persisted.
140
-
141
- ### Rules
142
-
143
- - One canonical doc per path. A doc's `owns:` globs must not overlap another doc's at equal specificity — the narrower glob wins; equal-specificity overlap is an ownership conflict to resolve.
144
- - Use glob patterns for directories, explicit paths for individual files. Don't list paths that don't exist in the codebase.
145
- - When a doc covers a deep feature with sub-specs (e.g., `editor/`), each sub-spec owns its own globs — don't duplicate a path across siblings.
146
- - For baseline/reconcile with many docs, use parallel sub-agents to read source and propose `owns:` globs.
147
-
148
- ---
149
-
150
- ## Co-Authoring Workflow
151
-
152
- For docs that don't match templates:
153
-
154
- **Stage 1: Context Gathering**
155
-
156
- - Ask: Audience? Purpose? Existing format?
157
- - Have user dump all context, then ask 5-10 clarifying questions
158
-
159
- **Stage 2: Structure & Draft**
160
-
161
- - Propose section structure, draft section by section
162
- - User indicates changes (don't edit directly — learn their style)
163
-
164
- ---
165
-
166
- ## Resources
167
-
168
- | File | Use For |
169
- | --- | --- |
170
- | `references/templates.md` | docs/README.md, structure.md, the feature-frontmatter contract, scaffolds (CHANGELOG, backlog, memory), feature, changelog, plan, operations procedure, migration runbook, protected files, AD, steering docs (system overview, domain model, glossary, non-goals, security, testing strategy), API reference, environment registry, project root README templates |
171
- | `references/style-guide.md` | Writing rules, formatting conventions, the two-natures tense rules |
172
- | `references/examples.md` | Good vs bad documentation examples |
@@ -1,203 +0,0 @@
1
- # Documentation Examples
2
-
3
- Good vs bad examples showing the key differences.
4
-
5
- ---
6
-
7
- ## Example 1: Function Documentation
8
-
9
- ### ❌ Bad: Full Implementation
10
-
11
- ```markdown
12
- ### mergeData
13
-
14
- function mergeData(server, local, changes) { const result = {}; const serverMap = new Map(server.map((i) => [i.id, i])); // ... 30 more lines return result; }
15
- ```
16
-
17
- **Problems:** Will become obsolete, focuses on HOW not WHAT.
18
-
19
- ### ✅ Good: Contract Only
20
-
21
- ```markdown
22
- ### `mergeData(serverData, localData, changes)`
23
-
24
- **Goal:** Merge server data with local changes **Input:**
25
-
26
- - `serverData` (array) - Fresh from API
27
- - `localData` (array) - Current state
28
- - `changes` (object) - `{ added, updated, removed }` **Output:** `{ merged: array, conflicts: array }`
29
-
30
- **Merge Rules:**
31
-
32
- - Server wins for conflicts
33
- - Local additions preserved
34
- - Local removals marked as intent
35
- ```
36
-
37
- ---
38
-
39
- ## Example 2: State Documentation
40
-
41
- ### ❌ Bad: State Everywhere
42
-
43
- ```markdown
44
- ## Component State
45
-
46
- const [items, setItems] = useState([]);
47
-
48
- ## Hook State
49
-
50
- { data: items, isLoading: loading, error: null }
51
-
52
- ## Redux State
53
-
54
- { items: [], loading: false, error: null }
55
- ```
56
-
57
- **Problems:** Documents transient state, repeats shapes.
58
-
59
- ### ✅ Good: Persistence Points Only
60
-
61
- ```markdown
62
- ## State
63
-
64
- **Frontend (at persistence):** { "data": [], "changes": { "added": [], "updated": [], "removed": [] } // "cache": {} // UNUSED: Deprecated }
65
-
66
- **Storage:** localStorage `app_state`
67
-
68
- **Backend:** model Item { id String @id data Json }
69
- ```
70
-
71
- ---
72
-
73
- ## Example 3: Changelog
74
-
75
- ### ❌ Bad: Vague
76
-
77
- ```markdown
78
- # 2025-01-05 - Updates
79
-
80
- ## Changes
81
-
82
- - Updated editor
83
- - Fixed bugs
84
- - Improved performance
85
-
86
- ## Files
87
-
88
- - Various files in src/
89
- ```
90
-
91
- ### ✅ Good: Function-Level Detail
92
-
93
- ```markdown
94
- # 2025-01-05 - Version-Based Merge
95
-
96
- ## Summary
97
-
98
- Replaced change-tracking merge with version-based conflict resolution.
99
-
100
- ## Changes
101
-
102
- ### Added
103
-
104
- - `mergeAndDerive(server, local, versionsMatch, type)` in `src/utils/merge.js`
105
- - Purpose: Single-pass merge with change detection
106
- - Returns: `{ merged, changes }`
107
-
108
- ### Changed
109
-
110
- - `useDataSync()` in `src/hooks/useDataSync.js`
111
- - Changed: Now compares versions before merge
112
-
113
- ### Removed
114
-
115
- - `deriveChanges()` from `src/utils/derive.js`
116
- - Replaced by: Logic in `mergeAndDerive()`
117
-
118
- ## Breaking Changes
119
-
120
- ⚠️ **Merge behavior changed**
121
-
122
- - Old: Local changes always preserved
123
- - New: Local preserved only if versions match
124
-
125
- ## Files Changed
126
-
127
- - `src/hooks/useDataSync.js`
128
- - `src/utils/merge.js`
129
- - `src/utils/derive.js` (deleted)
130
- ```
131
-
132
- ---
133
-
134
- ## Example 4: Data Flow
135
-
136
- ### ❌ Bad: Prose Description
137
-
138
- ```markdown
139
- When the page loads, the useAppInit hook calls the syncData function. This function first fetches data from the server using the API. Then it gets the local data from Redux. After that, it compares versions...
140
- ```
141
-
142
- ### ✅ Good: Diagram + Key Points
143
-
144
- ```markdown
145
- ## Data Flow
146
-
147
- ┌─────────────────────────────────────────┐ │ DATA SYNC │ ├─────────────────────────────────────────┤ │ │ │ ┌──────┐ ┌──────┐ ┌──────┐ │ │ │Server│────▶│Merge │────▶│Redux │ │ │ │ API │ │ │ │Store │ │ │ └──────┘ └──────┘ └──────┘ │ │ │ │ │ ▼ │ │ Version Check │ │ │ └─────────────────────────────────────────┘
148
-
149
- **Trigger:** `useAppInit()` on page load **Version Rule:** Match → local wins, Mismatch → server wins
150
- ```
151
-
152
- ---
153
-
154
- ## Example 5: Architecture Decision revision
155
-
156
- ### ❌ Bad: Supersession chain
157
-
158
- ```
159
- docs/architecture/decisions/
160
- ├── AD-002-auth-keycloak.md (status: Superseded)
161
- ├── AD-006-auth-better-auth.md (status: Superseded, "supersedes AD-002")
162
- └── AD-011-auth-better-auth-v2.md (status: Accepted, "supersedes AD-006")
163
- ```
164
-
165
- **Problems:** Three files hold one subject; the reader must diff a chain to learn the current truth; two of the three are wrong-but-present (the same pathology as keeping `report_v1.sql` beside the live `report_v2.sql`); the reasoning that killed Keycloak is stranded in a dead file nobody opens.
166
-
167
- ### ✅ Good: One subject, updated in place
168
-
169
- ```
170
- docs/architecture/decisions/
171
- └── AD-002-auth.md (status: Accepted, last-updated bumped)
172
- ```
173
-
174
- ```markdown
175
- ## Decision
176
-
177
- We use Better Auth with one-shot credential issuance… ← current truth, no journey
178
-
179
- …
180
-
181
- ## Decision Changelog
182
-
183
- - 2026-05-02 — Moved issuance to one-shot tokens because refresh-token theft
184
- surfaced in review. Implemented by [plan](…). (Previously: long-lived refresh tokens.)
185
- - 2026-03-18 — Replaced Keycloak with Better Auth because self-hosting cost
186
- outweighed SSO needs. Implemented by [plan](…). (Previously: Keycloak.)
187
- - 2026-01-10 — Initial decision accepted. Implemented by [plan](…).
188
- ```
189
-
190
- **Why it works:** The body answers "how does auth work and why" without archaeology; the tail preserves every reversal with its trigger; the rejected alternatives stay findable in the one file a reader actually opens.
191
-
192
- ---
193
-
194
- ## Quick Comparison
195
-
196
- | Aspect | Bad | Good |
197
- | ---------- | -------------------- | --------------------------- |
198
- | Code | Full implementations | Signatures + contracts |
199
- | State | Every occurrence | Persistence points only |
200
- | Flows | Prose paragraphs | ASCII diagrams |
201
- | Changelogs | "Updated X" | Function names + migrations |
202
- | Decisions | New doc per revision | One AD per subject, updated in place |
203
- | Length | 100+ lines | 20-40 lines |