@martinffx/atelier 0.1.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +285 -0
- package/agents/architect.md +38 -0
- package/agents/oracle.md +40 -0
- package/agents/recon.md +39 -0
- package/dist/atelier.js +33082 -0
- package/package.json +44 -0
- package/skills/code-conventional-commit/SKILL.md +134 -0
- package/skills/code-conventional-commit/evals/evals.json +23 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/commit-message.txt +4 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/validation-result.txt +16 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/commit-message.txt +8 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/report.html +1325 -0
- package/skills/code-debug/SKILL.md +271 -0
- package/skills/code-debug/references/language-tools.md +139 -0
- package/skills/code-debug/references/techniques.md +117 -0
- package/skills/code-docs/SKILL.md +171 -0
- package/skills/code-docs/references/api-docs.md +116 -0
- package/skills/code-docs/references/changelog.md +64 -0
- package/skills/code-docs/references/readme-structure.md +94 -0
- package/skills/code-git-worktrees/SKILL.md +218 -0
- package/skills/code-perf/SKILL.md +163 -0
- package/skills/code-perf/references/common-bottlenecks.md +124 -0
- package/skills/code-perf/references/optimization-patterns.md +167 -0
- package/skills/code-perf/references/profiling-tools.md +126 -0
- package/skills/code-review/SKILL.md +78 -0
- package/skills/code-review/references/output.md +200 -0
- package/skills/code-review/references/reviewers.md +719 -0
- package/skills/code-review/references/rq.md +357 -0
- package/skills/code-review/references/rs.md +30 -0
- package/skills/code-security/SKILL.md +183 -0
- package/skills/code-security/references/owasp-top-10.md +129 -0
- package/skills/code-security/references/security-tools.md +102 -0
- package/skills/code-security/references/vulnerability-patterns.md +129 -0
- package/skills/code-stacked-commit/SKILL.md +155 -0
- package/skills/code-subagents/SKILL.md +184 -0
- package/skills/code-subagents/references/code-quality-reviewer-prompt.md +48 -0
- package/skills/code-subagents/references/implementor-prompt.md +79 -0
- package/skills/code-subagents/references/spec-reviewer-prompt.md +62 -0
- package/skills/oracle-architect/SKILL.md +246 -0
- package/skills/oracle-architect/references/api-design.md +345 -0
- package/skills/oracle-architect/references/data-modeling.md +318 -0
- package/skills/oracle-architect/references/ddd-patterns.md +247 -0
- package/skills/oracle-challenge/SKILL.md +126 -0
- package/skills/oracle-testing/SKILL.md +237 -0
- package/skills/oracle-testing/references/anti-patterns.md +618 -0
- package/skills/oracle-testing/references/boundaries.md +579 -0
- package/skills/oracle-testing/references/core-testing.md +691 -0
- package/skills/oracle-testing/references/edge-testing.md +794 -0
- package/skills/oracle-testing/references/stub-driven-tdd.md +322 -0
- package/skills/oracle-thinkdeep/SKILL.md +164 -0
- package/skills/python-architecture/SKILL.md +148 -0
- package/skills/python-architecture/references/data-modeling.md +558 -0
- package/skills/python-architecture/references/ddd.md +569 -0
- package/skills/python-architecture/references/functional-core.md +337 -0
- package/skills/python-build-tools/SKILL.md +153 -0
- package/skills/python-build-tools/references/basedpyright.md +321 -0
- package/skills/python-build-tools/references/ruff.md +225 -0
- package/skills/python-build-tools/references/uv.md +257 -0
- package/skills/python-fastapi/SKILL.md +184 -0
- package/skills/python-fastapi/references/api-design.md +563 -0
- package/skills/python-fastapi/references/dependencies.md +479 -0
- package/skills/python-fastapi/references/middleware.md +475 -0
- package/skills/python-fastapi/references/validation.md +497 -0
- package/skills/python-modern-python/SKILL.md +201 -0
- package/skills/python-modern-python/references/async.md +76 -0
- package/skills/python-modern-python/references/pattern-matching.md +89 -0
- package/skills/python-modern-python/references/typing.md +96 -0
- package/skills/python-monorepo/SKILL.md +146 -0
- package/skills/python-monorepo/references/docker.md +515 -0
- package/skills/python-monorepo/references/namespace-packages.md +426 -0
- package/skills/python-monorepo/references/workspace-config.md +341 -0
- package/skills/python-sqlalchemy/SKILL.md +119 -0
- package/skills/python-sqlalchemy/references/async.md +51 -0
- package/skills/python-sqlalchemy/references/models.md +67 -0
- package/skills/python-sqlalchemy/references/queries.md +57 -0
- package/skills/python-temporal/SKILL.md +128 -0
- package/skills/python-temporal/references/patterns.md +87 -0
- package/skills/python-temporal/references/testing.md +54 -0
- package/skills/python-testing/SKILL.md +161 -0
- package/skills/python-testing/references/boundaries.md +449 -0
- package/skills/python-testing/references/mocking.md +449 -0
- package/skills/python-testing/references/pytest.md +524 -0
- package/skills/spec-brainstorm/SKILL.md +325 -0
- package/skills/spec-finish/SKILL.md +159 -0
- package/skills/spec-implement/SKILL.md +296 -0
- package/skills/spec-orchestrator/SKILL.md +156 -0
- package/skills/spec-plan/SKILL.md +248 -0
- package/skills/typescript-api-design/SKILL.md +396 -0
- package/skills/typescript-api-design/references/error-responses.md +469 -0
- package/skills/typescript-build-tools/SKILL.md +447 -0
- package/skills/typescript-build-tools/references/biome.md +436 -0
- package/skills/typescript-build-tools/references/bun.md +432 -0
- package/skills/typescript-build-tools/references/turborepo.md +426 -0
- package/skills/typescript-build-tools/references/vitest.md +518 -0
- package/skills/typescript-drizzle-orm/SKILL.md +398 -0
- package/skills/typescript-drizzle-orm/references/cloudflare.md +392 -0
- package/skills/typescript-drizzle-orm/references/entity-pattern.md +412 -0
- package/skills/typescript-drizzle-orm/references/postgresql.md +191 -0
- package/skills/typescript-drizzle-orm/references/repository-pattern.md +479 -0
- package/skills/typescript-drizzle-orm/references/sqlite.md +291 -0
- package/skills/typescript-dynamodb-toolbox/SKILL.md +370 -0
- package/skills/typescript-dynamodb-toolbox/references/entity-layer.md +574 -0
- package/skills/typescript-dynamodb-toolbox/references/error-handling.md +495 -0
- package/skills/typescript-dynamodb-toolbox/references/modeling.md +332 -0
- package/skills/typescript-dynamodb-toolbox/references/repository-layer.md +631 -0
- package/skills/typescript-dynamodb-toolbox/references/testing.md +718 -0
- package/skills/typescript-dynamodb-toolbox/references/transactions.md +423 -0
- package/skills/typescript-effect-ts/SKILL.md +341 -0
- package/skills/typescript-effect-ts/references/core.md +412 -0
- package/skills/typescript-effect-ts/references/error-handling.md +468 -0
- package/skills/typescript-effect-ts/references/resources.md +476 -0
- package/skills/typescript-effect-ts/references/schema.md +536 -0
- package/skills/typescript-effect-ts/references/services.md +461 -0
- package/skills/typescript-fastify/SKILL.md +405 -0
- package/skills/typescript-fastify/references/plugins.md +329 -0
- package/skills/typescript-fastify/references/typeid.md +315 -0
- package/skills/typescript-functional-patterns/SKILL.md +402 -0
- package/skills/typescript-functional-patterns/references/adts.md +497 -0
- package/skills/typescript-functional-patterns/references/branded-types.md +542 -0
- package/skills/typescript-functional-patterns/references/migration-guide.md +695 -0
- package/skills/typescript-functional-patterns/references/option-result.md +585 -0
- package/skills/typescript-testing/SKILL.md +353 -0
- package/skills/typescript-testing/references/mocking.md +675 -0
- package/skills/typescript-testing/references/msw.md +852 -0
- package/skills/typescript-testing/references/snapshot-testing.md +774 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# Request Review (rq) Workflow
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This workflow:
|
|
6
|
+
1. Gets diff (git diff against target branch)
|
|
7
|
+
2. Triage Subagent - Analyzes diff, selects reviewers, identifies skills to load
|
|
8
|
+
3. Reviewer Subagents (parallel) - Each selected reviewer analyzes code
|
|
9
|
+
4. Synthesis Subagent - Deduplicates findings
|
|
10
|
+
5. Architect Subagent - Architecture review
|
|
11
|
+
6. Challenge Subagent - Validates findings
|
|
12
|
+
7. Final synthesis and output
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Step 1: Get Diff
|
|
17
|
+
|
|
18
|
+
### Default: git diff to main
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git diff main
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If target branch specified:
|
|
25
|
+
```bash
|
|
26
|
+
git diff <branch>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Capture the list of changed files and the full diff.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 2: Triage Subagent
|
|
34
|
+
|
|
35
|
+
**Purpose:** Analyze diff to determine context, select reviewers, identify skills to load.
|
|
36
|
+
|
|
37
|
+
**Uses:** `scout` agent - See [agents/scout.md](../../agents/scout.md)
|
|
38
|
+
|
|
39
|
+
### Subagent Invocation
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
subagent_type: scout
|
|
43
|
+
description: "Triage diff for code review"
|
|
44
|
+
prompt: |
|
|
45
|
+
Analyze this code diff to determine review needs.
|
|
46
|
+
|
|
47
|
+
FILES: {files_changed}
|
|
48
|
+
DIFF: {git_diff}
|
|
49
|
+
|
|
50
|
+
Tasks:
|
|
51
|
+
1. Detect the primary language and framework
|
|
52
|
+
2. Identify the domain (web API, frontend, database, etc.)
|
|
53
|
+
3. Select 3-5 reviewers from this list based on what's in the diff:
|
|
54
|
+
- Security (auth, secrets, injection risks)
|
|
55
|
+
- Performance (hot paths, queries, algorithms)
|
|
56
|
+
- Correctness (logic, types, error handling)
|
|
57
|
+
- Maintainability (naming, complexity, tests)
|
|
58
|
+
- Architecture (boundaries, layers, SOLID)
|
|
59
|
+
- SecuritySkeptic (security + failure scenarios)
|
|
60
|
+
- PerformanceOperator (performance at scale)
|
|
61
|
+
- MaintainabilityPedant (quality + precision)
|
|
62
|
+
4. **Identify skills to load** based on detected language/framework:
|
|
63
|
+
- TypeScript → typescript-testing, typescript-fastify (if fastify framework)
|
|
64
|
+
- Python → python-testing, python-fastapi (if fastapi framework)
|
|
65
|
+
- Security concerns → code-security
|
|
66
|
+
- Performance concerns → code-perf
|
|
67
|
+
|
|
68
|
+
Return ONLY valid JSON (no markdown, no code blocks):
|
|
69
|
+
{
|
|
70
|
+
"context": {
|
|
71
|
+
"language": "typescript|python|go|...",
|
|
72
|
+
"framework": "react|fastapi|...",
|
|
73
|
+
"domain": "web-api|frontend|database|..."
|
|
74
|
+
},
|
|
75
|
+
"reviewers": ["Security", "Correctness"],
|
|
76
|
+
"skills_to_load": ["typescript-testing", "code-security"]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Expected Output
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"context": { "language": "typescript", "framework": "fastify", "domain": "web-api" },
|
|
85
|
+
"reviewers": ["Security", "Correctness", "PerformanceOperator"],
|
|
86
|
+
"skills_to_load": ["typescript-testing", "code-security"]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Step 3: Reviewer Subagents (Parallel)
|
|
93
|
+
|
|
94
|
+
**Purpose:** Each selected reviewer analyzes the code from their specialty perspective.
|
|
95
|
+
|
|
96
|
+
**Uses:** `general` subagent - One per reviewer, dispatched concurrently
|
|
97
|
+
|
|
98
|
+
**Pattern:** Spawn one subagent per reviewer **concurrently** (parallel execution).
|
|
99
|
+
|
|
100
|
+
### Skill Loading Pre-Step
|
|
101
|
+
|
|
102
|
+
Before dispatching reviewers, the detected skills are passed to each reviewer:
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"skills_to_load": ["typescript-testing", "code-security"]
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Subagent Invocation (One per Reviewer)
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
subagent_type: general
|
|
113
|
+
description: "Security review of code diff"
|
|
114
|
+
prompt: |
|
|
115
|
+
You are a Security Reviewer analyzing code for security vulnerabilities.
|
|
116
|
+
|
|
117
|
+
CONTEXT:
|
|
118
|
+
- Language: {language}
|
|
119
|
+
- Framework: {framework}
|
|
120
|
+
- Files: {files}
|
|
121
|
+
|
|
122
|
+
**PRE-STEP: Load Relevant Skills**
|
|
123
|
+
Before reviewing, load these skills:
|
|
124
|
+
{skills_to_load}
|
|
125
|
+
|
|
126
|
+
Use the `skill` tool to load each skill.
|
|
127
|
+
|
|
128
|
+
DIFF:
|
|
129
|
+
{git_diff}
|
|
130
|
+
|
|
131
|
+
Focus areas:
|
|
132
|
+
- Authentication and authorization flaws
|
|
133
|
+
- Injection vulnerabilities (SQL, command, XSS)
|
|
134
|
+
- Secrets in code (API keys, passwords, tokens)
|
|
135
|
+
- Surface area exposure
|
|
136
|
+
- Input validation gaps
|
|
137
|
+
|
|
138
|
+
Return findings as JSON array. For each finding:
|
|
139
|
+
{
|
|
140
|
+
"findings": [
|
|
141
|
+
{
|
|
142
|
+
"location": "file:line",
|
|
143
|
+
"severity": "Critical|High|Medium|Low",
|
|
144
|
+
"title": "Brief finding name",
|
|
145
|
+
"issue": "What's wrong",
|
|
146
|
+
"impact": "Why this matters",
|
|
147
|
+
"suggestion": "How to fix",
|
|
148
|
+
"pre_existing": true|false
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
If no findings, return {"findings": []}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Parallel Execution
|
|
157
|
+
|
|
158
|
+
Invoke **all reviewer subagents simultaneously**:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Concurrent invocations:
|
|
162
|
+
├── Security Reviewer
|
|
163
|
+
├── Correctness Reviewer
|
|
164
|
+
├── PerformanceOperator Reviewer
|
|
165
|
+
└── (etc. based on triage output)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Error Handling
|
|
169
|
+
|
|
170
|
+
- If a subagent fails/times out: Log error, continue with other reviewers
|
|
171
|
+
- If all subagents fail: Report error to user, abort review
|
|
172
|
+
- Partial results: Use findings from successful reviewers only
|
|
173
|
+
|
|
174
|
+
### Aggregating Results
|
|
175
|
+
|
|
176
|
+
Collect findings from all reviewer subagents:
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
all_findings = []
|
|
180
|
+
for reviewer in reviewers:
|
|
181
|
+
result = await reviewer_subagent(reviewer)
|
|
182
|
+
if result.success:
|
|
183
|
+
all_findings.extend(result.findings)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Step 4: Synthesis Subagent (First Pass)
|
|
189
|
+
|
|
190
|
+
**Purpose:** Group, deduplicate, and assign initial severity.
|
|
191
|
+
|
|
192
|
+
**Uses:** `general` subagent
|
|
193
|
+
|
|
194
|
+
### Subagent Invocation
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
subagent_type: general
|
|
198
|
+
description: "Synthesize code review findings"
|
|
199
|
+
prompt: |
|
|
200
|
+
Synthesize these code review findings from multiple reviewers.
|
|
201
|
+
|
|
202
|
+
RAW FINDINGS:
|
|
203
|
+
{all_findings_json}
|
|
204
|
+
|
|
205
|
+
Tasks:
|
|
206
|
+
1. Deduplicate findings that refer to the same issue
|
|
207
|
+
2. Flag potential false positives
|
|
208
|
+
3. Assign initial severity based on consensus
|
|
209
|
+
4. Group by severity (Critical, High, Medium, Low)
|
|
210
|
+
|
|
211
|
+
Return JSON:
|
|
212
|
+
{
|
|
213
|
+
"synthesized": [
|
|
214
|
+
{
|
|
215
|
+
"title": "Finding title",
|
|
216
|
+
"severity": "Critical|High|Medium|Low",
|
|
217
|
+
"locations": ["file:line", "file:line"],
|
|
218
|
+
"issue": "Consolidated issue description",
|
|
219
|
+
"impact": "Why this matters",
|
|
220
|
+
"suggestion": "How to fix",
|
|
221
|
+
"pre_existing": true|false,
|
|
222
|
+
"flag_for_challenge": true|false,
|
|
223
|
+
"original_findings": ["Reviewer: finding summary"]
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Step 5: Architect Subagent
|
|
232
|
+
|
|
233
|
+
**Purpose:** Review architecture-specific concerns.
|
|
234
|
+
|
|
235
|
+
**Uses:** `architect` agent - See [agents/architect.md](../../agents/architect.md)
|
|
236
|
+
|
|
237
|
+
### Subagent Invocation
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
subagent_type: architect
|
|
241
|
+
description: "Architecture review of code diff"
|
|
242
|
+
prompt: |
|
|
243
|
+
You are an Architecture Reviewer analyzing structural issues.
|
|
244
|
+
|
|
245
|
+
CONTEXT:
|
|
246
|
+
- Language: {language}
|
|
247
|
+
- Framework: {framework}
|
|
248
|
+
- Files: {files}
|
|
249
|
+
|
|
250
|
+
SYNTHESIZED FINDINGS:
|
|
251
|
+
{synthesized_findings_json}
|
|
252
|
+
|
|
253
|
+
**PRE-STEP: Load Relevant Skills**
|
|
254
|
+
Before reviewing, load:
|
|
255
|
+
- Use `skill` tool to load: oracle-architect
|
|
256
|
+
|
|
257
|
+
Focus areas:
|
|
258
|
+
- Boundary violations
|
|
259
|
+
- Responsibility leakage
|
|
260
|
+
- Dependency direction
|
|
261
|
+
- Layer separation
|
|
262
|
+
- SOLID violations
|
|
263
|
+
- Data model design
|
|
264
|
+
- API contract design
|
|
265
|
+
|
|
266
|
+
Return findings as JSON:
|
|
267
|
+
{
|
|
268
|
+
"architecture_findings": [
|
|
269
|
+
{
|
|
270
|
+
"location": "file:line",
|
|
271
|
+
"severity": "High|Medium",
|
|
272
|
+
"title": "Architecture Finding",
|
|
273
|
+
"issue": "What's wrong",
|
|
274
|
+
"impact": "Architectural debt",
|
|
275
|
+
"suggestion": "How to fix",
|
|
276
|
+
"pre_existing": true|false
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Step 6: Challenge Subagent
|
|
285
|
+
|
|
286
|
+
**Purpose:** Validate findings by challenging assumptions.
|
|
287
|
+
|
|
288
|
+
**Uses:** `oracle` agent - See [agents/oracle.md](../../agents/oracle.md)
|
|
289
|
+
|
|
290
|
+
### Subagent Invocation
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
subagent_type: oracle
|
|
294
|
+
description: "Challenge code review findings"
|
|
295
|
+
prompt: |
|
|
296
|
+
Challenge these code review findings critically using sequential-thinking.
|
|
297
|
+
|
|
298
|
+
ALL FINDINGS (includes synthesized + architecture):
|
|
299
|
+
{all_findings_json}
|
|
300
|
+
|
|
301
|
+
**PRE-STEP: Load Relevant Skills**
|
|
302
|
+
Before challenging, load:
|
|
303
|
+
- Use `skill` tool to load: oracle-challenge
|
|
304
|
+
|
|
305
|
+
For each flagged finding, use `mcp__sequential-thinking__sequentialthinking` to analyze:
|
|
306
|
+
1. Is this handled elsewhere in the codebase?
|
|
307
|
+
2. Is this the correct place for this concern?
|
|
308
|
+
3. Is this a valid concern or a false positive?
|
|
309
|
+
4. What evidence supports or refutes this finding?
|
|
310
|
+
5. What are alternative perspectives to consider?
|
|
311
|
+
|
|
312
|
+
Return JSON with validated findings:
|
|
313
|
+
{
|
|
314
|
+
"validated": [
|
|
315
|
+
{
|
|
316
|
+
"title": "Finding title",
|
|
317
|
+
"severity": "Critical|High|Medium|Low",
|
|
318
|
+
"locations": ["file:line"],
|
|
319
|
+
"issue": "Issue description",
|
|
320
|
+
"impact": "Impact explanation",
|
|
321
|
+
"suggestion": "Fix suggestion",
|
|
322
|
+
"pre_existing": true|false,
|
|
323
|
+
"reasoning": {
|
|
324
|
+
"why_flagged": "What triggered the finding",
|
|
325
|
+
"verification": "How it was validated",
|
|
326
|
+
"evidence": "Code snippets or references",
|
|
327
|
+
"alternative_view": "Other perspectives to consider"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"removed": ["Finding titles that were false positives"]
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Step 7: Final Synthesis and Output
|
|
338
|
+
|
|
339
|
+
**Purpose:** Produce final report with extended reasoning sections.
|
|
340
|
+
|
|
341
|
+
This step is done **inline** (no subagent needed) - format the validated findings into the output structure defined in [output.md](./output.md).
|
|
342
|
+
|
|
343
|
+
Display findings in terminal per [output.md](./output.md).
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Subagent Summary
|
|
348
|
+
|
|
349
|
+
| Step | Subagent | Uses | Parallel? | Purpose |
|
|
350
|
+
|------|----------|------|----------|---------|
|
|
351
|
+
| 1 | Get Diff | inline | — | `git diff <branch>` |
|
|
352
|
+
| 2 | Triage | `scout` agent | No | Detect context, select reviewers, identify skills |
|
|
353
|
+
| 3 | Reviewers | `general` subagent | Yes (per reviewer) | Specialty analysis |
|
|
354
|
+
| 4 | Synthesis | `general` subagent | No | Deduplicate and group |
|
|
355
|
+
| 5 | Architect | `architect` agent | No | Architecture review |
|
|
356
|
+
| 6 | Challenge | `oracle` agent | No | Validate findings |
|
|
357
|
+
| 7 | Output | inline | — | Format and display findings |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Respond to Review (rs) — Interview Mode
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Interactive interview mode to resolve code review findings. No subagents.
|
|
6
|
+
|
|
7
|
+
The agent interviews the user one question at a time, multiple choice, until it has enough context to resolve all issues raised by the review.
|
|
8
|
+
|
|
9
|
+
## Prompt
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Interview me until you have enough context to resolve all the issues raised by the code review.
|
|
13
|
+
Ask me questions 1 by 1, multiple choice.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
1. Load the review findings from the current conversation context
|
|
19
|
+
2. Begin interviewing the user — one question at a time, always multiple choice
|
|
20
|
+
3. Use answers to build understanding of how to resolve each finding
|
|
21
|
+
4. Once all context is gathered, apply the fixes
|
|
22
|
+
5. **Always ask user before applying fixes**
|
|
23
|
+
|
|
24
|
+
## Guidelines
|
|
25
|
+
|
|
26
|
+
- One question at a time — never batch questions
|
|
27
|
+
- Always provide multiple choice answers (a, b, c, d...)
|
|
28
|
+
- Start with the most ambiguous findings first
|
|
29
|
+
- Skip findings that are clearly actionable without input
|
|
30
|
+
- After all questions are answered, summarize the plan and confirm before making changes
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-security
|
|
3
|
+
description: >
|
|
4
|
+
Security audit and vulnerability detection. Use when reviewing code for security issues,
|
|
5
|
+
scanning dependencies, or addressing security concerns. Triggers on "security", "vulnerability",
|
|
6
|
+
"audit", "CVE", "injection", "XSS", "SQL injection", "auth", or when the user asks to check
|
|
7
|
+
for security issues.
|
|
8
|
+
user-invocable: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Code Security
|
|
12
|
+
|
|
13
|
+
Security audit workflow and checklist.
|
|
14
|
+
|
|
15
|
+
## The Workflow
|
|
16
|
+
|
|
17
|
+
### 1. Scan
|
|
18
|
+
|
|
19
|
+
Run automated security tools.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Check dependencies
|
|
23
|
+
npm audit
|
|
24
|
+
pip audit
|
|
25
|
+
cargo audit
|
|
26
|
+
|
|
27
|
+
# Run security scanner
|
|
28
|
+
trivy fs .
|
|
29
|
+
snyk test
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Review
|
|
33
|
+
|
|
34
|
+
Manual code review against checklist.
|
|
35
|
+
|
|
36
|
+
See references/owasp-top-10.md for common vulnerabilities.
|
|
37
|
+
|
|
38
|
+
### 3. Fix
|
|
39
|
+
|
|
40
|
+
Remediate vulnerabilities found.
|
|
41
|
+
|
|
42
|
+
### 4. Verify
|
|
43
|
+
|
|
44
|
+
Re-scan to confirm fixes.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Security Checklist
|
|
49
|
+
|
|
50
|
+
### Injection
|
|
51
|
+
|
|
52
|
+
| Check | Pattern |
|
|
53
|
+
|-------|---------|
|
|
54
|
+
| SQL | Parameterized queries |
|
|
55
|
+
| Command | No shell execution with user input |
|
|
56
|
+
| XSS | Escape/validate output |
|
|
57
|
+
| LDAP | Escape DN components |
|
|
58
|
+
|
|
59
|
+
### Authentication
|
|
60
|
+
|
|
61
|
+
| Check | Pattern |
|
|
62
|
+
|-------|---------|
|
|
63
|
+
| Passwords | Hash with bcrypt/argon2 |
|
|
64
|
+
| Sessions | Secure, httpOnly cookies |
|
|
65
|
+
| Tokens | Short-lived, proper validation |
|
|
66
|
+
| MFA | Consider for sensitive ops |
|
|
67
|
+
|
|
68
|
+
### Data Protection
|
|
69
|
+
|
|
70
|
+
| Check | Pattern |
|
|
71
|
+
|-------|---------|
|
|
72
|
+
| Secrets | Never in code |
|
|
73
|
+
| PII | Encrypt at rest |
|
|
74
|
+
| Transport | HTTPS only |
|
|
75
|
+
| Logs | No sensitive data |
|
|
76
|
+
|
|
77
|
+
### Dependencies
|
|
78
|
+
|
|
79
|
+
| Check | Pattern |
|
|
80
|
+
|-------|---------|
|
|
81
|
+
| Vulnerabilities | Scan regularly |
|
|
82
|
+
| Outdated | Update promptly |
|
|
83
|
+
| Sources | Trusted packages only |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Common Vulnerabilities
|
|
88
|
+
|
|
89
|
+
See references/vulnerability-patterns.md for detailed patterns:
|
|
90
|
+
|
|
91
|
+
### SQL Injection
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
# BAD
|
|
95
|
+
query = f"SELECT * FROM users WHERE id = {user_id}"
|
|
96
|
+
|
|
97
|
+
# GOOD
|
|
98
|
+
query = "SELECT * FROM users WHERE id = %s"
|
|
99
|
+
cursor.execute(query, (user_id,))
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### XSS
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
// BAD
|
|
106
|
+
element.innerHTML = userInput;
|
|
107
|
+
|
|
108
|
+
// GOOD
|
|
109
|
+
element.textContent = userInput;
|
|
110
|
+
// or
|
|
111
|
+
element.setAttribute('title', sanitize(userInput))
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Command Injection
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
# BAD
|
|
118
|
+
os.system(f"ping {host}")
|
|
119
|
+
|
|
120
|
+
# GOOD
|
|
121
|
+
subprocess.run(['ping', host])
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Hardcoded Secrets
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
// BAD
|
|
128
|
+
const apiKey = "sk_live_12345";
|
|
129
|
+
|
|
130
|
+
// GOOD (environment variable)
|
|
131
|
+
const apiKey = process.env.API_KEY;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Tools
|
|
137
|
+
|
|
138
|
+
See references/security-tools.md for setup and usage:
|
|
139
|
+
|
|
140
|
+
| Tool | Ecosystem | Purpose |
|
|
141
|
+
|------|-----------|---------|
|
|
142
|
+
| npm audit | Node.js | Dependency vulnerabilities |
|
|
143
|
+
| pip-audit | Python | Dependency vulnerabilities |
|
|
144
|
+
| cargo-audit | Rust | Dependency vulnerabilities |
|
|
145
|
+
| Snyk | Multi | Vulnerability scanning |
|
|
146
|
+
| Trivy | Multi | Container/infra scanning |
|
|
147
|
+
| OWASP ZAP | Multi | Web app scanning |
|
|
148
|
+
| bandit | Python | Static analysis |
|
|
149
|
+
| ESLint security | JS/TS | Static analysis |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Output Format
|
|
154
|
+
|
|
155
|
+
After security audit:
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
## Security Audit
|
|
159
|
+
|
|
160
|
+
### Scan Results
|
|
161
|
+
- Dependencies: 0 vulnerabilities
|
|
162
|
+
- Static analysis: 1 issue found
|
|
163
|
+
|
|
164
|
+
### Issues Found
|
|
165
|
+
|
|
166
|
+
| Severity | Issue | Location | Fix |
|
|
167
|
+
|----------|-------|----------|-----|
|
|
168
|
+
| High | SQL injection | users.py:42 | Use parameterized query |
|
|
169
|
+
| Medium | Hardcoded secret | config.js:5 | Use env var |
|
|
170
|
+
|
|
171
|
+
### Recommendations
|
|
172
|
+
1. Enable 2FA for admin accounts
|
|
173
|
+
2. Rotate API keys quarterly
|
|
174
|
+
3. Set up automated dependency scanning
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Skill Loading
|
|
180
|
+
|
|
181
|
+
- For database issues → load python-sqlalchemy or typescript-drizzle-orm
|
|
182
|
+
- For auth issues → load relevant auth patterns
|
|
183
|
+
- For deployment security → load infra skills if available
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# OWASP Top 10 (2021)
|
|
2
|
+
|
|
3
|
+
## A01: Broken Access Control
|
|
4
|
+
|
|
5
|
+
Users acting outside their intended permissions.
|
|
6
|
+
|
|
7
|
+
**Check:**
|
|
8
|
+
- Enforce authorization on every request
|
|
9
|
+
- Don't rely on hidden URLs
|
|
10
|
+
- Disable directory listing
|
|
11
|
+
- Log access control failures
|
|
12
|
+
|
|
13
|
+
**Patterns:**
|
|
14
|
+
```javascript
|
|
15
|
+
// Check permission
|
|
16
|
+
if (user.id !== resource.ownerId) {
|
|
17
|
+
throw new ForbiddenError();
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## A02: Cryptographic Failures
|
|
24
|
+
|
|
25
|
+
Data exposure due to weak cryptography.
|
|
26
|
+
|
|
27
|
+
**Check:**
|
|
28
|
+
- Encrypt sensitive data at rest
|
|
29
|
+
- Use strong encryption (AES-256, RSA-2048+)
|
|
30
|
+
- Don't use deprecated algorithms (MD5, SHA1)
|
|
31
|
+
- Proper key management
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## A03: Injection
|
|
36
|
+
|
|
37
|
+
User data interpreted as code.
|
|
38
|
+
|
|
39
|
+
**Types:**
|
|
40
|
+
- SQL
|
|
41
|
+
- NoSQL
|
|
42
|
+
- OS Command
|
|
43
|
+
- LDAP
|
|
44
|
+
- Expression Language
|
|
45
|
+
|
|
46
|
+
**Prevention:**
|
|
47
|
+
- Parameterized queries
|
|
48
|
+
- Input validation
|
|
49
|
+
- Escape output
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## A04: Insecure Design
|
|
54
|
+
|
|
55
|
+
Missing security controls in design.
|
|
56
|
+
|
|
57
|
+
**Check:**
|
|
58
|
+
- Threat modeling
|
|
59
|
+
- Secure design patterns
|
|
60
|
+
- Segregation of duties
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## A05: Security Misconfiguration
|
|
65
|
+
|
|
66
|
+
Incorrect security settings.
|
|
67
|
+
|
|
68
|
+
**Check:**
|
|
69
|
+
- Default credentials
|
|
70
|
+
- Unnecessary features
|
|
71
|
+
- Error handling (no stack traces)
|
|
72
|
+
- Security headers
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## A06: Vulnerable Components
|
|
77
|
+
|
|
78
|
+
Using components with known vulnerabilities.
|
|
79
|
+
|
|
80
|
+
**Check:**
|
|
81
|
+
- Keep dependencies updated
|
|
82
|
+
- Monitor CVE feeds
|
|
83
|
+
- Remove unused components
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## A07: Auth Failures
|
|
88
|
+
|
|
89
|
+
Weaknesses in authentication.
|
|
90
|
+
|
|
91
|
+
**Check:**
|
|
92
|
+
- Don't ship with default credentials
|
|
93
|
+
- Implement MFA
|
|
94
|
+
- Proper session handling
|
|
95
|
+
- Credential recovery flows
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## A08: Software/Data Integrity Failures
|
|
100
|
+
|
|
101
|
+
Assuming software updates are safe.
|
|
102
|
+
|
|
103
|
+
**Check:**
|
|
104
|
+
- Verify integrity (signatures, checksums)
|
|
105
|
+
- Don't use untrusted CDNs
|
|
106
|
+
- CI/CD security
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## A09: Logging Failures
|
|
111
|
+
|
|
112
|
+
Insufficient logging and monitoring.
|
|
113
|
+
|
|
114
|
+
**Check:**
|
|
115
|
+
- Log access control failures
|
|
116
|
+
- Log sensitive operations
|
|
117
|
+
- Don't log secrets
|
|
118
|
+
- Set up alerting
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## A10: SSRF
|
|
123
|
+
|
|
124
|
+
Fetching remote resources without validating URLs.
|
|
125
|
+
|
|
126
|
+
**Check:**
|
|
127
|
+
- Validate URLs
|
|
128
|
+
- Disable HTTP redirects
|
|
129
|
+
- Use allowlists
|