@nurix/etna 0.18.0 → 0.18.2

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 (118) hide show
  1. package/README.md +6 -5
  2. package/data/harness-index.json +1 -5
  3. package/data/harnesses/code/CLAUDE.md +8 -19
  4. package/data/harnesses/code/agents/brainstorm.md +3 -3
  5. package/data/harnesses/code/agents/change-review.md +13 -10
  6. package/data/harnesses/code/agents/harness-manager.md +15 -15
  7. package/data/harnesses/code/agents/maintenance.md +10 -3
  8. package/data/harnesses/code/agents/performance-review.md +5 -0
  9. package/data/harnesses/code/harness.json +1 -1
  10. package/data/harnesses/code/rules/general.md +40 -36
  11. package/data/harnesses/code/skills/boundary/SKILL.md +15 -42
  12. package/data/harnesses/code/skills/boundary/references/boundary-taxonomy.md +366 -304
  13. package/data/harnesses/code/skills/brainstorm/README.md +9 -9
  14. package/data/harnesses/code/skills/brainstorm/SKILL.md +15 -15
  15. package/data/harnesses/code/skills/brainstorm/harvest.md +3 -3
  16. package/data/harnesses/code/skills/brainstorm/templates/backlog.md +2 -2
  17. package/data/harnesses/code/skills/brainstorm/templates/build.md +6 -6
  18. package/data/harnesses/code/skills/brainstorm/templates/decisions.md +3 -3
  19. package/data/harnesses/code/skills/brainstorm/templates/doctrine.md +2 -2
  20. package/data/harnesses/code/skills/brainstorm/templates/domain-model.md +2 -2
  21. package/data/harnesses/code/skills/brainstorm/templates/glossary.md +2 -1
  22. package/data/harnesses/code/skills/brainstorm/templates/non-goals.md +3 -7
  23. package/data/harnesses/code/skills/brainstorm/templates/questions.md +6 -5
  24. package/data/harnesses/code/skills/brainstorm/templates/state.md +1 -8
  25. package/data/harnesses/code/skills/brainstorm/templates/tech.md +6 -6
  26. package/data/harnesses/code/skills/brainstorm/templates/thesis.md +2 -2
  27. package/data/harnesses/code/skills/distiller/SKILL.md +48 -177
  28. package/data/harnesses/code/skills/distiller/references/docs-mode.md +116 -343
  29. package/data/harnesses/code/skills/distiller/references/method.md +37 -109
  30. package/data/harnesses/code/skills/documentation/SKILL.md +9 -6
  31. package/data/harnesses/code/skills/documentation/references/examples.md +30 -61
  32. package/data/harnesses/code/skills/documentation/references/style-guide.md +59 -62
  33. package/data/harnesses/code/skills/documentation/references/templates.md +26 -34
  34. package/data/harnesses/code/skills/workflow-mapper/SKILL.md +32 -11
  35. package/data/harnesses/code/skills/workflow-mapper/references/patterns.md +1 -1
  36. package/data/harnesses/discover/CLAUDE.md +60 -113
  37. package/data/harnesses/discover/agents/api.md +11 -28
  38. package/data/harnesses/discover/agents/codebase.md +12 -30
  39. package/data/harnesses/discover/agents/community.md +9 -21
  40. package/data/harnesses/discover/agents/deployed-client-bundle.md +16 -67
  41. package/data/harnesses/discover/agents/distribution-artifacts.md +21 -59
  42. package/data/harnesses/discover/agents/docs.md +11 -20
  43. package/data/harnesses/discover/agents/infra-backend-fingerprint.md +28 -68
  44. package/data/harnesses/discover/agents/packages.md +12 -28
  45. package/data/harnesses/discover/agents/session.md +18 -50
  46. package/data/harnesses/discover/agents/website.md +9 -19
  47. package/data/harnesses/discover/agents/wire-capture.md +22 -72
  48. package/data/harnesses/discover/harness.json +1 -1
  49. package/data/harnesses/discover/rules/cartography-coverage.md +94 -0
  50. package/data/harnesses/discover/rules/cartography-flows.md +99 -0
  51. package/data/harnesses/discover/rules/cartography-ia.md +88 -0
  52. package/data/harnesses/discover/rules/cartography.md +109 -0
  53. package/data/harnesses/discover/rules/discovery.md +73 -182
  54. package/data/harnesses/discover/rules/evaluation.md +92 -98
  55. package/data/harnesses/discover/rules/ingestion.md +123 -322
  56. package/data/harnesses/discover/rules/self-correction.md +94 -107
  57. package/data/harnesses/discover/rules/tradecraft.md +201 -172
  58. package/data/harnesses/hr/CLAUDE.md +21 -51
  59. package/data/harnesses/hr/harness.json +1 -1
  60. package/data/harnesses/hr/skills/interview-eval/SKILL.md +23 -11
  61. package/data/harnesses/hr/skills/interview-eval/TEMPLATE.md +49 -29
  62. package/data/harnesses/hr/skills/interview-eval/rubric.md +30 -30
  63. package/data/harnesses/kb-agi/CLAUDE.md +8 -8
  64. package/data/harnesses/kb-agi/agents/kb-agi-init.md +31 -22
  65. package/data/harnesses/kb-agi/agents/kb-catch-stale.md +1 -1
  66. package/data/harnesses/kb-agi/agents/kb-find-gaps.md +1 -1
  67. package/data/harnesses/kb-agi/agents/kb-fix-links.md +1 -1
  68. package/data/harnesses/kb-agi/agents/kb-refresh-summaries.md +2 -2
  69. package/data/harnesses/kb-agi/agents/kb-sync-metadata.md +2 -2
  70. package/data/harnesses/kb-agi/harness.json +1 -1
  71. package/package.json +1 -1
  72. package/data/harnesses/code-fable/.prettierignore +0 -12
  73. package/data/harnesses/code-fable/.prettierrc.json +0 -3
  74. package/data/harnesses/code-fable/.vscode/settings.json +0 -10
  75. package/data/harnesses/code-fable/CLAUDE.md +0 -135
  76. package/data/harnesses/code-fable/agents/brainstorm.md +0 -35
  77. package/data/harnesses/code-fable/agents/change-review.md +0 -248
  78. package/data/harnesses/code-fable/agents/harness-manager.md +0 -181
  79. package/data/harnesses/code-fable/agents/maintenance.md +0 -115
  80. package/data/harnesses/code-fable/agents/performance-review.md +0 -218
  81. package/data/harnesses/code-fable/agents/spec-mode.md +0 -56
  82. package/data/harnesses/code-fable/harness.json +0 -12
  83. package/data/harnesses/code-fable/hooks/hooks.json +0 -27
  84. package/data/harnesses/code-fable/hooks/lib/redact.mjs +0 -35
  85. package/data/harnesses/code-fable/hooks/prompt-recall.mjs +0 -155
  86. package/data/harnesses/code-fable/hooks/session-reflect.mjs +0 -285
  87. package/data/harnesses/code-fable/rules/general.md +0 -79
  88. package/data/harnesses/code-fable/rules/nomenclature.md +0 -30
  89. package/data/harnesses/code-fable/rules/typescript.md +0 -19
  90. package/data/harnesses/code-fable/skills/boundary/SKILL.md +0 -76
  91. package/data/harnesses/code-fable/skills/boundary/references/boundary-taxonomy.md +0 -734
  92. package/data/harnesses/code-fable/skills/brainstorm/README.md +0 -136
  93. package/data/harnesses/code-fable/skills/brainstorm/SKILL.md +0 -135
  94. package/data/harnesses/code-fable/skills/brainstorm/harvest.md +0 -26
  95. package/data/harnesses/code-fable/skills/brainstorm/templates/backlog.md +0 -39
  96. package/data/harnesses/code-fable/skills/brainstorm/templates/build.md +0 -37
  97. package/data/harnesses/code-fable/skills/brainstorm/templates/decisions.md +0 -29
  98. package/data/harnesses/code-fable/skills/brainstorm/templates/doctrine.md +0 -31
  99. package/data/harnesses/code-fable/skills/brainstorm/templates/domain-model.md +0 -25
  100. package/data/harnesses/code-fable/skills/brainstorm/templates/glossary.md +0 -19
  101. package/data/harnesses/code-fable/skills/brainstorm/templates/milestones.md +0 -43
  102. package/data/harnesses/code-fable/skills/brainstorm/templates/non-goals.md +0 -21
  103. package/data/harnesses/code-fable/skills/brainstorm/templates/plan-doc.md +0 -61
  104. package/data/harnesses/code-fable/skills/brainstorm/templates/questions.md +0 -35
  105. package/data/harnesses/code-fable/skills/brainstorm/templates/references.md +0 -28
  106. package/data/harnesses/code-fable/skills/brainstorm/templates/rejected.md +0 -29
  107. package/data/harnesses/code-fable/skills/brainstorm/templates/state.md +0 -8
  108. package/data/harnesses/code-fable/skills/brainstorm/templates/tech.md +0 -23
  109. package/data/harnesses/code-fable/skills/brainstorm/templates/thesis.md +0 -21
  110. package/data/harnesses/code-fable/skills/distiller/SKILL.md +0 -219
  111. package/data/harnesses/code-fable/skills/distiller/references/docs-mode.md +0 -526
  112. package/data/harnesses/code-fable/skills/distiller/references/method.md +0 -166
  113. package/data/harnesses/code-fable/skills/documentation/SKILL.md +0 -125
  114. package/data/harnesses/code-fable/skills/documentation/references/examples.md +0 -193
  115. package/data/harnesses/code-fable/skills/documentation/references/style-guide.md +0 -288
  116. package/data/harnesses/code-fable/skills/documentation/references/templates.md +0 -865
  117. package/data/harnesses/code-fable/skills/workflow-mapper/SKILL.md +0 -430
  118. package/data/harnesses/code-fable/skills/workflow-mapper/references/patterns.md +0 -214
@@ -1,166 +0,0 @@
1
- # Distillation Method — the algorithm spec
2
-
3
- The shared knowledge root for the `distiller` skill. Every mode reads this file.
4
- It carries the four mechanisms the distiller runs, the fact-card format, and the
5
- inbox-consumption protocol.
6
-
7
- **These methods are stolen, not invented.** Each is sourced to its primary paper
8
- with an arXiv id — provenance matters here of all places. Embed them faithfully;
9
- do not paraphrase the retention signal away.
10
-
11
- ---
12
-
13
- ## The four methods
14
-
15
- ### 1. Surprisal filter — *what to keep* (Nemori, arXiv:2508.03341)
16
-
17
- Present the LLM with **(a)** a summary of the *current* fact-set, and **(b)** the
18
- new undigested inbox entries. Keep only what is **surprising** relative to
19
- (a) — what the existing knowledge would **not** have predicted. Predictable ⇒
20
- dropped.
21
-
22
- No importance scores. No emotional tags. No templates. **Prediction error is the
23
- only retention signal.**
24
-
25
- > **First run, empty fact-set.** With nothing to predict against, "predictable" =
26
- > mechanical routine. Keep decisions, reversals, discovered constraints, and
27
- > failures with a cause worth remembering. Drop the rote. (Inbox entries arrive
28
- > semi-distilled — the `session-reflect` hook already dropped routine work — so
29
- > most survive this filter; what it still catches is repetition of what the
30
- > fact-set already knows.)
31
-
32
- **Surprisal sources are not only inbox entries.** The inbox is the *default*
33
- stream, but the retention signal is prediction error wherever it lives. On a
34
- project whose inbox is thin or empty, the decision record carries the surprise
35
- instead: `docs/architecture/adr/**` (each accepted ADR is, by construction, a
36
- decision the prior knowledge would not have predicted) and
37
- `docs/memory/brainstorm.md` (reversals, owner pronouncements, discovered
38
- constraints). Treat these as input (b) alongside any inbox entries; the filter
39
- (keep the surprising, drop the predictable) is unchanged. Provenance then points
40
- at the ADR file or brainstorm section rather than a session id.
41
-
42
- (Independently corroborated by Honcho's "Dream" — same prediction-error
43
- retention, arrived at separately.)
44
-
45
- ### 2. Fact-card representation — *non-lossy EDUs* (EMem, arXiv:2511.17208)
46
-
47
- Each survivor becomes **ONE atomic, self-contained statement** — an Elementary
48
- Discourse Unit (EDU). Entity names normalized; the minimal context needed to
49
- stand alone baked into the sentence itself. Each card carries **provenance**: the
50
- session ids and/or commits it derives from.
51
-
52
- This is **decomposition, not summarization.** No information is destroyed; one
53
- survivor may decompose into several cards; everything stays auditable back to
54
- the session and commits that produced it.
55
-
56
- ### 3. Reconciliation — *consistency* (Mem0, arXiv:2504.19413)
57
-
58
- For each candidate card, retrieve the existing facts' **semantic neighbors**,
59
- then decide one of:
60
-
61
- - **ADD** — genuinely new fact; write a new card.
62
- - **UPDATE** — refines/extends a known fact; edit the existing card in place,
63
- extend its provenance.
64
- - **SUPERSEDE** — contradicts/replaces a known fact; invalidate the old, write
65
- the new (see §4).
66
- - **NOOP** — already known; write nothing.
67
-
68
- Neighbor retrieval: `qmd query --format json -c {repo}-facts "<statement>"`
69
- (scope with `-c`, one collection) — **only when the `{repo}-facts` collection
70
- exists** (`qmd collection list` shows it). The gate is the collection, not the
71
- binary: a present qmd whose facts collection has never been built (first run)
72
- returns nothing useful. **Fallback when the collection is missing** — qmd absent,
73
- *or* present but `{repo}-facts` not yet built: filename / grep similarity over
74
- `docs/memory/facts/*.md` (slug overlap + entity-name grep), and note in the
75
- report that reconciliation ran without semantic retrieval.
76
-
77
- ### 4. Bi-temporal supersession — *never delete* (Zep/Graphiti, arXiv:2501.13956)
78
-
79
- Superseding **never deletes.** On the **old** card, set `invalid_from:` (the date
80
- it stopped being true) and `superseded_by:` (the new fact's id), and **leave the
81
- file in place.** Write the **new** card with today's `valid_from:`. The old fact
82
- stays queryable as history; nothing vanishes.
83
-
84
- This is the *valid-time* axis of a bi-temporal model — a fact is true within
85
- `[valid_from, invalid_from)`; transaction time is the git history of the file.
86
-
87
- #### Self-contained reversal — *both cards in one pass*
88
-
89
- `SUPERSEDE` (§3) assumes the old fact already lives as a card. But a single input
90
- can state a reversal whole — "X was decided, then reversed to Y" in one sentence
91
- (e.g. brainstorm.md: *single-tenant → multi-tenant, same session*; or an ADR
92
- whose **Options Considered** (the `documentation` §10 ADR template's
93
- rejected-alternatives section) names a path "proposed and reversed within the
94
- brainstorm"). Here there is no pre-existing X card to invalidate — both X and Y
95
- arrive together.
96
-
97
- Emit **two cards in one pass**:
98
-
99
- 1. A **born-invalid historical card for X** — the superseded decision. Write it
100
- with `valid_from:` (when X was decided, if known, else the input date),
101
- `invalid_from:` (when it was reversed — the same date, for an in-session
102
- reversal), and `superseded_by:` pointing at Y's fact-id. It is created already
103
- carrying its own death so the reversal stays auditable.
104
- 2. A **live card for Y** — the decision that won. `valid_from:` the reversal date,
105
- `invalid_from: null`, `superseded_by: null`.
106
-
107
- Both share the input's provenance (the one ADR / brainstorm line). This is the
108
- ADD-side mirror of SUPERSEDE: SUPERSEDE invalidates a card that already exists;
109
- the self-contained reversal *manufactures* the invalidated card so the
110
- abandoned-X history is recorded rather than silently dropped.
111
-
112
- ---
113
-
114
- ## Fact-card format (`docs/memory/facts/{kebab-slug}.md`)
115
-
116
- ```markdown
117
- ---
118
- id: fact-{slug}
119
- valid_from: YYYY-MM-DD
120
- invalid_from: null # set on supersession — never delete the file
121
- superseded_by: null # fact-id
122
- entities: [qmd, anchors, maintenance]
123
- provenance: [session 28b2cd5e, commit abc123]
124
- ---
125
- One atomic, self-contained statement of the fact, entities normalized.
126
- ```
127
-
128
- - `id` — `fact-{slug}`, the slug matching the filename.
129
- - `valid_from` — the date the fact became true (the entry/commit date, or the
130
- distill date if no better signal).
131
- - `invalid_from` — `null` until superseded; then the date it stopped being true.
132
- **Never delete the file** to express invalidity — set this field.
133
- - `superseded_by` — `null`, or the `fact-id` of the card that replaced it.
134
- - `entities` — normalized names the fact concerns (used by the grep fallback and
135
- by retrieval).
136
- - `provenance` — the session ids (`session <id>`, as stamped on the inbox entry)
137
- and commits this card decomposes from. Inbox entries are consumed after
138
- digestion, so the session id + commit hashes ARE the audit trail — commits
139
- resolve in git; session ids resolve to transcripts while retained. ADR /
140
- brainstorm inputs cite their file or section instead.
141
- - The body — exactly one atomic, self-contained statement. Entities normalized,
142
- context baked in, so the card stands alone.
143
-
144
- ---
145
-
146
- ## Inbox-consumption protocol (`docs/memory/inbox/`)
147
-
148
- Consumption is what makes the distiller idempotent. The inbox
149
- (`docs/memory/inbox/{actor}.md`, one file per actor) is a queue: every entry
150
- block present is undigested, by definition. There is no separate high-water
151
- mark and no `.digest-state.md`.
152
-
153
- **Protocol:**
154
-
155
- 1. **Collect first.** Read every entry block across `docs/memory/inbox/*.md`.
156
- Empty inbox ⇒ fall through to the ADR/brainstorm surprisal sources (§1).
157
- 2. Digest the collected entries (filter → decompose → reconcile → write).
158
- 3. **Consume last** — only after every card is written, delete exactly the
159
- entry blocks this run digested (keep each file's header; never touch blocks
160
- that arrived mid-run). Last, so a crash mid-run leaves entries queued and the
161
- re-run re-digests them — reconciliation NOOPs the already-written cards —
162
- rather than silently dropping them.
163
-
164
- A second run immediately after a successful one finds an empty inbox and is a
165
- clean NOOP. ADR/brainstorm inputs are never consumed — reconciliation alone
166
- keeps re-runs over them idempotent.
@@ -1,125 +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, (2) create or update a changelog entry, (3) document data flows or Redux state, (4) add to protected files, (5) record an architecture decision (ADR), (6) create or update the project root README, (7) create or update a plan, (8) derive ownership frontmatter (`owns`/`touches`/`depends_on`) from code, (9) scaffold a standard doc (README, structure.md, CHANGELOG, backlog, memory) from its template, or (10) co-author any technical doc. Baselining / reconciling a repo's docs to the installed harness version is the **`harness-manager` agent** (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", "ADR", "architecture decision", "root README", "plan", "feature doc".
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 **`harness-manager` agent**, which calls this skill for each template it scaffolds. Reach here to generate *one* doc from a template; reach for `harness-manager` 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
- **No redirect docs.** When moving a doc to a new location, delete the old file entirely. Update all references (routing, memory files, frontmatter `depends_on`, cross-doc links) 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.
13
-
14
- ---
15
-
16
- ## Decision Tree
17
-
18
- ```
19
- User request
20
- │
21
- ├─ "Baseline/reconcile docs" ──────▶ harness-manager agent (it calls this skill per template)
22
- │
23
- ├─ "Document feature/module" ──────▶ Module Template
24
- │
25
- ├─ "Create/update changelog" ──────▶ Changelog Template
26
- │
27
- ├─ "Document data flow" ───────────▶ Module Template (Architecture section)
28
- │
29
- ├─ "Document Redux/state" ─────────▶ Module Template (State section)
30
- │
31
- ├─ "Add to protected files" ───────▶ Protected Files Template
32
- │
33
- ├─ "Record architecture decision" ─▶ ADR Template
34
- │
35
- ├─ "Create/update root README" ────▶ Project Root README Template
36
- │
37
- ├─ "Create/update plan" ───────────▶ Plan Template
38
- │
39
- ├─ "Update existing doc" ──────────▶ Preserve existing structure
40
- │
41
- └─ No template matches ────────────▶ Co-Authoring Workflow (below)
42
- ```
43
-
44
- ---
45
-
46
- ## Naming & Lifecycle
47
-
48
- - Features: `kebab-case.md` — living reference, status `Active`
49
- - Plans: `YYYY-MM-DD-kebab-case.md` — frozen after `Complete` or `Abandoned`
50
- - Changelogs: `YYYY-MM-DD-kebab-case.md` — append-only
51
- - Memory: `{agent-name}.md` — agent-maintained
52
-
53
- ---
54
-
55
- ## Frontmatter Derivation
56
-
57
- When creating or updating a feature doc in `docs/features/`, generate `owns`, `touches`, `depends_on` frontmatter from the source code the doc describes.
58
-
59
- ### When to run
60
-
61
- - **Baseline audit Step 6** — for every feature doc missing frontmatter
62
- - **New feature doc** — when creating a doc via the Module Documentation template
63
- - **Doc update** — when updating an existing feature doc and the frontmatter is missing or the documented scope changed
64
-
65
- ### How to derive values
66
-
67
- **1. Identify `owns` patterns**
68
-
69
- Read the feature doc's content. Extract every source file path referenced in the doc (file listings, function locations, component paths). Group them into the narrowest glob patterns that cover all referenced files without overlapping other features.
70
-
71
- | Doc references | `owns` pattern |
72
- |---|---|
73
- | Multiple files under one directory | `src/feature/**` |
74
- | Specific files in a shared directory | List each file explicitly |
75
- | A single entry-point file | The exact file path |
76
-
77
- Verify patterns match real files — glob each pattern against the codebase. Remove any that match nothing.
78
-
79
- **2. Identify `touches` patterns**
80
-
81
- From the same source files the doc describes, find imports and calls to code outside the `owns` scope. These are files the feature uses but doesn't own.
82
-
83
- Common `touches` candidates:
84
- - Shared Redux slices the feature reads/writes
85
- - Utility functions from other modules
86
- - Shared hooks the feature calls
87
- - API route files the feature's frontend calls
88
-
89
- Keep `touches` to direct dependencies only — not transitive ones.
90
-
91
- **3. Identify `depends_on` docs**
92
-
93
- Check for explicit cross-references to other docs in `docs/features/` or `docs/architecture/`. Also check if the feature's `touches` paths are `owns`-ed by another feature doc — that doc is a dependency.
94
-
95
- ### Rules
96
-
97
- - Every feature doc must have all three fields, even if empty (`depends_on: []`)
98
- - Use glob patterns for directories, explicit paths for individual files
99
- - Don't list paths that don't exist in the codebase
100
- - When a doc covers a deep feature with sub-specs (e.g., `editor/`), each sub-spec gets its own frontmatter — don't duplicate ownership across siblings
101
- - For baseline audits with 10+ files needing frontmatter, use parallel sub-agents to read and analyze the source files
102
-
103
- ---
104
-
105
- ## Co-Authoring Workflow
106
-
107
- For docs that don't match templates:
108
-
109
- **Stage 1: Context Gathering**
110
- - Ask: Audience? Purpose? Existing format?
111
- - Have user dump all context, then ask 5-10 clarifying questions
112
-
113
- **Stage 2: Structure & Draft**
114
- - Propose section structure, draft section by section
115
- - User indicates changes (don't edit directly — learn their style)
116
-
117
- ---
118
-
119
- ## Resources
120
-
121
- | File | Use For |
122
- |------|---------|
123
- | `references/templates.md` | docs/README.md, structure.md, frontmatter, scaffolds (CHANGELOG, backlog, memory), feature, changelog, plan, protected files, ADR, project root README templates |
124
- | `references/style-guide.md` | Writing rules, formatting conventions |
125
- | `references/examples.md` | Good vs bad documentation examples |
@@ -1,193 +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) {
15
- const result = {};
16
- const serverMap = new Map(server.map((i) => [i.id, i]));
17
- // ... 30 more lines
18
- return result;
19
- }
20
- ```
21
-
22
- **Problems:** Will become obsolete, focuses on HOW not WHAT.
23
-
24
- ### ✅ Good: Contract Only
25
-
26
- ```markdown
27
- ### `mergeData(serverData, localData, changes)`
28
-
29
- **Goal:** Merge server data with local changes
30
- **Input:**
31
-
32
- - `serverData` (array) - Fresh from API
33
- - `localData` (array) - Current state
34
- - `changes` (object) - `{ added, updated, removed }`
35
- **Output:** `{ merged: array, conflicts: array }`
36
-
37
- **Merge Rules:**
38
-
39
- - Server wins for conflicts
40
- - Local additions preserved
41
- - Local removals marked as intent
42
- ```
43
-
44
- ---
45
-
46
- ## Example 2: State Documentation
47
-
48
- ### ❌ Bad: State Everywhere
49
-
50
- ```markdown
51
- ## Component State
52
-
53
- const [items, setItems] = useState([]);
54
-
55
- ## Hook State
56
-
57
- { data: items, isLoading: loading, error: null }
58
-
59
- ## Redux State
60
-
61
- { items: [], loading: false, error: null }
62
- ```
63
-
64
- **Problems:** Documents transient state, repeats shapes.
65
-
66
- ### ✅ Good: Persistence Points Only
67
-
68
- ```markdown
69
- ## State
70
-
71
- **Frontend (at persistence):**
72
- {
73
- "data": [],
74
- "changes": { "added": [], "updated": [], "removed": [] }
75
- // "cache": {} // UNUSED: Deprecated
76
- }
77
-
78
- **Storage:** localStorage `app_state`
79
-
80
- **Backend:**
81
- model Item {
82
- id String @id
83
- data Json
84
- }
85
- ```
86
-
87
- ---
88
-
89
- ## Example 3: Changelog
90
-
91
- ### ❌ Bad: Vague
92
-
93
- ```markdown
94
- # 2025-01-05 - Updates
95
-
96
- ## Changes
97
-
98
- - Updated editor
99
- - Fixed bugs
100
- - Improved performance
101
-
102
- ## Files
103
-
104
- - Various files in src/
105
- ```
106
-
107
- ### ✅ Good: Function-Level Detail
108
-
109
- ```markdown
110
- # 2025-01-05 - Version-Based Merge
111
-
112
- ## Summary
113
-
114
- Replaced change-tracking merge with version-based conflict resolution.
115
-
116
- ## Changes
117
-
118
- ### Added
119
-
120
- - `mergeAndDerive(server, local, versionsMatch, type)` in `src/utils/merge.js`
121
- - Purpose: Single-pass merge with change detection
122
- - Returns: `{ merged, changes }`
123
-
124
- ### Modified
125
-
126
- - `useDataSync()` in `src/hooks/useDataSync.js`
127
- - Changed: Now compares versions before merge
128
-
129
- ### Removed
130
-
131
- - `deriveChanges()` from `src/utils/derive.js`
132
- - Replaced by: Logic in `mergeAndDerive()`
133
-
134
- ## Breaking Changes
135
-
136
- ⚠️ **Merge behavior changed**
137
-
138
- - Old: Local changes always preserved
139
- - New: Local preserved only if versions match
140
-
141
- ## Files Changed
142
-
143
- - `src/hooks/useDataSync.js`
144
- - `src/utils/merge.js`
145
- - `src/utils/derive.js` (deleted)
146
- ```
147
-
148
- ---
149
-
150
- ## Example 4: Data Flow
151
-
152
- ### ❌ Bad: Prose Description
153
-
154
- ```markdown
155
- When the page loads, the useAppInit hook calls the syncData function.
156
- This function first fetches data from the server using the API. Then
157
- it gets the local data from Redux. After that, it compares versions...
158
- ```
159
-
160
- ### ✅ Good: Diagram + Key Points
161
-
162
- ```markdown
163
- ## Data Flow
164
-
165
- ┌─────────────────────────────────────────┐
166
- │ DATA SYNC │
167
- ├─────────────────────────────────────────┤
168
- │ │
169
- │ ┌──────┐ ┌──────┐ ┌──────┐ │
170
- │ │Server│────▶│Merge │────▶│Redux │ │
171
- │ │ API │ │ │ │Store │ │
172
- │ └──────┘ └──────┘ └──────┘ │
173
- │ │ │
174
- │ ▼ │
175
- │ Version Check │
176
- │ │
177
- └─────────────────────────────────────────┘
178
-
179
- **Trigger:** `useAppInit()` on page load
180
- **Version Rule:** Match → local wins, Mismatch → server wins
181
- ```
182
-
183
- ---
184
-
185
- ## Quick Comparison
186
-
187
- | Aspect | Bad | Good |
188
- | ---------- | -------------------- | --------------------------- |
189
- | Code | Full implementations | Signatures + contracts |
190
- | State | Every occurrence | Persistence points only |
191
- | Flows | Prose paragraphs | ASCII diagrams |
192
- | Changelogs | "Updated X" | Function names + migrations |
193
- | Length | 100+ lines | 20-40 lines |