safeword 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{check-J6DFVBCE.js → check-US6EQLNS.js} +3 -3
  2. package/dist/check-US6EQLNS.js.map +1 -0
  3. package/dist/chunk-2XWIUEQK.js +190 -0
  4. package/dist/chunk-2XWIUEQK.js.map +1 -0
  5. package/dist/{chunk-UQMQ64CB.js → chunk-GZRQL3SX.js} +41 -2
  6. package/dist/chunk-GZRQL3SX.js.map +1 -0
  7. package/dist/chunk-Z2SOGTNJ.js +7 -0
  8. package/dist/{chunk-WWQ4YRZN.js.map → chunk-Z2SOGTNJ.js.map} +1 -1
  9. package/dist/cli.js +6 -6
  10. package/dist/{diff-U4IELWRL.js → diff-72ZUEZ6A.js} +32 -29
  11. package/dist/diff-72ZUEZ6A.js.map +1 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/{reset-XETOHTCK.js → reset-3ACTIYYE.js} +44 -27
  15. package/dist/reset-3ACTIYYE.js.map +1 -0
  16. package/dist/{setup-CLDCHROZ.js → setup-TSFCHD2D.js} +77 -48
  17. package/dist/setup-TSFCHD2D.js.map +1 -0
  18. package/dist/{upgrade-DOKWRK7J.js → upgrade-XDPQFSMC.js} +38 -50
  19. package/dist/upgrade-XDPQFSMC.js.map +1 -0
  20. package/package.json +1 -1
  21. package/templates/SAFEWORD.md +776 -0
  22. package/templates/commands/arch-review.md +24 -0
  23. package/templates/commands/lint.md +11 -0
  24. package/templates/commands/quality-review.md +23 -0
  25. package/templates/doc-templates/architecture-template.md +136 -0
  26. package/templates/doc-templates/design-doc-template.md +134 -0
  27. package/templates/doc-templates/test-definitions-feature.md +131 -0
  28. package/templates/doc-templates/user-stories-template.md +92 -0
  29. package/templates/guides/architecture-guide.md +423 -0
  30. package/templates/guides/code-philosophy.md +195 -0
  31. package/templates/guides/context-files-guide.md +457 -0
  32. package/templates/guides/data-architecture-guide.md +200 -0
  33. package/templates/guides/design-doc-guide.md +171 -0
  34. package/templates/guides/learning-extraction.md +552 -0
  35. package/templates/guides/llm-instruction-design.md +248 -0
  36. package/templates/guides/llm-prompting.md +102 -0
  37. package/templates/guides/tdd-best-practices.md +615 -0
  38. package/templates/guides/test-definitions-guide.md +334 -0
  39. package/templates/guides/testing-methodology.md +618 -0
  40. package/templates/guides/user-story-guide.md +256 -0
  41. package/templates/guides/zombie-process-cleanup.md +219 -0
  42. package/templates/hooks/agents-md-check.sh +27 -0
  43. package/templates/hooks/inject-timestamp.sh +2 -3
  44. package/templates/hooks/post-tool.sh +4 -0
  45. package/templates/hooks/pre-commit.sh +10 -0
  46. package/templates/lib/common.sh +26 -0
  47. package/templates/lib/jq-fallback.sh +20 -0
  48. package/templates/markdownlint.jsonc +25 -0
  49. package/templates/prompts/arch-review.md +43 -0
  50. package/templates/prompts/quality-review.md +10 -0
  51. package/templates/skills/safeword-quality-reviewer/SKILL.md +207 -0
  52. package/dist/check-J6DFVBCE.js.map +0 -1
  53. package/dist/chunk-24OB57NJ.js +0 -78
  54. package/dist/chunk-24OB57NJ.js.map +0 -1
  55. package/dist/chunk-DB4CMUFD.js +0 -157
  56. package/dist/chunk-DB4CMUFD.js.map +0 -1
  57. package/dist/chunk-UQMQ64CB.js.map +0 -1
  58. package/dist/chunk-WWQ4YRZN.js +0 -7
  59. package/dist/diff-U4IELWRL.js.map +0 -1
  60. package/dist/reset-XETOHTCK.js.map +0 -1
  61. package/dist/setup-CLDCHROZ.js.map +0 -1
  62. package/dist/upgrade-DOKWRK7J.js.map +0 -1
@@ -0,0 +1,334 @@
1
+ # Test Definitions Guide for Claude Code
2
+
3
+ ## How to Fill Out Feature Test Definitions
4
+
5
+ **Template:** `@.safeword/templates/test-definitions-feature.md`
6
+
7
+ **When user asks:** "Create test definitions for issue #N" or "Create test definitions for [feature]"
8
+
9
+ **What you do:**
10
+
11
+ 1. Read `@.safeword/templates/test-definitions-feature.md`
12
+ 2. Read user story's Technical Constraints section (if exists)
13
+ 3. Fill in feature name, issue number, test file path
14
+ 4. Organize tests into logical suites (e.g., "Layout Structure", "User Interactions", "Technical Constraints")
15
+ 5. Create numbered tests (Test 1.1, Test 1.2, etc.)
16
+ 6. Add status for each test (✅/⏭️/❌/🔴)
17
+ 7. Include detailed steps and expected outcomes
18
+ 8. Add summary with coverage breakdown
19
+ 9. Save to project location (e.g., `planning/test-definitions/45-feature-name-test-definitions.md`)
20
+
21
+ **DO include:**
22
+
23
+ - Status tracking per test (✅ Passing / ⏭️ Skipped / ❌ Not Implemented / 🔴 Failing)
24
+ - Detailed steps (numbered list)
25
+ - Expected outcomes (bullet points)
26
+ - Coverage summary with percentages
27
+ - Skipped tests rationale
28
+ - Test execution commands
29
+
30
+ ---
31
+
32
+ ## Test Status Indicators
33
+
34
+ Use these consistently:
35
+
36
+ - **✅ Passing** - Test is implemented and passing
37
+ - **⏭️ Skipped** - Test is intentionally skipped (add rationale in summary)
38
+ - **❌ Not Implemented** - Test is defined but not yet written
39
+ - **🔴 Failing** - Test exists but is currently failing
40
+
41
+ ---
42
+
43
+ ## Test Naming Conventions
44
+
45
+ **✅ GOOD - Descriptive and specific:**
46
+
47
+ - "Render all three panes"
48
+ - "Cmd+J toggles AI pane visibility"
49
+ - "State persistence across sessions"
50
+ - "Button appearance reflects pane state"
51
+
52
+ **❌ BAD - Vague or technical:**
53
+
54
+ - "Test 1" (no description)
55
+ - "Check state" (too vague)
56
+ - "Verify useUIStore hook" (implementation detail)
57
+
58
+ ---
59
+
60
+ ## Writing Test Steps
61
+
62
+ **✅ GOOD - Clear, actionable steps:**
63
+
64
+ ```
65
+ **Steps**:
66
+ 1. Toggle AI pane visible
67
+ 2. Get bounding box for AI pane
68
+ 3. Get bounding box for Editor pane
69
+ 4. Compare X coordinates
70
+ ```
71
+
72
+ **❌ BAD - Vague or incomplete:**
73
+
74
+ ```
75
+ **Steps**:
76
+ 1. Check panes
77
+ 2. Verify order
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Writing Expected Outcomes
83
+
84
+ **✅ GOOD - Specific, testable assertions:**
85
+
86
+ ```
87
+ **Expected**:
88
+ - AI pane X coordinate < Editor pane X coordinate
89
+ - Explorer pane X coordinate > Editor pane X coordinate
90
+ - All coordinates are positive numbers
91
+ ```
92
+
93
+ **❌ BAD - Vague expectations:**
94
+
95
+ ```
96
+ **Expected**:
97
+ - Panes are in correct order
98
+ - Everything works
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Organizing Test Suites
104
+
105
+ **Group related tests into suites:**
106
+
107
+ - **Layout/Structure** - DOM structure, element presence, positioning
108
+ - **User Interactions** - Clicks, keyboard shortcuts, drag/drop
109
+ - **State Management** - State changes, persistence, reactivity
110
+ - **Accessibility** - ARIA labels, keyboard navigation, focus management
111
+ - **Edge Cases** - Error handling, boundary conditions, race conditions
112
+ - **Technical Constraints** - Non-functional requirements from user story (see below)
113
+
114
+ **Each suite should have:**
115
+
116
+ - Clear name describing what it tests
117
+ - Brief description (1-2 sentences)
118
+ - Related tests grouped logically
119
+
120
+ ---
121
+
122
+ ## Coverage Summary Best Practices
123
+
124
+ **Always include:**
125
+
126
+ - Total test count
127
+ - Breakdown by status (passing, skipped, not implemented, failing)
128
+ - Percentages for each category
129
+ - Coverage by feature table
130
+ - Rationale for skipped tests
131
+
132
+ **Example:**
133
+
134
+ ```
135
+ **Total**: 20 tests
136
+ **Passing**: 9 tests (45%)
137
+ **Skipped**: 4 tests (20%)
138
+ **Not Implemented**: 7 tests (35%)
139
+ **Failing**: 0 tests
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Skipped Tests Rationale
145
+
146
+ **Always explain why tests are skipped:**
147
+
148
+ **✅ GOOD - Clear reasoning:**
149
+
150
+ - "Conflicts with Phase 2 design decision (AI pane hidden by default)"
151
+ - "Requires complex drag simulation, tested manually"
152
+ - "Blocked by upstream dependency (Issue #42)"
153
+
154
+ **❌ BAD - No explanation:**
155
+
156
+ - "Skipped"
157
+ - "Not needed"
158
+ - "TODO"
159
+
160
+ ---
161
+
162
+ ## Test Execution Section
163
+
164
+ **Include practical commands:**
165
+
166
+ ```bash
167
+ # Run all tests for this feature
168
+ npm run test:e2e -- tests/feature-name.spec.ts
169
+
170
+ # Run specific test
171
+ npm run test:e2e -- tests/feature-name.spec.ts --grep "specific test name"
172
+ ```
173
+
174
+ ---
175
+
176
+ ## TDD Workflow Integration
177
+
178
+ **Test definitions should be created:**
179
+
180
+ 1. **Before implementation** (TDD: write tests first)
181
+ 2. **During planning** (alongside user stories)
182
+ 3. **After user stories** (tests verify acceptance criteria)
183
+
184
+ **Update test definitions:**
185
+
186
+ - Mark tests ✅ as they pass
187
+ - Add ⏭️ with rationale if skipping
188
+ - Mark 🔴 if tests fail
189
+ - Update "Last Updated" date
190
+
191
+ ---
192
+
193
+ ## Relationship to User Stories
194
+
195
+ **Test definitions should:**
196
+
197
+ - Map directly to user story acceptance criteria
198
+ - Cover all acceptance criteria from user stories
199
+ - Include additional edge cases and error scenarios
200
+ - Reference test file locations mentioned in user stories
201
+ - **Include tests for Technical Constraints** (non-functional requirements)
202
+
203
+ **Example:**
204
+
205
+ - User Story AC: "AI pane is visible when toggled"
206
+ - Test: "Test 3.1: Cmd+J toggles AI pane visibility ✅"
207
+
208
+ ---
209
+
210
+ ## Testing Technical Constraints
211
+
212
+ **Purpose:** User stories include a Technical Constraints section with non-functional requirements. These constraints MUST have corresponding tests.
213
+
214
+ **See:** `@.safeword/guides/user-story-guide.md` for constraint categories and examples.
215
+
216
+ ### Constraint Categories → Test Types
217
+
218
+ | Constraint Category | Test Type | What to Verify |
219
+ | ------------------- | -------------------------- | --------------------------------------------------- |
220
+ | Performance | Load/timing tests | Response times, throughput, capacity limits |
221
+ | Security | Security tests | Input sanitization, auth checks, rate limiting |
222
+ | Compatibility | Cross-browser/device tests | Browser versions, mobile, accessibility |
223
+ | Data | Compliance tests | Retention, deletion, privacy rules |
224
+ | Dependencies | Integration tests | Required services work, no forbidden packages |
225
+ | Infrastructure | Resource tests | Memory limits, offline behavior, deploy constraints |
226
+
227
+ ### Writing Constraint Tests
228
+
229
+ **✅ GOOD - Specific, measurable:**
230
+
231
+ ```markdown
232
+ ### Test 7.1: API response under load ✅
233
+
234
+ **Status**: ✅ Passing
235
+ **Category**: Performance
236
+ **Constraint**: API response < 200ms at P95
237
+
238
+ **Steps**:
239
+
240
+ 1. Spawn 100 concurrent requests to /api/data
241
+ 2. Measure response times for all requests
242
+ 3. Calculate P95 latency
243
+
244
+ **Expected**:
245
+
246
+ - P95 response time < 200ms
247
+ - No requests timeout
248
+ - No 5xx errors under load
249
+ ```
250
+
251
+ **❌ BAD - Vague, untestable:**
252
+
253
+ ```markdown
254
+ ### Test 7.1: Performance test
255
+
256
+ **Steps**: Check if fast
257
+ **Expected**: Good performance
258
+ ```
259
+
260
+ ### When to Skip Constraint Tests
261
+
262
+ **Document skipped constraint tests with rationale:**
263
+
264
+ - "Performance: Tested in CI pipeline, not in unit tests"
265
+ - "Compatibility: Manual testing on BrowserStack, see QA checklist"
266
+ - "Security: Covered by automated SAST scan (Snyk)"
267
+
268
+ **Never skip without explanation.**
269
+
270
+ ---
271
+
272
+ ## Example: Good Test Definition
273
+
274
+ ```markdown
275
+ ### Test 3.1: Cmd+J toggles AI pane visibility ✅
276
+
277
+ **Status**: ✅ Passing
278
+ **Description**: Verifies Cmd+J keyboard shortcut toggles AI pane
279
+
280
+ **Steps**:
281
+
282
+ 1. Verify AI pane hidden initially (default state)
283
+ 2. Press Cmd+J (Mac) or Ctrl+J (Windows/Linux)
284
+ 3. Verify AI pane becomes visible
285
+ 4. Press Cmd+J again
286
+ 5. Verify AI pane becomes hidden
287
+
288
+ **Expected**:
289
+
290
+ - AI pane starts hidden
291
+ - After first toggle: AI pane visible
292
+ - After second toggle: AI pane hidden
293
+ - Toggle action triggers state change in uiStore
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Common Mistakes to Avoid
299
+
300
+ ❌ **Don't test implementation details:**
301
+
302
+ - Bad: "Verify useState hook updates"
303
+ - Good: "Verify pane becomes visible when toggled"
304
+
305
+ ❌ **Don't write vague steps:**
306
+
307
+ - Bad: "Check if it works"
308
+ - Good: "Click button and verify modal appears"
309
+
310
+ ❌ **Don't skip rationale for skipped tests:**
311
+
312
+ - Always explain WHY a test is skipped
313
+
314
+ ❌ **Don't forget coverage summary:**
315
+
316
+ - Always include totals and percentages
317
+
318
+ ❌ **Don't duplicate test descriptions:**
319
+
320
+ - Each test should have a unique, descriptive name
321
+
322
+ ---
323
+
324
+ ## LLM Instruction Design
325
+
326
+ **Important:** Test definitions are instructions that LLMs read and follow. Apply best practices for clarity.
327
+
328
+ **See:** `@.safeword/guides/llm-instruction-design.md` for comprehensive framework including:
329
+
330
+ - MECE decision trees (mutually exclusive, collectively exhaustive)
331
+ - Explicit definitions (never assume LLMs know what you mean)
332
+ - Concrete examples over abstract rules
333
+ - Edge cases must be explicit
334
+ - Actionable over vague language