.claude/skills/spec/SKILL.md
Produce a verifiable technical specification before coding. 6 mandatory sections: Interfaces, Behaviors, Invariants (from Aristotle Phase 2), File Plan, Test Plan, Exit Criteria (executable bash commands + expected results). Use when: (1) before implementing features with complexity > 4, (2) as Step 1.5 in orchestrator workflow, (3) when requirements need formalization. Triggers: /spec, 'create spec', 'write specification', 'technical spec'.
npx skillsauth add alfredolopez80/multi-agent-ralph-loop specInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Produce a specification that is executable — Exit Criteria are bash commands that pass/fail.
/task-batch Phase 3: for tasks with complexity > 6Define all public APIs, function signatures, type definitions:
Function: authenticateUser(email: string, password: string): Promise<AuthResult>
Type: AuthResult = { token: string, expiresAt: Date, user: UserProfile }
Endpoint: POST /api/auth/login → 200 AuthResult | 401 ErrorResponse
Define expected behaviors as given-when-then:
GIVEN a valid user with email "[email protected]"
WHEN authenticateUser("[email protected]", "correct-password") is called
THEN returns AuthResult with valid JWT token expiring in 24h
GIVEN an invalid password
WHEN authenticateUser("[email protected]", "wrong-password") is called
THEN throws AuthError with code "INVALID_CREDENTIALS"
Built from Aristotle Phase 2 (Irreducible Truths):
INV-1: A token MUST expire (no infinite tokens)
INV-2: Password MUST never appear in logs or responses
INV-3: Rate limit: max 5 failed attempts per IP per minute
INV-4: Session tokens are cryptographically random (min 256 bits)
Exactly which files will be created/modified:
CREATE: src/auth/authenticate.ts (main logic)
CREATE: src/auth/types.ts (AuthResult, AuthError types)
MODIFY: src/routes/index.ts (add /api/auth/login route)
CREATE: tests/auth/authenticate.test.ts (unit tests)
CREATE: tests/auth/authenticate.integration.test.ts (integration)
What tests will verify the specification:
UNIT:
- authenticateUser with valid credentials → returns token
- authenticateUser with invalid password → throws AuthError
- authenticateUser with non-existent user → throws AuthError
- Token expiry is exactly 24 hours from creation
INTEGRATION:
- POST /api/auth/login with valid body → 200
- POST /api/auth/login with wrong password → 401
- POST /api/auth/login 6 times rapidly → 429 (rate limited)
Executable bash commands with expected results. The spec is DONE when all pass:
# EC-1: Type check passes
npx tsc --noEmit
# Expected: exit 0
# EC-2: Unit tests pass
npm test -- --grep "authenticate"
# Expected: exit 0, all tests pass
# EC-3: Login endpoint returns 200 for valid credentials
curl -s -o /dev/null -w "%{http_code}" -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"test123"}'
# Expected: 200
# EC-4: Login endpoint returns 401 for invalid credentials
curl -s -o /dev/null -w "%{http_code}" -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"wrong"}'
# Expected: 401
# EC-5: No password in logs
grep -r "password" logs/ | grep -v "test" | grep -v ".spec.md"
# Expected: no matches (exit 1)
The spec is written to <feature-name>.spec.md in the project root or docs/specs/ directory.
Step 0: EVALUATE (Aristotle phases)
→ Invariants from Phase 2 feed into Section 3
Step 1: CLARIFY
Step 1.5: SPECIFY (this skill) ← for complexity > 4
Step 2: CLASSIFY
Step 3: PLAN (uses spec as input)
| Excuse | Rebuttal | |---|---| | "The feature is too simple for a spec" | If complexity > 4, it gets a spec. Period. | | "I'll write the spec after coding" | Spec comes BEFORE code. That's the point. | | "Exit criteria are too rigid" | They're the definition of done. Make them right. | | "I can't write exit criteria without coding first" | Write the behavior first, exit criteria follow. | | "The spec will slow me down" | A wrong implementation is slower than a spec. |
See: docs/templates/SPEC.md.template (auto-created on first /spec invocation)
development
Living knowledge base management. Actions: search (query vault), save (store learning), index (update indices), compile (raw->wiki->rules graduation), init (create vault structure). Follows Karpathy pipeline: ingest->compile->query. Use when: (1) searching accumulated knowledge, (2) saving learnings, (3) compiling raw notes into wiki, (4) initializing a new vault. Triggers: /vault, 'vault search', 'knowledge base', 'save learning'.
testing
Pre-launch shipping checklist orchestrating /gates, /security, /browser-test, /perf. Ensures nothing ships without passing all quality checks. Use when: (1) before deploying, (2) before merging to main, (3) before release. Triggers: /ship, 'ship it', 'ready to deploy', 'pre-launch check'.
development
Performance optimization skill. Core Web Vitals via Lighthouse, bundle size analysis, metrics tracking over time. Use when: (1) optimizing frontend performance, (2) analyzing bundle size, (3) tracking metrics regression. Triggers: /perf, 'performance audit', 'core web vitals', 'bundle size'.
development
End-of-session learning classification. Reviews accumulated learnings and classifies each as GREEN (generic, goes to global wiki), YELLOW (project-specific, goes to project wiki), or RED (sensitive, discarded). Triggered at session end via Stop hook. Use when: (1) session ending, (2) manual review of learnings. Triggers: /exit-review, 'review learnings', 'classify learnings'.