ralphie 1.0.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.
@@ -0,0 +1,496 @@
1
+ ---
2
+ name: verify
3
+ description: Pre-commit verification skill that auto-detects project tooling (package.json scripts, tsconfig, pytest, eslint, etc.) and runs appropriate tests, type checks, and linting. Zero configuration required - Claude figures it out from codebase context.
4
+ context: fork
5
+ allowed-tools: Read, Glob, Bash, Grep
6
+ ---
7
+
8
+ # Verify Skill
9
+
10
+ Auto-detect and run project verification checks before committing. Claude inspects the codebase to determine what tools are available and runs appropriate checks.
11
+
12
+ ## Workflow
13
+
14
+ ```
15
+ Detect Tools → Run Checks → Report Results
16
+ ```
17
+
18
+ ## Step 1: Detect Project Type and Tooling
19
+
20
+ Read configuration files to understand what verification tools are available.
21
+
22
+ ### 1.1 Check for Node.js/TypeScript Project
23
+
24
+ ```bash
25
+ # Check for package.json
26
+ Read package.json
27
+ ```
28
+
29
+ **Look for:**
30
+ - `scripts`: Contains test commands (e.g., `"test": "vitest"`, `"type-check": "tsc --noEmit"`)
31
+ - `devDependencies`: TypeScript, eslint, vitest, jest, prettier, etc.
32
+ - `dependencies`: Project runtime dependencies
33
+
34
+ **Common patterns:**
35
+
36
+ | Script Name | Tool | What It Does |
37
+ |-------------|------|--------------|
38
+ | `test` | vitest/jest/mocha | Runs unit/integration tests |
39
+ | `test:unit` | vitest/jest | Runs only unit tests |
40
+ | `test:integration` | vitest/jest | Runs only integration tests |
41
+ | `test:e2e` | playwright/cypress | Runs E2E tests |
42
+ | `type-check` | tsc | TypeScript type checking |
43
+ | `lint` | eslint | Code linting |
44
+ | `format` | prettier | Code formatting check |
45
+ | `format:check` | prettier | Check formatting without fixing |
46
+
47
+ ### 1.2 Check for TypeScript
48
+
49
+ ```bash
50
+ # Check for tsconfig.json
51
+ Read tsconfig.json
52
+ ```
53
+
54
+ If `tsconfig.json` exists, TypeScript type checking is required:
55
+ - Run `npm run type-check` if available in package.json
56
+ - Otherwise run `npx tsc --noEmit`
57
+
58
+ ### 1.3 Check for Python Project
59
+
60
+ ```bash
61
+ # Check for Python project markers
62
+ Glob pattern="*.py" path=.
63
+ Glob pattern="pyproject.toml"
64
+ Glob pattern="setup.py"
65
+ Glob pattern="requirements.txt"
66
+ ```
67
+
68
+ **Look for:**
69
+
70
+ | File | Tool | What to Run |
71
+ |------|------|-------------|
72
+ | `pyproject.toml` | pytest/ruff/mypy | Check `[tool.pytest]`, `[tool.ruff]`, `[tool.mypy]` sections |
73
+ | `setup.py` | setuptools | Python package, run `python -m pytest` |
74
+ | `requirements.txt` | pip | Check for pytest, mypy, ruff, pylint in dependencies |
75
+ | `.py` files | pytest | Run `pytest` or `python -m pytest` |
76
+
77
+ **Common Python commands:**
78
+
79
+ ```bash
80
+ # Tests
81
+ pytest
82
+ python -m pytest
83
+ pytest tests/
84
+
85
+ # Type checking
86
+ mypy src/
87
+ python -m mypy src/
88
+
89
+ # Linting
90
+ ruff check src/
91
+ pylint src/
92
+ ```
93
+
94
+ ### 1.4 Check for Other Languages
95
+
96
+ **Go:**
97
+ ```bash
98
+ Glob pattern="go.mod"
99
+ # If found, run: go test ./... && go vet ./...
100
+ ```
101
+
102
+ **Rust:**
103
+ ```bash
104
+ Glob pattern="Cargo.toml"
105
+ # If found, run: cargo test && cargo clippy
106
+ ```
107
+
108
+ **Ruby:**
109
+ ```bash
110
+ Glob pattern="Gemfile"
111
+ # If found, run: bundle exec rspec (or rake test)
112
+ ```
113
+
114
+ ## Step 2: Run Verification Checks
115
+
116
+ Run checks in priority order: **tests → type checking → linting**.
117
+
118
+ ### 2.1 Run Tests
119
+
120
+ **Node.js/TypeScript:**
121
+ ```bash
122
+ # Priority order (stop at first match):
123
+ 1. npm run test # If "test" script exists
124
+ 2. npm run test:unit # If only unit tests needed
125
+ 3. npx vitest run # If vitest in devDependencies
126
+ 4. npx jest # If jest in devDependencies
127
+ ```
128
+
129
+ **Python:**
130
+ ```bash
131
+ # Priority order:
132
+ 1. pytest # If pytest is installed
133
+ 2. python -m pytest # Alternative invocation
134
+ 3. python -m unittest # Fallback for stdlib tests
135
+ ```
136
+
137
+ **Detect test location:**
138
+ - Node.js: Usually `tests/` or `src/**/*.test.ts` or `src/**/*.spec.ts`
139
+ - Python: Usually `tests/` or `test_*.py` files
140
+
141
+ ### 2.2 Run Type Checking
142
+
143
+ **TypeScript:**
144
+ ```bash
145
+ # Priority order:
146
+ 1. npm run type-check # If script exists in package.json
147
+ 2. npx tsc --noEmit # Direct TypeScript check
148
+ ```
149
+
150
+ **Python (optional, not all projects use):**
151
+ ```bash
152
+ # Priority order:
153
+ 1. mypy src/ # If mypy in dependencies
154
+ 2. python -m mypy src/ # Alternative invocation
155
+ ```
156
+
157
+ **Note:** Type checking is MANDATORY for TypeScript projects, OPTIONAL for Python (many don't use type hints).
158
+
159
+ ### 2.3 Run Linting (Optional)
160
+
161
+ Linting is optional but recommended if tools are present.
162
+
163
+ **Node.js/TypeScript:**
164
+ ```bash
165
+ # Priority order:
166
+ 1. npm run lint # If "lint" script exists
167
+ 2. npx eslint src/ # If eslint in devDependencies
168
+ ```
169
+
170
+ **Python:**
171
+ ```bash
172
+ # Priority order:
173
+ 1. ruff check src/ # If ruff installed (fast, modern)
174
+ 2. pylint src/ # If pylint installed (slower, thorough)
175
+ ```
176
+
177
+ **Skip linting if:**
178
+ - No lint command in package.json
179
+ - No linter in dependencies
180
+ - User explicitly said "skip linting"
181
+
182
+ ## Step 3: Report Results
183
+
184
+ ### 3.1 Success Report
185
+
186
+ If all checks pass:
187
+
188
+ ```markdown
189
+ # Verification: PASS ✓
190
+
191
+ ## Tests: PASS
192
+ - Command: `npm test`
193
+ - Duration: 2.4s
194
+ - Results: 127 passing
195
+
196
+ ## Type Check: PASS
197
+ - Command: `npm run type-check`
198
+ - Duration: 1.8s
199
+ - No type errors found
200
+
201
+ ## Lint: PASS
202
+ - Command: `npm run lint`
203
+ - Duration: 0.9s
204
+ - No lint errors
205
+
206
+ ---
207
+
208
+ ✓ All checks passed. Safe to commit.
209
+ ```
210
+
211
+ ### 3.2 Failure Report
212
+
213
+ If any check fails:
214
+
215
+ ```markdown
216
+ # Verification: FAIL ✗
217
+
218
+ ## Tests: FAIL
219
+ - Command: `npm test`
220
+ - Duration: 3.1s
221
+ - Results: 125 passing, 2 failing
222
+
223
+ ### Failed Tests
224
+
225
+ 1. **UserService.test.ts**
226
+ ```
227
+ FAIL tests/UserService.test.ts
228
+ ● UserService › getUserById › returns user when found
229
+
230
+ expect(received).toEqual(expected)
231
+
232
+ Expected: {"id": "123", "name": "Alice"}
233
+ Received: {"id": "123", "name": null}
234
+
235
+ at tests/UserService.test.ts:42:25
236
+ ```
237
+
238
+ 2. **AuthController.test.ts**
239
+ ```
240
+ FAIL tests/AuthController.test.ts
241
+ ● AuthController › login › returns 401 for invalid credentials
242
+
243
+ Expected status 401, received 500
244
+
245
+ at tests/AuthController.test.ts:58:30
246
+ ```
247
+
248
+ ## Type Check: PASS
249
+ - Command: `npm run type-check`
250
+ - Duration: 1.8s
251
+ - No type errors found
252
+
253
+ ## Lint: SKIPPED
254
+ - Skipped because tests failed
255
+
256
+ ---
257
+
258
+ ✗ Fix failing tests before committing.
259
+ ```
260
+
261
+ ### 3.3 Error Report
262
+
263
+ If verification can't run (e.g., missing dependencies):
264
+
265
+ ```markdown
266
+ # Verification: ERROR
267
+
268
+ ## Issue
269
+
270
+ Cannot run tests - dependencies not installed.
271
+
272
+ ## Details
273
+
274
+ - Tried: `npm test`
275
+ - Error: `sh: vitest: command not found`
276
+ - Cause: `node_modules/` is missing or incomplete
277
+
278
+ ## Fix
279
+
280
+ Run `npm install` to install dependencies, then try verification again.
281
+
282
+ ---
283
+
284
+ ⚠️ Cannot verify without dependencies.
285
+ ```
286
+
287
+ ## Step 4: Exit Codes and Behavior
288
+
289
+ ### Exit Behavior
290
+
291
+ **If verification PASSES:**
292
+ - Report success
293
+ - Tell user it's safe to commit
294
+ - Return to iteration workflow
295
+
296
+ **If verification FAILS:**
297
+ - Report failures with details
298
+ - DO NOT commit
299
+ - Tell user to fix issues and re-run `/verify`
300
+
301
+ **If verification ERRORS:**
302
+ - Report configuration issue
303
+ - Provide fix suggestion
304
+ - DO NOT commit
305
+
306
+ ### When to Skip Checks
307
+
308
+ **Skip tests if:**
309
+ - No test files exist (check with `Glob pattern="**/*.test.*"`)
310
+ - Documentation-only changes (README.md, *.md files)
311
+ - Configuration-only changes (tsconfig.json, package.json metadata)
312
+
313
+ **Skip type checking if:**
314
+ - No TypeScript in project (no tsconfig.json)
315
+ - Python project without mypy
316
+
317
+ **Skip linting if:**
318
+ - No linter configured
319
+ - User explicitly requested to skip
320
+
321
+ ## Quick Decision Tree
322
+
323
+ ```
324
+ Start
325
+
326
+ ├─ package.json exists?
327
+ │ ├─ Yes → Read package.json scripts
328
+ │ │ └─ Run npm run test (or equivalent)
329
+ │ │ └─ Run npm run type-check (if TS)
330
+ │ │ └─ Run npm run lint (optional)
331
+ │ │
332
+ │ └─ No → Check for Python
333
+ │ └─ *.py files exist?
334
+ │ ├─ Yes → Run pytest
335
+ │ │ └─ Run mypy (if configured)
336
+ │ │ └─ Run ruff check (if installed)
337
+ │ │
338
+ │ └─ No → Check for Go, Rust, Ruby...
339
+ │ └─ Run language-specific tests
340
+ ```
341
+
342
+ ## Examples
343
+
344
+ ### Example 1: TypeScript Project (All Pass)
345
+
346
+ **Detection:**
347
+ ```bash
348
+ Read package.json
349
+ # Found scripts: { "test": "vitest run", "type-check": "tsc --noEmit", "lint": "eslint src/" }
350
+
351
+ Read tsconfig.json
352
+ # Found: compilerOptions with strict: true
353
+ ```
354
+
355
+ **Execution:**
356
+ ```bash
357
+ npm run test
358
+ # ✓ 127 tests passing (2.4s)
359
+
360
+ npm run type-check
361
+ # ✓ No type errors (1.8s)
362
+
363
+ npm run lint
364
+ # ✓ No lint errors (0.9s)
365
+ ```
366
+
367
+ **Report:**
368
+ ```
369
+ # Verification: PASS ✓
370
+
371
+ All checks passed. Safe to commit.
372
+ ```
373
+
374
+ ### Example 2: Python Project (Test Failure)
375
+
376
+ **Detection:**
377
+ ```bash
378
+ Glob pattern="*.py"
379
+ # Found: src/app.py, tests/test_app.py
380
+
381
+ Read pyproject.toml
382
+ # Found: [tool.pytest], [tool.mypy]
383
+ ```
384
+
385
+ **Execution:**
386
+ ```bash
387
+ pytest
388
+ # ✗ 8 passing, 1 failing (1.2s)
389
+ # FAIL: tests/test_app.py::test_login - AssertionError: Expected 401, got 500
390
+
391
+ python -m mypy src/
392
+ # ✓ Success: no issues found (0.8s)
393
+ ```
394
+
395
+ **Report:**
396
+ ```
397
+ # Verification: FAIL ✗
398
+
399
+ ## Tests: FAIL
400
+ - 8 passing, 1 failing
401
+ - FAIL: tests/test_app.py::test_login - AssertionError: Expected 401, got 500
402
+
403
+ Fix failing test before committing.
404
+ ```
405
+
406
+ ### Example 3: Documentation-Only Change (Skip Tests)
407
+
408
+ **Detection:**
409
+ ```bash
410
+ # Changes detected: README.md, docs/api.md (from git status)
411
+ Read package.json
412
+ # Found test script
413
+ ```
414
+
415
+ **Decision:**
416
+ ```
417
+ Documentation-only changes detected. Tests can be skipped.
418
+ ```
419
+
420
+ **Execution:**
421
+ ```bash
422
+ # SKIP tests (no code changes)
423
+ npm run type-check
424
+ # ✓ No type errors (1.8s)
425
+ ```
426
+
427
+ **Report:**
428
+ ```
429
+ # Verification: PASS ✓
430
+
431
+ Tests skipped (documentation-only changes).
432
+ Type check passed. Safe to commit.
433
+ ```
434
+
435
+ ## Integration with Ralphie Iteration
436
+
437
+ Use `/verify` in Step 5 (Review) of the Ralphie iteration:
438
+
439
+ ```markdown
440
+ ## Step 5: Review
441
+
442
+ 1. Run verification checks:
443
+ ```
444
+ /verify
445
+ ```
446
+
447
+ 2. If PASS:
448
+ - Proceed to Step 6 (Commit)
449
+
450
+ 3. If FAIL:
451
+ - Fix issues
452
+ - Re-run verification
453
+ - Don't commit until PASS
454
+
455
+ 4. If ERROR:
456
+ - Fix configuration issue (e.g., npm install)
457
+ - Re-run verification
458
+ ```
459
+
460
+ ## When to Use This Skill
461
+
462
+ **Use `/verify` when:**
463
+ - About to commit code changes in Ralphie iteration
464
+ - User asks "are tests passing?"
465
+ - Unsure if type checking passes
466
+ - Want to check lint status
467
+ - After fixing bugs, before committing
468
+
469
+ **Don't use when:**
470
+ - Already ran tests manually and they passed
471
+ - Doing exploratory coding (not ready to commit)
472
+ - Making documentation-only changes (unless user asks)
473
+
474
+ ## Advanced: Custom Verification
475
+
476
+ If a project has custom verification needs, detect from package.json:
477
+
478
+ ```json
479
+ {
480
+ "scripts": {
481
+ "verify": "npm run test && npm run type-check && npm run lint",
482
+ "precommit": "npm run verify"
483
+ }
484
+ }
485
+ ```
486
+
487
+ **Priority:**
488
+ 1. If `verify` script exists, run that
489
+ 2. If `precommit` script exists, run that
490
+ 3. Otherwise, detect and run individual checks
491
+
492
+ This allows projects to define their own verification flow while maintaining zero-config defaults.
493
+
494
+ ---
495
+
496
+ **Remember:** This skill is for **pre-commit verification**, not for debugging or development. It's a final check before committing, not a development workflow tool.
File without changes