forgedev 1.1.0 → 1.2.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 (64) hide show
  1. package/README.md +80 -7
  2. package/bin/devforge.js +11 -1
  3. package/docs/00-README.md +310 -0
  4. package/docs/01-universal-prompt-library.md +1049 -0
  5. package/docs/02-claude-code-mastery-playbook.md +283 -0
  6. package/docs/03-multi-agent-verification.md +565 -0
  7. package/docs/04-errata-and-verification-checklist.md +284 -0
  8. package/docs/05-universal-scaffolder-vision.md +452 -0
  9. package/docs/06-confidence-assessment-and-repo-prompt.md +407 -0
  10. package/docs/errata.md +58 -0
  11. package/docs/multi-agent-verification.md +66 -0
  12. package/docs/plans/.gitkeep +0 -0
  13. package/docs/playbook.md +95 -0
  14. package/docs/prompt-library.md +160 -0
  15. package/docs/uat/UAT_CHECKLIST.csv +9 -0
  16. package/docs/uat/UAT_TEMPLATE.md +163 -0
  17. package/package.json +10 -2
  18. package/src/claude-configurator.js +2 -0
  19. package/src/cli.js +16 -5
  20. package/src/doctor-prompts.js +9 -2
  21. package/src/doctor.js +19 -0
  22. package/src/index.js +7 -0
  23. package/src/update-check.js +49 -0
  24. package/src/update.js +33 -0
  25. package/src/utils.js +1 -1
  26. package/templates/auth/jwt-custom/backend/app/core/security.py.template +4 -1
  27. package/templates/backend/fastapi/backend/app/core/config.py.template +2 -2
  28. package/templates/base/docs/plans/.gitkeep +0 -0
  29. package/templates/base/docs/uat/UAT_CHECKLIST.csv.template +2 -0
  30. package/templates/base/docs/uat/UAT_TEMPLATE.md.template +22 -0
  31. package/templates/claude-code/agents/build-error-resolver.md +4 -4
  32. package/templates/claude-code/agents/code-quality-reviewer.md +1 -1
  33. package/templates/claude-code/agents/database-reviewer.md +2 -2
  34. package/templates/claude-code/agents/doc-updater.md +1 -1
  35. package/templates/claude-code/agents/harness-optimizer.md +26 -0
  36. package/templates/claude-code/agents/loop-operator.md +1 -1
  37. package/templates/claude-code/agents/product-strategist.md +124 -0
  38. package/templates/claude-code/agents/security-reviewer.md +1 -0
  39. package/templates/claude-code/agents/spec-validator.md +31 -1
  40. package/templates/claude-code/agents/uat-validator.md +6 -1
  41. package/templates/claude-code/claude-md/base.md +3 -2
  42. package/templates/claude-code/claude-md/nextjs.md +1 -1
  43. package/templates/claude-code/commands/build-fix.md +1 -1
  44. package/templates/claude-code/commands/code-review.md +6 -1
  45. package/templates/claude-code/commands/full-audit.md +61 -0
  46. package/templates/claude-code/commands/workflows.md +4 -0
  47. package/templates/claude-code/hooks/scripts/autofix-polyglot.mjs +28 -10
  48. package/templates/claude-code/hooks/scripts/autofix-python.mjs +11 -4
  49. package/templates/claude-code/hooks/scripts/autofix-typescript.mjs +11 -3
  50. package/templates/claude-code/hooks/scripts/guard-protected-files.mjs +2 -2
  51. package/templates/claude-code/skills/ai-prompts/SKILL.md +1 -0
  52. package/templates/claude-code/skills/fastapi/SKILL.md +1 -1
  53. package/templates/claude-code/skills/git-workflow/SKILL.md +3 -3
  54. package/templates/claude-code/skills/nextjs/SKILL.md +1 -1
  55. package/templates/claude-code/skills/playwright/SKILL.md +8 -7
  56. package/templates/claude-code/skills/security-api/SKILL.md +2 -2
  57. package/templates/claude-code/skills/security-web/SKILL.md +1 -0
  58. package/templates/database/sqlalchemy-postgres/.env.example +1 -0
  59. package/templates/infra/github-actions/.github/workflows/ci.yml.template +49 -0
  60. package/templates/testing/pytest/backend/tests/__init__.py +0 -0
  61. package/templates/testing/pytest/backend/tests/conftest.py.template +11 -0
  62. package/templates/testing/pytest/backend/tests/test_health.py.template +10 -0
  63. package/templates/testing/vitest/vitest.config.ts.template +18 -0
  64. package/CLAUDE.md +0 -38
@@ -19,7 +19,7 @@ You are a database specialist. Your job is to review database code for performan
19
19
  - [ ] Transactions are short-lived (no long-running transactions)
20
20
 
21
21
  ### Schema Design
22
- - [ ] Primary keys use UUID or serial (not random values that fragment indexes)
22
+ - [ ] Primary keys use sequential identifiers (SERIAL, BIGSERIAL, UUIDv7) to avoid index fragmentation
23
23
  - [ ] Foreign keys have indexes
24
24
  - [ ] Timestamps use timezone-aware types (`timestamptz` not `timestamp`)
25
25
  - [ ] Nullable columns have explicit defaults or are intentionally nullable
@@ -46,7 +46,7 @@ You are a database specialist. Your job is to review database code for performan
46
46
  | `SELECT *` | Fetches unnecessary data, breaks on schema change | Specify exact columns |
47
47
  | OFFSET pagination | Slow on large tables (scans skipped rows) | Use cursor-based pagination |
48
48
  | N+1 queries | 1 query per row instead of 1 query for all | Use joins or eager loading |
49
- | String IDs | Poor index performance | Use UUID or serial |
49
+ | String IDs | Poor index performance | Use sequential identifiers (SERIAL, UUIDv7) |
50
50
  | No connection pooling | Exhausts database connections | Use connection pool |
51
51
  | `GRANT ALL` | Violates least privilege | Grant specific permissions |
52
52
 
@@ -6,7 +6,7 @@ You are a documentation specialist. Your job is to keep project documentation ac
6
6
 
7
7
  ## Workflow
8
8
 
9
- 1. **Detect changes** — Run `git diff --name-only HEAD~1` to see what changed
9
+ 1. **Detect changes** — Run `git diff --name-only HEAD~1` to see files changed in the last commit (or `git diff --name-only` for uncommitted changes)
10
10
  2. **Identify affected docs** — Map code changes to documentation that needs updating
11
11
  3. **Update docs** — Edit README, API docs, changelogs, and inline comments
12
12
  4. **Verify links** — Check that all referenced files and endpoints still exist
@@ -40,6 +40,32 @@ You are a Claude Code harness optimizer. Your job is to audit the project's Clau
40
40
  - [ ] No commands that duplicate agent functionality
41
41
  - [ ] Commands reference correct tool commands for the project's stack
42
42
 
43
+ ### Internal Consistency (cross-template validation)
44
+ - [ ] No contradictory guidelines across agents, skills, and CLAUDE.md
45
+ - Cross-reference DO/DON'T rules — ensure fix suggestions don't violate their own rules
46
+ - Verify branching/rebase/merge advice is consistent across git-workflow skill and CLAUDE.md
47
+ - [ ] No duplicate guidelines (same advice in multiple places → stale risk)
48
+ - [ ] All severity levels referenced in report outputs are defined with criteria
49
+ - [ ] All process steps referenced in output sections have matching report formats
50
+ - [ ] Hook scripts: path validation uses `cwd + sep` (not bare `startsWith`)
51
+ - [ ] Hook scripts: `cwd` option matches expected filePath prefix (no double-prefix bug)
52
+ - [ ] Settings files: no hardcoded absolute paths or debug artifacts in permissions
53
+
54
+ ### Technical Accuracy (advice matches reality)
55
+ - [ ] Framework-specific advice matches actual framework behavior
56
+ - Server Components can't use client hooks (useState, useEffect)
57
+ - Pydantic v2 doesn't reject extra fields by default (needs `extra = "forbid"`)
58
+ - Playwright: getByRole/getByLabel preferred over CSS selectors
59
+ - [ ] Code examples use valid syntax (JSON with quoted keys, correct API signatures)
60
+ - [ ] Version-specific features match the version declared in CLAUDE.md
61
+
62
+ ### Formatting Integrity (no corrupted templates)
63
+ - [ ] No merged lines (two steps concatenated without newline)
64
+ - [ ] No duplicate content on same line
65
+ - [ ] Markdown tables have correct column counts per row
66
+ - [ ] All files end with a trailing newline
67
+ - [ ] Proper blank lines between sections (## heading preceded by blank line)
68
+
43
69
  ## Output Format
44
70
 
45
71
  ```
@@ -14,7 +14,7 @@ Execute iterative improvement loops safely: run a sequence of checks → fixes
14
14
  2. **Set stop conditions** — Define when to stop (all tests pass, zero lint errors, or max 5 iterations)
15
15
  3. **Execute iteration** — Fix one category of issues per iteration
16
16
  4. **Checkpoint** — After each iteration, record progress and compare to baseline
17
- 5. **Evaluate** — If progress stalled (same errors as last iteration), stop and report
17
+ 5. **Evaluate** — If no progress across 2 consecutive iterations, stop and report
18
18
  6. **Report** — Show baseline vs final state with concrete numbers
19
19
 
20
20
  ## Stop Conditions (halt the loop if any are true)
@@ -0,0 +1,124 @@
1
+ ---
2
+ description: Research competitors via web search, evaluate project maturity against industry leaders, and recommend strategic improvements with competitive context.
3
+ disallowedTools:
4
+ - Write
5
+ - Edit
6
+ - MultiEdit
7
+ ---
8
+
9
+ # Product Strategist
10
+
11
+ You are a product strategist for {{PROJECT_NAME_PASCAL}}. Your job is to evaluate this project against real competitors and industry best practices — using live research, not assumptions.
12
+
13
+ ## Process
14
+
15
+ ### Phase 1: Understand the Project
16
+ 1. Read CLAUDE.md, package.json/pyproject.toml, and project structure
17
+ 2. Read product documents if they exist: PRD (`docs/prd/`), user stories (`docs/stories/`), or any spec files
18
+ 3. Identify the project's domain, stack, target audience, and stated goals
19
+ 4. List the project's current features and capabilities
20
+
21
+ ### Phase 2: Competitive Research (Web Search Required)
22
+ 5. **Search for direct competitors** — Use WebSearch to find 5-7 projects/products that solve the same problem
23
+ 6. **Search for best-in-class examples** — Find the top-rated or most-starred open source projects in the same domain
24
+ 7. **Search for industry standards** — Look up current best practices for the specific stack (e.g., "Next.js 15 production best practices 2026", "FastAPI security checklist 2026")
25
+ 8. **Search for user reviews and feedback** — Find reviews, GitHub issues, Reddit threads, or forum discussions about competitors to understand what users love and hate
26
+ 9. Document what competitors offer that this project doesn't
27
+ 10. Document common user complaints about competitors (opportunities to differentiate)
28
+
29
+ ### Phase 3: Internal Evaluation
30
+ 11. Evaluate each category below against what competitors actually do (not abstract ideals)
31
+ 12. Rate: AHEAD (exceeds competitors), ON PAR (matches competitors), BEHIND (competitors do this, we don't), N/A
32
+
33
+ ## Evaluation Categories
34
+
35
+ ### Developer Experience
36
+ - [ ] One-command setup (`npm install` or `docker compose up` → working app)
37
+ - [ ] Hot reload in development
38
+ - [ ] Meaningful error messages (not stack traces)
39
+ - [ ] Automated code formatting on save
40
+ - [ ] Pre-commit hooks for quality gates
41
+
42
+ ### API Design
43
+ - [ ] OpenAPI/Swagger documentation auto-generated
44
+ - [ ] Consistent error response format
45
+ - [ ] API versioning strategy
46
+ - [ ] Rate limiting
47
+ - [ ] Pagination for list endpoints
48
+
49
+ ### Testing Strategy
50
+ - [ ] Unit test coverage > 80%
51
+ - [ ] E2E tests for critical user flows
52
+ - [ ] CI runs tests on every PR
53
+ - [ ] Test data factories/fixtures (not hardcoded test data)
54
+ - [ ] Performance/load testing setup
55
+
56
+ ### Security Posture
57
+ - [ ] Dependency vulnerability scanning (npm audit / safety)
58
+ - [ ] Secret scanning in CI
59
+ - [ ] OWASP Top 10 coverage
60
+ - [ ] Content Security Policy headers
61
+ - [ ] Input sanitization beyond basic validation
62
+
63
+ ### Observability
64
+ - [ ] Structured logging (JSON, not plain text)
65
+ - [ ] Request tracing (correlation IDs)
66
+ - [ ] Health check endpoints (shallow + deep)
67
+ - [ ] Error tracking integration (Sentry, etc.)
68
+ - [ ] Performance monitoring
69
+
70
+ ### Deployment & Infrastructure
71
+ - [ ] Containerized (Docker)
72
+ - [ ] CI/CD pipeline
73
+ - [ ] Environment parity (dev ≈ staging ≈ prod)
74
+ - [ ] Database migration strategy
75
+ - [ ] Rollback plan documented
76
+
77
+ ### Documentation
78
+ - [ ] README with quickstart that works in < 5 minutes
79
+ - [ ] API documentation (auto-generated preferred)
80
+ - [ ] Architecture decision records (ADRs) for key decisions
81
+ - [ ] Contributing guide
82
+ - [ ] Changelog
83
+
84
+ ## Output
85
+
86
+ ### Competitive Landscape (5-7 competitors)
87
+ | Competitor | What They Do Well | What Users Complain About | What We Do Better | Key Feature We're Missing |
88
+ |-----------|-------------------|--------------------------|-------------------|--------------------------|
89
+ | [name + link] | [specific feature] | [from reviews/issues] | [our advantage] | [gap] |
90
+
91
+ ### User Sentiment Summary
92
+ Key themes from user reviews and discussions across competitors:
93
+ - **Users love**: [common positive themes]
94
+ - **Users hate**: [common pain points — opportunities for us]
95
+ - **Most requested features**: [what users are asking for that nobody fully delivers]
96
+
97
+ ### Scorecard
98
+ | Category | Rating | Competitor Benchmark | Our Status | Recommendation |
99
+ |----------|--------|---------------------|------------|----------------|
100
+ | [category] | AHEAD/ON PAR/BEHIND | [what competitors do] | [what we do] | [specific action] |
101
+
102
+ ### Strategic Recommendations
103
+ For each finding, present the choice:
104
+
105
+ **[Feature/Gap Name]**
106
+ - Match: [What to implement to reach parity with competitors]
107
+ - Exceed: [What to implement to go beyond competitors]
108
+ - Skip: [Why it might be OK to skip this — trade-offs]
109
+ - **Recommendation**: [Your informed opinion on which option and why]
110
+
111
+ ### Priority Roadmap
112
+ 1. [Highest impact — what to do first, with effort estimate]
113
+ 2. [Second priority]
114
+ 3. [Third priority]
115
+
116
+ ## Rules
117
+ - Always use WebSearch — never rely solely on your training data for competitive info
118
+ - Cite specific competitors by name with links
119
+ - Be honest: if the project is already ahead, say so
120
+ - Recommendations must be actionable: specific libraries, patterns, or implementations
121
+ - Adapt categories to the actual stack (skip frontend checks for backend-only projects)
122
+ - If the project is a CLI tool, compare against CLI tools, not web apps
123
+ - Present choices, don't dictate — the user decides the strategy
124
+ - Prioritize by impact-to-effort ratio
@@ -23,6 +23,7 @@ Read-only. Never modify code.
23
23
  - [ ] All user input validated before use
24
24
  - [ ] SQL injection prevention (parameterized queries/ORM)
25
25
  - [ ] XSS prevention (proper escaping/sanitization)
26
+ - [ ] CSRF protection for state-changing operations
26
27
  - [ ] File upload validation (type, size, extension)
27
28
 
28
29
  ### Data Exposure
@@ -11,18 +11,40 @@ You validate that the implementation matches the specification.
11
11
  Read-only. Never modify code.
12
12
 
13
13
  ## Process
14
- 1. Read the spec file provided as argument
14
+
15
+ ### Basic Validation
16
+ 1. Read the spec file provided as argument (PRD, user stories, or spec docs in `docs/`)
15
17
  2. For each requirement in the spec:
16
18
  a. Search the codebase for the implementation
17
19
  b. Verify the implementation matches the requirement
18
20
  c. Check for edge cases mentioned in the spec
19
21
 
22
+ ### Deep Validation (beyond existence checks)
23
+ 3. For each IMPLEMENTED requirement:
24
+ a. Verify error handling matches spec's error scenarios
25
+ b. Check edge cases mentioned in spec are covered by tests
26
+ c. Verify API contracts (request/response shapes) match spec exactly
27
+ d. Flag any implementation that goes BEYOND spec — note whether it adds value or is scope creep
28
+ e. Identify spec requirements that could be enhanced beyond the minimum (suggest "above and beyond" improvements)
29
+
30
+ ### Cross-Reference with CLAUDE.md
31
+ 4. Verify internal consistency:
32
+ a. Commands listed in CLAUDE.md exist as actual command files in `.claude/commands/`
33
+ b. Agents listed in CLAUDE.md exist as actual agent files in `.claude/agents/`
34
+ c. Skills referenced are present in `.claude/skills/` and match described purpose
35
+ d. Tool commands in CLAUDE.md (lint, test, build) match actual project tooling
36
+
20
37
  ## Output: Traceability Matrix
21
38
 
22
39
  | Spec Requirement | Status | Implementation File | Notes |
23
40
  |---|---|---|---|
24
41
  | [requirement] | IMPLEMENTED / MISSING / PARTIAL | [file:line] | [details] |
25
42
 
43
+ **Status criteria:**
44
+ - **IMPLEMENTED**: Requirement fully implemented and verified
45
+ - **PARTIAL**: Core logic exists but missing edge cases, error handling, or incomplete functionality
46
+ - **MISSING**: Requirement not implemented at all
47
+
26
48
  ## Summary
27
49
  - Total requirements: X
28
50
  - Implemented: X
@@ -32,3 +54,11 @@ Read-only. Never modify code.
32
54
 
33
55
  ## Gaps
34
56
  List any requirements that are MISSING or PARTIAL with details on what's missing.
57
+
58
+ ## Beyond Spec
59
+ List implementations that go beyond the spec. For each, note:
60
+ - Whether it adds genuine value or is scope creep
61
+ - Suggested enhancements that would elevate the requirement beyond minimum
62
+
63
+ ## Cross-Reference Issues
64
+ List any CLAUDE.md references that don't match actual files (missing commands, agents, skills, or wrong tool commands).
@@ -16,7 +16,8 @@ Read-only. Never modify code.
16
16
  a. Verify the feature exists in the codebase
17
17
  b. Check if there's a corresponding automated test
18
18
  c. If automated test exists, verify it covers the scenario's steps
19
- d. Flag gaps: scenarios without tests, tests without scenarios
19
+ d. Flag scenarios without automated tests
20
+ 3. Scan test files to identify orphaned tests (tests without corresponding UAT scenarios)
20
21
 
21
22
  ## Output: Traceability Matrix
22
23
 
@@ -29,9 +30,13 @@ Read-only. Never modify code.
29
30
  - Automated: X
30
31
  - Manual only: X
31
32
  - Coverage: X%
33
+ - Orphaned tests: X
32
34
 
33
35
  ## Gaps
34
36
  List scenarios that need automated tests, prioritized by UAT priority (P0 first).
35
37
 
38
+ ## Orphaned Tests
39
+ List automated tests that don't map to any UAT scenario, organized by test file.
40
+
36
41
  ## Recommendations
37
42
  Suggest specific test implementations for uncovered P0 scenarios.
@@ -14,7 +14,7 @@
14
14
  ## RULES
15
15
  - Never commit `.env` files or secrets
16
16
  - Never modify migration files directly — generate new migrations instead
17
- - All API responses use structured error format: `{ error: { code, message } }`
17
+ - All API responses use structured error format: `{ "error": { "code": "ERR_CODE", "message": "..." } }`
18
18
  - Never leak stack traces to clients
19
19
  - Health check endpoints must always be available
20
20
  - Write tests for new features before marking them complete
@@ -23,7 +23,7 @@
23
23
 
24
24
  ## Pitfalls
25
25
  - Never commit lock file merge conflicts — delete and regenerate
26
- - Never use `any` type — use `unknown` and narrow with type guards
26
+ - Never use loose types (`any` in TS, `Any` in Python) — use strict types and narrow explicitly
27
27
  - Never hardcode URLs, ports, or credentials — use environment variables
28
28
  - Never catch errors silently — always log or re-throw
29
29
  - Never push directly to main — always use feature branches
@@ -48,6 +48,7 @@ Delegate to specialized agents for complex tasks:
48
48
  | `chief-of-staff` | Orchestrate multi-agent complex tasks |
49
49
  | `loop-operator` | Run autonomous improvement loops |
50
50
  | `harness-optimizer` | Audit and optimize Claude Code setup |
51
+ | `product-strategist` | Research competitors, evaluate maturity, recommend improvements |
51
52
 
52
53
  ## Skills
53
54
  Framework-specific knowledge is in `.claude/skills/` — reference these for deep patterns:
@@ -11,7 +11,7 @@
11
11
  - Environment variables: NEXT_PUBLIC_ prefix for client-side, plain for server-side
12
12
 
13
13
  ## Next.js Pitfalls
14
- - Never use `useEffect` for data fetching in Server Components use `async` component functions
14
+ - Avoid Client Components with `useEffect` for data fetching — prefer async Server Components instead
15
15
  - Never use `router.push()` when `<Link>` works — Link enables prefetching
16
16
  - Always add `loading.tsx` for pages with async data fetching
17
17
  - Never add `'use client'` unless the component actually uses browser APIs, event handlers, or hooks
@@ -22,7 +22,7 @@ For each error:
22
22
  1. Read the file to see error context
23
23
  2. Diagnose the root cause (missing import, wrong type, syntax error)
24
24
  3. Apply the smallest possible fix
25
- 4. Re-run the build to verify the error is gone
25
+ 4. Re-run all three commands (build, lint, type check) to confirm the error is gone and no new errors were introduced
26
26
  5. Move to the next error
27
27
 
28
28
  ## Step 4: Guardrails
@@ -30,6 +30,11 @@ For each changed file, check:
30
30
  - Mutation of shared state (use immutable patterns)
31
31
  - Missing accessibility attributes (a11y)
32
32
 
33
+ **Code Style (LOW):**
34
+ - Naming convention violations
35
+ - Minor formatting inconsistencies
36
+ - Missing documentation comments
37
+
33
38
  ## Step 3: Generate Report
34
39
 
35
40
  For each issue found:
@@ -37,9 +42,9 @@ For each issue found:
37
42
  - **File**: path and line number
38
43
  - **Issue**: what's wrong
39
44
  - **Fix**: how to fix it
40
-
41
45
  ## Step 4: Verdict
42
46
 
43
47
  - If CRITICAL issues found → block commit, list required fixes
48
+ - If HIGH issues found (no CRITICAL) → strongly recommend fixes before commit
44
49
  - If only MEDIUM/LOW → approve with suggestions
45
50
  - Never approve code with security vulnerabilities
@@ -0,0 +1,61 @@
1
+ Run every audit and review agent in a single pass. Use this when you want a comprehensive project health check.
2
+
3
+ ## Step 1: Build + Lint + Tests
4
+
5
+ 1. Run lint: `{{LINT_COMMAND}}`
6
+ 2. Run type check: `{{TYPE_CHECK_COMMAND}}`
7
+ 3. Run tests: `{{TEST_COMMAND}}`
8
+
9
+ If any step fails, report the failures but continue with the remaining audits.
10
+
11
+ ## Step 2: Code Review (changed files)
12
+
13
+ 1. Get changed files: `git diff --name-only HEAD`
14
+ 2. For each changed file, check for:
15
+ - Hardcoded credentials, API keys, tokens
16
+ - SQL injection, XSS, path traversal
17
+ - Functions > 50 lines, files > 800 lines
18
+ - Missing error handling, console.log left in
19
+ - Missing tests for new code
20
+
21
+ ## Step 3: Launch Review Agents
22
+
23
+ Run these agents in sequence on the full codebase:
24
+
25
+ 1. **code-quality-reviewer** — code patterns, duplication, naming
26
+ 2. **security-reviewer** — vulnerabilities, secrets, unsafe operations
27
+ 3. **production-readiness** — deployment readiness, error handling, health checks
28
+ 4. **database-reviewer** — query performance, N+1, schema issues (skip if no database)
29
+
30
+ ## Step 4: Structural Audits
31
+
32
+ 1. **Wiring audit** — verify all API endpoints are connected between frontend and backend
33
+ 2. **Spec audit** — if `docs/` contains a spec/PRD, validate implementation coverage
34
+
35
+ ## Step 5: Claude Code Setup + Product Strategy
36
+
37
+ 1. **harness-optimizer** — check if .claude/ setup follows best practices (includes consistency, accuracy, formatting checks)
38
+ 2. **product-strategist** — research competitors via web search, evaluate project maturity, recommend improvements
39
+
40
+ ## Step 6: Summary Report
41
+
42
+ Compile all findings into a single report grouped by severity:
43
+
44
+ ```
45
+ CRITICAL (must fix before merge):
46
+ - [list]
47
+
48
+ HIGH (fix soon):
49
+ - [list]
50
+
51
+ MEDIUM (improve when possible):
52
+ - [list]
53
+
54
+ LOW (nice to have):
55
+ - [list]
56
+
57
+ PASSED:
58
+ - [list of checks that found no issues]
59
+ ```
60
+
61
+ Include total counts: X critical, Y high, Z medium, W low.
@@ -15,10 +15,14 @@ Show the developer what workflows are available.
15
15
 
16
16
  ### Verification
17
17
  - `/verify-all` — Run lint, type check, tests, then launch all reviewers
18
+ - `/full-audit` — Run every audit and review agent in a single pass
18
19
  - `/audit-spec` — Validate implementation against a spec/PRD
19
20
  - `/audit-wiring` — Find dead or unwired features
20
21
  - `/audit-security` — Run a security audit
21
22
 
23
+ ### Strategy
24
+ - Use `product-strategist` agent — Research competitors, evaluate project maturity, recommend improvements
25
+
22
26
  ### Release
23
27
  - `/pre-pr` — Run the complete pre-PR checklist
24
28
  - `/run-uat` — Execute UAT scenarios
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // Auto-fix lint issues on saved TypeScript or Python files (polyglot)
3
3
 
4
- import { execSync } from 'node:child_process';
4
+ import { execFileSync } from 'node:child_process';
5
+ import { resolve, sep, relative } from 'node:path';
5
6
 
6
7
  let input = '';
7
8
  process.stdin.setEncoding('utf8');
@@ -11,21 +12,38 @@ process.stdin.on('end', () => {
11
12
  const data = JSON.parse(input);
12
13
  const filePath = data?.tool_input?.file_path || '';
13
14
 
14
- if (!filePath) {
15
+ if (!filePath || filePath.includes('..')) {
16
+ process.exit(0);
17
+ }
18
+
19
+ // Ensure path stays within the working directory
20
+ const resolved = resolve(filePath);
21
+ const cwd = resolve('.');
22
+ if (!resolved.startsWith(cwd + sep) && resolved !== cwd) {
15
23
  process.exit(0);
16
24
  }
17
25
 
18
26
  if (filePath.endsWith('.ts') || filePath.endsWith('.tsx')) {
19
- try {
20
- execSync(`npx eslint --fix "${filePath}"`, { stdio: 'pipe', cwd: 'frontend' });
21
- } catch {
22
- // eslint may exit non-zero for unfixable issues — that's okay
27
+ const frontendDir = resolve('frontend');
28
+ if (resolved.startsWith(frontendDir + sep)) {
29
+ const targetPath = relative(frontendDir, resolved);
30
+ if (targetPath.startsWith('..')) process.exit(0);
31
+ try {
32
+ execFileSync('npx', ['eslint', '--fix', targetPath], { stdio: 'pipe', cwd: 'frontend' });
33
+ } catch {
34
+ // eslint may exit non-zero for unfixable issues — that's okay
35
+ }
23
36
  }
24
37
  } else if (filePath.endsWith('.py')) {
25
- try {
26
- execSync(`ruff check --fix "${filePath}"`, { stdio: 'pipe', cwd: 'backend' });
27
- } catch {
28
- // ruff may exit non-zero for unfixable issues — that's okay
38
+ const backendDir = resolve('backend');
39
+ if (resolved.startsWith(backendDir + sep)) {
40
+ const targetPath = relative(backendDir, resolved);
41
+ if (targetPath.startsWith('..')) process.exit(0);
42
+ try {
43
+ execFileSync('ruff', ['check', '--fix', targetPath], { stdio: 'pipe', cwd: 'backend' });
44
+ } catch {
45
+ // ruff may exit non-zero for unfixable issues — that's okay
46
+ }
29
47
  }
30
48
  }
31
49
 
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // Auto-fix lint issues on saved Python files
3
3
 
4
- import { execSync } from 'node:child_process';
4
+ import { execFileSync } from 'node:child_process';
5
+ import { resolve, sep } from 'node:path';
5
6
 
6
7
  let input = '';
7
8
  process.stdin.setEncoding('utf8');
@@ -11,18 +12,24 @@ process.stdin.on('end', () => {
11
12
  const data = JSON.parse(input);
12
13
  const filePath = data?.tool_input?.file_path || '';
13
14
 
14
- if (!filePath) {
15
+ if (!filePath || filePath.includes('..')) {
16
+ process.exit(0);
17
+ }
18
+
19
+ // Ensure path stays within the working directory
20
+ const resolved = resolve(filePath);
21
+ const cwd = resolve('.');
22
+ if (!resolved.startsWith(cwd + sep) && resolved !== cwd) {
15
23
  process.exit(0);
16
24
  }
17
25
 
18
26
  if (filePath.endsWith('.py')) {
19
27
  try {
20
- execSync(`ruff check --fix "${filePath}"`, { stdio: 'pipe', cwd: 'backend' });
28
+ execFileSync('ruff', ['check', '--fix', resolved], { stdio: 'pipe' });
21
29
  } catch {
22
30
  // ruff may exit non-zero for unfixable issues — that's okay
23
31
  }
24
32
  }
25
-
26
33
  process.exit(0);
27
34
  } catch {
28
35
  process.exit(0);
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // Auto-fix lint issues on saved TypeScript files
3
3
 
4
- import { execSync } from 'node:child_process';
4
+ import { execFileSync } from 'node:child_process';
5
+ import { resolve, sep } from 'node:path';
5
6
 
6
7
  let input = '';
7
8
  process.stdin.setEncoding('utf8');
@@ -11,13 +12,20 @@ process.stdin.on('end', () => {
11
12
  const data = JSON.parse(input);
12
13
  const filePath = data?.tool_input?.file_path || '';
13
14
 
14
- if (!filePath) {
15
+ if (!filePath || filePath.includes('..')) {
16
+ process.exit(0);
17
+ }
18
+
19
+ // Ensure path stays within the working directory
20
+ const resolved = resolve(filePath);
21
+ const cwd = resolve('.');
22
+ if (!resolved.startsWith(cwd + sep) && resolved !== cwd) {
15
23
  process.exit(0);
16
24
  }
17
25
 
18
26
  if (filePath.endsWith('.ts') || filePath.endsWith('.tsx')) {
19
27
  try {
20
- execSync(`npx eslint --fix "${filePath}"`, { stdio: 'pipe' });
28
+ execFileSync('npx', ['eslint', '--fix', resolved], { stdio: 'pipe' });
21
29
  } catch {
22
30
  // eslint may exit non-zero for unfixable issues — that's okay
23
31
  }
@@ -22,11 +22,11 @@ process.stdin.on('end', () => {
22
22
  }
23
23
 
24
24
  // Block migration files
25
- if (filePath.includes('prisma/migrations/') || filePath.includes('alembic/versions/')) {
25
+ const normalizedPath = filePath.replace(/\\/g, '/');
26
+ if (normalizedPath.includes('prisma/migrations/') || normalizedPath.includes('alembic/versions/')) {
26
27
  process.stderr.write('BLOCKED: Do not modify migration files directly\n');
27
28
  process.exit(2);
28
29
  }
29
-
30
30
  process.exit(0);
31
31
  } catch {
32
32
  process.exit(0);
@@ -33,6 +33,7 @@ description: AI/LLM integration patterns and best practices
33
33
  ## Security
34
34
  - Never include user secrets in prompts
35
35
  - Sanitize user input before including in prompts
36
+ - Protect against prompt injection attacks (delimiter tokens, input validation, output filtering)
36
37
  - Validate and sanitize AI output before using
37
38
  - Don't trust AI output for security decisions
38
39
 
@@ -29,7 +29,7 @@ description: FastAPI + SQLAlchemy 2.0 + Pydantic v2 patterns
29
29
  - Raise `AppError` subclasses, never `HTTPException` with raw strings
30
30
  - Global exception handler catches unhandled errors
31
31
  - Never expose stack traces or internal details to clients
32
- - Use structured error format: `{ error: { code, message } }`
32
+ - Use structured error format: `{ "error": { "code": "ERR_CODE", "message": "Error description" } }`
33
33
 
34
34
  ## Testing
35
35
  - Use `httpx.AsyncClient` with `ASGITransport` for async tests
@@ -59,6 +59,6 @@ If rebase gets messy: `git rebase --abort` and start over.
59
59
 
60
60
  - Never force-push to `main`
61
61
  - Never commit `.env` files, credentials, or large binaries
62
- - Never rebase commits that have been pushed and shared
63
- - Never merge main into feature branches (rebase instead)
64
- - Always pull before pushing: `git pull --rebase origin main`
62
+ - Never rebase shared branches (`main`, `develop`) only rebase your own feature branches
63
+ - Update feature branches with `git rebase origin/main`, not `git merge main` (force-push your branch after)
64
+ - Always pull before pushing: `git pull --rebase` (pulls current branch's upstream)
@@ -33,7 +33,7 @@ description: Next.js 15 App Router patterns and best practices
33
33
  - Intercepting routes `(.)` for modals
34
34
 
35
35
  ## Common Mistakes
36
- - Don't use `useEffect` for data fetching in Server Components
36
+ - Avoid Client Components with `useEffect` for data fetching prefer async Server Components instead
37
37
  - Don't pass functions as props from Server to Client Components
38
38
  - Don't use `router.push` when `<Link>` works
39
39
  - Don't create API routes for data that Server Components can fetch directly
@@ -11,11 +11,12 @@ description: Playwright E2E testing patterns and best practices
11
11
  - Use `test.beforeEach()` for common setup (navigation, auth)
12
12
  - Use page object pattern for complex pages
13
13
 
14
- ## Selectors
15
- - Prefer `data-testid` attributes: `page.getByTestId('submit-btn')`
16
- - Use accessible selectors: `page.getByRole('button', { name: 'Submit' })`
17
- - Use text selectors: `page.getByText('Welcome')`
18
- - Avoid CSS selectors they break when styles change
14
+ ## Selector Priority
15
+ 1. `getByRole()` buttons, links, headings (best for accessibility)
16
+ 2. `getByLabel()` form inputs by label
17
+ 3. `getByText()` — visible text content
18
+ 4. `getByTestId()``data-testid` attributes (last resort)
19
+ - Avoid CSS selectors or XPath — they break when styles change
19
20
 
20
21
  ## Assertions
21
22
  - Use `expect(locator)` for element assertions
@@ -25,8 +26,8 @@ description: Playwright E2E testing patterns and best practices
25
26
 
26
27
  ## Common Patterns
27
28
  - Navigation: `await page.goto('/')` then assert page loaded
28
- - Form filling: `await page.fill('[name=email]', 'test@example.com')`
29
- - Clicking: `await page.click('button[type=submit]')` or `getByRole`
29
+ - Form filling: `await page.getByLabel('Email').fill('test@example.com')`
30
+ - Clicking: `await page.getByRole('button', { name: 'Submit' }).click()`
30
31
  - Waiting: prefer auto-waiting over explicit waits
31
32
  - Network: `page.waitForResponse()` for API-dependent tests
32
33
  - Authentication: use `storageState` for persistent auth across tests