sequant 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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/dist/bin/cli.d.ts +8 -0
  4. package/dist/bin/cli.d.ts.map +1 -0
  5. package/dist/bin/cli.js +70 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/src/commands/doctor.d.ts +8 -0
  8. package/dist/src/commands/doctor.d.ts.map +1 -0
  9. package/dist/src/commands/doctor.js +171 -0
  10. package/dist/src/commands/doctor.js.map +1 -0
  11. package/dist/src/commands/init.d.ts +11 -0
  12. package/dist/src/commands/init.d.ts.map +1 -0
  13. package/dist/src/commands/init.js +124 -0
  14. package/dist/src/commands/init.js.map +1 -0
  15. package/dist/src/commands/run.d.ts +18 -0
  16. package/dist/src/commands/run.d.ts.map +1 -0
  17. package/dist/src/commands/run.js +229 -0
  18. package/dist/src/commands/run.js.map +1 -0
  19. package/dist/src/commands/status.d.ts +5 -0
  20. package/dist/src/commands/status.d.ts.map +1 -0
  21. package/dist/src/commands/status.js +45 -0
  22. package/dist/src/commands/status.js.map +1 -0
  23. package/dist/src/commands/update.d.ts +10 -0
  24. package/dist/src/commands/update.d.ts.map +1 -0
  25. package/dist/src/commands/update.js +124 -0
  26. package/dist/src/commands/update.js.map +1 -0
  27. package/dist/src/index.d.ts +15 -0
  28. package/dist/src/index.d.ts.map +1 -0
  29. package/dist/src/index.js +13 -0
  30. package/dist/src/index.js.map +1 -0
  31. package/dist/src/lib/fs.d.ts +10 -0
  32. package/dist/src/lib/fs.d.ts.map +1 -0
  33. package/dist/src/lib/fs.js +44 -0
  34. package/dist/src/lib/fs.js.map +1 -0
  35. package/dist/src/lib/manifest.d.ts +14 -0
  36. package/dist/src/lib/manifest.d.ts.map +1 -0
  37. package/dist/src/lib/manifest.js +37 -0
  38. package/dist/src/lib/manifest.js.map +1 -0
  39. package/dist/src/lib/stacks.d.ts +22 -0
  40. package/dist/src/lib/stacks.d.ts.map +1 -0
  41. package/dist/src/lib/stacks.js +131 -0
  42. package/dist/src/lib/stacks.js.map +1 -0
  43. package/dist/src/lib/templates.d.ts +16 -0
  44. package/dist/src/lib/templates.d.ts.map +1 -0
  45. package/dist/src/lib/templates.js +118 -0
  46. package/dist/src/lib/templates.js.map +1 -0
  47. package/dist/src/lib/workflow/cli-args.d.ts +138 -0
  48. package/dist/src/lib/workflow/cli-args.d.ts.map +1 -0
  49. package/dist/src/lib/workflow/cli-args.js +210 -0
  50. package/dist/src/lib/workflow/cli-args.js.map +1 -0
  51. package/dist/src/lib/workflow/execute-issues.d.ts +42 -0
  52. package/dist/src/lib/workflow/execute-issues.d.ts.map +1 -0
  53. package/dist/src/lib/workflow/execute-issues.js +463 -0
  54. package/dist/src/lib/workflow/execute-issues.js.map +1 -0
  55. package/dist/src/lib/workflow/logger.d.ts +168 -0
  56. package/dist/src/lib/workflow/logger.d.ts.map +1 -0
  57. package/dist/src/lib/workflow/logger.js +249 -0
  58. package/dist/src/lib/workflow/logger.js.map +1 -0
  59. package/dist/src/lib/workflow/types.d.ts +89 -0
  60. package/dist/src/lib/workflow/types.d.ts.map +1 -0
  61. package/dist/src/lib/workflow/types.js +23 -0
  62. package/dist/src/lib/workflow/types.js.map +1 -0
  63. package/package.json +69 -0
  64. package/stacks/go.yaml +22 -0
  65. package/stacks/nextjs.yaml +28 -0
  66. package/stacks/python.yaml +24 -0
  67. package/stacks/rust.yaml +23 -0
  68. package/templates/hooks/post-tool.sh +301 -0
  69. package/templates/hooks/pre-tool.sh +350 -0
  70. package/templates/memory/constitution.md +60 -0
  71. package/templates/scripts/cleanup-worktree.sh +78 -0
  72. package/templates/scripts/list-worktrees.sh +50 -0
  73. package/templates/scripts/new-feature.sh +156 -0
  74. package/templates/settings.json +26 -0
  75. package/templates/skills/assess/SKILL.md +428 -0
  76. package/templates/skills/clean/SKILL.md +196 -0
  77. package/templates/skills/docs/SKILL.md +323 -0
  78. package/templates/skills/exec/SKILL.md +426 -0
  79. package/templates/skills/fullsolve/SKILL.md +479 -0
  80. package/templates/skills/loop/SKILL.md +310 -0
  81. package/templates/skills/qa/SKILL.md +261 -0
  82. package/templates/skills/qa/references/code-quality-exemplars.md +112 -0
  83. package/templates/skills/qa/references/code-review-checklist.md +77 -0
  84. package/templates/skills/qa/references/quality-gates.md +95 -0
  85. package/templates/skills/qa/references/testing-requirements.md +109 -0
  86. package/templates/skills/qa/scripts/quality-checks.sh +109 -0
  87. package/templates/skills/reflect/SKILL.md +159 -0
  88. package/templates/skills/reflect/references/documentation-tiers.md +70 -0
  89. package/templates/skills/reflect/references/phase-reflection.md +95 -0
  90. package/templates/skills/reflect/scripts/workflow-queries.ts +165 -0
  91. package/templates/skills/security-review/SKILL.md +344 -0
  92. package/templates/skills/security-review/references/security-checklists.md +377 -0
  93. package/templates/skills/solve/SKILL.md +242 -0
  94. package/templates/skills/spec/SKILL.md +169 -0
  95. package/templates/skills/spec/references/parallel-groups.md +72 -0
  96. package/templates/skills/spec/references/verification-criteria.md +104 -0
  97. package/templates/skills/test/SKILL.md +508 -0
  98. package/templates/skills/testgen/SKILL.md +561 -0
  99. package/templates/skills/verify/SKILL.md +266 -0
@@ -0,0 +1,77 @@
1
+ # Code Review Checklist
2
+
3
+ ## Duplicate Utility Check
4
+
5
+ Before approving any new helper functions, components, or types, check:
6
+ 1. `docs/patterns/HELPERS.md` - Does a similar helper already exist?
7
+ 2. `docs/patterns/COMPONENTS.md` - Does a similar component already exist?
8
+ 3. `docs/patterns/TYPES.md` - Does a similar type already exist?
9
+
10
+ If duplicates are found, flag as `AC_MET_BUT_NOT_A_PLUS` with recommendation to use existing utilities.
11
+
12
+ ## Integration Verification
13
+
14
+ Before approving, verify the implementation integrates properly:
15
+
16
+ ### 1. File Locations
17
+ Are new files in correct directories per `scripts/README.md` structure?
18
+ ```bash
19
+ git diff main...HEAD --name-only | grep "^scripts/"
20
+ ```
21
+
22
+ ### 2. Pattern Compliance
23
+ Do new scripts follow existing patterns?
24
+ - Scripts: Inline Supabase client, env validation, CLI flags (`--dry-run`, `--limit`)
25
+ - Components: Follow established admin patterns (List + Card + Modal)
26
+ - Compare with similar files: `ls scripts/fix/` or `ls components/admin/`
27
+
28
+ ### 3. Documentation References
29
+ Check for dangling refs in CLAUDE.md:
30
+ ```bash
31
+ grep -oE 'docs/[A-Z_]+\.md' CLAUDE.md | sort -u | while read f; do
32
+ [ ! -f "$f" ] && echo "Missing: $f"
33
+ done
34
+ ```
35
+
36
+ ### 4. CLAUDE.md Updates Needed?
37
+ If adding new scripts/commands, should they be documented?
38
+ - New scripts in `scripts/` → Add to Common Commands section
39
+ - New patterns → Add to Key Patterns or patterns catalog
40
+
41
+ ## Do NOT Nitpick
42
+
43
+ Skip trivial formatting if the repo already has automated formatting tools.
44
+
45
+ ## RLS-Protected Table Access Check
46
+
47
+ Admin pages must use `supabaseAdmin`:
48
+
49
+ ```bash
50
+ rls_tables="content_updates|content_ideas|fact_check_logs"
51
+ admin_files=$(git diff main...HEAD --name-only | grep -E "^app/admin/")
52
+ if [[ -n "$admin_files" ]]; then
53
+ for file in $admin_files; do
54
+ if [[ -f "$file" ]]; then
55
+ if grep -q "from '@/lib/supabase'" "$file" && grep -qE "\.from\(['\"]($rls_tables)['\"]" "$file"; then
56
+ echo "❌ BLOCKER: $file uses anon client for RLS-protected table"
57
+ fi
58
+ fi
59
+ done
60
+ fi
61
+ ```
62
+
63
+ ## Integration Check
64
+
65
+ Verify new exports are imported somewhere:
66
+ ```bash
67
+ new_files=$(git diff main...HEAD --name-only --diff-filter=A | grep -E "\.(ts|tsx)$" || true)
68
+ for file in $new_files; do
69
+ exports=$(grep -oE "export (const|function|class|type|interface) ([A-Za-z_][A-Za-z0-9_]*)" "$file" | awk '{print $3}')
70
+ for exp in $exports; do
71
+ import_count=$(grep -r "import.*$exp" --include="*.ts" --include="*.tsx" . | grep -v "$file" | wc -l | xargs)
72
+ if [[ $import_count -eq 0 ]]; then
73
+ echo "⚠️ '$exp' exported from $file but never imported"
74
+ fi
75
+ done
76
+ done
77
+ ```
@@ -0,0 +1,95 @@
1
+ # Quality Gates & Verdict Criteria
2
+
3
+ ## Automated Check Synthesis
4
+
5
+ Combine agent outputs into a unified quality assessment:
6
+
7
+ | Agent | Output | Weight |
8
+ |-------|--------|--------|
9
+ | Type Safety Checker | Type issues count, verdict | High - blocking if issues > 3 |
10
+ | Scope/Size Checker | Files changed, LOC, assessment | Medium - warning if very large |
11
+ | Security Scanner | Critical/warning/info counts | High - blocking if criticals > 0 |
12
+ | RLS Checker (conditional) | Violations found | High - blocking if violations |
13
+
14
+ **Synthesis Rules:**
15
+ - **Any FAIL verdict** → Flag as blocker in manual review
16
+ - **Security criticals** → Block merge, require fix before proceeding
17
+ - **All PASS** → Proceed with confidence to manual review
18
+ - **WARN verdicts** → Note in review, verify manually
19
+
20
+ ## Verdict Criteria
21
+
22
+ ### `READY_FOR_MERGE`
23
+
24
+ Must meet ALL of:
25
+ - ✅ All AC items marked `MET`
26
+ - ✅ Type issues = 0 (no `any` additions)
27
+ - ✅ Deleted tests = 0 (or justified)
28
+ - ✅ Purpose Test: All files necessary
29
+ - ✅ Proportionality Test: Size matches AC complexity
30
+ - ✅ Risk Test: Blast radius understood and acceptable
31
+ - ✅ Reversibility Test: Clean revert possible
32
+ - ✅ **Adversarial Test: Failure path tested**
33
+ - ✅ **Edge Case Test: At least 1 edge case per AC tested**
34
+
35
+ ### `AC_MET_BUT_NOT_A_PLUS`
36
+
37
+ AC met, but one or more issues:
38
+ - ⚠️ Minor scope creep (1-2 extra files)
39
+ - ⚠️ Over-engineering (abstraction not required)
40
+ - ⚠️ Size larger than expected but justified
41
+ - ⚠️ Type issues present but necessary
42
+ - ⚠️ Code works but could be cleaner
43
+
44
+ **Action:** List specific improvements, but don't block merge if working
45
+
46
+ ### `AC_NOT_MET`
47
+
48
+ Any of:
49
+ - ❌ One or more AC items `NOT_MET` or `PARTIALLY_MET`
50
+ - ❌ Deleted tests without justification
51
+ - ❌ Major scope creep (many unrelated files)
52
+ - ❌ Type safety violations (adding `any` without reason)
53
+ - ❌ Schema changes without migrations
54
+ - ❌ Breaking changes to shared code
55
+
56
+ **Action:** Block merge, list required fixes
57
+
58
+ ## Code Review Decision Framework
59
+
60
+ ### 1. Purpose Test
61
+ **Question:** Can I explain why each changed file was necessary for the AC?
62
+ - ✅ **Yes, all files:** Strong signal for `READY_FOR_MERGE`
63
+ - ⚠️ **Yes, most files:** May indicate minor scope creep → `AC_MET_BUT_NOT_A_PLUS`
64
+ - ❌ **No, many files unclear:** Scope creep → `AC_NOT_MET`
65
+
66
+ ### 2. Proportionality Test
67
+ **Question:** Is the diff size reasonable for AC complexity?
68
+
69
+ **Reference:**
70
+ - 1-3 simple AC: <100 LOC expected
71
+ - 4-6 medium AC: 100-300 LOC expected
72
+ - 7+ complex AC: 300-500 LOC expected
73
+
74
+ ### 3. Risk Test
75
+ **Question:** What's the blast radius if this breaks?
76
+ - ✅ **Isolated feature, easy to revert:** Lower bar for approval
77
+ - ⚠️ **Touches shared utilities:** Scrutinize more carefully
78
+ - ❌ **Changes core types, schemas, or auth:** Highest bar
79
+
80
+ ### 4. Reversibility Test
81
+ **Question:** Would reverting lose anything besides the AC?
82
+ - ✅ **No, only AC work:** Clean implementation
83
+ - ⚠️ **Yes, minor refactors:** Document them, may still approve
84
+ - ❌ **Yes, major refactors/features:** Scope creep
85
+
86
+ ## Check Interpretation
87
+
88
+ - **Type issues** = 0: ✅ Good
89
+ - **Type issues** > 0: ⚠️ Review each case, ensure justified
90
+ - **Deleted tests** > 0: ❌ Blocker unless tests obsolete
91
+ - **Files changed**: Compare to similar features for proportionality
92
+ - **Net LOC**: Should align with AC complexity (see Size Check guidelines)
93
+ - **Unintegrated exports**: ⚠️ Warning only
94
+ - **Security criticals** > 0: ❌ Blocker
95
+ - **Security warnings** > 0: ⚠️ Review each case
@@ -0,0 +1,109 @@
1
+ # Testing Requirements
2
+
3
+ ## Adversarial Thinking Checklist
4
+
5
+ **STOP and ask these questions before any READY_FOR_MERGE verdict:**
6
+
7
+ ### 1. "What would break this?"
8
+ - [ ] Identified at least 2 failure scenarios
9
+ - [ ] Actually tested each failure scenario (not just thought about it)
10
+ - [ ] Documented what happens when failure occurs
11
+
12
+ ### 2. "What assumptions am I making?"
13
+ - [ ] Listed key assumptions (API behavior, data format, status codes)
14
+ - [ ] Validated each assumption with actual test
15
+ - [ ] If assumption can't be tested, flagged as risk
16
+
17
+ ### 3. "What's the unhappy path?"
18
+ - [ ] Tested behavior when inputs are invalid
19
+ - [ ] Tested behavior when dependencies fail
20
+ - [ ] Tested behavior when resources don't exist
21
+
22
+ ### 4. "Did I test the feature's PRIMARY PURPOSE?"
23
+ - [ ] If feature handles errors → actually triggered an error
24
+ - [ ] If feature retries → actually triggered a retry
25
+ - [ ] If feature validates → actually provided invalid input
26
+ - [ ] If feature blocks → actually tried the blocked action
27
+
28
+ ## Failure Path Testing by Feature Type
29
+
30
+ | Feature Type | Must Test |
31
+ |--------------|-----------|
32
+ | Retry mechanism | Force a failure, verify retry triggers |
33
+ | Validation | Submit invalid data, verify rejection |
34
+ | Error handling | Cause an error, verify graceful handling |
35
+ | Auth/permissions | Try unauthorized action, verify blocked |
36
+ | Rate limiting | Exceed limit, verify throttled |
37
+
38
+ ## Red Flags (Incomplete Testing)
39
+
40
+ - ❌ "All tests pass" but no failure scenarios tested
41
+ - ❌ "Feature works" but only success path verified
42
+ - ❌ Unit tests pass but integration never tested
43
+ - ❌ No manual testing of edge cases
44
+
45
+ ## Edge Case Verification
46
+
47
+ For each AC, identify and test at least ONE edge case:
48
+
49
+ | AC | Happy Path Tested | Edge Case Identified | Edge Case Tested |
50
+ |----|-------------------|---------------------|------------------|
51
+ | AC-1 | ✅ | Empty input | ✅ |
52
+ | AC-2 | ✅ | Concurrent access | ❌ (flagged as risk) |
53
+ | AC-3 | ✅ | Non-existent resource | ✅ |
54
+
55
+ **Common edge cases to consider:**
56
+ - Empty/null inputs
57
+ - Maximum/minimum values
58
+ - Concurrent operations
59
+ - Non-existent resources
60
+ - Permission denied scenarios
61
+ - Network/timeout failures
62
+ - Invalid state transitions
63
+
64
+ ## Admin Feature Smoke Test
65
+
66
+ **REQUIRED for `app/admin/` changes:**
67
+
68
+ ```bash
69
+ admin_modified=$(git diff main...HEAD --name-only | grep -E "^app/admin/" | head -1)
70
+ if [[ -n "$admin_modified" ]]; then
71
+ echo "⚠️ Admin files modified - smoke test required"
72
+ fi
73
+ ```
74
+
75
+ **Smoke test checklist:**
76
+ - [ ] Navigate to `/admin/news` - stat cards show data
77
+ - [ ] Navigate to affected feature page - content displays
78
+ - [ ] If feature queries `content_updates`, `content_ideas`, `fact_check_logs` - verify data appears
79
+
80
+ **Smoke test failure = BLOCKER**
81
+
82
+ ## Cache & RLS Verification
83
+
84
+ **If feature displays content on public pages:**
85
+ - [ ] Verify `revalidatePath('/')` called if content appears on homepage
86
+ - [ ] Verify `revalidatePath` covers all pages displaying the content
87
+ - [ ] Test in incognito (anon client) to verify public reads work
88
+
89
+ **Check RLS allows public reads:**
90
+ ```sql
91
+ SELECT policyname, cmd, qual FROM pg_policies WHERE tablename = 'TABLE_NAME';
92
+ ```
93
+
94
+ ## Integration Smoke Test
95
+
96
+ **For external system integrations:**
97
+
98
+ 1. **Identify the integration point** - Document: `Integration: <system name>`
99
+
100
+ 2. **Validate assumptions**
101
+ - [ ] API contract verified against official docs
102
+ - [ ] Data format assumptions tested
103
+ - [ ] Authentication method confirmed
104
+ - [ ] Error response handling matches actual API
105
+
106
+ 3. **Manual smoke test**
107
+ - [ ] Actually invoke the integration once
108
+ - [ ] Verify data flows end-to-end
109
+ - [ ] Document: "Tested by: <description>"
@@ -0,0 +1,109 @@
1
+ #!/bin/bash
2
+ # Quality checks script for /qa command
3
+ # Run these checks before detailed review
4
+
5
+ set -e
6
+
7
+ echo "🔍 Running automated quality checks..."
8
+ echo ""
9
+
10
+ # 1. Type safety check - detect 'any' type usage
11
+ type_issues=$(git diff main...HEAD | grep -E ":\s*any[,)]|as any" | wc -l | xargs)
12
+ if [[ $type_issues -gt 0 ]]; then
13
+ echo "⚠️ WARNING: $type_issues potential 'any' type usages"
14
+ else
15
+ echo "✅ Type safety: No 'any' type additions"
16
+ fi
17
+
18
+ # 2. Deleted tests check
19
+ deleted_tests=$(git diff main...HEAD --diff-filter=D --name-only | grep -E "\\.test\\.|\\spec\\." | wc -l | xargs)
20
+ if [[ $deleted_tests -gt 0 ]]; then
21
+ echo "❌ BLOCKER: $deleted_tests test files deleted"
22
+ else
23
+ echo "✅ Test coverage: No test files deleted"
24
+ fi
25
+
26
+ # 3. Scope check - files changed
27
+ files_changed=$(git diff main...HEAD --name-only | wc -l | xargs)
28
+ echo "📊 Files changed: $files_changed"
29
+
30
+ # 4. Size check - LOC added/removed
31
+ additions=$(git diff main...HEAD --numstat | awk '{sum+=$1} END {print sum+0}')
32
+ deletions=$(git diff main...HEAD --numstat | awk '{sum+=$2} END {print sum+0}')
33
+ net_change=$((additions - deletions))
34
+ echo "📊 Diff size: +$additions -$deletions (net: $net_change lines)"
35
+
36
+ # 5. AC proportionality assessment
37
+ echo ""
38
+ if [[ $net_change -lt 100 ]]; then
39
+ echo "✅ Size: Small change (<100 net LOC)"
40
+ elif [[ $net_change -lt 300 ]]; then
41
+ echo "✅ Size: Medium change (100-300 net LOC)"
42
+ elif [[ $net_change -lt 500 ]]; then
43
+ echo "⚠️ Size: Large change (300-500 net LOC) - verify proportional to AC"
44
+ else
45
+ echo "❌ Size: Very large (>500 net LOC) - may indicate scope creep"
46
+ fi
47
+
48
+ # 6. RLS-protected table access check (admin pages must use supabaseAdmin)
49
+ echo ""
50
+ echo "🔒 Checking RLS-protected table access..."
51
+ rls_tables="content_updates|content_ideas|fact_check_logs"
52
+ admin_files=$(git diff main...HEAD --name-only | grep -E "^app/admin/" || true)
53
+ if [[ -n "$admin_files" ]]; then
54
+ rls_violations=0
55
+ for file in $admin_files; do
56
+ if [[ -f "$file" ]]; then
57
+ # Check if file imports anon client and queries RLS-protected tables
58
+ if grep -q "from '@/lib/supabase'" "$file" && grep -qE "\.from\(['\"]($rls_tables)['\"]" "$file"; then
59
+ echo "❌ BLOCKER: $file uses anon client for RLS-protected table"
60
+ echo " Fix: Use supabaseAdmin from '@/lib/supabase-admin' instead"
61
+ rls_violations=$((rls_violations + 1))
62
+ fi
63
+ fi
64
+ done
65
+ if [[ $rls_violations -eq 0 ]]; then
66
+ echo "✅ RLS access: No violations found in admin files"
67
+ fi
68
+ else
69
+ echo " No admin files modified"
70
+ fi
71
+
72
+ # 7. Integration check - verify new exports are imported somewhere
73
+ echo ""
74
+ echo "🔌 Checking integration of new exports..."
75
+ new_files=$(git diff main...HEAD --name-only --diff-filter=A | grep -E "\.(ts|tsx)$" || true)
76
+ if [[ -n "$new_files" ]]; then
77
+ unintegrated=0
78
+ for file in $new_files; do
79
+ if [[ -f "$file" ]]; then
80
+ exports=$(grep -oE "export (const|function|class|type|interface) ([A-Za-z_][A-Za-z0-9_]*)" "$file" 2>/dev/null | awk '{print $3}' || true)
81
+ for exp in $exports; do
82
+ if [[ -n "$exp" ]]; then
83
+ import_count=$(grep -r "import.*$exp" --include="*.ts" --include="*.tsx" . 2>/dev/null | grep -v "$file" | wc -l | xargs)
84
+ if [[ $import_count -eq 0 ]]; then
85
+ echo "⚠️ WARNING: '$exp' exported from $file but never imported"
86
+ unintegrated=$((unintegrated + 1))
87
+ fi
88
+ fi
89
+ done
90
+ fi
91
+ done
92
+ if [[ $unintegrated -eq 0 ]]; then
93
+ echo "✅ Integration: All exports are imported"
94
+ fi
95
+ else
96
+ echo " No new TypeScript files added"
97
+ fi
98
+
99
+ # 8. Security scan - OWASP vulnerability checks
100
+ echo ""
101
+ echo "🔒 Running security scan..."
102
+ if command -v npx &> /dev/null; then
103
+ npx tsx scripts/lib/__tests__/run-security-scan.ts 2>/dev/null || echo " Security scanner not available, skipping..."
104
+ else
105
+ echo " npx not available, skipping security scan"
106
+ fi
107
+
108
+ echo ""
109
+ echo "✅ Quality checks complete"
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: reflect
3
+ description: "Strategic reflection on workflow effectiveness and continuous improvement"
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Read
10
+ - Write
11
+ - Glob
12
+ - Grep
13
+ - mcp__supabase__execute_sql
14
+ ---
15
+
16
+ # Reflection Agent
17
+
18
+ You are the "Reflection Agent" for the current repository.
19
+
20
+ ## Purpose
21
+
22
+ When invoked as `/reflect`, your job is to:
23
+
24
+ 1. Analyze the recent work session for workflow effectiveness
25
+ 2. Identify friction points, inefficiencies, or missing context
26
+ 3. Propose targeted improvements to commands, docs, or processes
27
+ 4. Balance documentation completeness with actionability (avoid bloat)
28
+
29
+ ## Behavior
30
+
31
+ When called without arguments:
32
+ - Reflect on the current conversation/session
33
+ - Analyze what worked well and what could be improved
34
+ - Auto-detect current workflow phase (planning, implementation, QA)
35
+
36
+ When called with a focus area:
37
+ - `/reflect commands` - Focus on slash command effectiveness
38
+ - `/reflect docs` - Focus on documentation (CLAUDE.md, other docs/)
39
+ - `/reflect workflow` - Focus on development workflow (includes historical data)
40
+ - `/reflect tools` - Focus on tool usage patterns
41
+ - `/reflect planning` - Focus on planning phase (use during/after `/spec`)
42
+ - `/reflect implementation` - Focus on implementation phase (use during/after `/exec`)
43
+ - `/reflect qa` - Focus on QA/review phase (use during/after `/qa`)
44
+
45
+ ## Reflection Framework
46
+
47
+ ### 1. Session Analysis
48
+
49
+ **Effectiveness Metrics:**
50
+ - How many attempts to complete tasks?
51
+ - Were there repeated searches for the same information?
52
+ - Did I have the right context at the right time?
53
+ - Were there ambiguities that blocked progress?
54
+
55
+ **Friction Points:**
56
+ - What information was hard to find?
57
+ - What decisions took multiple iterations?
58
+ - What patterns did I have to discover vs. having documented?
59
+ - Where did I waste time or tokens?
60
+
61
+ ### 2. Root Cause Analysis
62
+
63
+ For each friction point, determine:
64
+ - **Missing documentation:** Information exists but isn't documented
65
+ - **Documentation bloat:** Information documented but hard to find/use
66
+ - **Process gap:** No established pattern for this scenario
67
+ - **Tool limitation:** Current tools don't support this workflow
68
+ - **Command gap:** Common task lacks dedicated slash command
69
+
70
+ ### 3. Improvement Proposals
71
+
72
+ See [documentation-tiers.md](references/documentation-tiers.md) for the 4-tier system.
73
+
74
+ **For Documentation Changes:**
75
+ - **What to add:** Missing patterns, decisions, or context
76
+ - **What to remove:** Outdated, redundant, or rarely-used content
77
+ - **What to restructure:** Information that's hard to find or too verbose
78
+ - **Where to put it:** Right file, right section, right level of detail
79
+
80
+ ## Documentation Balance Principles
81
+
82
+ **Avoid these anti-patterns:**
83
+ ❌ **Over-documentation:** Every edge case documented exhaustively
84
+ ❌ **Stale documentation:** Old information that's no longer accurate
85
+ ❌ **Premature documentation:** Documenting patterns before they're stable
86
+ ❌ **Redundant documentation:** Same info in multiple places
87
+ ❌ **Example overload:** Too many examples that obscure the pattern
88
+
89
+ **Follow these principles:**
90
+ ✅ **Just-in-time documentation:** Document when pattern stabilizes (2-3 uses)
91
+ ✅ **Progressive disclosure:** Brief overview → link to details
92
+ ✅ **Living documentation:** Review and prune quarterly
93
+ ✅ **Decision logs:** Document *why* not just *what*
94
+ ✅ **Searchable patterns:** Use consistent keywords for grep/search
95
+
96
+ ## Output Structure
97
+
98
+ ### **Session Summary**
99
+ - What was accomplished
100
+ - What went smoothly
101
+ - What caused friction
102
+
103
+ ### **Effectiveness Analysis**
104
+ - Token usage efficiency (did we re-read files unnecessarily?)
105
+ - Context gathering (did we find info quickly?)
106
+ - Decision making (were choices clear or iterative?)
107
+ - Pattern reuse (did we reinvent vs. follow existing patterns?)
108
+
109
+ ### **Proposed Changes**
110
+
111
+ For each proposal, specify:
112
+ 1. **Change Type:** [Add | Update | Remove | Restructure]
113
+ 2. **Target:** [File path or command name]
114
+ 3. **Rationale:** [Why this change improves workflow]
115
+ 4. **Content:** [Specific text to add/change, or "see draft"]
116
+ 5. **Priority:** [High | Medium | Low]
117
+ 6. **Risk:** [What could go wrong with this change]
118
+
119
+ ### **Documentation Health Check**
120
+
121
+ Review CLAUDE.md size and relevance:
122
+ - Current line count (target: 700-800)
123
+ - Sections that feel bloated
124
+ - Sections that are missing
125
+ - Redundancy check
126
+ - Extract candidates (sections >50 lines)
127
+ - Recommendation: [Prune | Expand | Restructure | Extract | Good as-is]
128
+
129
+ ### **Action Items**
130
+
131
+ Generate a checklist:
132
+ - [ ] Add section to CLAUDE.md: [topic]
133
+ - [ ] Update slash command: [command name]
134
+ - [ ] Move to docs/archive/: [file name]
135
+ - [ ] Create new command: [command name]
136
+ - [ ] Remove outdated content: [location]
137
+
138
+ ## Workflow Analytics
139
+
140
+ For `/reflect workflow`, use the SQL queries in [workflow-queries.ts](scripts/workflow-queries.ts) to analyze historical data.
141
+
142
+ See [phase-reflection.md](references/phase-reflection.md) for phase-specific guidance.
143
+
144
+ ## Reflection Cadence
145
+
146
+ **Suggested usage:**
147
+ - After completing a major feature
148
+ - When workflow feels inefficient
149
+ - Monthly for general health check
150
+ - After onboarding new team members (capture confusion points)
151
+
152
+ ## Meta-Reflection
153
+
154
+ At the end of reflection, ask:
155
+ - Is this reflection session providing value?
156
+ - Are the proposed changes specific enough to act on?
157
+ - Did I identify root causes or just symptoms?
158
+ - Will these changes be maintainable long-term?
159
+ - Am I in the right workflow phase for this reflection focus?
@@ -0,0 +1,70 @@
1
+ # Documentation Tiers
2
+
3
+ Organize information by access frequency:
4
+
5
+ ## Tier 1: Hot Path (CLAUDE.md)
6
+
7
+ - Used in 50%+ of sessions
8
+ - Core architecture decisions
9
+ - Most common commands and patterns
10
+ - **Target: 700-800 lines** (check with `wc -l CLAUDE.md`)
11
+ - Quick summaries with links to detailed docs
12
+ - Review monthly
13
+
14
+ **Keep in CLAUDE.md:**
15
+ - ✅ Core architecture patterns (database, routing, components)
16
+ - ✅ Most common commands (development, discovery, enrichment)
17
+ - ✅ Critical patterns (validation, audit logging, state management)
18
+ - ✅ Quick reference information needed in 50%+ of sessions
19
+
20
+ ## Tier 2: Reference (docs/ folder)
21
+
22
+ - Used in 10-50% of sessions
23
+ - Detailed specs, schemas, guides
24
+ - Can be 1000+ lines per doc
25
+ - Review quarterly
26
+
27
+ **Current specialized docs:**
28
+ - `CITY_COVERAGE.md` - Coverage analysis workflow
29
+ - `SHOP_DISCOVERY.md` - Discovery & enrichment pipeline
30
+ - `TESTING.md` - UI testing patterns
31
+ - `ADMIN_CMS_ARCHITECTURE.md` - Full CMS architecture
32
+
33
+ ## Tier 3: Archive (docs/archive/)
34
+
35
+ - Used in <10% of sessions
36
+ - Historical context, deprecated patterns
37
+ - Move here after 6 months of non-use
38
+ - Keep for searchability, not active use
39
+
40
+ ## Tier 4: Code Comments
41
+
42
+ - Implementation-specific details
43
+ - Edge case handling
44
+ - Why certain approaches were chosen
45
+ - Lives with the code, not in docs
46
+
47
+ ## When to Extract to Separate Docs
48
+
49
+ Move from CLAUDE.md to docs/ when:
50
+ - ✅ Section exceeds 50 lines
51
+ - ✅ Contains detailed workflow steps (>3 steps)
52
+ - ✅ Has extensive examples or command variations
53
+ - ✅ Used occasionally but not in every session
54
+ - ✅ Could evolve independently
55
+
56
+ ## Documentation Health Metrics
57
+
58
+ **CLAUDE.md Health Check:**
59
+ - Current line count vs target (700-800)
60
+ - Lines added in last month
61
+ - Sections that feel bloated
62
+ - Sections that are missing
63
+ - Redundancy between CLAUDE.md and docs/
64
+
65
+ **Recommendations:**
66
+ - **Prune:** >900 lines, multiple bloated sections
67
+ - **Expand:** <600 lines, missing critical patterns
68
+ - **Restructure:** Hard to find information
69
+ - **Extract:** Multiple sections >50 lines
70
+ - **Good as-is:** 700-800 lines, balanced content