@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,102 @@
|
|
|
1
|
+
# Security Tools
|
|
2
|
+
|
|
3
|
+
## Node.js
|
|
4
|
+
|
|
5
|
+
### npm audit
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm audit
|
|
9
|
+
npm audit fix
|
|
10
|
+
npm audit --audit-level=high
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Snyk
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g snyk
|
|
17
|
+
snyk auth
|
|
18
|
+
snyk test
|
|
19
|
+
snyk monitor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### ESLint Security
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install --save-dev eslint-plugin-security
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
.eslintrc.json:
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"plugins": ["security"],
|
|
32
|
+
"rules": {
|
|
33
|
+
"security/detect-object-injection": "error",
|
|
34
|
+
"security/detect-non-literal-fs-filename": "error"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Python
|
|
42
|
+
|
|
43
|
+
### pip-audit
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install pip-audit
|
|
47
|
+
pip-audit
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Bandit
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install bandit
|
|
54
|
+
bandit -r src/
|
|
55
|
+
bandit -r src/ -f json -o report.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Safety
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install safety
|
|
62
|
+
safety check
|
|
63
|
+
safety check --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Go
|
|
69
|
+
|
|
70
|
+
### govulncheck
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
go install golang.org/x/vuln/cmd/govulncheck@latest
|
|
74
|
+
govulncheck ./...
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### gosec
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
go install github.com/securego/gosec/cmd/gosec@latest
|
|
81
|
+
gosec ./...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Multi-Language
|
|
87
|
+
|
|
88
|
+
### Trivy
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
brew install trivy
|
|
92
|
+
trivy fs .
|
|
93
|
+
trivy fs --severity HIGH,CRITICAL .
|
|
94
|
+
trivy image myimage:latest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### OWASP ZAP
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Docker
|
|
101
|
+
docker run -p 8080:8080 owasp/zap2docker-stable zap-baseline.py -t https://example.com
|
|
102
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Vulnerability Patterns
|
|
2
|
+
|
|
3
|
+
## SQL Injection
|
|
4
|
+
|
|
5
|
+
### Bad
|
|
6
|
+
```python
|
|
7
|
+
query = f"SELECT * FROM users WHERE id = {user_id}"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Good
|
|
11
|
+
```python
|
|
12
|
+
query = "SELECT * FROM users WHERE id = %s"
|
|
13
|
+
cursor.execute(query, (user_id,))
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Command Injection
|
|
19
|
+
|
|
20
|
+
### Bad
|
|
21
|
+
```python
|
|
22
|
+
os.system(f"ping {host}")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Good
|
|
26
|
+
```python
|
|
27
|
+
subprocess.run(['ping', host], check=True)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## XSS (Cross-Site Scripting)
|
|
33
|
+
|
|
34
|
+
### Bad
|
|
35
|
+
```javascript
|
|
36
|
+
element.innerHTML = userInput;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Good
|
|
40
|
+
```javascript
|
|
41
|
+
element.textContent = userInput;
|
|
42
|
+
// or
|
|
43
|
+
element.setAttribute('title', sanitize(userInput));
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Path Traversal
|
|
49
|
+
|
|
50
|
+
### Bad
|
|
51
|
+
```python
|
|
52
|
+
file = open(f"uploads/{filename}")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Good
|
|
56
|
+
```python
|
|
57
|
+
import os
|
|
58
|
+
base = "/app/uploads"
|
|
59
|
+
filename = os.path.basename(filename)
|
|
60
|
+
filepath = os.path.join(base, filename)
|
|
61
|
+
if not filepath.startswith(base):
|
|
62
|
+
raise ValueError("Invalid path")
|
|
63
|
+
file = open(filepath)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Hardcoded Secrets
|
|
69
|
+
|
|
70
|
+
### Bad
|
|
71
|
+
```javascript
|
|
72
|
+
const API_KEY = "sk_live_abc123";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Good
|
|
76
|
+
```javascript
|
|
77
|
+
const API_KEY = process.env.API_KEY;
|
|
78
|
+
if (!API_KEY) throw new Error("API_KEY not set");
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Insecure Random
|
|
84
|
+
|
|
85
|
+
### Bad
|
|
86
|
+
```javascript
|
|
87
|
+
const token = Math.random().toString(36);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Good
|
|
91
|
+
```javascript
|
|
92
|
+
const crypto = require('crypto');
|
|
93
|
+
const token = crypto.randomBytes(32).toString('hex');
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Unvalidated Redirect
|
|
99
|
+
|
|
100
|
+
### Bad
|
|
101
|
+
```javascript
|
|
102
|
+
res.redirect(req.query.url);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Good
|
|
106
|
+
```javascript
|
|
107
|
+
const allowed = ['/dashboard', '/profile'];
|
|
108
|
+
if (allowed.includes(req.query.url)) {
|
|
109
|
+
res.redirect(req.query.url);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Mass Assignment
|
|
116
|
+
|
|
117
|
+
### Bad
|
|
118
|
+
```javascript
|
|
119
|
+
const user = req.body; // All fields accepted
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Good
|
|
123
|
+
```javascript
|
|
124
|
+
const user = {
|
|
125
|
+
name: req.body.name,
|
|
126
|
+
email: req.body.email
|
|
127
|
+
// Explicitly select allowed fields
|
|
128
|
+
};
|
|
129
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-stacked-commit
|
|
3
|
+
description: Manage stacked commits using Graphite. Use when the user wants to create multiple stacked commits, manage a commit stack, sync with remote, or submit PRs from a stack. Triggers on "stacked", "stack", "gt ", "graphite", or when working with multiple related commits.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stacked Commit Skill (Graphite)
|
|
8
|
+
|
|
9
|
+
Manage stacked commits using [Graphite](https://graphite.dev) - a CLI for creating and managing stacked PRs.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- User wants to break work into multiple small, reviewable commits
|
|
14
|
+
- Working with stacked commits (multiple commits stacked on each other)
|
|
15
|
+
- Syncing and submitting stacked PRs
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
Ensure Graphite is installed:
|
|
20
|
+
```bash
|
|
21
|
+
brew install graphite-dev || npm install -g @graphite-dev/cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Core Operations
|
|
25
|
+
|
|
26
|
+
### 1. View Current Stack
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
gt stack
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Shows all branches in the stack with their status (synced, to-push, in-progress).
|
|
33
|
+
|
|
34
|
+
### 2. Create a New Commit
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
gt branch create "feat(auth): add JWT authentication"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This:
|
|
41
|
+
1. Creates a new branch on top of the current stack
|
|
42
|
+
2. Opens editor for commit message (or use `-m` for inline)
|
|
43
|
+
3. Commits the staged changes
|
|
44
|
+
|
|
45
|
+
**Works best when you:**
|
|
46
|
+
- Stage specific files: `git add file1 file2`
|
|
47
|
+
- Then create commit: `gt branch create "feat: add feature"`
|
|
48
|
+
- Repeat for each logical unit of work
|
|
49
|
+
|
|
50
|
+
### 3. Restack (Rebase onto Main)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gt branch restack
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Rebases all branches in the stack onto the latest main. Use before submitting or when main has advanced.
|
|
57
|
+
|
|
58
|
+
### 4. Sync with Remote
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
gt branch sync
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Pull latest changes from remote and restack.
|
|
65
|
+
|
|
66
|
+
### 5. Submit Stack as PRs
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
gt branch submit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Creates PRs for each branch in the stack. Opens browser to create the first PR; subsequent PRs link to it.
|
|
73
|
+
|
|
74
|
+
### 6. Continue Working on Branch
|
|
75
|
+
|
|
76
|
+
If you need to add more changes to a specific commit:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Make your changes, stage them
|
|
80
|
+
git add .
|
|
81
|
+
|
|
82
|
+
# Amend to current branch
|
|
83
|
+
gt branch continue
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 7. Navigate Stack
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Go to parent branch
|
|
90
|
+
gt branch checkout @parent
|
|
91
|
+
|
|
92
|
+
# Go to child branch
|
|
93
|
+
gt branch checkout @child
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Workflow Example
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
# Start new feature work
|
|
100
|
+
git checkout main
|
|
101
|
+
gt branch create "feat(api): add user endpoint"
|
|
102
|
+
|
|
103
|
+
# Add user endpoint code
|
|
104
|
+
git add src/users/
|
|
105
|
+
gt branch continue # Amend to current commit
|
|
106
|
+
|
|
107
|
+
# Create next commit in stack
|
|
108
|
+
gt branch create "feat(api): add user validation"
|
|
109
|
+
|
|
110
|
+
# Add validation code
|
|
111
|
+
git add src/validation/
|
|
112
|
+
gt branch continue
|
|
113
|
+
|
|
114
|
+
# View stack
|
|
115
|
+
gt stack
|
|
116
|
+
|
|
117
|
+
# Restack before submit
|
|
118
|
+
gt branch restack
|
|
119
|
+
|
|
120
|
+
# Submit all as stacked PRs
|
|
121
|
+
gt branch submit
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Best Practices
|
|
125
|
+
|
|
126
|
+
1. **One logical change per commit** - Each commit should be reviewable independently
|
|
127
|
+
2. **Meaningful commit messages** - Use conventional commit format
|
|
128
|
+
3. **Restack before submit** - Always `gt branch restack` before submitting to ensure clean history
|
|
129
|
+
4. **Keep stack small** - Deep stacks can be hard to manage; 3-5 commits is ideal
|
|
130
|
+
5. **Sync regularly** - Run `gt branch sync` often when working with others
|
|
131
|
+
|
|
132
|
+
## Troubleshooting
|
|
133
|
+
|
|
134
|
+
| Issue | Solution |
|
|
135
|
+
|-------|----------|
|
|
136
|
+
| Conflicts during restack | Resolve in editor, then `gt branch continue` |
|
|
137
|
+
| Stack broken | `gt branch repair` to fix detached HEAD |
|
|
138
|
+
| Too many branches | `gt branch delete <name>` to remove (won't delete remote) |
|
|
139
|
+
|
|
140
|
+
## Commit Message Format
|
|
141
|
+
|
|
142
|
+
Follow conventional commits within the Graphite workflow:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
<type>(<scope>): <subject>
|
|
146
|
+
|
|
147
|
+
[optional body]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Examples:
|
|
151
|
+
```
|
|
152
|
+
feat(api): add user profile endpoint
|
|
153
|
+
fix(db): resolve connection pool exhaustion
|
|
154
|
+
docs(readme): update installation instructions
|
|
155
|
+
```
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-subagents
|
|
3
|
+
description: >
|
|
4
|
+
Subagent dispatch patterns for implementation tasks. Use when spec-implement has multiple
|
|
5
|
+
tasks to execute and subagents are available. Covers parallel dispatch for independent work,
|
|
6
|
+
the two-stage review cycle (spec compliance then code quality), focused prompt construction,
|
|
7
|
+
and integration of results. Trigger when executing plan tasks with subagent support, when
|
|
8
|
+
facing 2+ independent problems, or when the user asks to use subagents for implementation.
|
|
9
|
+
user-invocable: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Spec Subagents
|
|
13
|
+
|
|
14
|
+
Fresh subagent per task. Two-stage review after each. Parallel when independent, sequential
|
|
15
|
+
when dependent.
|
|
16
|
+
|
|
17
|
+
## When to Use Subagents
|
|
18
|
+
|
|
19
|
+
**Use when:**
|
|
20
|
+
- Executing tasks from plan.json with subagent support available
|
|
21
|
+
- 2+ independent tasks that don't share state or files
|
|
22
|
+
- Each problem can be understood without context from others
|
|
23
|
+
|
|
24
|
+
**Don't use when:**
|
|
25
|
+
- Tasks are tightly coupled (editing the same files)
|
|
26
|
+
- You need to understand full system state across tasks
|
|
27
|
+
- Failures are related (fixing one might fix others)
|
|
28
|
+
- Exploratory work where the problem isn't well-defined yet
|
|
29
|
+
|
|
30
|
+
## Dispatch Modes
|
|
31
|
+
|
|
32
|
+
### Sequential (dependent tasks)
|
|
33
|
+
|
|
34
|
+
Tasks with dependencies execute one at a time. Each gets a fresh subagent — no context
|
|
35
|
+
pollution from previous tasks.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Task 1 (Entity) → review → complete
|
|
39
|
+
Task 2 (Repository, depends on T1) → review → complete
|
|
40
|
+
Task 3 (Service, depends on T2) → review → complete
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Parallel (independent tasks)
|
|
44
|
+
|
|
45
|
+
Independent tasks dispatch simultaneously. One agent per problem domain.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Task A (auth tests) ──→ review → complete
|
|
49
|
+
Task B (billing tests) ──→ review → complete ← concurrent
|
|
50
|
+
Task C (notification tests) ──→ review → complete
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Independence check:** Would fixing Task A affect Task B? Would they edit the same files?
|
|
54
|
+
If no to both, dispatch in parallel.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Prompt Templates
|
|
59
|
+
|
|
60
|
+
Use these templates when dispatching subagents. Each template is battle-tested — don't
|
|
61
|
+
improvise, use them as-is and fill in the variables.
|
|
62
|
+
|
|
63
|
+
- **[references/implementer-prompt.md](references/implementer-prompt.md)** — Dispatch an implementer. Includes self-review checklist.
|
|
64
|
+
- **[references/spec-reviewer-prompt.md](references/spec-reviewer-prompt.md)** — Spec compliance review. "Do not trust the report."
|
|
65
|
+
- **[references/code-quality-reviewer-prompt.md](references/code-quality-reviewer-prompt.md)** — Code quality review. Critical/Important/Minor severity.
|
|
66
|
+
|
|
67
|
+
### Prompt quality rules
|
|
68
|
+
|
|
69
|
+
- **Focused** — one task, one problem domain
|
|
70
|
+
- **Self-contained** — all context needed is in the prompt. Don't make the subagent
|
|
71
|
+
read the plan file; provide the full task text
|
|
72
|
+
- **Specific about files** — exact paths, not "the relevant files"
|
|
73
|
+
- **Specific about output** — what should the subagent return?
|
|
74
|
+
- **Constrained** — what should they NOT touch?
|
|
75
|
+
|
|
76
|
+
### Common mistakes
|
|
77
|
+
|
|
78
|
+
| Mistake | Fix |
|
|
79
|
+
|---------|-----|
|
|
80
|
+
| "Fix all the tests" | "Fix the 3 failures in user.test.ts" |
|
|
81
|
+
| No context about codebase | Paste the relevant patterns and conventions |
|
|
82
|
+
| No constraints | "Do NOT change production code" or scope to specific files |
|
|
83
|
+
| Vague output expectations | "Return: root cause, changes made, test results" |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Two-Stage Review
|
|
88
|
+
|
|
89
|
+
Every completed task gets two reviews in order. Do not skip either. Do not reverse the order.
|
|
90
|
+
|
|
91
|
+
### Stage 1: Spec Compliance
|
|
92
|
+
|
|
93
|
+
Does the implementation match what was specified?
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
## Spec Review
|
|
97
|
+
|
|
98
|
+
Review the implementation against the task specification:
|
|
99
|
+
|
|
100
|
+
**Task spec:** [paste task from plan.json]
|
|
101
|
+
|
|
102
|
+
**Files changed:** [list from subagent output]
|
|
103
|
+
|
|
104
|
+
Check:
|
|
105
|
+
1. Are all requirements from the task spec implemented?
|
|
106
|
+
2. Is anything implemented that wasn't specified? (over-building)
|
|
107
|
+
3. Do tests cover the specified acceptance criteria?
|
|
108
|
+
4. Does the implementation match the design in design.md?
|
|
109
|
+
|
|
110
|
+
Report: List any gaps or extras. Mark ✅ if compliant, ❌ if not.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If the spec reviewer finds issues → the implementer subagent fixes them → spec reviewer
|
|
114
|
+
reviews again. Repeat until ✅.
|
|
115
|
+
|
|
116
|
+
### Stage 2: Code Quality
|
|
117
|
+
|
|
118
|
+
Is the implementation well-built?
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
## Code Quality Review
|
|
122
|
+
|
|
123
|
+
Review the implementation for code quality:
|
|
124
|
+
|
|
125
|
+
**Files changed:** [list]
|
|
126
|
+
|
|
127
|
+
Check:
|
|
128
|
+
1. Does the code follow existing patterns and conventions?
|
|
129
|
+
2. Are tests meaningful (not just asserting true)?
|
|
130
|
+
3. Is there unnecessary complexity?
|
|
131
|
+
4. Are edge cases handled?
|
|
132
|
+
5. Is the code clean (no dead code, no unnecessary comments)?
|
|
133
|
+
|
|
134
|
+
Rate issues as Critical (blocks merge), Important (should fix), or Minor (nice to have).
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If the quality reviewer finds Critical or Important issues → implementer fixes → reviewer
|
|
138
|
+
reviews again. Minor issues can be noted and moved past.
|
|
139
|
+
|
|
140
|
+
### Why this order matters
|
|
141
|
+
|
|
142
|
+
Spec compliance first because there's no point polishing code that doesn't meet the spec.
|
|
143
|
+
Quality second because compliant code still needs to be well-built.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Handling Subagent Questions
|
|
148
|
+
|
|
149
|
+
Subagents may ask questions before or during implementation. This is good — it means
|
|
150
|
+
they're thinking rather than guessing.
|
|
151
|
+
|
|
152
|
+
- Answer clearly and completely
|
|
153
|
+
- Provide additional context if needed
|
|
154
|
+
- Don't rush them into implementation
|
|
155
|
+
- If the question reveals a gap in the plan, that's valuable — note it
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Integrating Results
|
|
160
|
+
|
|
161
|
+
After subagents complete (especially parallel dispatch):
|
|
162
|
+
|
|
163
|
+
1. **Read each summary** — understand what changed
|
|
164
|
+
2. **Check for conflicts** — did any agents edit the same code?
|
|
165
|
+
3. **Run full test suite** — verify all changes work together
|
|
166
|
+
4. **Update task tracking** — mark tasks complete: beads `bd close <id>`, or harness todo list
|
|
167
|
+
|
|
168
|
+
If there are conflicts between parallel results, resolve them manually. Don't dispatch
|
|
169
|
+
another subagent to merge — that requires too much context.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## When Subagents Fail
|
|
174
|
+
|
|
175
|
+
If a subagent fails a task:
|
|
176
|
+
|
|
177
|
+
- **Don't fix it manually** — that pollutes your context
|
|
178
|
+
- **Dispatch a fix subagent** with specific instructions about what went wrong
|
|
179
|
+
- **If it fails twice**, stop and escalate to the human. The plan may need revision.
|
|
180
|
+
|
|
181
|
+
If failure reveals a design problem:
|
|
182
|
+
|
|
183
|
+
> "This task is failing because [reason]. The design in design.md may need to change.
|
|
184
|
+
> Want me to go back to spec-brainstorm?"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Code Quality Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Dispatch after the spec compliance review passes (✅). Verifies the implementation is
|
|
4
|
+
well-built — clean, tested, maintainable.
|
|
5
|
+
|
|
6
|
+
**Only dispatch after spec compliance is confirmed.**
|
|
7
|
+
|
|
8
|
+
## Template
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
You are reviewing code quality for Task {TASK_ID}: {TASK_NAME}
|
|
12
|
+
|
|
13
|
+
## What Was Implemented
|
|
14
|
+
|
|
15
|
+
{From implementer's report — what they built}
|
|
16
|
+
|
|
17
|
+
## Requirements Reference
|
|
18
|
+
|
|
19
|
+
Task {TASK_ID} from {PLAN_FILE_PATH}
|
|
20
|
+
|
|
21
|
+
## Diff Range
|
|
22
|
+
|
|
23
|
+
Base: {BASE_SHA} (commit before task)
|
|
24
|
+
Head: {HEAD_SHA} (current commit)
|
|
25
|
+
|
|
26
|
+
## Your Job
|
|
27
|
+
|
|
28
|
+
Review the implementation for quality:
|
|
29
|
+
|
|
30
|
+
1. Does the code follow existing patterns and conventions in the codebase?
|
|
31
|
+
2. Are tests meaningful (not just asserting true or testing mocks)?
|
|
32
|
+
3. Is there unnecessary complexity?
|
|
33
|
+
4. Are edge cases handled?
|
|
34
|
+
5. Is the code clean (no dead code, no unnecessary comments, clear naming)?
|
|
35
|
+
6. Are the right things tested at the right boundaries (unit vs integration)?
|
|
36
|
+
|
|
37
|
+
## Issue Severity
|
|
38
|
+
|
|
39
|
+
- **Critical** — Blocks merge. Bugs, security issues, broken tests, missing error handling.
|
|
40
|
+
- **Important** — Should fix. Magic numbers, unclear naming, missing edge cases, poor test design.
|
|
41
|
+
- **Minor** — Nice to have. Style preferences, minor refactors, documentation suggestions.
|
|
42
|
+
|
|
43
|
+
## Report
|
|
44
|
+
|
|
45
|
+
- **Strengths:** What was done well
|
|
46
|
+
- **Issues:** List with severity (Critical / Important / Minor) and file:line references
|
|
47
|
+
- **Assessment:** Approved, Approved with minor issues, or Changes requested
|
|
48
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Implementer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching an implementer subagent. Paste the full task text from
|
|
4
|
+
plan.json — don't make the subagent read the plan file.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
You are implementing Task {TASK_ID}: {TASK_NAME}
|
|
10
|
+
|
|
11
|
+
## Task Description
|
|
12
|
+
|
|
13
|
+
{FULL TEXT of task from plan.json — paste it here}
|
|
14
|
+
|
|
15
|
+
## Context
|
|
16
|
+
|
|
17
|
+
{Scene-setting: where this fits in the feature, what was built before this task,
|
|
18
|
+
relevant architectural decisions from design.md, existing patterns to follow}
|
|
19
|
+
|
|
20
|
+
## Before You Begin
|
|
21
|
+
|
|
22
|
+
If you have questions about:
|
|
23
|
+
- The requirements or acceptance criteria
|
|
24
|
+
- The approach or implementation strategy
|
|
25
|
+
- Dependencies or assumptions
|
|
26
|
+
- Anything unclear in the task description
|
|
27
|
+
|
|
28
|
+
**Ask them now.** Raise any concerns before starting work.
|
|
29
|
+
|
|
30
|
+
## Your Job
|
|
31
|
+
|
|
32
|
+
Once you're clear on requirements:
|
|
33
|
+
1. Implement exactly what the task specifies
|
|
34
|
+
2. Write tests following TDD (failing test → verify fail → implement → verify pass)
|
|
35
|
+
3. Verify implementation works
|
|
36
|
+
4. Commit your work
|
|
37
|
+
5. Self-review (see below)
|
|
38
|
+
6. Report back
|
|
39
|
+
|
|
40
|
+
Work from: {WORKING_DIRECTORY}
|
|
41
|
+
|
|
42
|
+
**While you work:** If you encounter something unexpected or unclear, ask questions.
|
|
43
|
+
It's always OK to pause and clarify. Don't guess or make assumptions.
|
|
44
|
+
|
|
45
|
+
## Before Reporting Back: Self-Review
|
|
46
|
+
|
|
47
|
+
Review your work with fresh eyes:
|
|
48
|
+
|
|
49
|
+
**Completeness:**
|
|
50
|
+
- Did I fully implement everything in the spec?
|
|
51
|
+
- Did I miss any requirements?
|
|
52
|
+
- Are there edge cases I didn't handle?
|
|
53
|
+
|
|
54
|
+
**Quality:**
|
|
55
|
+
- Is this my best work?
|
|
56
|
+
- Are names clear and accurate?
|
|
57
|
+
- Is the code clean and maintainable?
|
|
58
|
+
|
|
59
|
+
**Discipline:**
|
|
60
|
+
- Did I avoid overbuilding (YAGNI)?
|
|
61
|
+
- Did I only build what was requested?
|
|
62
|
+
- Did I follow existing patterns in the codebase?
|
|
63
|
+
|
|
64
|
+
**Testing:**
|
|
65
|
+
- Do tests actually verify behaviour (not just mock behaviour)?
|
|
66
|
+
- Did I follow TDD?
|
|
67
|
+
- Are tests comprehensive?
|
|
68
|
+
|
|
69
|
+
If you find issues during self-review, fix them before reporting.
|
|
70
|
+
|
|
71
|
+
## Report Format
|
|
72
|
+
|
|
73
|
+
When done, report:
|
|
74
|
+
- What you implemented
|
|
75
|
+
- What you tested and test results
|
|
76
|
+
- Files changed
|
|
77
|
+
- Self-review findings (if any)
|
|
78
|
+
- Any issues or concerns
|
|
79
|
+
```
|