sequant 1.17.0 → 1.18.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +14 -2
- package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +21 -0
- package/dist/marketplace/external_plugins/sequant/README.md +38 -0
- package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +292 -0
- package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +463 -0
- package/dist/marketplace/external_plugins/sequant/skills/_shared/references/prompt-templates.md +350 -0
- package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +131 -0
- package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +474 -0
- package/dist/marketplace/external_plugins/sequant/skills/clean/SKILL.md +211 -0
- package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +337 -0
- package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +807 -0
- package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +678 -0
- package/dist/marketplace/external_plugins/sequant/skills/improve/SKILL.md +668 -0
- package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +374 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +570 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-quality-exemplars.md +107 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +65 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +179 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/semgrep-rules.md +207 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +109 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +622 -0
- package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +175 -0
- package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +70 -0
- package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +95 -0
- package/dist/marketplace/external_plugins/sequant/skills/security-review/SKILL.md +358 -0
- package/dist/marketplace/external_plugins/sequant/skills/security-review/references/security-checklists.md +432 -0
- package/dist/marketplace/external_plugins/sequant/skills/solve/SKILL.md +697 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +754 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/references/parallel-groups.md +72 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/references/recommended-workflow.md +92 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +104 -0
- package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +600 -0
- package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +576 -0
- package/dist/marketplace/external_plugins/sequant/skills/verify/SKILL.md +281 -0
- package/dist/src/commands/run.d.ts +13 -280
- package/dist/src/commands/run.js +23 -1956
- package/dist/src/commands/sync.js +3 -0
- package/dist/src/commands/update.js +3 -0
- package/dist/src/lib/plugin-version-sync.d.ts +2 -1
- package/dist/src/lib/plugin-version-sync.js +28 -7
- package/dist/src/lib/solve-comment-parser.d.ts +26 -0
- package/dist/src/lib/solve-comment-parser.js +63 -7
- package/dist/src/lib/workflow/batch-executor.d.ts +117 -0
- package/dist/src/lib/workflow/batch-executor.js +574 -0
- package/dist/src/lib/workflow/phase-executor.d.ts +40 -0
- package/dist/src/lib/workflow/phase-executor.js +381 -0
- package/dist/src/lib/workflow/phase-mapper.d.ts +65 -0
- package/dist/src/lib/workflow/phase-mapper.js +147 -0
- package/dist/src/lib/workflow/pr-operations.d.ts +86 -0
- package/dist/src/lib/workflow/pr-operations.js +326 -0
- package/dist/src/lib/workflow/pr-status.d.ts +9 -7
- package/dist/src/lib/workflow/pr-status.js +13 -11
- package/dist/src/lib/workflow/run-summary.d.ts +36 -0
- package/dist/src/lib/workflow/run-summary.js +142 -0
- package/dist/src/lib/workflow/worktree-manager.d.ts +205 -0
- package/dist/src/lib/workflow/worktree-manager.js +918 -0
- package/package.json +3 -1
- package/templates/skills/fullsolve/SKILL.md +11 -1
- package/templates/skills/qa/SKILL.md +41 -1
- package/templates/skills/solve/SKILL.md +86 -0
- package/templates/skills/spec/SKILL.md +53 -0
- package/templates/skills/test/SKILL.md +10 -0
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
---
|
|
14
|
+
|
|
15
|
+
# Reflection Agent
|
|
16
|
+
|
|
17
|
+
You are the "Reflection Agent" for the current repository.
|
|
18
|
+
|
|
19
|
+
## Purpose
|
|
20
|
+
|
|
21
|
+
When invoked as `/reflect`, your job is to:
|
|
22
|
+
|
|
23
|
+
1. Analyze the recent work session for workflow effectiveness
|
|
24
|
+
2. Identify friction points, inefficiencies, or missing context
|
|
25
|
+
3. Propose targeted improvements to commands, docs, or processes
|
|
26
|
+
4. Balance documentation completeness with actionability (avoid bloat)
|
|
27
|
+
|
|
28
|
+
## Behavior
|
|
29
|
+
|
|
30
|
+
When called without arguments:
|
|
31
|
+
- Reflect on the current conversation/session
|
|
32
|
+
- Analyze what worked well and what could be improved
|
|
33
|
+
- Auto-detect current workflow phase (planning, implementation, QA)
|
|
34
|
+
|
|
35
|
+
When called with a focus area:
|
|
36
|
+
- `/reflect commands` - Focus on slash command effectiveness
|
|
37
|
+
- `/reflect docs` - Focus on documentation (CLAUDE.md, other docs/)
|
|
38
|
+
- `/reflect workflow` - Focus on development workflow (includes historical data)
|
|
39
|
+
- `/reflect tools` - Focus on tool usage patterns
|
|
40
|
+
- `/reflect planning` - Focus on planning phase (use during/after `/spec`)
|
|
41
|
+
- `/reflect implementation` - Focus on implementation phase (use during/after `/exec`)
|
|
42
|
+
- `/reflect qa` - Focus on QA/review phase (use during/after `/qa`)
|
|
43
|
+
|
|
44
|
+
## Reflection Framework
|
|
45
|
+
|
|
46
|
+
### 1. Session Analysis
|
|
47
|
+
|
|
48
|
+
**Effectiveness Metrics:**
|
|
49
|
+
- How many attempts to complete tasks?
|
|
50
|
+
- Were there repeated searches for the same information?
|
|
51
|
+
- Did I have the right context at the right time?
|
|
52
|
+
- Were there ambiguities that blocked progress?
|
|
53
|
+
|
|
54
|
+
**Friction Points:**
|
|
55
|
+
- What information was hard to find?
|
|
56
|
+
- What decisions took multiple iterations?
|
|
57
|
+
- What patterns did I have to discover vs. having documented?
|
|
58
|
+
- Where did I waste time or tokens?
|
|
59
|
+
|
|
60
|
+
### 2. Root Cause Analysis
|
|
61
|
+
|
|
62
|
+
For each friction point, determine:
|
|
63
|
+
- **Missing documentation:** Information exists but isn't documented
|
|
64
|
+
- **Documentation bloat:** Information documented but hard to find/use
|
|
65
|
+
- **Process gap:** No established pattern for this scenario
|
|
66
|
+
- **Tool limitation:** Current tools don't support this workflow
|
|
67
|
+
- **Command gap:** Common task lacks dedicated slash command
|
|
68
|
+
|
|
69
|
+
### 3. Improvement Proposals
|
|
70
|
+
|
|
71
|
+
See [documentation-tiers.md](references/documentation-tiers.md) for the 4-tier system.
|
|
72
|
+
|
|
73
|
+
**For Documentation Changes:**
|
|
74
|
+
- **What to add:** Missing patterns, decisions, or context
|
|
75
|
+
- **What to remove:** Outdated, redundant, or rarely-used content
|
|
76
|
+
- **What to restructure:** Information that's hard to find or too verbose
|
|
77
|
+
- **Where to put it:** Right file, right section, right level of detail
|
|
78
|
+
|
|
79
|
+
## Documentation Balance Principles
|
|
80
|
+
|
|
81
|
+
**Avoid these anti-patterns:**
|
|
82
|
+
❌ **Over-documentation:** Every edge case documented exhaustively
|
|
83
|
+
❌ **Stale documentation:** Old information that's no longer accurate
|
|
84
|
+
❌ **Premature documentation:** Documenting patterns before they're stable
|
|
85
|
+
❌ **Redundant documentation:** Same info in multiple places
|
|
86
|
+
❌ **Example overload:** Too many examples that obscure the pattern
|
|
87
|
+
|
|
88
|
+
**Follow these principles:**
|
|
89
|
+
✅ **Just-in-time documentation:** Document when pattern stabilizes (2-3 uses)
|
|
90
|
+
✅ **Progressive disclosure:** Brief overview → link to details
|
|
91
|
+
✅ **Living documentation:** Review and prune quarterly
|
|
92
|
+
✅ **Decision logs:** Document *why* not just *what*
|
|
93
|
+
✅ **Searchable patterns:** Use consistent keywords for grep/search
|
|
94
|
+
|
|
95
|
+
## Output Structure
|
|
96
|
+
|
|
97
|
+
### **Session Summary**
|
|
98
|
+
- What was accomplished
|
|
99
|
+
- What went smoothly
|
|
100
|
+
- What caused friction
|
|
101
|
+
|
|
102
|
+
### **Effectiveness Analysis**
|
|
103
|
+
- Token usage efficiency (did we re-read files unnecessarily?)
|
|
104
|
+
- Context gathering (did we find info quickly?)
|
|
105
|
+
- Decision making (were choices clear or iterative?)
|
|
106
|
+
- Pattern reuse (did we reinvent vs. follow existing patterns?)
|
|
107
|
+
|
|
108
|
+
### **Proposed Changes**
|
|
109
|
+
|
|
110
|
+
For each proposal, specify:
|
|
111
|
+
1. **Change Type:** [Add | Update | Remove | Restructure]
|
|
112
|
+
2. **Target:** [File path or command name]
|
|
113
|
+
3. **Rationale:** [Why this change improves workflow]
|
|
114
|
+
4. **Content:** [Specific text to add/change, or "see draft"]
|
|
115
|
+
5. **Priority:** [High | Medium | Low]
|
|
116
|
+
6. **Risk:** [What could go wrong with this change]
|
|
117
|
+
|
|
118
|
+
### **Documentation Health Check**
|
|
119
|
+
|
|
120
|
+
Review CLAUDE.md size and relevance:
|
|
121
|
+
- Current line count (target: 700-800)
|
|
122
|
+
- Sections that feel bloated
|
|
123
|
+
- Sections that are missing
|
|
124
|
+
- Redundancy check
|
|
125
|
+
- Extract candidates (sections >50 lines)
|
|
126
|
+
- Recommendation: [Prune | Expand | Restructure | Extract | Good as-is]
|
|
127
|
+
|
|
128
|
+
### **Action Items**
|
|
129
|
+
|
|
130
|
+
Generate a checklist:
|
|
131
|
+
- [ ] Add section to CLAUDE.md: [topic]
|
|
132
|
+
- [ ] Update slash command: [command name]
|
|
133
|
+
- [ ] Move to docs/archive/: [file name]
|
|
134
|
+
- [ ] Create new command: [command name]
|
|
135
|
+
- [ ] Remove outdated content: [location]
|
|
136
|
+
|
|
137
|
+
## Workflow Analytics
|
|
138
|
+
|
|
139
|
+
For `/reflect workflow`, analyze:
|
|
140
|
+
- Log files in `/tmp/claude-issue-*.log`
|
|
141
|
+
- Git history and commit patterns
|
|
142
|
+
- Issue comments and PR history
|
|
143
|
+
|
|
144
|
+
See [phase-reflection.md](references/phase-reflection.md) for phase-specific guidance.
|
|
145
|
+
|
|
146
|
+
## Reflection Cadence
|
|
147
|
+
|
|
148
|
+
**Suggested usage:**
|
|
149
|
+
- After completing a major feature
|
|
150
|
+
- When workflow feels inefficient
|
|
151
|
+
- Monthly for general health check
|
|
152
|
+
- After onboarding new team members (capture confusion points)
|
|
153
|
+
|
|
154
|
+
## Meta-Reflection
|
|
155
|
+
|
|
156
|
+
At the end of reflection, ask:
|
|
157
|
+
- Is this reflection session providing value?
|
|
158
|
+
- Are the proposed changes specific enough to act on?
|
|
159
|
+
- Did I identify root causes or just symptoms?
|
|
160
|
+
- Will these changes be maintainable long-term?
|
|
161
|
+
- Am I in the right workflow phase for this reflection focus?
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Output Verification
|
|
166
|
+
|
|
167
|
+
**Before responding, verify your output includes ALL of these:**
|
|
168
|
+
|
|
169
|
+
- [ ] **Session Summary** - What was accomplished, what went well, friction points
|
|
170
|
+
- [ ] **Effectiveness Analysis** - Token efficiency, context gathering, pattern reuse
|
|
171
|
+
- [ ] **Proposed Changes** - Specific changes with target files and rationale
|
|
172
|
+
- [ ] **Documentation Health** - Line count, bloat assessment, recommendations
|
|
173
|
+
- [ ] **Action Items** - Checklist of concrete next steps
|
|
174
|
+
|
|
175
|
+
**DO NOT respond until all items are verified.**
|
package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md
ADDED
|
@@ -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
|
+
- `ARCHITECTURE.md` - System architecture overview
|
|
29
|
+
- `DATA_PIPELINE.md` - Data processing workflows
|
|
30
|
+
- `TESTING.md` - Testing patterns and strategies
|
|
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
|
package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Phase-Specific Reflection
|
|
2
|
+
|
|
3
|
+
## Planning Phase (`/reflect planning`)
|
|
4
|
+
|
|
5
|
+
Focus on planning effectiveness after `/spec`:
|
|
6
|
+
|
|
7
|
+
**Key Questions:**
|
|
8
|
+
- Did context gathering find similar patterns efficiently?
|
|
9
|
+
- Were architectural decisions well-reasoned with clear options?
|
|
10
|
+
- Did Sequential Thinking help or add overhead?
|
|
11
|
+
- Were open questions actionable (question + recommendation + impact)?
|
|
12
|
+
- Was the plan specific enough to implement without re-planning?
|
|
13
|
+
|
|
14
|
+
**Common Friction Points:**
|
|
15
|
+
- Missing component patterns in docs
|
|
16
|
+
- Unclear which dependencies are already installed
|
|
17
|
+
- Database schema not matching assumptions
|
|
18
|
+
- Too many iterations on same decision
|
|
19
|
+
|
|
20
|
+
**Improvement Areas:**
|
|
21
|
+
- Add missing patterns to CLAUDE.md "Finding Similar Components"
|
|
22
|
+
- Update command with better decision frameworks
|
|
23
|
+
- Archive obsolete examples
|
|
24
|
+
|
|
25
|
+
## Implementation Phase (`/reflect implementation`)
|
|
26
|
+
|
|
27
|
+
Focus on implementation effectiveness after `/exec`:
|
|
28
|
+
|
|
29
|
+
**Key Questions:**
|
|
30
|
+
- Did implementation follow the agreed plan or deviate significantly?
|
|
31
|
+
- How many test failures before success? (Target: <3)
|
|
32
|
+
- Were there repeated context re-reads? (inefficient)
|
|
33
|
+
- Did type errors reveal missing/incorrect types in types/ folder?
|
|
34
|
+
- Were there missing patterns that could be documented?
|
|
35
|
+
|
|
36
|
+
**Common Friction Points:**
|
|
37
|
+
- Plan was too vague, required re-planning during implementation
|
|
38
|
+
- Missing utility functions (kept reimplementing same logic)
|
|
39
|
+
- Unclear testing patterns (what to test, how to structure tests)
|
|
40
|
+
- Type mismatches between database and TypeScript types
|
|
41
|
+
|
|
42
|
+
**Improvement Areas:**
|
|
43
|
+
- Update planning command to require more specificity
|
|
44
|
+
- Extract repeated logic into lib/utils/
|
|
45
|
+
- Document testing patterns in docs/TESTING_PATTERNS.md
|
|
46
|
+
- Run type generation more frequently
|
|
47
|
+
|
|
48
|
+
## QA Phase (`/reflect qa`)
|
|
49
|
+
|
|
50
|
+
Focus on QA/review effectiveness after `/qa`:
|
|
51
|
+
|
|
52
|
+
**Key Questions:**
|
|
53
|
+
- Did QA catch issues that should have been caught earlier?
|
|
54
|
+
- Were AC clear enough to validate objectively?
|
|
55
|
+
- Did the review identify missing edge cases?
|
|
56
|
+
- Were there repeated issues across similar features? (pattern opportunity)
|
|
57
|
+
- Was the A+ assessment criteria clear and consistent?
|
|
58
|
+
|
|
59
|
+
**Common Friction Points:**
|
|
60
|
+
- AC were too vague to validate objectively
|
|
61
|
+
- Missing test cases for edge cases
|
|
62
|
+
- Inconsistent code style across similar components
|
|
63
|
+
- Performance issues not caught until QA
|
|
64
|
+
|
|
65
|
+
**Improvement Areas:**
|
|
66
|
+
- Update AC templates with more specificity
|
|
67
|
+
- Add edge case checklist to `/qa` command
|
|
68
|
+
- Create style guide for recurring patterns
|
|
69
|
+
- Add performance check reminders
|
|
70
|
+
|
|
71
|
+
## Good Reflection Examples
|
|
72
|
+
|
|
73
|
+
### Documentation Improvement
|
|
74
|
+
|
|
75
|
+
> **Friction Point:** Spent 10 minutes searching for how neighborhood extraction works across multiple files.
|
|
76
|
+
>
|
|
77
|
+
> **Root Cause:** Process is documented in docs/AUTO_NEIGHBORHOOD_ENRICHMENT.md (tier 2) but not referenced in CLAUDE.md's discovery pipeline section (tier 1).
|
|
78
|
+
>
|
|
79
|
+
> **Proposal:**
|
|
80
|
+
> - **Type:** Add
|
|
81
|
+
> - **Target:** CLAUDE.md, line 230 (Discovery Methods section)
|
|
82
|
+
> - **Content:** Add one-line reference: "Neighborhoods auto-extracted via ZIP mapping (see docs/AUTO_NEIGHBORHOOD_ENRICHMENT.md)"
|
|
83
|
+
> - **Priority:** Medium
|
|
84
|
+
> - **Risk:** Low (just adding a signpost)
|
|
85
|
+
|
|
86
|
+
### Documentation Pruning
|
|
87
|
+
|
|
88
|
+
> **Bloat:** CLAUDE.md has 150 lines on Mapbox troubleshooting that solved a one-time issue 6 months ago.
|
|
89
|
+
>
|
|
90
|
+
> **Proposal:**
|
|
91
|
+
> - **Type:** Remove + Archive
|
|
92
|
+
> - **Target:** CLAUDE.md lines 450-600
|
|
93
|
+
> - **Action:** Move to docs/archive/mapbox-troubleshooting-2024.md with note "Archived: Issue resolved in react-map-gl v7.1.0"
|
|
94
|
+
> - **Priority:** High (saves 150 lines in hot path)
|
|
95
|
+
> - **Risk:** Low (still searchable if issue recurs)
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-review
|
|
3
|
+
description: "Deep security analysis for sensitive features (auth, payments, admin, API routes, file operations)."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: sequant
|
|
7
|
+
version: "1.0"
|
|
8
|
+
allowed-tools:
|
|
9
|
+
- Read
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
- Bash(git diff:*)
|
|
13
|
+
- Bash(git status:*)
|
|
14
|
+
- Bash(git log:*)
|
|
15
|
+
- Bash(npm test:*)
|
|
16
|
+
- Bash(gh issue view:*)
|
|
17
|
+
- Bash(gh issue comment:*)
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Security Review Command
|
|
21
|
+
|
|
22
|
+
You are the Security Review Agent for the current repository.
|
|
23
|
+
|
|
24
|
+
## Purpose
|
|
25
|
+
|
|
26
|
+
When invoked as `/security-review`, perform a comprehensive security analysis focused on the specific security domain of the feature being implemented.
|
|
27
|
+
|
|
28
|
+
## When to Use
|
|
29
|
+
|
|
30
|
+
| Feature Type | Use /security-review? | Focus Areas |
|
|
31
|
+
|-------------|----------------------|-------------|
|
|
32
|
+
| Auth flows | Yes | Session handling, token security, password hashing |
|
|
33
|
+
| Payment | Yes | PCI compliance, data handling, error messages |
|
|
34
|
+
| Admin features | Yes | Privilege escalation, IDOR, access control |
|
|
35
|
+
| API routes (user data) | Yes | Input validation, auth checks, rate limiting |
|
|
36
|
+
| File operations | Yes | Path traversal, file type validation, size limits |
|
|
37
|
+
| UI-only changes | No | Use /qa security checks |
|
|
38
|
+
| Content updates | No | No security surface |
|
|
39
|
+
|
|
40
|
+
**For lightweight security checks on every issue, use `/qa` instead.**
|
|
41
|
+
|
|
42
|
+
## Behavior
|
|
43
|
+
|
|
44
|
+
Invocation:
|
|
45
|
+
|
|
46
|
+
- `/security-review 123`:
|
|
47
|
+
- Treat `123` as the GitHub issue number.
|
|
48
|
+
- Analyze the feature being implemented for that issue.
|
|
49
|
+
- `/security-review --domain auth`:
|
|
50
|
+
- Perform review focused on authentication domain.
|
|
51
|
+
- `/security-review --domain api`:
|
|
52
|
+
- Perform review focused on API security domain.
|
|
53
|
+
- `/security-review --domain admin`:
|
|
54
|
+
- Perform review focused on admin/authorization domain.
|
|
55
|
+
|
|
56
|
+
## Process
|
|
57
|
+
|
|
58
|
+
### 1. Identify Security Domain
|
|
59
|
+
|
|
60
|
+
Analyze the feature being implemented to determine which security domain(s) apply:
|
|
61
|
+
|
|
62
|
+
**Auto-detection signals:**
|
|
63
|
+
- **Authentication:** Issue mentions "login", "password", "session", "token", "auth", "logout"
|
|
64
|
+
- **Authorization:** Files in `app/admin/`, mentions "role", "permission", "access control"
|
|
65
|
+
- **API Security:** Files in `app/api/`, mentions "endpoint", "request", "validation"
|
|
66
|
+
- **Data Protection:** Mentions "PII", "sensitive", "encrypt", "GDPR", "privacy"
|
|
67
|
+
- **Infrastructure:** Mentions "env", "secret", "config", "headers", "CSP"
|
|
68
|
+
- **File Operations:** Mentions "upload", "download", "file", "path"
|
|
69
|
+
|
|
70
|
+
### 2. Gather Context
|
|
71
|
+
|
|
72
|
+
- Read the GitHub issue for feature details
|
|
73
|
+
- Identify files changed (worktree or PR diff)
|
|
74
|
+
- Determine which security checklists apply
|
|
75
|
+
|
|
76
|
+
### 3. Apply Domain-Specific Checklists
|
|
77
|
+
|
|
78
|
+
Run through the relevant security checklists, marking each item as:
|
|
79
|
+
- Passed (verified secure)
|
|
80
|
+
- Failed (security issue found)
|
|
81
|
+
- Needs Manual Review (cannot verify automatically)
|
|
82
|
+
- N/A (not applicable to this feature)
|
|
83
|
+
|
|
84
|
+
See [references/security-checklists.md](references/security-checklists.md) for detailed checklist by domain.
|
|
85
|
+
|
|
86
|
+
## Security Checklists by Domain
|
|
87
|
+
|
|
88
|
+
### Authentication (8 items)
|
|
89
|
+
|
|
90
|
+
| # | Check | How to Verify |
|
|
91
|
+
|---|-------|---------------|
|
|
92
|
+
| AUTH-1 | Password hashing uses bcrypt/argon2 with appropriate cost | Look for password handling in auth code |
|
|
93
|
+
| AUTH-2 | Session tokens are cryptographically random | Check token generation method |
|
|
94
|
+
| AUTH-3 | Sessions expire appropriately | Check session TTL configuration |
|
|
95
|
+
| AUTH-4 | Logout invalidates session server-side | Verify session deletion on logout |
|
|
96
|
+
| AUTH-5 | Password reset tokens are single-use and expire | Check reset token handling |
|
|
97
|
+
| AUTH-6 | Rate limiting on login attempts | Look for rate limiter on auth endpoints |
|
|
98
|
+
| AUTH-7 | No timing attacks in password comparison | Check for constant-time comparison |
|
|
99
|
+
| AUTH-8 | MFA implementation (if applicable) | Review MFA flow if present |
|
|
100
|
+
|
|
101
|
+
### Authorization (6 items)
|
|
102
|
+
|
|
103
|
+
| # | Check | How to Verify |
|
|
104
|
+
|---|-------|---------------|
|
|
105
|
+
| AUTHZ-1 | Every endpoint checks authentication | Review middleware/guards on routes |
|
|
106
|
+
| AUTHZ-2 | Role-based access control properly enforced | Check RBAC implementation |
|
|
107
|
+
| AUTHZ-3 | No IDOR vulnerabilities (direct object references) | Review ID handling in queries |
|
|
108
|
+
| AUTHZ-4 | Horizontal privilege escalation prevented | Check user scoping in queries |
|
|
109
|
+
| AUTHZ-5 | Vertical privilege escalation prevented | Check role checks before actions |
|
|
110
|
+
| AUTHZ-6 | Admin actions logged for audit | Verify audit logging exists |
|
|
111
|
+
|
|
112
|
+
### API Security (7 items)
|
|
113
|
+
|
|
114
|
+
| # | Check | How to Verify |
|
|
115
|
+
|---|-------|---------------|
|
|
116
|
+
| API-1 | Input validation on all parameters | Check validation schemas (Zod, etc.) |
|
|
117
|
+
| API-2 | Output encoding to prevent XSS | Review response sanitization |
|
|
118
|
+
| API-3 | SQL injection prevention (parameterized queries) | Check for raw SQL, string concat |
|
|
119
|
+
| API-4 | Rate limiting configured | Look for rate limiter middleware |
|
|
120
|
+
| API-5 | CORS properly configured | Check CORS headers/config |
|
|
121
|
+
| API-6 | Error messages don't leak sensitive info | Review error responses |
|
|
122
|
+
| API-7 | File uploads validated (type, size, name) | Check upload handling |
|
|
123
|
+
|
|
124
|
+
### Data Protection (5 items)
|
|
125
|
+
|
|
126
|
+
| # | Check | How to Verify |
|
|
127
|
+
|---|-------|---------------|
|
|
128
|
+
| DATA-1 | Sensitive data encrypted at rest | Check database encryption settings |
|
|
129
|
+
| DATA-2 | Sensitive data encrypted in transit | Verify HTTPS enforcement |
|
|
130
|
+
| DATA-3 | PII handling compliant with privacy policy | Review data collection/storage |
|
|
131
|
+
| DATA-4 | Logs don't contain sensitive data | Check logging statements |
|
|
132
|
+
| DATA-5 | Database queries don't expose unauthorized data | Review RLS policies, query filters |
|
|
133
|
+
|
|
134
|
+
### Infrastructure (5 items)
|
|
135
|
+
|
|
136
|
+
| # | Check | How to Verify |
|
|
137
|
+
|---|-------|---------------|
|
|
138
|
+
| INFRA-1 | Environment variables properly protected | No hardcoded secrets in code |
|
|
139
|
+
| INFRA-2 | No hardcoded secrets | grep for API keys, passwords |
|
|
140
|
+
| INFRA-3 | Dependencies up to date | Check for known vulnerabilities |
|
|
141
|
+
| INFRA-4 | CSP headers configured | Review security headers |
|
|
142
|
+
| INFRA-5 | Security headers set (HSTS, X-Frame-Options, etc.) | Check Next.js config/middleware |
|
|
143
|
+
|
|
144
|
+
## Threat Modeling
|
|
145
|
+
|
|
146
|
+
For each security review, perform basic threat modeling:
|
|
147
|
+
|
|
148
|
+
### 1. Identify Threat Actors
|
|
149
|
+
|
|
150
|
+
| Actor Type | Description | Relevance |
|
|
151
|
+
|------------|-------------|-----------|
|
|
152
|
+
| Anonymous User | Unauthenticated visitor | Can they access protected resources? |
|
|
153
|
+
| Authenticated User | Logged in with basic role | Can they escalate privileges? |
|
|
154
|
+
| Admin User | Elevated privileges | Can they abuse their access? |
|
|
155
|
+
| Malicious Insider | Has valid credentials | Can they exfiltrate data? |
|
|
156
|
+
| External Attacker | No credentials, probing system | What attack surface is exposed? |
|
|
157
|
+
|
|
158
|
+
### 2. Map Attack Surface
|
|
159
|
+
|
|
160
|
+
For the feature being reviewed, identify:
|
|
161
|
+
- **Inputs:** What data does the feature accept? (form fields, URL params, headers)
|
|
162
|
+
- **Outputs:** What data does the feature expose? (API responses, page content, logs)
|
|
163
|
+
- **State Changes:** What does the feature modify? (database, files, sessions)
|
|
164
|
+
- **External Dependencies:** What external systems does it interact with? (APIs, databases)
|
|
165
|
+
|
|
166
|
+
### 3. Document Attack Vectors
|
|
167
|
+
|
|
168
|
+
For each identified risk, document:
|
|
169
|
+
- **Attack Vector:** How could this be exploited?
|
|
170
|
+
- **Impact:** What's the worst case scenario?
|
|
171
|
+
- **Likelihood:** How likely is this attack?
|
|
172
|
+
- **Mitigation:** What controls are in place?
|
|
173
|
+
|
|
174
|
+
## Report Format
|
|
175
|
+
|
|
176
|
+
Generate a security review report in this format:
|
|
177
|
+
|
|
178
|
+
```markdown
|
|
179
|
+
## Security Review: [Feature Name]
|
|
180
|
+
|
|
181
|
+
**Issue:** #[number]
|
|
182
|
+
**Domain(s):** [Authentication | Authorization | API | Data | Infrastructure]
|
|
183
|
+
**Risk Level:** [Critical | High | Medium | Low]
|
|
184
|
+
**Files Reviewed:** [count]
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Threat Model Summary
|
|
189
|
+
|
|
190
|
+
**Attack Surface:**
|
|
191
|
+
- [List of inputs, outputs, state changes]
|
|
192
|
+
|
|
193
|
+
**Key Threat Actors:**
|
|
194
|
+
- [Relevant actors for this feature]
|
|
195
|
+
|
|
196
|
+
**Primary Attack Vectors:**
|
|
197
|
+
- [Top 3 attack vectors identified]
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
### Findings
|
|
202
|
+
|
|
203
|
+
#### Critical
|
|
204
|
+
_Issues requiring immediate attention before merge._
|
|
205
|
+
|
|
206
|
+
1. **[Finding Title]** (`file:line`)
|
|
207
|
+
- **Issue:** [Description]
|
|
208
|
+
- **Impact:** [Potential damage]
|
|
209
|
+
- **Remediation:** [How to fix]
|
|
210
|
+
|
|
211
|
+
#### High
|
|
212
|
+
_Significant security concerns._
|
|
213
|
+
|
|
214
|
+
1. **[Finding Title]** (`file:line`)
|
|
215
|
+
- **Issue:** [Description]
|
|
216
|
+
- **Remediation:** [How to fix]
|
|
217
|
+
|
|
218
|
+
#### Medium
|
|
219
|
+
_Issues that should be addressed._
|
|
220
|
+
|
|
221
|
+
1. **[Finding Title]** (`file:line`)
|
|
222
|
+
- **Issue:** [Description]
|
|
223
|
+
- **Remediation:** [How to fix]
|
|
224
|
+
|
|
225
|
+
#### Low / Informational
|
|
226
|
+
_Best practice recommendations._
|
|
227
|
+
|
|
228
|
+
1. **[Finding Title]**
|
|
229
|
+
- **Recommendation:** [Suggested improvement]
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Checklist Status
|
|
234
|
+
|
|
235
|
+
| Domain | Passed | Failed | Manual | Total |
|
|
236
|
+
|--------|--------|--------|--------|-------|
|
|
237
|
+
| Authentication | X | X | X | 8 |
|
|
238
|
+
| Authorization | X | X | X | 6 |
|
|
239
|
+
| API Security | X | X | X | 7 |
|
|
240
|
+
| Data Protection | X | X | X | 5 |
|
|
241
|
+
| Infrastructure | X | X | X | 5 |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### Verdict
|
|
246
|
+
|
|
247
|
+
**[SECURE | WARNINGS | ISSUES_FOUND]**
|
|
248
|
+
|
|
249
|
+
[Summary of overall security posture and recommended actions]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Verdicts
|
|
253
|
+
|
|
254
|
+
| Verdict | Meaning | Action |
|
|
255
|
+
|---------|---------|--------|
|
|
256
|
+
| `SECURE` | No security issues found | Safe to proceed |
|
|
257
|
+
| `WARNINGS` | Minor issues or items needing manual review | Review warnings, may proceed |
|
|
258
|
+
| `ISSUES_FOUND` | Security issues requiring remediation | Fix before merge |
|
|
259
|
+
|
|
260
|
+
## Integration with Workflow
|
|
261
|
+
|
|
262
|
+
### Standalone Usage (Manual)
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
/security-review 493
|
|
266
|
+
/security-review --domain auth
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### As Part of Workflow
|
|
270
|
+
|
|
271
|
+
When working on security-sensitive issues:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
/spec 493 # Plan implementation
|
|
275
|
+
/exec 493 # Implement feature
|
|
276
|
+
/security-review 493 # Deep security analysis
|
|
277
|
+
/qa 493 # Final code review
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Logging to workflow_runs
|
|
281
|
+
|
|
282
|
+
After completing review, log results:
|
|
283
|
+
- **Phase:** `security`
|
|
284
|
+
- **Verdict:** Maps to existing verdict types:
|
|
285
|
+
- `SECURE` → `pass`
|
|
286
|
+
- `WARNINGS` → `pass_with_notes`
|
|
287
|
+
- `ISSUES_FOUND` → `fail`
|
|
288
|
+
- **Output Summary:** Findings count by severity
|
|
289
|
+
|
|
290
|
+
## Post Review: GitHub Issue Update
|
|
291
|
+
|
|
292
|
+
After completing the security review, post results to the GitHub issue:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
gh issue comment <issue-number> --body "$(cat <<'EOF'
|
|
296
|
+
## Security Review Complete
|
|
297
|
+
|
|
298
|
+
[Include full report from above]
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
Generated with [Claude Code](https://claude.com/claude-code)
|
|
302
|
+
EOF
|
|
303
|
+
)"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Examples
|
|
307
|
+
|
|
308
|
+
### Example 1: Admin Feature Review
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
/security-review 180
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Detection:** Files in `app/admin/`, labels include "admin"
|
|
315
|
+
**Domains:** Authorization, API Security
|
|
316
|
+
**Focus:**
|
|
317
|
+
- AUTHZ-1: Check admin middleware enforces authentication
|
|
318
|
+
- AUTHZ-3: Check for IDOR in city configuration
|
|
319
|
+
- API-6: Verify error messages don't leak city data
|
|
320
|
+
|
|
321
|
+
### Example 2: API Route Review
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
/security-review --domain api
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Focus:** API Security checklist (all 7 items)
|
|
328
|
+
**Additional:**
|
|
329
|
+
- Review request validation schemas
|
|
330
|
+
- Check response sanitization
|
|
331
|
+
- Verify rate limiting configuration
|
|
332
|
+
|
|
333
|
+
### Example 3: Auth Flow Review
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
/security-review --domain auth
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Focus:** Authentication checklist (all 8 items)
|
|
340
|
+
**Additional:**
|
|
341
|
+
- Trace session lifecycle
|
|
342
|
+
- Review token handling
|
|
343
|
+
- Check for timing vulnerabilities
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Output Verification
|
|
348
|
+
|
|
349
|
+
**Before responding, verify your output includes ALL of these:**
|
|
350
|
+
|
|
351
|
+
- [ ] **Security Domain** - Identified domains (Auth, API, Admin, Data, Infra)
|
|
352
|
+
- [ ] **Threat Model Summary** - Attack surface, threat actors, attack vectors
|
|
353
|
+
- [ ] **Findings by Severity** - Critical, High, Medium, Low/Informational
|
|
354
|
+
- [ ] **Checklist Status Table** - Passed/Failed/Manual counts per domain
|
|
355
|
+
- [ ] **Verdict** - SECURE, WARNINGS, or ISSUES_FOUND
|
|
356
|
+
- [ ] **GitHub Comment** - Security review posted to issue
|
|
357
|
+
|
|
358
|
+
**DO NOT respond until all items are verified.**
|