safeword 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check-3NGQ4NR5.js +129 -0
- package/dist/check-3NGQ4NR5.js.map +1 -0
- package/dist/chunk-2XWIUEQK.js +190 -0
- package/dist/chunk-2XWIUEQK.js.map +1 -0
- package/dist/chunk-GZRQL3SX.js +146 -0
- package/dist/chunk-GZRQL3SX.js.map +1 -0
- package/dist/chunk-ORQHKDT2.js +10 -0
- package/dist/chunk-ORQHKDT2.js.map +1 -0
- package/dist/chunk-W66Z3C5H.js +21 -0
- package/dist/chunk-W66Z3C5H.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +34 -0
- package/dist/cli.js.map +1 -0
- package/dist/diff-Y6QTAW4O.js +166 -0
- package/dist/diff-Y6QTAW4O.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/reset-3ACTIYYE.js +143 -0
- package/dist/reset-3ACTIYYE.js.map +1 -0
- package/dist/setup-RR4M334C.js +266 -0
- package/dist/setup-RR4M334C.js.map +1 -0
- package/dist/upgrade-6AR3DHUV.js +134 -0
- package/dist/upgrade-6AR3DHUV.js.map +1 -0
- package/package.json +44 -19
- package/{.safeword → templates}/hooks/agents-md-check.sh +0 -0
- package/{.safeword → templates}/hooks/post-tool.sh +0 -0
- package/{.safeword → templates}/hooks/pre-commit.sh +0 -0
- package/.claude/commands/arch-review.md +0 -32
- package/.claude/commands/lint.md +0 -6
- package/.claude/commands/quality-review.md +0 -13
- package/.claude/commands/setup-linting.md +0 -6
- package/.claude/hooks/auto-lint.sh +0 -6
- package/.claude/hooks/auto-quality-review.sh +0 -170
- package/.claude/hooks/check-linting-sync.sh +0 -17
- package/.claude/hooks/inject-timestamp.sh +0 -6
- package/.claude/hooks/question-protocol.sh +0 -12
- package/.claude/hooks/run-linters.sh +0 -8
- package/.claude/hooks/run-quality-review.sh +0 -76
- package/.claude/hooks/version-check.sh +0 -10
- package/.claude/mcp/README.md +0 -96
- package/.claude/mcp/arcade.sample.json +0 -9
- package/.claude/mcp/context7.sample.json +0 -7
- package/.claude/mcp/playwright.sample.json +0 -7
- package/.claude/settings.json +0 -62
- package/.claude/skills/quality-reviewer/SKILL.md +0 -190
- package/.claude/skills/safeword-quality-reviewer/SKILL.md +0 -13
- package/.env.arcade.example +0 -4
- package/.env.example +0 -11
- package/.gitmodules +0 -4
- package/.safeword/SAFEWORD.md +0 -33
- package/.safeword/eslint/eslint-base.mjs +0 -101
- package/.safeword/guides/architecture-guide.md +0 -404
- package/.safeword/guides/code-philosophy.md +0 -174
- package/.safeword/guides/context-files-guide.md +0 -405
- package/.safeword/guides/data-architecture-guide.md +0 -183
- package/.safeword/guides/design-doc-guide.md +0 -165
- package/.safeword/guides/learning-extraction.md +0 -515
- package/.safeword/guides/llm-instruction-design.md +0 -239
- package/.safeword/guides/llm-prompting.md +0 -95
- package/.safeword/guides/tdd-best-practices.md +0 -570
- package/.safeword/guides/test-definitions-guide.md +0 -243
- package/.safeword/guides/testing-methodology.md +0 -573
- package/.safeword/guides/user-story-guide.md +0 -237
- package/.safeword/guides/zombie-process-cleanup.md +0 -214
- package/.safeword/planning/002-user-story-quality-evaluation.md +0 -1840
- package/.safeword/planning/003-langsmith-eval-setup-prompt.md +0 -363
- package/.safeword/planning/004-llm-eval-test-cases.md +0 -3226
- package/.safeword/planning/005-architecture-enforcement-system.md +0 -169
- package/.safeword/planning/006-reactive-fix-prevention-research.md +0 -135
- package/.safeword/planning/011-cli-ux-vision.md +0 -330
- package/.safeword/planning/012-project-structure-cleanup.md +0 -154
- package/.safeword/planning/README.md +0 -39
- package/.safeword/planning/automation-plan-v2.md +0 -1225
- package/.safeword/planning/automation-plan-v3.md +0 -1291
- package/.safeword/planning/automation-plan.md +0 -3058
- package/.safeword/planning/design/005-cli-implementation.md +0 -343
- package/.safeword/planning/design/013-cli-self-contained-templates.md +0 -596
- package/.safeword/planning/design/013a-eslint-plugin-suite.md +0 -256
- package/.safeword/planning/design/013b-implementation-snippets.md +0 -385
- package/.safeword/planning/design/013c-config-isolation-strategy.md +0 -242
- package/.safeword/planning/design/code-philosophy-improvements.md +0 -60
- package/.safeword/planning/mcp-analysis.md +0 -545
- package/.safeword/planning/phase2-subagents-vs-skills-analysis.md +0 -451
- package/.safeword/planning/settings-improvements.md +0 -970
- package/.safeword/planning/test-definitions/005-cli-implementation.md +0 -1301
- package/.safeword/planning/test-definitions/cli-self-contained-templates.md +0 -205
- package/.safeword/planning/user-stories/001-guides-review-user-stories.md +0 -1381
- package/.safeword/planning/user-stories/003-reactive-fix-prevention.md +0 -132
- package/.safeword/planning/user-stories/004-technical-constraints.md +0 -86
- package/.safeword/planning/user-stories/005-cli-implementation.md +0 -311
- package/.safeword/planning/user-stories/cli-self-contained-templates.md +0 -172
- package/.safeword/planning/versioned-distribution.md +0 -740
- package/.safeword/prompts/arch-review.md +0 -43
- package/.safeword/prompts/quality-review.md +0 -11
- package/.safeword/scripts/arch-review.sh +0 -235
- package/.safeword/scripts/check-linting-sync.sh +0 -58
- package/.safeword/scripts/setup-linting.sh +0 -559
- package/.safeword/templates/architecture-template.md +0 -136
- package/.safeword/templates/ci/architecture-check.yml +0 -79
- package/.safeword/templates/design-doc-template.md +0 -127
- package/.safeword/templates/test-definitions-feature.md +0 -100
- package/.safeword/templates/ticket-template.md +0 -74
- package/.safeword/templates/user-stories-template.md +0 -82
- package/.safeword/tickets/001-guides-review-user-stories.md +0 -83
- package/.safeword/tickets/002-architecture-enforcement.md +0 -211
- package/.safeword/tickets/003-reactive-fix-prevention.md +0 -57
- package/.safeword/tickets/004-technical-constraints-in-user-stories.md +0 -39
- package/.safeword/tickets/005-cli-implementation.md +0 -248
- package/.safeword/tickets/006-flesh-out-skills.md +0 -43
- package/.safeword/tickets/007-flesh-out-questioning.md +0 -44
- package/.safeword/tickets/008-upgrade-questioning.md +0 -58
- package/.safeword/tickets/009-naming-conventions.md +0 -41
- package/.safeword/tickets/010-safeword-md-cleanup.md +0 -34
- package/.safeword/tickets/011-cursor-setup.md +0 -86
- package/.safeword/tickets/README.md +0 -73
- package/.safeword/version +0 -1
- package/AGENTS.md +0 -59
- package/CLAUDE.md +0 -12
- package/README.md +0 -347
- package/docs/001-cli-implementation-plan.md +0 -856
- package/docs/elite-dx-implementation-plan.md +0 -1034
- package/framework/README.md +0 -131
- package/framework/mcp/README.md +0 -96
- package/framework/mcp/arcade.sample.json +0 -8
- package/framework/mcp/context7.sample.json +0 -6
- package/framework/mcp/playwright.sample.json +0 -6
- package/framework/scripts/arch-review.sh +0 -235
- package/framework/scripts/check-linting-sync.sh +0 -58
- package/framework/scripts/load-env.sh +0 -49
- package/framework/scripts/setup-claude.sh +0 -223
- package/framework/scripts/setup-linting.sh +0 -559
- package/framework/scripts/setup-quality.sh +0 -477
- package/framework/scripts/setup-safeword.sh +0 -550
- package/framework/templates/ci/architecture-check.yml +0 -78
- package/learnings/ai-sdk-v5-breaking-changes.md +0 -178
- package/learnings/e2e-test-zombie-processes.md +0 -231
- package/learnings/milkdown-crepe-editor-property.md +0 -96
- package/learnings/prosemirror-fragment-traversal.md +0 -119
- package/packages/cli/AGENTS.md +0 -1
- package/packages/cli/ARCHITECTURE.md +0 -279
- package/packages/cli/package.json +0 -51
- package/packages/cli/src/cli.ts +0 -63
- package/packages/cli/src/commands/check.ts +0 -166
- package/packages/cli/src/commands/diff.ts +0 -209
- package/packages/cli/src/commands/reset.ts +0 -190
- package/packages/cli/src/commands/setup.ts +0 -325
- package/packages/cli/src/commands/upgrade.ts +0 -163
- package/packages/cli/src/index.ts +0 -3
- package/packages/cli/src/templates/config.ts +0 -58
- package/packages/cli/src/templates/content.ts +0 -18
- package/packages/cli/src/templates/index.ts +0 -12
- package/packages/cli/src/utils/agents-md.ts +0 -66
- package/packages/cli/src/utils/fs.ts +0 -179
- package/packages/cli/src/utils/git.ts +0 -124
- package/packages/cli/src/utils/hooks.ts +0 -29
- package/packages/cli/src/utils/output.ts +0 -60
- package/packages/cli/src/utils/project-detector.test.ts +0 -185
- package/packages/cli/src/utils/project-detector.ts +0 -44
- package/packages/cli/src/utils/version.ts +0 -28
- package/packages/cli/src/version.ts +0 -6
- package/packages/cli/templates/SAFEWORD.md +0 -776
- package/packages/cli/templates/doc-templates/architecture-template.md +0 -136
- package/packages/cli/templates/doc-templates/design-doc-template.md +0 -134
- package/packages/cli/templates/doc-templates/test-definitions-feature.md +0 -131
- package/packages/cli/templates/doc-templates/ticket-template.md +0 -82
- package/packages/cli/templates/doc-templates/user-stories-template.md +0 -92
- package/packages/cli/templates/guides/architecture-guide.md +0 -423
- package/packages/cli/templates/guides/code-philosophy.md +0 -195
- package/packages/cli/templates/guides/context-files-guide.md +0 -457
- package/packages/cli/templates/guides/data-architecture-guide.md +0 -200
- package/packages/cli/templates/guides/design-doc-guide.md +0 -171
- package/packages/cli/templates/guides/learning-extraction.md +0 -552
- package/packages/cli/templates/guides/llm-instruction-design.md +0 -248
- package/packages/cli/templates/guides/llm-prompting.md +0 -102
- package/packages/cli/templates/guides/tdd-best-practices.md +0 -615
- package/packages/cli/templates/guides/test-definitions-guide.md +0 -334
- package/packages/cli/templates/guides/testing-methodology.md +0 -618
- package/packages/cli/templates/guides/user-story-guide.md +0 -256
- package/packages/cli/templates/guides/zombie-process-cleanup.md +0 -219
- package/packages/cli/templates/hooks/agents-md-check.sh +0 -27
- package/packages/cli/templates/hooks/post-tool.sh +0 -4
- package/packages/cli/templates/hooks/pre-commit.sh +0 -10
- package/packages/cli/templates/prompts/arch-review.md +0 -43
- package/packages/cli/templates/prompts/quality-review.md +0 -10
- package/packages/cli/templates/skills/safeword-quality-reviewer/SKILL.md +0 -207
- package/packages/cli/tests/commands/check.test.ts +0 -129
- package/packages/cli/tests/commands/cli.test.ts +0 -89
- package/packages/cli/tests/commands/diff.test.ts +0 -115
- package/packages/cli/tests/commands/reset.test.ts +0 -310
- package/packages/cli/tests/commands/self-healing.test.ts +0 -170
- package/packages/cli/tests/commands/setup-blocking.test.ts +0 -71
- package/packages/cli/tests/commands/setup-core.test.ts +0 -135
- package/packages/cli/tests/commands/setup-git.test.ts +0 -139
- package/packages/cli/tests/commands/setup-hooks.test.ts +0 -334
- package/packages/cli/tests/commands/setup-linting.test.ts +0 -189
- package/packages/cli/tests/commands/setup-noninteractive.test.ts +0 -80
- package/packages/cli/tests/commands/setup-templates.test.ts +0 -181
- package/packages/cli/tests/commands/upgrade.test.ts +0 -215
- package/packages/cli/tests/helpers.ts +0 -243
- package/packages/cli/tests/npm-package.test.ts +0 -83
- package/packages/cli/tests/technical-constraints.test.ts +0 -96
- package/packages/cli/tsconfig.json +0 -25
- package/packages/cli/tsup.config.ts +0 -11
- package/packages/cli/vitest.config.ts +0 -23
- package/promptfoo.yaml +0 -3270
- /package/{framework → templates}/SAFEWORD.md +0 -0
- /package/{packages/cli/templates → templates}/commands/arch-review.md +0 -0
- /package/{packages/cli/templates → templates}/commands/lint.md +0 -0
- /package/{packages/cli/templates → templates}/commands/quality-review.md +0 -0
- /package/{framework/templates → templates/doc-templates}/architecture-template.md +0 -0
- /package/{framework/templates → templates/doc-templates}/design-doc-template.md +0 -0
- /package/{framework/templates → templates/doc-templates}/test-definitions-feature.md +0 -0
- /package/{framework/templates → templates/doc-templates}/ticket-template.md +0 -0
- /package/{framework/templates → templates/doc-templates}/user-stories-template.md +0 -0
- /package/{framework → templates}/guides/architecture-guide.md +0 -0
- /package/{framework → templates}/guides/code-philosophy.md +0 -0
- /package/{framework → templates}/guides/context-files-guide.md +0 -0
- /package/{framework → templates}/guides/data-architecture-guide.md +0 -0
- /package/{framework → templates}/guides/design-doc-guide.md +0 -0
- /package/{framework → templates}/guides/learning-extraction.md +0 -0
- /package/{framework → templates}/guides/llm-instruction-design.md +0 -0
- /package/{framework → templates}/guides/llm-prompting.md +0 -0
- /package/{framework → templates}/guides/tdd-best-practices.md +0 -0
- /package/{framework → templates}/guides/test-definitions-guide.md +0 -0
- /package/{framework → templates}/guides/testing-methodology.md +0 -0
- /package/{framework → templates}/guides/user-story-guide.md +0 -0
- /package/{framework → templates}/guides/zombie-process-cleanup.md +0 -0
- /package/{packages/cli/templates → templates}/hooks/inject-timestamp.sh +0 -0
- /package/{packages/cli/templates → templates}/lib/common.sh +0 -0
- /package/{packages/cli/templates → templates}/lib/jq-fallback.sh +0 -0
- /package/{packages/cli/templates → templates}/markdownlint.jsonc +0 -0
- /package/{framework → templates}/prompts/arch-review.md +0 -0
- /package/{framework → templates}/prompts/quality-review.md +0 -0
- /package/{framework/skills/quality-reviewer → templates/skills/safeword-quality-reviewer}/SKILL.md +0 -0
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Design Doc Guide for Claude Code
|
|
2
|
-
|
|
3
|
-
## How to Fill Out Design Doc
|
|
4
|
-
|
|
5
|
-
**Template:** `@.safeword/templates/design-doc-template.md`
|
|
6
|
-
|
|
7
|
-
**When user asks:** "Create design doc for [feature]" or "Design [system/component]"
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## What You Do
|
|
12
|
-
|
|
13
|
-
1. **Verify Prerequisites**
|
|
14
|
-
- Confirm user stories exist (if not, create them first)
|
|
15
|
-
- Confirm test definitions exist (if not, create them first)
|
|
16
|
-
- Reference both in the design doc
|
|
17
|
-
|
|
18
|
-
2. **Read Template**
|
|
19
|
-
- Read `@.safeword/templates/design-doc-template.md`
|
|
20
|
-
- Use it as the structure for the design doc
|
|
21
|
-
|
|
22
|
-
3. **Fill In Sections**
|
|
23
|
-
|
|
24
|
-
**Architecture:**
|
|
25
|
-
- 1-2 paragraphs: High-level approach
|
|
26
|
-
- What are we building and how does it fit together?
|
|
27
|
-
- Add diagram if helpful (optional)
|
|
28
|
-
|
|
29
|
-
**Components:**
|
|
30
|
-
- Define Component [N] with full example (name, responsibility, interface, dependencies, tests)
|
|
31
|
-
- Define Component [N+1] with different example (show the [N]/[N+1] pattern)
|
|
32
|
-
- Add more components as needed (N+2, N+3, etc.)
|
|
33
|
-
|
|
34
|
-
**Data Model (if applicable):**
|
|
35
|
-
- State shape, database schema, or data structures
|
|
36
|
-
- Show relationships between types
|
|
37
|
-
- How data flows through the system
|
|
38
|
-
|
|
39
|
-
**Component Interaction (if applicable):**
|
|
40
|
-
- How components communicate
|
|
41
|
-
- Data flow between them (Component [N] → Component [N+1])
|
|
42
|
-
- Events/method calls
|
|
43
|
-
|
|
44
|
-
**User Flow:**
|
|
45
|
-
- Step-by-step user interaction
|
|
46
|
-
- Use concrete examples (e.g., "clicks 'Toggle AI Pane' button, presses Cmd+J")
|
|
47
|
-
|
|
48
|
-
**Key Decisions:**
|
|
49
|
-
- Decision [N]: What we're using/doing, why (with specifics), trade-off
|
|
50
|
-
- Decision [N+1]: Different decision (show the [N]/[N+1] pattern)
|
|
51
|
-
- Add more decisions as needed
|
|
52
|
-
|
|
53
|
-
**Implementation Notes (if applicable):**
|
|
54
|
-
- Constraints (technical limitations, performance requirements)
|
|
55
|
-
- Error Handling (how errors are caught, user-facing vs internal)
|
|
56
|
-
- Gotchas (edge cases, common mistakes)
|
|
57
|
-
- Open Questions (blocking questions, needs research)
|
|
58
|
-
|
|
59
|
-
**References (if applicable):**
|
|
60
|
-
- Link to relevant ADRs, external docs, proof of concepts
|
|
61
|
-
|
|
62
|
-
4. **Save to Project**
|
|
63
|
-
- Save to `planning/design/[feature-name]-design.md` or similar location
|
|
64
|
-
- Follow project's convention for design doc location
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## DO Include
|
|
69
|
-
|
|
70
|
-
- ✅ Clear component interfaces with TypeScript examples
|
|
71
|
-
- ✅ Full [N] and [N+1] examples (like user stories and test definitions templates)
|
|
72
|
-
- ✅ References to user stories and test definitions (don't duplicate them)
|
|
73
|
-
- ✅ User flow with concrete examples
|
|
74
|
-
- ✅ Key decisions with "what, why, trade-off"
|
|
75
|
-
- ✅ Rationale with specifics (metrics, benchmarks, analysis)
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## DON'T Include
|
|
80
|
-
|
|
81
|
-
- ❌ Duplicating user stories (reference them instead)
|
|
82
|
-
- ❌ Duplicating test definitions (reference them instead)
|
|
83
|
-
- ❌ Project-wide architecture decisions (those go in ARCHITECTURE.md)
|
|
84
|
-
- ❌ Implementation details that should be in code comments
|
|
85
|
-
- ❌ Generic advice without project-specific context
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## When to Use Design Doc vs Architecture Doc
|
|
90
|
-
|
|
91
|
-
**Use Design Doc when:**
|
|
92
|
-
- Designing a specific feature implementation
|
|
93
|
-
- Need component breakdown and interactions
|
|
94
|
-
- Feature-specific technical decisions
|
|
95
|
-
- 2-3 pages (~121 lines)
|
|
96
|
-
|
|
97
|
-
**Use Architecture Doc when:**
|
|
98
|
-
- Project-wide technology choices
|
|
99
|
-
- Data model for entire system
|
|
100
|
-
- Principles and patterns for the whole project
|
|
101
|
-
- Comprehensive (10+ pages)
|
|
102
|
-
|
|
103
|
-
**Reference:** `@.safeword/guides/architecture-guide.md` for detailed comparison
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Re-evaluation Path (When Unclear)
|
|
108
|
-
|
|
109
|
-
**If unsure whether feature needs a design doc:**
|
|
110
|
-
|
|
111
|
-
1. **Count components** — Does implementation touch >3 components?
|
|
112
|
-
- Yes → Design doc needed
|
|
113
|
-
- No → Continue to question 2
|
|
114
|
-
|
|
115
|
-
2. **Check user story count** — Does feature span 2+ user stories?
|
|
116
|
-
- Yes → Design doc needed
|
|
117
|
-
- No → Continue to question 3
|
|
118
|
-
|
|
119
|
-
3. **Check complexity signals** — Any of these present?
|
|
120
|
-
- New data model or schema changes
|
|
121
|
-
- Non-obvious component interactions
|
|
122
|
-
- Multiple technical decisions with trade-offs
|
|
123
|
-
- Yes to any → Design doc needed
|
|
124
|
-
- No to all → Skip design doc, implement directly
|
|
125
|
-
|
|
126
|
-
**If prerequisites don't exist:**
|
|
127
|
-
1. User stories missing → Create them first (guide: `@.safeword/guides/user-story-guide.md`)
|
|
128
|
-
2. Test definitions missing → Create them after user stories (guide: `@.safeword/guides/test-definitions-guide.md`)
|
|
129
|
-
3. Then create design doc referencing both
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Example Commands
|
|
134
|
-
|
|
135
|
-
**Creating design doc:**
|
|
136
|
-
```
|
|
137
|
-
User: "Create design doc for three-pane layout"
|
|
138
|
-
You: [Read user stories and test definitions, then create design doc]
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Updating design doc:**
|
|
142
|
-
```
|
|
143
|
-
User: "Update design doc to add error handling section"
|
|
144
|
-
You: [Read existing design doc, add Implementation Notes section with error handling]
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Quality Checklist
|
|
150
|
-
|
|
151
|
-
Before saving, verify:
|
|
152
|
-
- ✓ References user stories and test definitions (not duplicates them)
|
|
153
|
-
- ✓ Has Component [N] and Component [N+1] examples
|
|
154
|
-
- ✓ User flow has concrete examples
|
|
155
|
-
- ✓ Key decisions have "what, why, trade-off"
|
|
156
|
-
- ✓ All optional sections marked "(if applicable)"
|
|
157
|
-
- ✓ ~121 lines (concise, LLM-optimized)
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## LLM Instruction Design
|
|
162
|
-
|
|
163
|
-
**Important:** Design docs are instructions that LLMs read and follow.
|
|
164
|
-
|
|
165
|
-
**See:** `@.safeword/guides/llm-instruction-design.md` for comprehensive framework on writing clear, actionable documentation that LLMs can reliably follow.
|
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
# Learning Extraction Process
|
|
2
|
-
|
|
3
|
-
Extract reusable knowledge from debugging sessions and implementation discoveries. Ensures insights compound across sessions.
|
|
4
|
-
|
|
5
|
-
**LLM Instruction Design:** Learnings are documentation that LLMs read and follow. Apply best practices from `@.safeword/guides/llm-instruction-design.md` when writing learning files (concrete examples, explicit definitions, MECE principles).
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## When to Extract (Recognition Triggers)
|
|
10
|
-
|
|
11
|
-
**Note:** LLMs cannot sense time. Use observable signals instead of duration.
|
|
12
|
-
|
|
13
|
-
Extract after experiencing ANY of these:
|
|
14
|
-
|
|
15
|
-
1. **Observable debugging complexity** - Any of these signals:
|
|
16
|
-
- User says "still debugging", "been stuck on this", "tried many things"
|
|
17
|
-
- 5+ debug cycles (Read → Edit → Bash pattern repeated)
|
|
18
|
-
- 3+ different error states encountered
|
|
19
|
-
- Modified 3+ files while debugging same issue
|
|
20
|
-
2. **Trial and error** - Tried 3+ different approaches before finding the right one
|
|
21
|
-
3. **Undocumented gotcha** - Not in official library/framework docs
|
|
22
|
-
4. **Integration struggle** - Two tools that don't work together smoothly
|
|
23
|
-
5. **Testing trap** - Tests pass but UX is broken (or vice versa)
|
|
24
|
-
6. **Architectural insight** - Discovered during implementation, not planned upfront
|
|
25
|
-
|
|
26
|
-
**Key question:** "Would this save time on future work in this codebase (or any codebase)?"
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## File Locations
|
|
31
|
-
|
|
32
|
-
**Global learnings** (`.safeword/learnings/[concept].md`):
|
|
33
|
-
- **Why**: Applies to ALL your projects (React patterns, Git workflows)
|
|
34
|
-
- **Scope**: Personal directory (not shared)
|
|
35
|
-
- **Use case**: Generic programming knowledge
|
|
36
|
-
|
|
37
|
-
**Project learnings** (`./.safeword/learnings/[concept].md`):
|
|
38
|
-
- **Why**: Specific to THIS codebase (custom architecture, unique patterns)
|
|
39
|
-
- **Scope**: Shared via git (team knowledge base)
|
|
40
|
-
- **Use case**: Project-specific gotchas
|
|
41
|
-
|
|
42
|
-
**Historical archives** (`./.safeword/learnings/archive/[bug-fix].md`):
|
|
43
|
-
- **Why**: One-time debugging narratives (not forward-looking)
|
|
44
|
-
- **Scope**: Shared via git (learning history)
|
|
45
|
-
- **Use case**: Reference when similar bugs occur
|
|
46
|
-
|
|
47
|
-
**Cascading Precedence** (both Claude Code and SAFEWORD.md):
|
|
48
|
-
1. Explicit user instruction (highest priority)
|
|
49
|
-
2. Project `./.safeword/learnings/` (project-specific)
|
|
50
|
-
3. Global `.safeword/learnings/` (personal defaults)
|
|
51
|
-
4. Project `./SAFEWORD.md` → Common Gotchas (inline reference)
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Using Existing Learnings
|
|
56
|
-
|
|
57
|
-
**CRITICAL**: Before extracting new learnings, ALWAYS check if similar learnings already exist. This prevents duplication and keeps knowledge organized.
|
|
58
|
-
|
|
59
|
-
### When to Check for Existing Learnings
|
|
60
|
-
|
|
61
|
-
**Check PROACTIVELY in these situations:**
|
|
62
|
-
|
|
63
|
-
1. **Before debugging** - Check if similar issue has learning already
|
|
64
|
-
```bash
|
|
65
|
-
ls .safeword/learnings/*[technology]*.md
|
|
66
|
-
ls ./learnings/*[pattern]*.md
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. **When user mentions technology/pattern** - Check for relevant learnings
|
|
70
|
-
- User says "React hooks" → Check for `*hooks*.md`
|
|
71
|
-
- User says "Electron IPC" → Check for `*electron*.md` or `*ipc*.md`
|
|
72
|
-
- User says "state management" → Check for `*state*.md`
|
|
73
|
-
|
|
74
|
-
3. **During architectural discussions** - Check for pattern learnings
|
|
75
|
-
- Discussing patterns → Check for `*pattern*.md` or `*architecture*.md`
|
|
76
|
-
|
|
77
|
-
4. **After suggesting extraction** - Check if learning already exists
|
|
78
|
-
- If found → Suggest updating existing learning instead of creating duplicate
|
|
79
|
-
- If not found → Proceed with extraction
|
|
80
|
-
|
|
81
|
-
### How to Check
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# Global learnings (all projects)
|
|
85
|
-
ls .safeword/learnings/
|
|
86
|
-
|
|
87
|
-
# Search global learnings by keyword
|
|
88
|
-
ls .safeword/learnings/*keyword*.md
|
|
89
|
-
|
|
90
|
-
# Project learnings (current project)
|
|
91
|
-
ls ./.safeword/learnings/
|
|
92
|
-
|
|
93
|
-
# Search project learnings by keyword
|
|
94
|
-
ls ./.safeword/learnings/*keyword*.md
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### When to Reference Existing Learnings
|
|
98
|
-
|
|
99
|
-
**Found existing learning** → Read and apply it:
|
|
100
|
-
```
|
|
101
|
-
"I found an existing learning about [concept] at [path]. Let me read it and apply to your case..."
|
|
102
|
-
[Read the file]
|
|
103
|
-
"Based on the learning, here's how to handle this: [specific guidance from learning]"
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**No existing learning** → Proceed normally (no message needed)
|
|
107
|
-
|
|
108
|
-
**Similar but different** → Reference and note difference:
|
|
109
|
-
```
|
|
110
|
-
"This is similar to the [existing learning] at [path], but differs in [specific way].
|
|
111
|
-
The existing learning covers [X], but your case involves [Y]."
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Example Workflow
|
|
115
|
-
|
|
116
|
-
**Scenario 1: Found relevant learning**
|
|
117
|
-
```
|
|
118
|
-
User: "I'm getting an async state update error with React hooks"
|
|
119
|
-
→ Check: ls .safeword/learnings/*react*.md *hooks*.md *async*.md
|
|
120
|
-
→ Found: react-hooks-async.md
|
|
121
|
-
→ Read: [file contents]
|
|
122
|
-
→ Apply: "I found a learning about async React hooks. It mentions you should use useEffect
|
|
123
|
-
for side effects, not setState directly in callbacks. Applying this to your case..."
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**Scenario 2: No existing learning**
|
|
127
|
-
```
|
|
128
|
-
User: "IndexedDB quota is behaving strangely in Safari"
|
|
129
|
-
→ Check: ls .safeword/learnings/*indexeddb*.md *safari*.md *quota*.md
|
|
130
|
-
→ Not found
|
|
131
|
-
→ Proceed: Continue debugging normally, suggest extraction if triggers match
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Scenario 3: Update existing learning**
|
|
135
|
-
```
|
|
136
|
-
User: Debugging for 6 cycles, discovers new IndexedDB quirk
|
|
137
|
-
→ Suggest extraction
|
|
138
|
-
→ Check: ls .safeword/learnings/*indexeddb*.md
|
|
139
|
-
→ Found: indexeddb-quota-api.md
|
|
140
|
-
→ Suggest: "I found an existing learning about IndexedDB quota. Should I update it with
|
|
141
|
-
this new discovery instead of creating a separate learning?"
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Benefits of Checking Existing Learnings
|
|
145
|
-
|
|
146
|
-
✅ **Prevents duplication** - One learning per concept, easier to find
|
|
147
|
-
✅ **Compounds knowledge** - Update existing learnings with new discoveries
|
|
148
|
-
✅ **Faster problem solving** - Apply known patterns immediately
|
|
149
|
-
✅ **Better organization** - Learnings directory stays clean and navigable
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Decision Tree
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
Just learned something valuable
|
|
157
|
-
│
|
|
158
|
-
├─ Forward-looking? (useful on FUTURE work, not just this bug)
|
|
159
|
-
│ ├─ YES → Continue
|
|
160
|
-
│ └─ NO → .safeword/learnings/archive/[bug-fix].md (optional)
|
|
161
|
-
│
|
|
162
|
-
├─ Applies to ALL projects or just THIS one?
|
|
163
|
-
│ │
|
|
164
|
-
│ ├─ ALL PROJECTS
|
|
165
|
-
│ │ └─ Extract to: .safeword/learnings/[concept].md
|
|
166
|
-
│ │ Examples: "React hooks gotchas", "Electron IPC patterns"
|
|
167
|
-
│ │
|
|
168
|
-
│ └─ THIS PROJECT ONLY
|
|
169
|
-
│ │
|
|
170
|
-
│ ├─ Architectural? (why we chose X over Y)
|
|
171
|
-
│ │ └─ YES → Add to: SAFEWORD.md "Architecture Decisions"
|
|
172
|
-
│ │
|
|
173
|
-
│ ├─ Short gotcha? (1-2 sentences + code snippet)
|
|
174
|
-
│ │ └─ YES → Add to: SAFEWORD.md "Common Gotchas"
|
|
175
|
-
│ │
|
|
176
|
-
│ └─ Needs examples/explanation?
|
|
177
|
-
│ └─ YES → Extract to: ./.safeword/learnings/[concept].md
|
|
178
|
-
│ Then cross-reference in SAFEWORD.md
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## Templates
|
|
184
|
-
|
|
185
|
-
### Forward-Looking Learning (.safeword/learnings/)
|
|
186
|
-
|
|
187
|
-
**Use when:** Pattern applies to 2+ features/files, needs explanation
|
|
188
|
-
|
|
189
|
-
**Structure:**
|
|
190
|
-
```markdown
|
|
191
|
-
# [Concept Name]
|
|
192
|
-
|
|
193
|
-
**Principle:** One-sentence summary
|
|
194
|
-
|
|
195
|
-
## The Gotcha
|
|
196
|
-
|
|
197
|
-
What breaks if you don't know this:
|
|
198
|
-
|
|
199
|
-
❌ **Bad:** [Anti-pattern]
|
|
200
|
-
✅ **Good:** [Correct pattern]
|
|
201
|
-
|
|
202
|
-
**Why it matters:** [User impact or technical consequence]
|
|
203
|
-
|
|
204
|
-
## Examples
|
|
205
|
-
|
|
206
|
-
[2-3 concrete before/after code examples]
|
|
207
|
-
|
|
208
|
-
## Testing Trap (if applicable)
|
|
209
|
-
|
|
210
|
-
[How tests might pass while UX is broken]
|
|
211
|
-
|
|
212
|
-
## Reference
|
|
213
|
-
|
|
214
|
-
See `.safeword/learnings/archive/[investigation].md` for full debugging narrative.
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Debugging Narrative (.safeword/learnings/archive/)
|
|
218
|
-
|
|
219
|
-
**Use when:** One-time bug fix, historical record
|
|
220
|
-
|
|
221
|
-
**Structure:**
|
|
222
|
-
```markdown
|
|
223
|
-
# [Issue Title]
|
|
224
|
-
|
|
225
|
-
**Date:** YYYY-MM-DD
|
|
226
|
-
**Root Cause:** One-sentence explanation
|
|
227
|
-
|
|
228
|
-
## Problem
|
|
229
|
-
|
|
230
|
-
Expected: [What should happen]
|
|
231
|
-
Actual: [What happened]
|
|
232
|
-
|
|
233
|
-
## Investigation
|
|
234
|
-
|
|
235
|
-
1. [Hypothesis] → [Outcome]
|
|
236
|
-
2. [Hypothesis] → [Outcome]
|
|
237
|
-
3. [Discovery] → [Fix]
|
|
238
|
-
|
|
239
|
-
## Solution
|
|
240
|
-
|
|
241
|
-
```diff
|
|
242
|
-
- Old broken code
|
|
243
|
-
+ New fixed code
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
## Lesson
|
|
247
|
-
|
|
248
|
-
[One-sentence takeaway]
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## SAFEWORD.md Integration
|
|
254
|
-
|
|
255
|
-
**CRITICAL**: ALWAYS cross-reference in SAFEWORD.md after creating learning file.
|
|
256
|
-
|
|
257
|
-
After extracting to `.safeword/learnings/`, add cross-reference in SAFEWORD.md:
|
|
258
|
-
|
|
259
|
-
```markdown
|
|
260
|
-
## Common Gotchas
|
|
261
|
-
|
|
262
|
-
Project-specific gotchas in `.safeword/learnings/`:
|
|
263
|
-
|
|
264
|
-
- **Persistent UI Placement** - Controls in LayoutBar (always visible), not EditorTabBar (conditional) → `.safeword/learnings/persistent-ui.md`
|
|
265
|
-
- **Electron Renderer Context** - Renderer = browser, not Node.js; use `split(/[/\\]/)` for paths → `.safeword/learnings/electron-contexts.md`
|
|
266
|
-
|
|
267
|
-
**Additional gotchas:**
|
|
268
|
-
- Tab state timing: Add tab first (trigger render), wait 50ms, load content
|
|
269
|
-
- File validation: Whitelist extensions before operations
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
**Pattern:** Bold name + one-sentence summary + optional link
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## Examples: What Goes Where
|
|
277
|
-
|
|
278
|
-
### ✅ Global (.safeword/learnings/)
|
|
279
|
-
|
|
280
|
-
**Learning:** "React useState updates are async - use useEffect for side effects"
|
|
281
|
-
|
|
282
|
-
**Why global:** Applies to ANY React project
|
|
283
|
-
|
|
284
|
-
**File:** `.safeword/learnings/react-state-async.md`
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
### ✅ Project Architecture (SAFEWORD.md)
|
|
289
|
-
|
|
290
|
-
**Learning:** "Why Zustand over Redux?"
|
|
291
|
-
|
|
292
|
-
**Why SAFEWORD.md:** Architectural decision unique to this project
|
|
293
|
-
|
|
294
|
-
**Location:** `SAFEWORD.md` → Architecture Decisions section
|
|
295
|
-
|
|
296
|
-
```markdown
|
|
297
|
-
### Why Zustand over Redux/MobX?
|
|
298
|
-
|
|
299
|
-
**Decision:** Zustand for all UI state
|
|
300
|
-
|
|
301
|
-
**Why:**
|
|
302
|
-
- Single-user desktop app = simple state
|
|
303
|
-
- 1KB vs Redux's 10KB+ boilerplate
|
|
304
|
-
- Hooks-based, TypeScript-first
|
|
305
|
-
|
|
306
|
-
**Trade-off:** No time-travel debugging, but not needed
|
|
307
|
-
|
|
308
|
-
**Gotcha:** NEVER import stores in store definitions (circular deps)
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
### ✅ Project Learning (.safeword/learnings/)
|
|
314
|
-
|
|
315
|
-
**Learning:** "UI controls must be in persistent areas, not conditional components"
|
|
316
|
-
|
|
317
|
-
**Why learnings/:** Applies to multiple features (layout, toolbar, status) in THIS project
|
|
318
|
-
|
|
319
|
-
**File:** `.safeword/learnings/persistent-ui.md`
|
|
320
|
-
|
|
321
|
-
**Cross-ref:** Link from `SAFEWORD.md` → Common Gotchas
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
### ❌ Archive (.safeword/learnings/archive/)
|
|
326
|
-
|
|
327
|
-
**Learning:** "Electron tests failed because forgot to build"
|
|
328
|
-
|
|
329
|
-
**Why archive:** One-time gotcha - after learning once, don't need full narrative
|
|
330
|
-
|
|
331
|
-
**File:** `.safeword/learnings/archive/electron-build-forgotten.md`
|
|
332
|
-
|
|
333
|
-
**Note:** Short gotcha goes in SAFEWORD.md: "Electron tests use built files - run `npm run build` first"
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## When Claude Should Suggest Extraction
|
|
338
|
-
|
|
339
|
-
**High confidence - Suggest IMMEDIATELY DURING debugging:**
|
|
340
|
-
- Observable debugging complexity (5+ debug cycles, 3+ error states, user says "stuck")
|
|
341
|
-
- Just discovered gotcha not in official docs
|
|
342
|
-
- Just found anti-pattern (violated best practice)
|
|
343
|
-
- Say: "I notice this pattern could save time on future work. Should I extract a learning after we fix this?"
|
|
344
|
-
|
|
345
|
-
**Medium confidence - Ask AFTER completing task:**
|
|
346
|
-
- "I noticed [pattern X] during implementation - should I document this as a learning?"
|
|
347
|
-
|
|
348
|
-
**Low confidence - Don't suggest:**
|
|
349
|
-
- Simple fix (1 debug cycle, typo, user says "quick fix")
|
|
350
|
-
- Well-documented in official library docs
|
|
351
|
-
- One-off implementation detail
|
|
352
|
-
|
|
353
|
-
---
|
|
354
|
-
|
|
355
|
-
## Iteration & Refinement
|
|
356
|
-
|
|
357
|
-
**Living Documentation**: This process evolves with your needs.
|
|
358
|
-
|
|
359
|
-
**Review Cycle**:
|
|
360
|
-
1. **Monthly**: Review existing learnings for relevance
|
|
361
|
-
2. **Quarterly**: Archive obsolete learnings (technology changed, pattern no longer used)
|
|
362
|
-
3. **Per feature**: After major features, assess if new learnings emerged
|
|
363
|
-
|
|
364
|
-
**Test the Process**:
|
|
365
|
-
- Did extracting this learning actually help on the next feature?
|
|
366
|
-
- Are learnings being referenced in future conversations?
|
|
367
|
-
- Are the examples clear and actionable?
|
|
368
|
-
|
|
369
|
-
**Remove When**:
|
|
370
|
-
- Technology deprecated (e.g., "Webpack 4 gotchas" when using Vite)
|
|
371
|
-
- Pattern no longer used (e.g., class components → functional components)
|
|
372
|
-
- Merged into official documentation (library now documents the gotcha)
|
|
373
|
-
|
|
374
|
-
**Refactor When**:
|
|
375
|
-
- Multiple learnings cover similar topics → consolidate
|
|
376
|
-
- Learning file >200 lines → split into focused topics
|
|
377
|
-
- Examples are outdated → update or remove
|
|
378
|
-
- Wording is unclear → simplify
|
|
379
|
-
|
|
380
|
-
**Feedback Loop**:
|
|
381
|
-
- After suggesting extraction: Note if user accepted or declined
|
|
382
|
-
- After user accepts: Monitor if learning is referenced in future sessions
|
|
383
|
-
- Adjust suggestion threshold based on acceptance rate (if <30% accepted, raise the bar)
|
|
384
|
-
|
|
385
|
-
---
|
|
386
|
-
|
|
387
|
-
## Workflow Integration
|
|
388
|
-
|
|
389
|
-
### During Development
|
|
390
|
-
|
|
391
|
-
1. **Recognize trigger** - Spent 45 min debugging race condition
|
|
392
|
-
2. **Assess scope** - Forward-looking? (YES) Global or project? (Project)
|
|
393
|
-
3. **Choose location** - Needs examples → `.safeword/learnings/race-conditions.md`
|
|
394
|
-
4. **Extract** - Use template, write before/after examples
|
|
395
|
-
5. **Cross-reference** - Add to SAFEWORD.md Common Gotchas
|
|
396
|
-
|
|
397
|
-
### After Completing Feature
|
|
398
|
-
|
|
399
|
-
1. **Review** - Did we learn anything reusable?
|
|
400
|
-
2. **Extract** - If threshold met (>30min debug, non-obvious pattern)
|
|
401
|
-
3. **Update** - Add SAFEWORD.md cross-reference if needed
|
|
402
|
-
4. **Commit** - Include learning in commit message
|
|
403
|
-
|
|
404
|
-
---
|
|
405
|
-
|
|
406
|
-
## Anti-Patterns (Don't Extract)
|
|
407
|
-
|
|
408
|
-
❌ **Well-documented in official docs**
|
|
409
|
-
- "React useState is async" → Already in React docs
|
|
410
|
-
|
|
411
|
-
❌ **One-line fixes without context**
|
|
412
|
-
- "Changed `==` to `===`" → Trivial
|
|
413
|
-
|
|
414
|
-
❌ **Implementation without principle**
|
|
415
|
-
- "File X uses pattern Y" → No reusable insight
|
|
416
|
-
|
|
417
|
-
❌ **Opinions without justification**
|
|
418
|
-
- "Prefer tabs over spaces" → Not a gotcha
|
|
419
|
-
|
|
420
|
-
❌ **Debugging steps without lesson**
|
|
421
|
-
- "Tried 5 things, #4 worked" → What's the takeaway?
|
|
422
|
-
|
|
423
|
-
❌ **Extracting mid-debugging**
|
|
424
|
-
- Wait until fix is confirmed and working
|
|
425
|
-
- Premature extraction leads to incorrect learnings
|
|
426
|
-
|
|
427
|
-
❌ **Forgetting to delete old code comments after extraction**
|
|
428
|
-
- Learning file should REPLACE inline code comments
|
|
429
|
-
- Keep code clean by removing debugging notes after documenting
|
|
430
|
-
|
|
431
|
-
❌ **Keeping obsolete learnings**
|
|
432
|
-
- Remove when technology deprecated or pattern no longer used
|
|
433
|
-
- Archive instead of delete (move to archive/ with "OBSOLETE:" prefix)
|
|
434
|
-
- Update SAFEWORD.md references to point to replacement learning
|
|
435
|
-
- Example: "React class components gotchas" → OBSOLETE when project migrates to hooks
|
|
436
|
-
|
|
437
|
-
---
|
|
438
|
-
|
|
439
|
-
## Quick Reference
|
|
440
|
-
|
|
441
|
-
| Situation | Location | Example |
|
|
442
|
-
|-----------|----------|---------|
|
|
443
|
-
| Universal principle | `.safeword/learnings/` | React hooks, Electron patterns |
|
|
444
|
-
| Architecture decision | `SAFEWORD.md` → Architecture | Why Zustand? Why Electron-only? |
|
|
445
|
-
| Short gotcha | `SAFEWORD.md` → Gotchas | "Validate paths before file ops" |
|
|
446
|
-
| Detailed gotcha | `.safeword/learnings/` + SAFEWORD.md ref | Persistent UI, race conditions |
|
|
447
|
-
| One-time bug | `.safeword/learnings/archive/` | Forgot to build before testing |
|
|
448
|
-
|
|
449
|
-
---
|
|
450
|
-
|
|
451
|
-
## Directory Structure
|
|
452
|
-
|
|
453
|
-
```
|
|
454
|
-
# Global learnings (all projects)
|
|
455
|
-
.safeword/learnings/
|
|
456
|
-
├── react-state-async.md
|
|
457
|
-
├── electron-ipc-patterns.md
|
|
458
|
-
└── typescript-strict-mode.md
|
|
459
|
-
|
|
460
|
-
# Project learnings (this project)
|
|
461
|
-
./.safeword/learnings/
|
|
462
|
-
├── persistent-ui.md
|
|
463
|
-
├── electron-contexts.md
|
|
464
|
-
├── milkdown-trailing-newlines.md
|
|
465
|
-
└── archive/
|
|
466
|
-
├── electron-build-forgotten.md
|
|
467
|
-
└── test-grep-compatibility.md
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
**File Size Guidelines**:
|
|
471
|
-
- Forward-looking learning: 50-150 lines (includes 2-3 examples)
|
|
472
|
-
- Debugging narrative: 30-100 lines (problem → investigation → solution)
|
|
473
|
-
- If >200 lines: Split into multiple focused learnings
|
|
474
|
-
|
|
475
|
-
**When to Split**:
|
|
476
|
-
```
|
|
477
|
-
# TOO BIG (250 lines covering 3 separate concepts)
|
|
478
|
-
.safeword/learnings/electron-gotchas.md
|
|
479
|
-
|
|
480
|
-
# BETTER (3 focused files)
|
|
481
|
-
.safeword/learnings/electron-renderer-context.md (80 lines)
|
|
482
|
-
.safeword/learnings/electron-ipc-patterns.md (60 lines)
|
|
483
|
-
.safeword/learnings/electron-path-validation.md (50 lines)
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
---
|
|
487
|
-
|
|
488
|
-
## Summary
|
|
489
|
-
|
|
490
|
-
This is a **living process** - iterate and refine based on what works.
|
|
491
|
-
|
|
492
|
-
**Core Principle**: Extract knowledge that **compounds over time**. Each learning should save time on 2+ future features.
|
|
493
|
-
|
|
494
|
-
**Decision Framework**:
|
|
495
|
-
1. **Forward-looking?** → Extract (helps future work)
|
|
496
|
-
2. **Global or project?** → Choose directory
|
|
497
|
-
3. **Architectural or gotcha?** → Choose SAFEWORD.md or separate file
|
|
498
|
-
4. **ALWAYS cross-reference** → Update SAFEWORD.md
|
|
499
|
-
|
|
500
|
-
**Continuous Improvement**:
|
|
501
|
-
- Monthly: Review existing learnings for relevance
|
|
502
|
-
- Quarterly: Archive obsolete learnings
|
|
503
|
-
- Per feature: Assess if new learnings emerged
|
|
504
|
-
- Test: Did extracting this actually help on the next feature?
|
|
505
|
-
|
|
506
|
-
**When in Doubt**:
|
|
507
|
-
- Extract more rather than less (can archive later)
|
|
508
|
-
- Prefer separate file over inline comments (keeps code clean)
|
|
509
|
-
- Update immediately while fresh (don't defer to "later")
|
|
510
|
-
|
|
511
|
-
**Maintenance**:
|
|
512
|
-
- Remove when technology deprecated or pattern no longer used
|
|
513
|
-
- Refactor when multiple learnings cover similar topics (consolidate)
|
|
514
|
-
- Split when learning file >200 lines (focus on single concept)
|
|
515
|
-
- Update SAFEWORD.md references when learnings move or merge
|