safeword 0.6.8 → 0.7.0

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 (57) hide show
  1. package/dist/{check-OYYSYHFP.js → check-QGZJ62PY.js} +73 -57
  2. package/dist/check-QGZJ62PY.js.map +1 -0
  3. package/dist/{chunk-ZS3Z3Q37.js → chunk-QPO3C3FP.js} +285 -65
  4. package/dist/chunk-QPO3C3FP.js.map +1 -0
  5. package/dist/{chunk-LNSEDZIW.js → chunk-YMLVQC4V.js} +159 -152
  6. package/dist/chunk-YMLVQC4V.js.map +1 -0
  7. package/dist/cli.js +6 -6
  8. package/dist/{diff-325TIZ63.js → diff-654SSCFQ.js} +51 -53
  9. package/dist/diff-654SSCFQ.js.map +1 -0
  10. package/dist/index.d.ts +1 -0
  11. package/dist/{reset-ZGJIKMUW.js → reset-IU6AIT7C.js} +3 -3
  12. package/dist/{setup-GAMXTFM2.js → setup-5IQ4KV2M.js} +17 -20
  13. package/dist/setup-5IQ4KV2M.js.map +1 -0
  14. package/dist/{sync-BFMXZEHM.js → sync-YBQEISFI.js} +8 -26
  15. package/dist/sync-YBQEISFI.js.map +1 -0
  16. package/dist/{upgrade-X4GREJXN.js → upgrade-RRTWEQIP.js} +3 -3
  17. package/package.json +1 -1
  18. package/templates/SAFEWORD.md +141 -73
  19. package/templates/commands/architecture.md +1 -1
  20. package/templates/commands/lint.md +1 -0
  21. package/templates/commands/quality-review.md +1 -1
  22. package/templates/cursor/rules/safeword-core.mdc +5 -0
  23. package/templates/doc-templates/architecture-template.md +1 -1
  24. package/templates/doc-templates/task-spec-template.md +151 -0
  25. package/templates/doc-templates/ticket-template.md +2 -4
  26. package/templates/guides/architecture-guide.md +2 -2
  27. package/templates/guides/code-philosophy.md +1 -1
  28. package/templates/guides/context-files-guide.md +3 -3
  29. package/templates/guides/design-doc-guide.md +2 -2
  30. package/templates/guides/development-workflow.md +2 -2
  31. package/templates/guides/learning-extraction.md +9 -9
  32. package/templates/guides/tdd-best-practices.md +39 -38
  33. package/templates/guides/test-definitions-guide.md +15 -14
  34. package/templates/hooks/cursor/after-file-edit.sh +66 -0
  35. package/templates/hooks/cursor/stop.sh +50 -0
  36. package/templates/hooks/post-tool-lint.sh +19 -5
  37. package/templates/hooks/prompt-questions.sh +1 -1
  38. package/templates/hooks/prompt-timestamp.sh +8 -1
  39. package/templates/hooks/session-lint-check.sh +1 -1
  40. package/templates/hooks/session-verify-agents.sh +1 -1
  41. package/templates/hooks/session-version.sh +1 -1
  42. package/templates/hooks/stop-quality.sh +2 -2
  43. package/templates/markdownlint-cli2.jsonc +18 -19
  44. package/templates/scripts/bisect-test-pollution.sh +87 -0
  45. package/templates/scripts/bisect-zombie-processes.sh +129 -0
  46. package/templates/scripts/lint-md.sh +16 -0
  47. package/templates/skills/safeword-quality-reviewer/SKILL.md +3 -3
  48. package/templates/skills/safeword-systematic-debugger/SKILL.md +246 -0
  49. package/templates/skills/safeword-tdd-enforcer/SKILL.md +221 -0
  50. package/dist/check-OYYSYHFP.js.map +0 -1
  51. package/dist/chunk-LNSEDZIW.js.map +0 -1
  52. package/dist/chunk-ZS3Z3Q37.js.map +0 -1
  53. package/dist/diff-325TIZ63.js.map +0 -1
  54. package/dist/setup-GAMXTFM2.js.map +0 -1
  55. package/dist/sync-BFMXZEHM.js.map +0 -1
  56. /package/dist/{reset-ZGJIKMUW.js.map → reset-IU6AIT7C.js.map} +0 -0
  57. /package/dist/{upgrade-X4GREJXN.js.map → upgrade-RRTWEQIP.js.map} +0 -0
@@ -1,26 +1,79 @@
1
1
  # SAFEWORD Agent Instructions
2
2
 
3
- Core guidance for AI coding agents. Uses imports for detailed workflows.
3
+ ---
4
+
5
+ ## Code Philosophy
6
+
7
+ **Optimize for:** Clarity → Simplicity → Correctness (in that order)
8
+
9
+ | Principle | Definition |
10
+ | ---------------- | ---------------------------------------------------------------- |
11
+ | Elegant code | Readable at a glance; clear naming; minimal cognitive load |
12
+ | No bloat | Delete unused code; no premature abstractions; no "just in case" |
13
+ | Explicit errors | Every catch block re-throws with context OR logs with details |
14
+ | Self-documenting | Comment only: business rules, workarounds, non-obvious "why" |
15
+
16
+ **Tie-breaker:** When in doubt, choose the simpler solution that works today.
4
17
 
5
18
  ---
6
19
 
7
- ## Quick Reference
20
+ ## Anti-Patterns
8
21
 
9
- | Task | Guide |
10
- | ------------------------ | ---------------------------------------------- |
11
- | Feature development | @./.safeword/guides/development-workflow.md |
12
- | User stories | @./.safeword/guides/user-story-guide.md |
13
- | Test definitions | @./.safeword/guides/test-definitions-guide.md |
14
- | TDD patterns / examples | @./.safeword/guides/tdd-best-practices.md |
15
- | Design docs | @./.safeword/guides/design-doc-guide.md |
16
- | Architecture decisions | @./.safeword/guides/architecture-guide.md |
17
- | Data architecture | @./.safeword/guides/data-architecture-guide.md |
18
- | LLM integration & docs | @./.safeword/guides/llm-guide.md |
19
- | Context file maintenance | @./.safeword/guides/context-files-guide.md |
20
- | Learning extraction | @./.safeword/guides/learning-extraction.md |
21
- | Process cleanup | @./.safeword/guides/zombie-process-cleanup.md |
22
- | Code standards | @./.safeword/guides/code-philosophy.md |
23
- | Safeword CLI | @./.safeword/guides/cli-reference.md |
22
+ | Don't | Do | Why |
23
+ | ---------------------------- | ------------------------------------------------ | ------------------------- |
24
+ | `catch (e) {}` | `throw new Error(\`Failed to X: ${e.message}\`)` | Silent failures hide bugs |
25
+ | Utility class for 1 function | Single exported function | Abstraction without reuse |
26
+ | Factory for simple object | Direct construction | Indirection without value |
27
+ | `data`, `tmp`, `d` | `userProfile`, `pendingOrder` | Names should explain |
28
+ | Code "for later" | Delete it; add when needed | YAGNI |
29
+ | >50 lines for nice-to-have | Ask user: "Essential now?" | Scope creep |
30
+
31
+ ---
32
+
33
+ ## Before Using Any Library API
34
+
35
+ Training data is stale. Follow this sequence:
36
+
37
+ 1. Check `package.json` for installed version
38
+ 2. Look up docs via Context7 or official site
39
+ 3. If uncertain: ask user which version they're using
40
+
41
+ ---
42
+
43
+ ## Guides
44
+
45
+ **Read the matching guide when ANY trigger fires:**
46
+
47
+ | Trigger | Guide |
48
+ | --------------------------------------------------------- | ---------------------------------------------- |
49
+ | Starting ANY feature, bug fix, or enhancement | @./.safeword/guides/development-workflow.md |
50
+ | Need to write OR review user stories | @./.safeword/guides/user-story-guide.md |
51
+ | Need to write OR review test definitions | @./.safeword/guides/test-definitions-guide.md |
52
+ | Writing tests, doing TDD, or test is failing | @./.safeword/guides/tdd-best-practices.md |
53
+ | Creating OR updating a design doc | @./.safeword/guides/design-doc-guide.md |
54
+ | Making architectural decision OR writing ADR | @./.safeword/guides/architecture-guide.md |
55
+ | Designing data models, schemas, or database changes | @./.safeword/guides/data-architecture-guide.md |
56
+ | Calling LLM APIs OR writing LLM-consumable docs | @./.safeword/guides/llm-guide.md |
57
+ | Updating CLAUDE.md, SAFEWORD.md, or any context file | @./.safeword/guides/context-files-guide.md |
58
+ | Hit same bug 3+ times OR discovered undocumented gotcha | @./.safeword/guides/learning-extraction.md |
59
+ | Process hanging, port in use, or zombie process suspected | @./.safeword/guides/zombie-process-cleanup.md |
60
+ | Using `safeword` CLI commands | @./.safeword/guides/cli-reference.md |
61
+ | Debugging issues OR need git/cross-platform guidance | @./.safeword/guides/code-philosophy.md |
62
+
63
+ ---
64
+
65
+ ## Templates
66
+
67
+ **Use the matching template when ANY trigger fires:**
68
+
69
+ | Trigger | Template |
70
+ | ---------------------------------------------------------- | -------------------------------------------------- |
71
+ | User asks for user story OR planning new feature scope | @./.safeword/templates/user-stories-template.md |
72
+ | Bug, improvement, refactor, or internal task | @./.safeword/templates/task-spec-template.md |
73
+ | Need test definitions for a feature OR acceptance criteria | @./.safeword/templates/test-definitions-feature.md |
74
+ | Feature spans 3+ components OR needs technical spec | @./.safeword/templates/design-doc-template.md |
75
+ | Making decision with long-term impact OR trade-offs | @./.safeword/templates/architecture-template.md |
76
+ | Task needs context anchoring (see Ticket System below) | @./.safeword/templates/ticket-template.md |
24
77
 
25
78
  ---
26
79
 
@@ -28,10 +81,20 @@ Core guidance for AI coding agents. Uses imports for detailed workflows.
28
81
 
29
82
  **Location:** `.safeword/planning/` at project root
30
83
 
31
- - User stories → `.safeword/planning/user-stories/`
32
- - Test definitions `.safeword/planning/test-definitions/`
33
- - Design docs → `.safeword/planning/design/`
34
- - Issues `.safeword/planning/issues/`
84
+ | Type | Path | Contents |
85
+ | ---------------- | -------------------------------------- | --------------------------------- |
86
+ | Specs | `.safeword/planning/specs/` | `feature-*.md` and `task-*.md` |
87
+ | Test definitions | `.safeword/planning/test-definitions/` | `feature-*.md` (L2 features only) |
88
+ | Design docs | `.safeword/planning/design/` | Complex features (3+ components) |
89
+ | Issues | `.safeword/planning/issues/` | Issue tracking |
90
+
91
+ **Artifact Levels:**
92
+
93
+ | Level | Artifacts | Test Location |
94
+ | ------ | ---------------------------------------------------- | ------------------- |
95
+ | **L2** | Feature Spec + Test Definitions (+ Design Doc if 3+) | `test-definitions/` |
96
+ | **L1** | Task Spec | Inline in spec |
97
+ | **L0** | Task Spec (minimal) | Existing tests |
35
98
 
36
99
  **Archive:** Move completed docs to `archive/` subfolder within each.
37
100
 
@@ -76,66 +139,55 @@ status: in_progress
76
139
 
77
140
  - Log immediately after each action
78
141
  - Re-read ticket before significant actions
79
- - **CRITICAL:** Never mark `done` without user confirmation (prevents premature closure)
80
-
81
- **Full template:** `.safeword/templates/ticket-template.md`
142
+ - **CRITICAL:** Never mark `done` without user confirmation
82
143
 
83
144
  ---
84
145
 
85
- ## Feature Development (CRITICAL)
146
+ ## Feature Development
86
147
 
87
- **Always follow this order:**
148
+ **Triage first - answer IN ORDER, stop at first match:**
149
+
150
+ | Question | Level | Artifacts |
151
+ | ---------------------------------------- | -------------- | ---------------------------- |
152
+ | User-facing feature with business value? | **L2 Feature** | Spec + Test Defs (+ Design) |
153
+ | Bug, improvement, internal, or refactor? | **L1 Task** | Spec with inline tests |
154
+ | Typo, config, or trivial change? | **L0 Micro** | Minimal spec, existing tests |
155
+
156
+ **Then follow this order:**
88
157
 
89
158
  1. **Check/create ticket** if context-loss risk exists (see decision tree above)
90
- 2. **Read user stories** (`.safeword/planning/user-stories/`)
91
- 3. **Read test definitions** (`.safeword/planning/test-definitions/`)
92
- 4. **Read design doc** if complex (>3 components OR 2+ user stories)
159
+ 2. **Read/create spec** (`.safeword/planning/specs/`)
160
+ 3. **Read/create test definitions** (L2 only: `.safeword/planning/test-definitions/`)
161
+ 4. **Read/create design doc** if complex (3+ components)
93
162
  5. **TDD: RED → GREEN → REFACTOR**
94
163
  6. **Update ticket** with progress, ask user to confirm completion
95
164
 
96
165
  **Edge cases:**
97
166
 
98
- | Situation | Action |
99
- | ----------------------------------- | --------------------------------- |
100
- | User stories exist, test defs don't | Create test defs first |
101
- | Test defs exist, user stories don't | Ask if user stories needed |
102
- | Neither exist | Create both before implementation |
103
-
104
- **Full workflow:** @./.safeword/guides/development-workflow.md
167
+ | Situation | Action |
168
+ | ------------------------- | ----------------------- |
169
+ | Spec exists, no test defs | Create test defs (L2) |
170
+ | Test defs exist, no spec | Create spec first |
171
+ | Neither exist | Create spec, then tests |
172
+ | L0/L1 task | Inline tests in spec |
105
173
 
106
174
  ---
107
175
 
108
- ## Self-Testing (CRITICAL)
176
+ ## Self-Testing
109
177
 
110
178
  **Never ask the user to test what you can test yourself.**
111
179
 
112
- - After fixes → run relevant tests
113
- - After features run affected tests
114
- - Before completion verify everything passes
180
+ | After... | Do |
181
+ | ----------------- | ------------------------ |
182
+ | Fixes | Run relevant tests |
183
+ | Features | Run affected test suites |
184
+ | Before completion | Verify everything passes |
115
185
 
116
186
  **Anti-patterns:**
117
187
 
118
188
  - ❌ "Please refresh and test"
119
189
  - ❌ "Can you verify it works?"
120
- - ✅ "Fixed. Running tests..." → "Tests pass"
121
-
122
- ---
123
-
124
- ## Code Quality
125
-
126
- **Avoid over-engineering:**
127
-
128
- | ❌ Over-engineering | ✅ Keep it simple |
129
- | --------------------------------- | ------------------- |
130
- | Utility class for one function | Single function |
131
- | Factory/builder for simple object | Direct construction |
132
- | Config file for 2 options | Hardcode or params |
133
-
134
- **Rules:**
135
-
136
- - If feature adds >50 lines for "nice to have", ask user first
137
- - Never swallow errors—include context: `Failed to X: ${e.message}`
138
- - Verify library APIs against package.json version + Context7 (training data is stale)
190
+ - ✅ "Fixed. Running tests..." → "Tests pass"
139
191
 
140
192
  ---
141
193
 
@@ -143,11 +195,11 @@ status: in_progress
143
195
 
144
196
  **Use for:** 3+ step tasks, non-trivial work, multiple user requests.
145
197
 
146
- **Rules:**
147
-
148
- - Create as first tool call
149
- - One task `in_progress` at a time
150
- - Mark completed immediately (don't batch)
198
+ | Rule | Why |
199
+ | -------------------------------- | ----------------------- |
200
+ | Create as first tool call | Plan before acting |
201
+ | One task `in_progress` at a time | Focus |
202
+ | Mark completed immediately | Don't batch completions |
151
203
 
152
204
  ---
153
205
 
@@ -159,18 +211,36 @@ End every response with:
159
211
  {"proposedChanges": boolean, "madeChanges": boolean, "askedQuestion": boolean}
160
212
  ```
161
213
 
162
- - `proposedChanges`: suggested changes to files in this response
163
- - `madeChanges`: modified files using Write/Edit tools
164
- - `askedQuestion`: asked question, need response before proceeding
214
+ | Field | True when... |
215
+ | --------------- | ----------------------------------------------- |
216
+ | proposedChanges | Suggested changes to files in this response |
217
+ | madeChanges | Modified files using Write/Edit tools |
218
+ | askedQuestion | Asked question, need response before proceeding |
165
219
 
166
220
  ---
167
221
 
168
222
  ## Commit Frequently
169
223
 
170
- - After each GREEN phase
171
- - Before refactoring
172
- - After successful refactor
173
- - When switching tasks
224
+ Commit after: GREEN phase, before/after refactoring, when switching tasks.
225
+
226
+ ---
227
+
228
+ ## Code Fence Languages (MD040)
229
+
230
+ When markdown lint reports MD040 (missing language), choose:
231
+
232
+ | Content Type | Language Hint |
233
+ | ------------------------ | ---------------------------- |
234
+ | TypeScript/JavaScript | `typescript` or `javascript` |
235
+ | Shell commands | `bash` |
236
+ | JSON, YAML, TOML configs | `json`, `yaml`, `toml` |
237
+ | SQL queries | `sql` |
238
+ | Directory trees | `plaintext` |
239
+ | Templates, pseudocode | `text` |
240
+ | Command output, logs | `text` |
241
+ | Truly ambiguous | `text` |
242
+
243
+ **Why this matters:** Language hints help LLMs understand code context. Use real languages for real code, `text` for everything else.
174
244
 
175
245
  ---
176
246
 
@@ -184,5 +254,3 @@ End every response with:
184
254
  - Integration struggle between tools
185
255
 
186
256
  **Before extracting:** Check `.safeword/learnings/` for existing similar learnings—update, don't duplicate.
187
-
188
- **Full workflow:** @./.safeword/guides/learning-extraction.md
@@ -20,7 +20,7 @@ When the user invokes this command:
20
20
 
21
21
  ## Example Usage
22
22
 
23
- ```
23
+ ```text
24
24
  /architecture
25
25
  ```
26
26
 
@@ -27,6 +27,7 @@ npm run lint:md 2>&1 || true
27
27
  ## Summary
28
28
 
29
29
  After running, report:
30
+
30
31
  1. Any ESLint errors that couldn't be auto-fixed
31
32
  2. Any formatting issues
32
33
  3. Type errors (if TypeScript)
@@ -23,7 +23,7 @@ When the user invokes this command:
23
23
 
24
24
  ## Example Usage
25
25
 
26
- ```
26
+ ```text
27
27
  /quality-review
28
28
  ```
29
29
 
@@ -0,0 +1,5 @@
1
+ ---
2
+ alwaysApply: true
3
+ ---
4
+
5
+ @.safeword/SAFEWORD.md
@@ -76,7 +76,7 @@ Boundaries enforced via `eslint-plugin-boundaries`. See `.safeword/guides/archit
76
76
 
77
77
  ### Relationships
78
78
 
79
- ```
79
+ ```text
80
80
  [Entity A] 1──n [Entity B]
81
81
  [Entity B] n──n [Entity C]
82
82
  ```
@@ -0,0 +1,151 @@
1
+ # Task: [Name]
2
+
3
+ **Guide**: `@./.safeword/guides/development-workflow.md`
4
+ **Template**: `@./.safeword/templates/task-spec-template.md`
5
+
6
+ ---
7
+
8
+ ## Standard Task (L1)
9
+
10
+ Use for: bugs, improvements, internal work, refactors.
11
+
12
+ ```markdown
13
+ # Task: [Name]
14
+
15
+ **Type:** Bug | Improvement | Internal | Refactor
16
+
17
+ **Scope:** [1-2 sentences describing what this task accomplishes]
18
+
19
+ **Out of Scope:** [Explicit boundaries - what this task does NOT include]
20
+
21
+ **Done When:**
22
+
23
+ - [ ] [Observable outcome 1]
24
+ - [ ] [Observable outcome 2]
25
+
26
+ **Tests:**
27
+
28
+ - [ ] [Test scenario 1 - what behavior to verify]
29
+ - [ ] [Test scenario 2 - edge case or secondary behavior]
30
+ ```
31
+
32
+ **Location:** `.safeword/planning/specs/task-[name].md`
33
+
34
+ ---
35
+
36
+ ## Micro Task (L0)
37
+
38
+ Use for: typos, config changes, trivial fixes. Still scoped to prevent creep.
39
+
40
+ ```markdown
41
+ # Task: [Name]
42
+
43
+ **Type:** Micro
44
+
45
+ **Scope:** [One sentence - exactly what is changing]
46
+
47
+ **Out of Scope:** [Boundaries - prevents "while I'm here" expansion]
48
+
49
+ **Done When:**
50
+
51
+ - [ ] [Single observable outcome]
52
+
53
+ **Tests:**
54
+
55
+ - [ ] Existing tests pass (no new test needed)
56
+ ```
57
+
58
+ **Location:** `.safeword/planning/specs/task-[name].md`
59
+
60
+ ---
61
+
62
+ ## Examples
63
+
64
+ ### L1: Bug Fix
65
+
66
+ ```markdown
67
+ # Task: Fix login timeout after 30 minutes
68
+
69
+ **Type:** Bug
70
+
71
+ **Scope:** Session refresh logic in auth middleware. User stays logged in if active.
72
+
73
+ **Out of Scope:** Session duration settings, auth flow changes, UI modifications.
74
+
75
+ **Done When:**
76
+
77
+ - [ ] User stays logged in if active within session window
78
+ - [ ] Session refreshes on API calls
79
+
80
+ **Tests:**
81
+
82
+ - [ ] Unit: session refresh extends expiry timestamp
83
+ - [ ] Unit: inactive session expires correctly after timeout
84
+ ```
85
+
86
+ ### L1: Improvement
87
+
88
+ ```markdown
89
+ # Task: Add retry logic to API client
90
+
91
+ **Type:** Improvement
92
+
93
+ **Scope:** Add exponential backoff retry for failed API requests in http client.
94
+
95
+ **Out of Scope:** Circuit breaker, rate limiting, request queuing, UI loading states.
96
+
97
+ **Done When:**
98
+
99
+ - [ ] Failed requests retry up to 3 times with exponential backoff
100
+ - [ ] Permanent failures (4xx) do not retry
101
+
102
+ **Tests:**
103
+
104
+ - [ ] Unit: retries on 5xx errors with backoff
105
+ - [ ] Unit: does not retry on 4xx errors
106
+ - [ ] Unit: gives up after max retries
107
+ ```
108
+
109
+ ### L0: Micro
110
+
111
+ ```markdown
112
+ # Task: Fix typo in auth error message
113
+
114
+ **Type:** Micro
115
+
116
+ **Scope:** Typo in login error ("authetication" → "authentication").
117
+
118
+ **Out of Scope:** Error handling logic, other error messages, refactoring.
119
+
120
+ **Done When:**
121
+
122
+ - [ ] Typo fixed in error message string
123
+
124
+ **Tests:**
125
+
126
+ - [ ] Existing auth tests pass
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Why L0 Needs Scope
132
+
133
+ Even trivial tasks need boundaries. Without explicit "Out of Scope":
134
+
135
+ - "Fix typo" becomes "improve all error messages"
136
+ - "Update config" becomes "refactor config system"
137
+ - "Rename variable" becomes "rename all related functions"
138
+
139
+ The spec takes 30 seconds to write and prevents hours of scope creep.
140
+
141
+ ---
142
+
143
+ ## Relationship to Feature Specs
144
+
145
+ | Type | Use When | Artifacts |
146
+ | --------------------- | --------------------------------------- | ------------------------------------ |
147
+ | **Feature Spec (L2)** | User-facing feature with business value | Feature spec + test definitions file |
148
+ | **Task Spec (L1)** | Bug, improvement, internal, refactor | Task spec with inline tests |
149
+ | **Task Spec (L0)** | Typo, config, trivial | Minimal task spec, existing tests |
150
+
151
+ For L2 features, use: `@./.safeword/templates/user-stories-template.md`
@@ -30,7 +30,7 @@ last_modified: YYYY-MM-DDTHH:MM:SSZ
30
30
 
31
31
  **Examples:**
32
32
 
33
- ```
33
+ ```text
34
34
  - 2025-11-24T18:50:00Z Started: Changing button background to red
35
35
  - 2025-11-24T18:51:30Z Tried: Added `background: red` to Button.css
36
36
  - 2025-11-24T18:52:00Z Found: Button now has white text on red (unreadable)
@@ -62,9 +62,7 @@ last_modified: YYYY-MM-DDTHH:MM:SSZ
62
62
 
63
63
  **In scope:**
64
64
 
65
- -
66
-
67
- **Out of scope:**
65
+ - **Out of scope:**
68
66
 
69
67
  -
70
68
 
@@ -99,7 +99,7 @@ Answer **IN ORDER**. Stop at the first "Yes":
99
99
 
100
100
  **✅ GOOD:**
101
101
 
102
- ```
102
+ ```plaintext
103
103
  project/
104
104
  ├── ARCHITECTURE.md
105
105
  └── docs/design/
@@ -273,7 +273,7 @@ Answer **IN ORDER**:
273
273
 
274
274
  ## File Organization
275
275
 
276
- ```
276
+ ```plaintext
277
277
  project/
278
278
  ├── ARCHITECTURE.md # Single comprehensive doc
279
279
  ├── .safeword/planning/
@@ -192,7 +192,7 @@ Before completing any work, verify:
192
192
  - Use descriptive commit messages
193
193
  - Make atomic commits (one logical change per commit)
194
194
 
195
- ```
195
+ ```text
196
196
  # ❌ Bad: "misc fixes"
197
197
  # ✅ Good: "fix: login button not responding to clicks"
198
198
  ```
@@ -61,7 +61,7 @@ Read it BEFORE working on any task in this project.
61
61
 
62
62
  **Example:**
63
63
 
64
- ```
64
+ ```text
65
65
  Working in: /project/src/feature/
66
66
  Loaded context:
67
67
  ✓ /project/CLAUDE.md (Claude-specific guidance)
@@ -96,7 +96,7 @@ See root AGENTS.md for TDD workflow. This file covers test-specific patterns.
96
96
 
97
97
  ## File Structure Pattern
98
98
 
99
- ```
99
+ ```plaintext
100
100
  project/
101
101
  ├─ SAFEWORD.md # Project context (references guides)
102
102
  ├─ CLAUDE.md # Claude-specific context
@@ -106,7 +106,7 @@ project/
106
106
 
107
107
  **Modular Approach (Recommended):**
108
108
 
109
- ```
109
+ ```plaintext
110
110
  project/
111
111
  ├─ AGENTS.md / CLAUDE.md # 50 lines: imports + structure
112
112
  ├─ docs/architecture.md # 100 lines: architecture decisions
@@ -137,14 +137,14 @@
137
137
 
138
138
  **Creating design doc:**
139
139
 
140
- ```
140
+ ```text
141
141
  User: "Create design doc for three-pane layout"
142
142
  You: [Read user stories and test definitions, then create design doc]
143
143
  ```
144
144
 
145
145
  **Updating design doc:**
146
146
 
147
- ```
147
+ ```text
148
148
  User: "Update design doc to add error handling section"
149
149
  You: [Read existing design doc, add Implementation Notes section with error handling]
150
150
  ```
@@ -46,7 +46,7 @@ Tests are the specification. When a test fails, the implementation is wrong—no
46
46
 
47
47
  ### Test Speed Hierarchy (Fast → Slow)
48
48
 
49
- ```
49
+ ```text
50
50
  Unit (milliseconds) ← Pure functions, no I/O
51
51
 
52
52
  Integration (seconds) ← Multiple modules, database, API calls
@@ -186,7 +186,7 @@ function calculateTotal(amount: number, taxRate: number): number {
186
186
 
187
187
  Answer these questions in order to choose the test type. Questions are mutually exclusive - stop at the first match. If multiple seem to apply, use the tie-breaking rule (line 19): choose the faster one.
188
188
 
189
- ```
189
+ ```text
190
190
  1. Does this test AI-generated content quality (tone, reasoning, creativity)?
191
191
  └─ YES → LLM Evaluation
192
192
  Examples: Narrative quality, prompt effectiveness, conversational naturalness
@@ -103,7 +103,7 @@ ls ./.safeword/learnings/*keyword*.md
103
103
 
104
104
  **Found existing learning** → Read and apply it:
105
105
 
106
- ```
106
+ ```text
107
107
  "I found an existing learning about [concept] at [path]. Let me read it and apply to your case..."
108
108
  [Read the file]
109
109
  "Based on the learning, here's how to handle this: [specific guidance from learning]"
@@ -113,7 +113,7 @@ ls ./.safeword/learnings/*keyword*.md
113
113
 
114
114
  **Similar but different** → Reference and note difference:
115
115
 
116
- ```
116
+ ```text
117
117
  "This is similar to the [existing learning] at [path], but differs in [specific way].
118
118
  The existing learning covers [X], but your case involves [Y]."
119
119
  ```
@@ -122,7 +122,7 @@ The existing learning covers [X], but your case involves [Y]."
122
122
 
123
123
  **Scenario 1: Found relevant learning**
124
124
 
125
- ```
125
+ ```text
126
126
  User: "I'm getting an async state update error with React hooks"
127
127
  → Check: ls .safeword/learnings/*react*.md *hooks*.md *async*.md
128
128
  → Found: react-hooks-async.md
@@ -133,7 +133,7 @@ User: "I'm getting an async state update error with React hooks"
133
133
 
134
134
  **Scenario 2: No existing learning**
135
135
 
136
- ```
136
+ ```text
137
137
  User: "IndexedDB quota is behaving strangely in Safari"
138
138
  → Check: ls .safeword/learnings/*indexeddb*.md *safari*.md *quota*.md
139
139
  → Not found
@@ -142,7 +142,7 @@ User: "IndexedDB quota is behaving strangely in Safari"
142
142
 
143
143
  **Scenario 3: Update existing learning**
144
144
 
145
- ```
145
+ ```text
146
146
  User: Debugging for 6 cycles, discovers new IndexedDB quirk
147
147
  → Suggest extraction
148
148
  → Check: ls .safeword/learnings/*indexeddb*.md
@@ -162,7 +162,7 @@ User: Debugging for 6 cycles, discovers new IndexedDB quirk
162
162
 
163
163
  ## Decision Tree
164
164
 
165
- ```
165
+ ```text
166
166
  Just learned something valuable
167
167
 
168
168
  ├─ Forward-looking? (useful on FUTURE work, not just this bug)
@@ -260,7 +260,7 @@ Actual: [What happened]
260
260
 
261
261
  [One-sentence takeaway]
262
262
 
263
- ````
263
+ ````text
264
264
 
265
265
  ---
266
266
 
@@ -481,7 +481,7 @@ Project-specific gotchas in `.safeword/learnings/`:
481
481
 
482
482
  ## Directory Structure
483
483
 
484
- ```
484
+ ```plaintext
485
485
  # Global learnings (all projects)
486
486
  .safeword/learnings/
487
487
  ├── react-state-async.md
@@ -506,7 +506,7 @@ Project-specific gotchas in `.safeword/learnings/`:
506
506
 
507
507
  **When to Split**:
508
508
 
509
- ```
509
+ ```text
510
510
  # TOO BIG (250 lines covering 3 separate concepts)
511
511
  .safeword/learnings/electron-gotchas.md
512
512