@phuc1403/musketeer 0.7.0 → 0.9.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/README.md +49 -49
- package/manifest.json +333 -301
- package/package.json +1 -1
- package/template/.claude/agents/code-reviewer.md +182 -166
- package/template/.claude/hooks/git-skill-reminder.cjs +53 -0
- package/template/.claude/hooks/inject-design-docs.cjs +13 -13
- package/template/.claude/hooks/inject-ubiquitous-language.cjs +52 -0
- package/template/.claude/hooks/lib/colors.cjs +180 -122
- package/template/.claude/hooks/lib/transcript-parser.cjs +300 -277
- package/template/.claude/skills/code-review/SKILL.md +201 -54
- package/template/.claude/skills/code-review/references/checklist-workflow.md +96 -0
- package/template/.claude/skills/code-review/references/checklists/api.md +52 -52
- package/template/.claude/skills/code-review/references/checklists/base.md +100 -100
- package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -54
- package/template/.claude/skills/code-review/references/code-review-reception.md +113 -0
- package/template/.claude/skills/code-review/references/codebase-scan-workflow.md +30 -0
- package/template/.claude/skills/code-review/references/edge-case-scouting.md +119 -0
- package/template/.claude/skills/code-review/references/input-mode-resolution.md +135 -0
- package/template/.claude/skills/code-review/references/parallel-review-workflow.md +76 -0
- package/template/.claude/skills/code-review/references/requesting-code-review.md +116 -0
- package/template/.claude/skills/code-review/references/spec-compliance-review.md +43 -0
- package/template/.claude/skills/code-review/references/task-management-reviews.md +140 -0
- package/template/.claude/skills/code-review/references/verification-before-completion.md +139 -0
- package/template/.claude/skills/context-map/SKILL.md +1 -1
- package/template/.claude/skills/git/SKILL.md +131 -115
- package/template/.claude/skills/git/references/branch-management.md +88 -88
- package/template/.claude/skills/git/references/commit-standards.md +46 -46
- package/template/.claude/skills/git/references/context-efficiency.md +54 -0
- package/template/.claude/skills/git/references/gh-cli-guide.md +109 -109
- package/template/.claude/skills/git/references/safety-protocols.md +69 -69
- package/template/.claude/skills/git/references/workflow-commit.md +58 -58
- package/template/.claude/skills/git/references/workflow-merge-pr.md +136 -0
- package/template/.claude/skills/git/references/workflow-merge.md +48 -48
- package/template/.claude/skills/git/references/workflow-pr.md +58 -58
- package/template/.claude/skills/git/references/workflow-push.md +52 -52
- package/template/.claude/skills/knowledge-crunching/SKILL.md +56 -92
- package/template/.claude/skills/knowledge-crunching/assets/ubiquitous-language.template.md +3 -0
- package/template/.claude/skills/skill-creator/LICENSE.txt +201 -201
- package/template/.claude/skills/skill-creator/SKILL.md +154 -149
- package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -274
- package/template/.claude/skills/skill-creator/agents/comparator.md +202 -202
- package/template/.claude/skills/skill-creator/agents/grader.md +223 -223
- package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -146
- package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -471
- package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
- package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -86
- package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -79
- package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -129
- package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -121
- package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -71
- package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -94
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -104
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -89
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -93
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -103
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -76
- package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -106
- package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -77
- package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +152 -151
- package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -75
- package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -102
- package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -114
- package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -78
- package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -74
- package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -81
- package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -83
- package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -88
- package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -92
- package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -401
- package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -36
- package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -326
- package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -248
- package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -360
- package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -143
- package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -110
- package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -310
- package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -332
- package/template/.claude/skills/skill-creator/scripts/utils.py +47 -47
- package/template/.claude/statusline.cjs +0 -0
- package/template/.claude/hooks/inject-context.cjs +0 -52
- package/template/.claude/skills/code-review/references/adversarial-review.md +0 -223
- package/template/.claude/skills/knowledge-crunching/assets/context.template.md +0 -59
- package/template/.claude/skills/knowledge-crunching/references/crunching-dialogue.md +0 -113
- /package/template/.claude/hooks/{usage-context-awareness.cjs → usage-quota-cache-refresh.cjs} +0 -0
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# Web App Review Checklist (Overlay)
|
|
2
|
-
|
|
3
|
-
Additive to `base.md`. Apply when project has frontend framework (React, Vue, Svelte, Next.js, etc.).
|
|
4
|
-
|
|
5
|
-
## Detection
|
|
6
|
-
|
|
7
|
-
Apply this overlay when any of these are true:
|
|
8
|
-
- `package.json` has `react`, `vue`, `svelte`, `next`, `nuxt`, `angular` dependency
|
|
9
|
-
- Project has `src/pages/`, `src/app/`, `src/components/`, `src/views/` directories
|
|
10
|
-
- HTML/JSX/TSX/Vue files in the diff
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Pass 1 — CRITICAL (additions to base)
|
|
15
|
-
|
|
16
|
-
### XSS
|
|
17
|
-
- `innerHTML` assignment from any non-static source
|
|
18
|
-
- Template literals interpolated into DOM without escaping
|
|
19
|
-
- URL parameters rendered without sanitization
|
|
20
|
-
- `<a href={userInput}>` without protocol validation (javascript: protocol)
|
|
21
|
-
- Server-rendered user content without HTML entity encoding
|
|
22
|
-
|
|
23
|
-
### CSRF
|
|
24
|
-
- State-changing endpoints (POST/PUT/DELETE) without CSRF token verification
|
|
25
|
-
- Cookie-based auth without SameSite attribute
|
|
26
|
-
- Form submissions to external URLs
|
|
27
|
-
|
|
28
|
-
### N+1 Queries (server-rendered views)
|
|
29
|
-
- Database queries inside loops rendering lists
|
|
30
|
-
- Missing eager loading for associations rendered in views/pages
|
|
31
|
-
- Sequential API calls that could be batched
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Pass 2 — INFORMATIONAL (additions to base)
|
|
36
|
-
|
|
37
|
-
### Frontend Performance
|
|
38
|
-
- Inline `<style>` blocks in components re-parsed every render
|
|
39
|
-
- Missing `key` prop on list items
|
|
40
|
-
- Large bundle imports that could be lazy-loaded (e.g., full lodash instead of lodash/get)
|
|
41
|
-
- Images without width/height causing layout shift
|
|
42
|
-
- Missing `loading="lazy"` on below-fold images
|
|
43
|
-
|
|
44
|
-
### Accessibility
|
|
45
|
-
- Interactive elements without keyboard support (onClick without onKeyDown)
|
|
46
|
-
- Missing `alt` text on images
|
|
47
|
-
- Form inputs without associated labels
|
|
48
|
-
- Color-only indicators (no text/icon fallback)
|
|
49
|
-
- Missing ARIA attributes on custom interactive components
|
|
50
|
-
|
|
51
|
-
### Responsive / Layout
|
|
52
|
-
- Fixed pixel widths that break on mobile
|
|
53
|
-
- Missing viewport meta tag
|
|
54
|
-
- Overflow hidden cutting off content on small screens
|
|
1
|
+
# Web App Review Checklist (Overlay)
|
|
2
|
+
|
|
3
|
+
Additive to `base.md`. Apply when project has frontend framework (React, Vue, Svelte, Next.js, etc.).
|
|
4
|
+
|
|
5
|
+
## Detection
|
|
6
|
+
|
|
7
|
+
Apply this overlay when any of these are true:
|
|
8
|
+
- `package.json` has `react`, `vue`, `svelte`, `next`, `nuxt`, `angular` dependency
|
|
9
|
+
- Project has `src/pages/`, `src/app/`, `src/components/`, `src/views/` directories
|
|
10
|
+
- HTML/JSX/TSX/Vue files in the diff
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Pass 1 — CRITICAL (additions to base)
|
|
15
|
+
|
|
16
|
+
### XSS
|
|
17
|
+
- `innerHTML` assignment from any non-static source
|
|
18
|
+
- Template literals interpolated into DOM without escaping
|
|
19
|
+
- URL parameters rendered without sanitization
|
|
20
|
+
- `<a href={userInput}>` without protocol validation (javascript: protocol)
|
|
21
|
+
- Server-rendered user content without HTML entity encoding
|
|
22
|
+
|
|
23
|
+
### CSRF
|
|
24
|
+
- State-changing endpoints (POST/PUT/DELETE) without CSRF token verification
|
|
25
|
+
- Cookie-based auth without SameSite attribute
|
|
26
|
+
- Form submissions to external URLs
|
|
27
|
+
|
|
28
|
+
### N+1 Queries (server-rendered views)
|
|
29
|
+
- Database queries inside loops rendering lists
|
|
30
|
+
- Missing eager loading for associations rendered in views/pages
|
|
31
|
+
- Sequential API calls that could be batched
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Pass 2 — INFORMATIONAL (additions to base)
|
|
36
|
+
|
|
37
|
+
### Frontend Performance
|
|
38
|
+
- Inline `<style>` blocks in components re-parsed every render
|
|
39
|
+
- Missing `key` prop on list items
|
|
40
|
+
- Large bundle imports that could be lazy-loaded (e.g., full lodash instead of lodash/get)
|
|
41
|
+
- Images without width/height causing layout shift
|
|
42
|
+
- Missing `loading="lazy"` on below-fold images
|
|
43
|
+
|
|
44
|
+
### Accessibility
|
|
45
|
+
- Interactive elements without keyboard support (onClick without onKeyDown)
|
|
46
|
+
- Missing `alt` text on images
|
|
47
|
+
- Form inputs without associated labels
|
|
48
|
+
- Color-only indicators (no text/icon fallback)
|
|
49
|
+
- Missing ARIA attributes on custom interactive components
|
|
50
|
+
|
|
51
|
+
### Responsive / Layout
|
|
52
|
+
- Fixed pixel widths that break on mobile
|
|
53
|
+
- Missing viewport meta tag
|
|
54
|
+
- Overflow hidden cutting off content on small screens
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: receiving-code-review
|
|
3
|
+
description: Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review Reception
|
|
7
|
+
|
|
8
|
+
**Core principle:** Verify before implementing. Ask before assuming. Technical correctness over social comfort.
|
|
9
|
+
|
|
10
|
+
## Response Pattern
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
1. READ: Complete feedback without reacting
|
|
14
|
+
2. UNDERSTAND: Restate requirement (or ask)
|
|
15
|
+
3. VERIFY: Check against codebase reality
|
|
16
|
+
4. EVALUATE: Technically sound for THIS codebase?
|
|
17
|
+
5. RESPOND: Technical acknowledgment or reasoned pushback
|
|
18
|
+
6. IMPLEMENT: One at a time, test each
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Forbidden Responses
|
|
22
|
+
|
|
23
|
+
❌ "You're absolutely right!" / "Great point!" / "Thanks for [anything]"
|
|
24
|
+
❌ "Let me implement that now" (before verification)
|
|
25
|
+
|
|
26
|
+
✅ Restate technical requirement
|
|
27
|
+
✅ Ask clarifying questions
|
|
28
|
+
✅ Push back with technical reasoning
|
|
29
|
+
✅ Just start working (actions > words)
|
|
30
|
+
|
|
31
|
+
## Handling Unclear Feedback
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
IF any item unclear:
|
|
35
|
+
STOP - don't implement anything
|
|
36
|
+
ASK for clarification on ALL unclear items
|
|
37
|
+
|
|
38
|
+
WHY: Items may be related. Partial understanding = wrong implementation.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Source-Specific Handling
|
|
42
|
+
|
|
43
|
+
**Human partner:** Trusted - implement after understanding, no performative agreement
|
|
44
|
+
|
|
45
|
+
**External reviewers:**
|
|
46
|
+
```
|
|
47
|
+
BEFORE implementing:
|
|
48
|
+
1. Technically correct for THIS codebase?
|
|
49
|
+
2. Breaks existing functionality?
|
|
50
|
+
3. Reason for current implementation?
|
|
51
|
+
4. Works all platforms/versions?
|
|
52
|
+
|
|
53
|
+
IF wrong: Push back with technical reasoning
|
|
54
|
+
IF can't verify: State limitation, ask direction
|
|
55
|
+
IF conflicts with partner's decisions: Stop, discuss first
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## YAGNI Check
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
IF reviewer suggests "implementing properly":
|
|
62
|
+
grep codebase for actual usage
|
|
63
|
+
IF unused: "This isn't called. Remove it (YAGNI)?"
|
|
64
|
+
IF used: Implement properly
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Implementation Order
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
1. Clarify unclear items FIRST
|
|
71
|
+
2. Implement: blocking → simple → complex
|
|
72
|
+
3. Test each individually
|
|
73
|
+
4. Verify no regressions
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## When To Push Back
|
|
77
|
+
|
|
78
|
+
- Breaks existing functionality
|
|
79
|
+
- Reviewer lacks full context
|
|
80
|
+
- Violates YAGNI (unused feature)
|
|
81
|
+
- Technically incorrect for stack
|
|
82
|
+
- Legacy/compatibility reasons
|
|
83
|
+
- Conflicts with architectural decisions
|
|
84
|
+
|
|
85
|
+
**How:** Technical reasoning, specific questions, reference working tests
|
|
86
|
+
|
|
87
|
+
## Acknowledging Correct Feedback
|
|
88
|
+
|
|
89
|
+
✅ "Fixed. [Brief description]"
|
|
90
|
+
✅ "Good catch - [issue]. Fixed in [location]."
|
|
91
|
+
✅ Just fix it (actions > words)
|
|
92
|
+
|
|
93
|
+
❌ ANY gratitude or performative expression
|
|
94
|
+
|
|
95
|
+
## Correcting Wrong Pushback
|
|
96
|
+
|
|
97
|
+
✅ "You were right - checked [X], it does [Y]. Implementing."
|
|
98
|
+
❌ Long apology, defending, over-explaining
|
|
99
|
+
|
|
100
|
+
## Quick Reference
|
|
101
|
+
|
|
102
|
+
| Mistake | Fix |
|
|
103
|
+
|---------|-----|
|
|
104
|
+
| Performative agreement | State requirement or act |
|
|
105
|
+
| Blind implementation | Verify against codebase |
|
|
106
|
+
| Batch without testing | One at a time |
|
|
107
|
+
| Assuming reviewer right | Check if breaks things |
|
|
108
|
+
| Avoiding pushback | Technical correctness > comfort |
|
|
109
|
+
|
|
110
|
+
## Bottom Line
|
|
111
|
+
|
|
112
|
+
External feedback = suggestions to evaluate, not orders.
|
|
113
|
+
Verify. Question. Then implement.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Codebase Scan Workflow
|
|
2
|
+
|
|
3
|
+
Think harder to scan the codebase and analyze it follow the Orchestration Protocol, Core Responsibilities, Subagents Team and Development Rules:
|
|
4
|
+
<tasks>$ARGUMENTS</tasks>
|
|
5
|
+
|
|
6
|
+
## Role Responsibilities
|
|
7
|
+
- You are an elite software engineering expert who specializes in system architecture design and technical decision-making.
|
|
8
|
+
- You operate by: **YAGNI**, **KISS**, and **DRY**.
|
|
9
|
+
- Sacrifice grammar for concision. List unresolved questions at end.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Research
|
|
14
|
+
* Use 2 `researcher` subagents in parallel to search up to 5 sources
|
|
15
|
+
* Keep every research report concise (≤150 lines)
|
|
16
|
+
* Dispatch `Explore` subagents to search the codebase
|
|
17
|
+
|
|
18
|
+
### Code Review
|
|
19
|
+
* Use multiple `code-reviewer` subagents in parallel to review code
|
|
20
|
+
* If issues found, ask main agent to improve and repeat until tests pass
|
|
21
|
+
* When complete, run verification for accepted findings before reporting completion
|
|
22
|
+
* Report combined quality findings and verification evidence to user
|
|
23
|
+
|
|
24
|
+
### Plan
|
|
25
|
+
* Analyze the reports and write the improvement plan directly
|
|
26
|
+
* Save overview at `plan.md`, phase files as `phase-XX-phase-name.md`
|
|
27
|
+
|
|
28
|
+
### Final Report
|
|
29
|
+
* Summary of changes, guide user to get started, suggest next steps
|
|
30
|
+
* Ask user if they want to commit and push
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: edge-case-scouting
|
|
3
|
+
description: Use after implementation, before code review to proactively find edge cases, side effects, and potential issues via scout skill - catches problems code-reviewer might miss
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Edge Case Scouting
|
|
7
|
+
|
|
8
|
+
Proactive detection of edge cases, side effects, and potential issues before code review.
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Code reviews catch obvious issues but miss subtle side effects. Scout detects:
|
|
13
|
+
- Files affected by changes reviewer might not check
|
|
14
|
+
- Data flow paths that could break
|
|
15
|
+
- Boundary conditions and error paths
|
|
16
|
+
- Integration issues across modules
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
**Mandatory:** Multi-file features, shared utility refactors, complex bug fixes
|
|
21
|
+
**Optional:** Single-file changes, docs, config
|
|
22
|
+
|
|
23
|
+
## Process
|
|
24
|
+
|
|
25
|
+
### 1. Identify Changed Files
|
|
26
|
+
```bash
|
|
27
|
+
git diff --name-only HEAD~1
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. Dispatch an Explore Subagent
|
|
31
|
+
```
|
|
32
|
+
Scout edge cases for the changes under review.
|
|
33
|
+
|
|
34
|
+
Changed: {files from git diff}
|
|
35
|
+
|
|
36
|
+
Find:
|
|
37
|
+
1. Files importing/depending on changed modules
|
|
38
|
+
2. Data flow paths through modified functions
|
|
39
|
+
3. Error handling paths not tested
|
|
40
|
+
4. Boundary conditions (null, empty, max)
|
|
41
|
+
5. Race conditions in async code
|
|
42
|
+
6. State management side effects
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 3. Analyze & Act
|
|
46
|
+
|
|
47
|
+
| Finding | Action |
|
|
48
|
+
|---------|--------|
|
|
49
|
+
| Affected file not in scope | Add to review |
|
|
50
|
+
| Data flow risk | Verify or add test |
|
|
51
|
+
| Edge case | Add test or verify |
|
|
52
|
+
| Missing test | Add before review |
|
|
53
|
+
|
|
54
|
+
### 4. Document for Review
|
|
55
|
+
```
|
|
56
|
+
Scout findings:
|
|
57
|
+
- {issues found}
|
|
58
|
+
- Verified: {what checked}
|
|
59
|
+
- Addressed: {what fixed}
|
|
60
|
+
- Needs review: {remaining}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Scout Prompts
|
|
64
|
+
|
|
65
|
+
**Feature:**
|
|
66
|
+
```
|
|
67
|
+
Scout edge cases for {feature}.
|
|
68
|
+
Changed: {files}
|
|
69
|
+
Find: consumers, error states, untested inputs, performance, compatibility
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Bug fix:**
|
|
73
|
+
```
|
|
74
|
+
Scout side effects of fix in {file}.
|
|
75
|
+
Bug: {description}, Fix: {approach}
|
|
76
|
+
Find: other paths using logic, dependent features, similar bugs
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Refactor:**
|
|
80
|
+
```
|
|
81
|
+
Scout breaking changes in {module}.
|
|
82
|
+
Before: {old}, After: {new}
|
|
83
|
+
Find: importers, behavior diffs, removed functionality
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## What Scout Catches
|
|
87
|
+
|
|
88
|
+
| Issue | Why Missed | Scout Detects |
|
|
89
|
+
|-------|------------|---------------|
|
|
90
|
+
| Indirect deps | Not in diff | Traces imports |
|
|
91
|
+
| Race conditions | Hard static review | Analyzes flow |
|
|
92
|
+
| State mutations | Hidden side effects | Tracks data |
|
|
93
|
+
| Missing null checks | Assumed safe | Boundary analysis |
|
|
94
|
+
| Integration breaks | Out of scope | Cross-module search |
|
|
95
|
+
|
|
96
|
+
## Red Flags
|
|
97
|
+
|
|
98
|
+
- Shared utility changed but only one caller tested
|
|
99
|
+
- Error path leads to unhandled rejection
|
|
100
|
+
- State modified in place without notification
|
|
101
|
+
- Breaking change without migration
|
|
102
|
+
|
|
103
|
+
## Example
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
1. Done: Add cache to UserService.getUser()
|
|
107
|
+
2. Diff: src/services/user-service.ts
|
|
108
|
+
3. Scout: "edge cases for caching in getUser()"
|
|
109
|
+
4. Report:
|
|
110
|
+
- ProfileComponent expects fresh data on edit
|
|
111
|
+
- AdminPanel loops getUser() (memory risk)
|
|
112
|
+
- No cache clear on updateUser()
|
|
113
|
+
5. Fix: Add invalidation, maxSize
|
|
114
|
+
6. Document for code-reviewer
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Bottom Line
|
|
118
|
+
|
|
119
|
+
Scout before review. Don't trust "simple changes" - scout them anyway.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: input-mode-resolution
|
|
3
|
+
description: How to parse code-review arguments and resolve PR number, commit hash, pending changes, or default context into a reviewable diff
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Input Mode Resolution
|
|
7
|
+
|
|
8
|
+
Resolve `/code-review` arguments into a diff for the review pipeline.
|
|
9
|
+
|
|
10
|
+
## Auto-Detection Rules
|
|
11
|
+
|
|
12
|
+
Parse arguments left-to-right. First match wins.
|
|
13
|
+
|
|
14
|
+
| Pattern | Mode | Example |
|
|
15
|
+
|---------|------|---------|
|
|
16
|
+
| `#\d+` | PR | `#123`, `#45` |
|
|
17
|
+
| GitHub PR URL | PR | `https://github.com/org/repo/pull/123` |
|
|
18
|
+
| `[0-9a-f]{7,40}` | Commit | `abc1234`, full SHA |
|
|
19
|
+
| `--pending` | Pending | explicit flag |
|
|
20
|
+
| `codebase` | Codebase | existing mode |
|
|
21
|
+
| *(none + context)* | Default | recent changes |
|
|
22
|
+
| *(none + no context)* | Prompt | ask user via `AskUserQuestion` |
|
|
23
|
+
|
|
24
|
+
## Resolution Commands
|
|
25
|
+
|
|
26
|
+
### PR Mode
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Extract PR number from argument
|
|
30
|
+
PR_NUM=$(echo "$ARG" | grep -oE '[0-9]+$')
|
|
31
|
+
|
|
32
|
+
# Fetch PR metadata
|
|
33
|
+
gh pr view "$PR_NUM" --json title,body,files,additions,deletions,baseRefName,headRefName
|
|
34
|
+
|
|
35
|
+
# Get the diff
|
|
36
|
+
gh pr diff "$PR_NUM"
|
|
37
|
+
|
|
38
|
+
# Get changed file list
|
|
39
|
+
gh pr diff "$PR_NUM" --name-only
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Context passed to reviewers:**
|
|
43
|
+
- PR title and description (intent)
|
|
44
|
+
- Base branch (what it merges into)
|
|
45
|
+
- Full diff
|
|
46
|
+
- Changed file list for scout
|
|
47
|
+
|
|
48
|
+
### Commit Mode
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Validate commit exists
|
|
52
|
+
git cat-file -t "$COMMIT_HASH"
|
|
53
|
+
|
|
54
|
+
# Get commit metadata
|
|
55
|
+
git log -1 --format="%H%n%s%n%b" "$COMMIT_HASH"
|
|
56
|
+
|
|
57
|
+
# Get the diff
|
|
58
|
+
git show "$COMMIT_HASH" --stat
|
|
59
|
+
git show "$COMMIT_HASH" -- # full diff
|
|
60
|
+
|
|
61
|
+
# Changed files
|
|
62
|
+
git show "$COMMIT_HASH" --name-only --format=""
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Context passed to reviewers:**
|
|
66
|
+
- Commit message (intent)
|
|
67
|
+
- Parent commit (what it changed from)
|
|
68
|
+
- Full diff
|
|
69
|
+
- Changed file list for scout
|
|
70
|
+
|
|
71
|
+
### Pending Mode
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Staged changes
|
|
75
|
+
git diff --cached
|
|
76
|
+
|
|
77
|
+
# Unstaged changes
|
|
78
|
+
git diff
|
|
79
|
+
|
|
80
|
+
# Combined (staged + unstaged vs HEAD)
|
|
81
|
+
git diff HEAD
|
|
82
|
+
|
|
83
|
+
# Changed files
|
|
84
|
+
git diff HEAD --name-only
|
|
85
|
+
|
|
86
|
+
# Status overview
|
|
87
|
+
git status --short
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Context passed to reviewers:**
|
|
91
|
+
- No commit message yet — ask user for brief intent description
|
|
92
|
+
- Combined diff (staged + unstaged)
|
|
93
|
+
- Changed file list for scout
|
|
94
|
+
|
|
95
|
+
### Default Mode
|
|
96
|
+
|
|
97
|
+
Use recent changes already in conversation context. If no changes apparent, fall back to Prompt mode.
|
|
98
|
+
|
|
99
|
+
### Prompt Mode
|
|
100
|
+
|
|
101
|
+
When no arguments and no recent context, use `AskUserQuestion`:
|
|
102
|
+
- Header: "Review Target"
|
|
103
|
+
- Question: "What would you like to review?"
|
|
104
|
+
- Options: Pending changes, Enter PR number, Enter commit hash, Full codebase scan, Parallel codebase audit
|
|
105
|
+
|
|
106
|
+
For PR/commit options, follow up with second `AskUserQuestion` to get the number/hash.
|
|
107
|
+
|
|
108
|
+
### Codebase Mode
|
|
109
|
+
|
|
110
|
+
Codebase modes bypass diff resolution — they scan the full codebase instead.
|
|
111
|
+
- `codebase` → hand off to `references/codebase-scan-workflow.md`
|
|
112
|
+
- `codebase parallel` → hand off to `references/parallel-review-workflow.md`
|
|
113
|
+
|
|
114
|
+
Both workflows include code quality review and final verification.
|
|
115
|
+
|
|
116
|
+
## Pipeline Handoff
|
|
117
|
+
|
|
118
|
+
After resolving the diff, pass to the review pipeline:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Resolved diff
|
|
122
|
+
├─ Changed files → Edge case scout
|
|
123
|
+
├─ Full diff → Stage 1 (Spec compliance, if plan exists)
|
|
124
|
+
├─ Full diff → Stage 2 (Code quality review)
|
|
125
|
+
└─ Findings → Fix accepted issues and verify
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Error Handling
|
|
129
|
+
|
|
130
|
+
| Error | Action |
|
|
131
|
+
|-------|--------|
|
|
132
|
+
| PR not found | `gh pr view` fails → report "PR #N not found in this repo" |
|
|
133
|
+
| Commit not found | `git cat-file` fails → report "Commit not found — is it pushed?" |
|
|
134
|
+
| No pending changes | `git diff HEAD` empty → report "No pending changes to review" |
|
|
135
|
+
| Ambiguous input | Could be PR or commit → prefer PR (more common), note assumption |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Parallel Review Workflow
|
|
2
|
+
|
|
3
|
+
**Ultrathink** to exhaustively list ALL potential edge cases, then dispatch parallel `code-reviewer` agents to verify: <scope>$ARGUMENTS</scope>
|
|
4
|
+
|
|
5
|
+
**IMPORTANT:** Activate needed skills. Ensure token efficiency. Sacrifice grammar for concision.
|
|
6
|
+
|
|
7
|
+
## Workflow
|
|
8
|
+
|
|
9
|
+
### 1. Ultrathink Edge Cases
|
|
10
|
+
|
|
11
|
+
Main agent deeply analyzes the scope to LIST all potential edge cases FIRST:
|
|
12
|
+
- Read any project overview docs the repo has, for context
|
|
13
|
+
- Dispatch an `Explore` subagent to find relevant files
|
|
14
|
+
- **Think exhaustively** about what could go wrong:
|
|
15
|
+
- Null/undefined scenarios
|
|
16
|
+
- Boundary conditions (off-by-one, empty, max values)
|
|
17
|
+
- Error handling gaps
|
|
18
|
+
- Race conditions, async edge cases
|
|
19
|
+
- Input validation holes
|
|
20
|
+
- Trust-boundary defects
|
|
21
|
+
- Resource leaks
|
|
22
|
+
- Untested code paths
|
|
23
|
+
|
|
24
|
+
**Output format:**
|
|
25
|
+
```markdown
|
|
26
|
+
## Edge Cases Identified
|
|
27
|
+
|
|
28
|
+
### Category: [scope-area]
|
|
29
|
+
1. [edge case description] → files: [file1, file2]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Categorize & Assign
|
|
33
|
+
|
|
34
|
+
Group edge cases by similar scope for parallel verification:
|
|
35
|
+
- Each category → one `code-reviewer` agent
|
|
36
|
+
- Max 6 categories (merge small ones)
|
|
37
|
+
- Each reviewer gets specific edge cases to VERIFY, not discover
|
|
38
|
+
|
|
39
|
+
### 3. Parallel Verification
|
|
40
|
+
|
|
41
|
+
Launch N `code-reviewer` subagents simultaneously:
|
|
42
|
+
- Pass: category name, list of edge cases, relevant files
|
|
43
|
+
- Task: **VERIFY** if each edge case is properly handled in code
|
|
44
|
+
- Report: which edge cases are handled vs unhandled
|
|
45
|
+
|
|
46
|
+
### 4. Aggregate Results
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Edge Case Verification Report
|
|
50
|
+
|
|
51
|
+
### Summary
|
|
52
|
+
- Total edge cases: X
|
|
53
|
+
- Handled: Y
|
|
54
|
+
- Unhandled: Z
|
|
55
|
+
- Partial: W
|
|
56
|
+
|
|
57
|
+
### Unhandled Edge Cases (Need Fix)
|
|
58
|
+
| # | Edge Case | File | Status |
|
|
59
|
+
|---|-----------|------|--------|
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 5. Verification Review
|
|
63
|
+
|
|
64
|
+
After aggregation, verify accepted findings against the full scope:
|
|
65
|
+
- Re-check aggregated findings and unhandled edge cases
|
|
66
|
+
- Confirm each blocking issue has a concrete file/line and reproduction path
|
|
67
|
+
- Classify findings as Accept / Reject / Defer
|
|
68
|
+
|
|
69
|
+
### 6. Auto-Fix Pipeline
|
|
70
|
+
|
|
71
|
+
**IF** unhandled/partial edge cases found:
|
|
72
|
+
- Ask: "Found N unhandled edge cases. Fix them now? [Y/n]" — on yes, fix by category, re-verify each
|
|
73
|
+
|
|
74
|
+
### 7. Final Report
|
|
75
|
+
- Summary of verification
|
|
76
|
+
- Ask: "Commit? [Y/n]" → use `git-manager`
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements - dispatches code-reviewer subagent to review implementation against plan or requirements before proceeding
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requesting Code Review
|
|
7
|
+
|
|
8
|
+
Dispatch code-reviewer subagent to catch issues before they cascade.
|
|
9
|
+
|
|
10
|
+
**Core principle:** Scout first, review often.
|
|
11
|
+
|
|
12
|
+
## When to Request Review
|
|
13
|
+
|
|
14
|
+
**Mandatory:**
|
|
15
|
+
- After each task in subagent-driven development
|
|
16
|
+
- After completing major feature
|
|
17
|
+
- Before merge to main
|
|
18
|
+
|
|
19
|
+
**Optional but valuable:**
|
|
20
|
+
- When stuck (fresh perspective)
|
|
21
|
+
- Before refactoring (baseline check)
|
|
22
|
+
- After fixing complex bug
|
|
23
|
+
|
|
24
|
+
## How to Request
|
|
25
|
+
|
|
26
|
+
**0. Scout edge cases first (NEW):**
|
|
27
|
+
```
|
|
28
|
+
Before dispatching code-reviewer, dispatch an `Explore` subagent to find:
|
|
29
|
+
- Files affected by changes (not just modified files)
|
|
30
|
+
- Data flow paths that could break
|
|
31
|
+
- Edge cases and boundary conditions
|
|
32
|
+
- Potential side effects
|
|
33
|
+
|
|
34
|
+
See: references/edge-case-scouting.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**1. Get git SHAs:**
|
|
38
|
+
```bash
|
|
39
|
+
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
|
40
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**2. Dispatch code-reviewer subagent:**
|
|
44
|
+
|
|
45
|
+
Use Task tool with `code-reviewer` type, fill template at `code-reviewer.md`
|
|
46
|
+
|
|
47
|
+
**Placeholders:**
|
|
48
|
+
- `{WHAT_WAS_IMPLEMENTED}` - What you just built
|
|
49
|
+
- `{PLAN_OR_REQUIREMENTS}` - What it should do
|
|
50
|
+
- `{BASE_SHA}` - Starting commit
|
|
51
|
+
- `{HEAD_SHA}` - Ending commit
|
|
52
|
+
- `{DESCRIPTION}` - Brief summary
|
|
53
|
+
|
|
54
|
+
**3. Act on feedback:**
|
|
55
|
+
- Fix Critical issues immediately
|
|
56
|
+
- Fix Important issues before proceeding
|
|
57
|
+
- Note Minor issues for later
|
|
58
|
+
- Push back if reviewer is wrong (with reasoning)
|
|
59
|
+
|
|
60
|
+
## Example
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
[Just completed Task 2: Add verification function]
|
|
64
|
+
|
|
65
|
+
You: Let me request code review before proceeding.
|
|
66
|
+
|
|
67
|
+
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
|
|
68
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
69
|
+
|
|
70
|
+
[Dispatch code-reviewer subagent]
|
|
71
|
+
WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
|
|
72
|
+
PLAN_OR_REQUIREMENTS: Task 2 from <path/to/plan.md>
|
|
73
|
+
BASE_SHA: a7981ec
|
|
74
|
+
HEAD_SHA: 3df7661
|
|
75
|
+
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
|
|
76
|
+
|
|
77
|
+
[Subagent returns]:
|
|
78
|
+
Strengths: Clean architecture, real tests
|
|
79
|
+
Issues:
|
|
80
|
+
Important: Missing progress indicators
|
|
81
|
+
Minor: Magic number (100) for reporting interval
|
|
82
|
+
Assessment: Ready to proceed
|
|
83
|
+
|
|
84
|
+
You: [Fix progress indicators]
|
|
85
|
+
[Continue to Task 3]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Integration with Workflows
|
|
89
|
+
|
|
90
|
+
**Subagent-Driven Development:**
|
|
91
|
+
- Review after EACH task
|
|
92
|
+
- Catch issues before they compound
|
|
93
|
+
- Fix before moving to next task
|
|
94
|
+
|
|
95
|
+
**Executing Plans:**
|
|
96
|
+
- Review after each batch (3 tasks)
|
|
97
|
+
- Get feedback, apply, continue
|
|
98
|
+
|
|
99
|
+
**Ad-Hoc Development:**
|
|
100
|
+
- Review before merge
|
|
101
|
+
- Review when stuck
|
|
102
|
+
|
|
103
|
+
## Red Flags
|
|
104
|
+
|
|
105
|
+
**Never:**
|
|
106
|
+
- Skip review because "it's simple"
|
|
107
|
+
- Ignore Critical issues
|
|
108
|
+
- Proceed with unfixed Important issues
|
|
109
|
+
- Argue with valid technical feedback
|
|
110
|
+
|
|
111
|
+
**If reviewer wrong:**
|
|
112
|
+
- Push back with technical reasoning
|
|
113
|
+
- Show code/tests that prove it works
|
|
114
|
+
- Request clarification
|
|
115
|
+
|
|
116
|
+
See template at: requesting-code-review/code-reviewer.md
|