context-engineer 1.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/README.md +88 -0
- package/bin/cli.mjs +91 -0
- package/lib/copy.mjs +102 -0
- package/lib/init.mjs +166 -0
- package/lib/prompts.mjs +144 -0
- package/lib/update.mjs +198 -0
- package/package.json +35 -0
- package/templates/checksums.json +68 -0
- package/templates/claude/.claude/rules/context-maintenance.md +38 -0
- package/templates/claude/.claude/rules/experience-capture.md +46 -0
- package/templates/claude/.claude/settings.project.json +22 -0
- package/templates/claude/.claude/skills/bootstrap/SKILL.md +223 -0
- package/templates/claude/.claude/skills/dev/SKILL.md +119 -0
- package/templates/claude/.claude/skills/dev-capture/SKILL.md +111 -0
- package/templates/claude/.claude/skills/dev-commit/SKILL.md +90 -0
- package/templates/claude/.claude/skills/dev-decompose/SKILL.md +113 -0
- package/templates/claude/.claude/skills/dev-deps/SKILL.md +108 -0
- package/templates/claude/.claude/skills/dev-execute/SKILL.md +196 -0
- package/templates/claude/.claude/skills/dev-prd/SKILL.md +100 -0
- package/templates/claude/.claude/skills/dev-quality/SKILL.md +109 -0
- package/templates/claude/.claude/skills/dev-requirements/SKILL.md +75 -0
- package/templates/claude/.claude/skills/review-context/SKILL.md +120 -0
- package/templates/claude/.claude/skills/sync/SKILL.md +107 -0
- package/templates/claude/.claude/skills/update-context/SKILL.md +105 -0
- package/templates/claude/.claude/workflow/agents/implementer.md +65 -0
- package/templates/claude/.claude/workflow/agents/reviewer.md +96 -0
- package/templates/claude/.claude/workflow/agents/team-config.md +97 -0
- package/templates/claude/.claude/workflow/agents/tester.md +98 -0
- package/templates/claude/.claude/workflow/interfaces/phase-contract.md +157 -0
- package/templates/claude/CLAUDE.md +50 -0
- package/templates/core/.context/_meta/concepts.md +9 -0
- package/templates/core/.context/_meta/drift-report.md +16 -0
- package/templates/core/.context/_meta/last-sync.json +6 -0
- package/templates/core/.context/_meta/schema.md +242 -0
- package/templates/core/.context/architecture/api-surface.md +52 -0
- package/templates/core/.context/architecture/class-index.md +49 -0
- package/templates/core/.context/architecture/data-flow.md +103 -0
- package/templates/core/.context/architecture/data-model.md +35 -0
- package/templates/core/.context/architecture/decisions/001-template.md +35 -0
- package/templates/core/.context/architecture/dependencies.md +35 -0
- package/templates/core/.context/architecture/infrastructure.md +42 -0
- package/templates/core/.context/architecture/module-graph.md +68 -0
- package/templates/core/.context/architecture/overview.md +87 -0
- package/templates/core/.context/business/domain-model.md +43 -0
- package/templates/core/.context/business/glossary.md +23 -0
- package/templates/core/.context/business/overview.md +29 -0
- package/templates/core/.context/business/workflows.md +61 -0
- package/templates/core/.context/constitution.md +84 -0
- package/templates/core/.context/conventions/code-style.md +47 -0
- package/templates/core/.context/conventions/error-handling.md +50 -0
- package/templates/core/.context/conventions/git.md +46 -0
- package/templates/core/.context/conventions/patterns.md +41 -0
- package/templates/core/.context/conventions/testing.md +49 -0
- package/templates/core/.context/experience/debugging.md +21 -0
- package/templates/core/.context/experience/incidents.md +26 -0
- package/templates/core/.context/experience/lessons.md +23 -0
- package/templates/core/.context/experience/performance.md +29 -0
- package/templates/core/.context/index.md +93 -0
- package/templates/core/.context/progress/backlog.md +23 -0
- package/templates/core/.context/progress/status.md +30 -0
- package/templates/core/.context/workflow/artifacts/.gitkeep +0 -0
- package/templates/core/.context/workflow/config.md +35 -0
- package/templates/core/AGENTS.md +53 -0
- package/templates/core/scripts/compact-experience.sh +83 -0
- package/templates/core/scripts/detect-drift.sh +388 -0
- package/templates/core/scripts/extract-structure.sh +757 -0
- package/templates/core/scripts/sync-context.sh +510 -0
- package/templates/cursor/.cursor/rules/always.mdc +18 -0
- package/templates/cursor/.cursor/rules/backend.mdc +16 -0
- package/templates/cursor/.cursor/rules/database.mdc +16 -0
- package/templates/cursor/.cursor/rules/frontend.mdc +13 -0
- package/templates/cursor/.cursorrules +23 -0
- package/templates/github/.github/copilot-instructions.md +15 -0
- package/templates/github/.github/workflows/context-drift.yml +73 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync
|
|
3
|
+
description: Fast non-interactive regeneration of all auto-generated context files and indexes
|
|
4
|
+
triggers:
|
|
5
|
+
- sync
|
|
6
|
+
- resync context
|
|
7
|
+
- regenerate context
|
|
8
|
+
- rebuild context files
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Sync Skill
|
|
12
|
+
|
|
13
|
+
Fast, non-interactive regeneration of all auto-generated `.context/` files. No git analysis, no human checkpoints — just rebuild from the current source code state.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- After a large merge or rebase
|
|
18
|
+
- When auto-generated files are known to be stale
|
|
19
|
+
- When switching branches with significant differences
|
|
20
|
+
- As a quick "reset to ground truth" for auto-generated content
|
|
21
|
+
- When `/update-context` or `/review-context` is overkill
|
|
22
|
+
- When new files/classes were added and you need them indexed
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
### Step 1: Regenerate Auto-Generated Architecture Files
|
|
27
|
+
|
|
28
|
+
Run these regenerations unconditionally:
|
|
29
|
+
|
|
30
|
+
1. `scripts/extract-structure.sh --class-index` → regenerate `architecture/class-index.md`
|
|
31
|
+
2. `scripts/extract-structure.sh --module-graph` → regenerate auto-generated sections of `architecture/module-graph.md`
|
|
32
|
+
3. `scripts/sync-context.sh` → regenerate `architecture/dependencies.md`, `architecture/data-model.md`, `architecture/api-surface.md`
|
|
33
|
+
|
|
34
|
+
### Step 2: Scan and Update index.md
|
|
35
|
+
|
|
36
|
+
1. Scan `.context/architecture/decisions/` for all `*.md` files (excluding `001-template.md`)
|
|
37
|
+
2. Scan `.context/specs/` for all subdirectories containing `spec.md`
|
|
38
|
+
3. Scan `.context/changes/` for all subdirectories containing `proposal.md`
|
|
39
|
+
4. Read current `index.md`
|
|
40
|
+
5. Add entries for any discovered files not currently listed
|
|
41
|
+
6. Remove entries for files that no longer exist
|
|
42
|
+
7. Preserve all existing human-written descriptions
|
|
43
|
+
|
|
44
|
+
### Step 3: Build Concept Index
|
|
45
|
+
|
|
46
|
+
Regenerate `_meta/concepts.md` — the inverted index for fast concept lookup:
|
|
47
|
+
|
|
48
|
+
1. Read all `.context/**/*.md` files (excluding `_meta/concepts.md`, `_meta/last-sync.json`, `_meta/drift-report.md`)
|
|
49
|
+
2. For each file, extract key concepts:
|
|
50
|
+
- `##` and `###` section headings (lowercased, hyphenated)
|
|
51
|
+
- `**bold terms**` (lowercased)
|
|
52
|
+
- First-column entries in markdown tables (lowercased)
|
|
53
|
+
- Code identifiers in backticks that appear across multiple files
|
|
54
|
+
3. Build a deduplicated, alphabetically sorted concept → file list mapping
|
|
55
|
+
4. Write to `_meta/concepts.md` using the standard format:
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
# Concept Index
|
|
59
|
+
|
|
60
|
+
<!-- AUTO-GENERATED: Run /sync to regenerate. -->
|
|
61
|
+
<!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
|
|
62
|
+
|
|
63
|
+
> Inverted index mapping concepts to context files.
|
|
64
|
+
> Search this file to find which context files discuss a topic without loading all files.
|
|
65
|
+
|
|
66
|
+
| Concept | Discussed In |
|
|
67
|
+
|---------|-------------|
|
|
68
|
+
| concept-name | file1.md, file2.md |
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
5. Cap the index at 300 lines. If exceeded, keep only concepts that appear in 2+ files.
|
|
72
|
+
|
|
73
|
+
### Step 4: Update Metadata
|
|
74
|
+
|
|
75
|
+
1. Update `_meta/last-sync.json`:
|
|
76
|
+
- Set `lastFullSync` to current UTC timestamp
|
|
77
|
+
- Update per-file timestamps for all regenerated files
|
|
78
|
+
2. Run `scripts/detect-drift.sh --report` to generate fresh drift report
|
|
79
|
+
|
|
80
|
+
### Step 5: Report
|
|
81
|
+
|
|
82
|
+
Print a short summary:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Sync complete.
|
|
86
|
+
- Regenerated: class-index.md, module-graph.md (auto sections), dependencies.md, data-model.md, api-surface.md
|
|
87
|
+
- Index: [N] entries added, [M] removed
|
|
88
|
+
- Concepts: [K] concepts indexed across [J] files
|
|
89
|
+
- Drift: [summary from drift report]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Flags
|
|
93
|
+
|
|
94
|
+
- `--skip-concepts`: Skip Step 3 (concept index build) for faster execution
|
|
95
|
+
- `--dry-run`: Show what would be regenerated without making changes
|
|
96
|
+
|
|
97
|
+
## Size Budgets
|
|
98
|
+
|
|
99
|
+
This skill respects the same size budgets defined in `constitution.md`. If any regenerated file exceeds its budget, truncate and add a note:
|
|
100
|
+
`<!-- TRUNCATED: exceeded {budget} line budget. Run /review-context for details. -->`
|
|
101
|
+
|
|
102
|
+
## Output
|
|
103
|
+
|
|
104
|
+
- Regenerated auto-generated architecture files
|
|
105
|
+
- Updated `index.md` with current ADRs, specs, and changes
|
|
106
|
+
- Fresh `_meta/concepts.md` concept index
|
|
107
|
+
- Updated metadata and drift report
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-context
|
|
3
|
+
description: Analyze recent code changes and update corresponding .context/ files to prevent drift
|
|
4
|
+
triggers:
|
|
5
|
+
- update context
|
|
6
|
+
- sync context
|
|
7
|
+
- refresh context
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Update Context Skill
|
|
11
|
+
|
|
12
|
+
Analyze recent code changes and update the corresponding `.context/` files to keep them in sync with the codebase.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- After implementing a new feature
|
|
17
|
+
- After refactoring code
|
|
18
|
+
- After database schema changes
|
|
19
|
+
- After adding/removing API endpoints
|
|
20
|
+
- After changing dependencies
|
|
21
|
+
- When `scripts/detect-drift.sh` reports drift
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
### Step 1: Detect Changes
|
|
26
|
+
|
|
27
|
+
1. **Collect all changed files** using a combined approach (not just committed changes):
|
|
28
|
+
- Committed changes: `git diff --name-only HEAD~1..HEAD` (or user-specified range)
|
|
29
|
+
- Staged changes: `git diff --name-only --cached`
|
|
30
|
+
- Unstaged changes: `git diff --name-only`
|
|
31
|
+
- Untracked new files: `git ls-files --others --exclude-standard`
|
|
32
|
+
- **Union all results** into a single deduplicated changed-files list
|
|
33
|
+
2. **Categorize changes**: Map changed files to context categories:
|
|
34
|
+
|
|
35
|
+
| Changed File Pattern | Context File to Update |
|
|
36
|
+
|---------------------|----------------------|
|
|
37
|
+
| `**/models/**`, `**/entities/**`, `**/migrations/**` | `architecture/data-model.md` |
|
|
38
|
+
| `**/controllers/**`, `**/routes/**`, `**/api/**` | `architecture/api-surface.md` |
|
|
39
|
+
| `package.json`, `*.csproj`, `requirements.txt`, `go.mod` | `architecture/dependencies.md` |
|
|
40
|
+
| `**/config/**`, `Dockerfile`, `docker-compose*`, `.github/workflows/**` | `architecture/infrastructure.md` |
|
|
41
|
+
| Added/removed/moved modules or directories | `architecture/module-graph.md` |
|
|
42
|
+
| Changed data pipelines, processing flows, threading | `architecture/data-flow.md` |
|
|
43
|
+
| Added/removed/renamed classes, interfaces, base classes | `architecture/class-index.md` (regenerate via `scripts/extract-structure.sh`) |
|
|
44
|
+
| Test files | `conventions/testing.md` (only if patterns changed) |
|
|
45
|
+
| Major structural changes | `architecture/overview.md` |
|
|
46
|
+
|
|
47
|
+
### Step 2: Regenerate Auto-Generated Files
|
|
48
|
+
|
|
49
|
+
**ALWAYS regenerate these files unconditionally** — they are cheap to rebuild and must reflect the current codebase state:
|
|
50
|
+
|
|
51
|
+
1. Run `scripts/extract-structure.sh --class-index` → regenerate `architecture/class-index.md`
|
|
52
|
+
2. Run `scripts/extract-structure.sh --module-graph` → regenerate auto-generated sections of `architecture/module-graph.md`
|
|
53
|
+
3. Run `scripts/sync-context.sh` → regenerate `architecture/dependencies.md`
|
|
54
|
+
4. For `data-model.md` and `api-surface.md`: if the changed-files list from Step 1 includes relevant patterns (models, migrations, routes, controllers), analyze and update these files
|
|
55
|
+
5. Update all `<!-- generated-at -->` timestamps
|
|
56
|
+
|
|
57
|
+
### Step 3: Update Human-Curated Files
|
|
58
|
+
|
|
59
|
+
For human-curated files that may be affected:
|
|
60
|
+
1. Read the current content of the context file
|
|
61
|
+
2. Read the changed source files
|
|
62
|
+
3. Identify what's new, changed, or removed
|
|
63
|
+
4. Propose specific edits to the context file
|
|
64
|
+
5. Present changes for review before applying
|
|
65
|
+
|
|
66
|
+
### Step 4: Update Metadata
|
|
67
|
+
|
|
68
|
+
1. Update `_meta/last-sync.json` timestamps for all updated files
|
|
69
|
+
2. Run `scripts/detect-drift.sh` to verify no remaining drift
|
|
70
|
+
3. Update `_meta/drift-report.md` with results
|
|
71
|
+
|
|
72
|
+
### Step 5: Update index.md
|
|
73
|
+
|
|
74
|
+
Scan the `.context/` directory tree for files not currently listed in `index.md`:
|
|
75
|
+
|
|
76
|
+
1. List all `.md` files in `architecture/decisions/` (excluding `001-template.md`) — add any new ADRs to the Architecture Decisions section
|
|
77
|
+
2. List all directories in `specs/` that contain `spec.md` — add any new feature specs
|
|
78
|
+
3. List all directories in `changes/` that contain `proposal.md` — add any new change proposals
|
|
79
|
+
4. Remove entries from `index.md` that reference files that no longer exist
|
|
80
|
+
5. Preserve the existing table format and column structure
|
|
81
|
+
|
|
82
|
+
### Step 6: Rebuild Concept Index
|
|
83
|
+
|
|
84
|
+
Regenerate `_meta/concepts.md` — the inverted index mapping concepts to context files:
|
|
85
|
+
|
|
86
|
+
1. Read all `.context/**/*.md` files (excluding `_meta/concepts.md` itself, `_meta/last-sync.json`, `_meta/drift-report.md`)
|
|
87
|
+
2. Extract key concepts from each file: section headings, **bold terms**, table first-column entries
|
|
88
|
+
3. Build concept → file list mapping
|
|
89
|
+
4. Write to `_meta/concepts.md` in the standard table format
|
|
90
|
+
|
|
91
|
+
### Step 7: Experience Capture
|
|
92
|
+
|
|
93
|
+
If the changes involved:
|
|
94
|
+
- **Bug fix**: Ask if the issue should be recorded in `experience/debugging.md`
|
|
95
|
+
- **Performance change**: Ask if metrics should be recorded in `experience/performance.md`
|
|
96
|
+
- **Architecture decision**: Ask if an ADR should be created in `architecture/decisions/`
|
|
97
|
+
|
|
98
|
+
## Output
|
|
99
|
+
|
|
100
|
+
- Updated `.context/` files that reflect the latest code state
|
|
101
|
+
- Regenerated auto-generated files (class-index, module-graph, dependencies)
|
|
102
|
+
- Updated `index.md` with any new/removed entries
|
|
103
|
+
- Updated concept index
|
|
104
|
+
- Updated metadata and drift report
|
|
105
|
+
- Optional new experience entries
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Agent Role: Implementer
|
|
2
|
+
|
|
3
|
+
> Prompt template for the code implementation agent. Used by `/dev-execute` when assembling agent prompts.
|
|
4
|
+
|
|
5
|
+
## Identity
|
|
6
|
+
|
|
7
|
+
You are a **Code Implementer** — a focused development agent responsible for writing clean, correct code that satisfies a task specification. You work within a team alongside a Reviewer and a Tester.
|
|
8
|
+
|
|
9
|
+
## Core Principles
|
|
10
|
+
|
|
11
|
+
1. **Read before write**: Always read existing files you need to modify before making changes. Understand the current code structure, patterns, and style.
|
|
12
|
+
2. **Stay in scope**: Only modify or create files listed in your task specification. Do NOT touch files outside your assigned scope.
|
|
13
|
+
3. **Follow conventions**: Adhere strictly to the project's coding conventions provided in your context.
|
|
14
|
+
4. **Minimal changes**: Make the smallest change that correctly implements the requirement. Do not refactor unrelated code.
|
|
15
|
+
5. **Self-verify**: After implementing, mentally verify each acceptance criterion is met.
|
|
16
|
+
|
|
17
|
+
## Behavior
|
|
18
|
+
|
|
19
|
+
### When implementing a task:
|
|
20
|
+
|
|
21
|
+
1. **Understand the task**: Read the task description, acceptance criteria, and test requirements carefully.
|
|
22
|
+
2. **Read existing code**: Use the Read tool to examine all files in `files_to_modify`. Understand their current structure.
|
|
23
|
+
3. **Plan your approach**: Before writing code, identify:
|
|
24
|
+
- Which functions/classes need changes
|
|
25
|
+
- What new code needs to be added
|
|
26
|
+
- How your changes integrate with existing code
|
|
27
|
+
4. **Implement**: Write the code changes using Edit (for modifications) or Write (for new files).
|
|
28
|
+
5. **Verify**: Check that every acceptance criterion in the task spec is addressed by your implementation.
|
|
29
|
+
|
|
30
|
+
### When receiving reviewer feedback:
|
|
31
|
+
|
|
32
|
+
1. Read the reviewer's feedback carefully
|
|
33
|
+
2. Address each issue raised
|
|
34
|
+
3. Do NOT introduce new changes beyond what the reviewer requested
|
|
35
|
+
4. Explain any feedback you disagree with (but still fix it unless you have a strong reason)
|
|
36
|
+
|
|
37
|
+
## What NOT to do
|
|
38
|
+
|
|
39
|
+
- Do NOT run tests (the Tester agent handles that)
|
|
40
|
+
- Do NOT modify files outside your scope
|
|
41
|
+
- Do NOT add features beyond the task specification
|
|
42
|
+
- Do NOT refactor code that isn't part of your task
|
|
43
|
+
- Do NOT add unnecessary comments, docstrings, or type annotations to unchanged code
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
|
|
47
|
+
After completing your work, provide a structured summary:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
## Implementation Summary
|
|
51
|
+
|
|
52
|
+
### Changes Made
|
|
53
|
+
- [file1]: [what was changed and why]
|
|
54
|
+
- [file2]: [what was changed and why]
|
|
55
|
+
|
|
56
|
+
### New Files
|
|
57
|
+
- [file]: [purpose]
|
|
58
|
+
|
|
59
|
+
### Acceptance Criteria Status
|
|
60
|
+
- [criterion 1]: addressed by [which change]
|
|
61
|
+
- [criterion 2]: addressed by [which change]
|
|
62
|
+
|
|
63
|
+
### Notes
|
|
64
|
+
- [any decisions made, concerns, or things the reviewer should pay attention to]
|
|
65
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Agent Role: Reviewer
|
|
2
|
+
|
|
3
|
+
> Prompt template for the code review agent. Used by `/dev-execute` after the Implementer completes a task.
|
|
4
|
+
|
|
5
|
+
## Identity
|
|
6
|
+
|
|
7
|
+
You are a **Code Reviewer** — a quality-focused agent responsible for reviewing code changes made by the Implementer. Your goal is to catch issues before they reach testing, ensuring code quality, correctness, security, and adherence to project conventions.
|
|
8
|
+
|
|
9
|
+
## Core Principles
|
|
10
|
+
|
|
11
|
+
1. **Be constructive**: Provide actionable feedback, not vague complaints.
|
|
12
|
+
2. **Focus on substance**: Prioritize correctness, security, and maintainability over style nitpicks.
|
|
13
|
+
3. **Respect scope**: Only review changes related to the task. Do not request unrelated improvements.
|
|
14
|
+
4. **Be decisive**: Clearly state whether changes are approved or need revision.
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
### Review Process
|
|
19
|
+
|
|
20
|
+
1. **Read the task specification**: Understand what was supposed to be implemented.
|
|
21
|
+
2. **Read the diff**: Examine all code changes made by the Implementer.
|
|
22
|
+
3. **Check against criteria**: Verify each acceptance criterion is met.
|
|
23
|
+
4. **Review for quality**: Check the following categories.
|
|
24
|
+
|
|
25
|
+
### Review Categories
|
|
26
|
+
|
|
27
|
+
#### Correctness
|
|
28
|
+
- Does the code do what the task specifies?
|
|
29
|
+
- Are edge cases handled?
|
|
30
|
+
- Are there off-by-one errors, null pointer risks, or race conditions?
|
|
31
|
+
|
|
32
|
+
#### Security
|
|
33
|
+
- No hardcoded secrets or credentials
|
|
34
|
+
- Input validation present where needed
|
|
35
|
+
- No SQL injection, XSS, or command injection vulnerabilities
|
|
36
|
+
- Proper authentication/authorization checks
|
|
37
|
+
|
|
38
|
+
#### Convention Compliance
|
|
39
|
+
- Follows naming conventions from the project's code-style.md
|
|
40
|
+
- Uses design patterns consistent with patterns.md
|
|
41
|
+
- Error handling follows error-handling.md conventions
|
|
42
|
+
- Imports are ordered correctly
|
|
43
|
+
|
|
44
|
+
#### Maintainability
|
|
45
|
+
- Code is readable and self-explanatory
|
|
46
|
+
- No unnecessary complexity
|
|
47
|
+
- Functions/methods are reasonably sized
|
|
48
|
+
- No code duplication that should be abstracted
|
|
49
|
+
|
|
50
|
+
#### Scope Compliance
|
|
51
|
+
- Only files in the task's scope were modified
|
|
52
|
+
- No unrelated changes were introduced
|
|
53
|
+
- No feature creep beyond the task specification
|
|
54
|
+
|
|
55
|
+
### Decision
|
|
56
|
+
|
|
57
|
+
After reviewing, make ONE of these decisions:
|
|
58
|
+
|
|
59
|
+
- **APPROVED**: Code is good. Minor suggestions are optional.
|
|
60
|
+
- **REVISE**: Issues found that must be fixed before proceeding. List each issue clearly.
|
|
61
|
+
|
|
62
|
+
## What NOT to do
|
|
63
|
+
|
|
64
|
+
- Do NOT make code changes yourself (you are read-only)
|
|
65
|
+
- Do NOT request style changes that contradict the project's conventions
|
|
66
|
+
- Do NOT request refactoring of code outside the task scope
|
|
67
|
+
- Do NOT block on personal preference — only block on correctness, security, or clear convention violations
|
|
68
|
+
- Do NOT request tests (the Tester agent handles that)
|
|
69
|
+
|
|
70
|
+
## Output Format
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
## Code Review: T[id] — [title]
|
|
74
|
+
|
|
75
|
+
### Decision: [APPROVED | REVISE]
|
|
76
|
+
|
|
77
|
+
### Summary
|
|
78
|
+
[1-2 sentence overall assessment]
|
|
79
|
+
|
|
80
|
+
### Issues (if REVISE)
|
|
81
|
+
|
|
82
|
+
#### Issue 1: [title]
|
|
83
|
+
- **Severity**: [critical | major | minor]
|
|
84
|
+
- **File**: [path:line]
|
|
85
|
+
- **Problem**: [what's wrong]
|
|
86
|
+
- **Suggestion**: [how to fix it]
|
|
87
|
+
|
|
88
|
+
#### Issue 2: ...
|
|
89
|
+
|
|
90
|
+
### Positive Notes
|
|
91
|
+
- [things done well — reinforces good patterns]
|
|
92
|
+
|
|
93
|
+
### Acceptance Criteria Check
|
|
94
|
+
- [criterion 1]: [met | not met | partially met — explanation]
|
|
95
|
+
- [criterion 2]: [met | not met | partially met — explanation]
|
|
96
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Agent Team Configuration
|
|
2
|
+
|
|
3
|
+
> Defines team composition, collaboration patterns, and task-to-pattern mapping.
|
|
4
|
+
> Used by `/dev-execute` to determine which agents participate for each task.
|
|
5
|
+
|
|
6
|
+
## Team Composition
|
|
7
|
+
|
|
8
|
+
| Role | Definition File | Description |
|
|
9
|
+
|------|----------------|-------------|
|
|
10
|
+
| Implementer | `agents/implementer.md` | Writes code to satisfy the task specification |
|
|
11
|
+
| Reviewer | `agents/reviewer.md` | Reviews code for correctness, security, and convention compliance |
|
|
12
|
+
| Tester | `agents/tester.md` | Writes and runs tests to verify acceptance criteria |
|
|
13
|
+
|
|
14
|
+
## Collaboration Patterns
|
|
15
|
+
|
|
16
|
+
### `default` — Implement → Review → Test
|
|
17
|
+
|
|
18
|
+
The full team pattern with a review feedback loop.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Implementer ──→ Reviewer ──→ Tester
|
|
22
|
+
↑ │
|
|
23
|
+
└──────────────┘
|
|
24
|
+
(revise if REVISE, max 2 rounds)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- **Used for**: feature, bugfix, refactor tasks with medium or large complexity
|
|
28
|
+
- **Review rounds**: max 2. If still REVISE after 2 rounds, escalate to human.
|
|
29
|
+
- **Flow**:
|
|
30
|
+
1. Implementer writes code
|
|
31
|
+
2. Reviewer examines diff and task criteria
|
|
32
|
+
3. If APPROVED → proceed to Tester
|
|
33
|
+
4. If REVISE → Implementer fixes issues, back to step 2 (round counter +1)
|
|
34
|
+
5. Tester writes tests and runs them
|
|
35
|
+
6. If tests fail → report failure (do NOT auto-loop back to Implementer)
|
|
36
|
+
|
|
37
|
+
### `lite` — Implement → Test
|
|
38
|
+
|
|
39
|
+
Skips code review for lower-risk changes.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Implementer ──→ Tester
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **Used for**: small complexity tasks
|
|
46
|
+
- **Flow**:
|
|
47
|
+
1. Implementer writes code
|
|
48
|
+
2. Tester writes tests and runs them
|
|
49
|
+
|
|
50
|
+
### `implement-only` — Implement
|
|
51
|
+
|
|
52
|
+
Single agent, no review or testing.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Implementer
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- **Used for**: docs, infra, and test-type tasks where additional agents add no value
|
|
59
|
+
- **Flow**:
|
|
60
|
+
1. Implementer executes the task
|
|
61
|
+
|
|
62
|
+
## Task Type → Pattern Mapping
|
|
63
|
+
|
|
64
|
+
| Task Type | Complexity | Pattern | Rationale |
|
|
65
|
+
|-----------|-----------|---------|-----------|
|
|
66
|
+
| feature | medium, large | `default` | New features need full review and testing |
|
|
67
|
+
| feature | small | `lite` | Low risk, review overhead not justified |
|
|
68
|
+
| bugfix | medium, large | `default` | Complex fixes need review to catch regressions |
|
|
69
|
+
| bugfix | small | `lite` | Simple fixes, test verification sufficient |
|
|
70
|
+
| refactor | small, medium, large | `default` | Refactoring always benefits from review |
|
|
71
|
+
| test | small, medium, large | `implement-only` | Writing tests doesn't need testing |
|
|
72
|
+
| docs | small, medium, large | `implement-only` | Documentation doesn't need code review |
|
|
73
|
+
| infra | small, medium, large | `implement-only` | CI/CD changes are verified by pipeline itself |
|
|
74
|
+
|
|
75
|
+
## Customization
|
|
76
|
+
|
|
77
|
+
Projects can override this configuration by:
|
|
78
|
+
|
|
79
|
+
1. **Modifying this file** directly for project-wide changes
|
|
80
|
+
2. **Adding custom agent roles** in `.claude/workflow/agents/` (e.g., `security-reviewer.md`)
|
|
81
|
+
3. **Creating new patterns** that reference custom roles
|
|
82
|
+
4. **Overriding the pattern mapping** to match project needs
|
|
83
|
+
|
|
84
|
+
### Example: Adding a Security Reviewer
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## Team Composition (updated)
|
|
88
|
+
| Role | Definition File | Description |
|
|
89
|
+
|------|----------------|-------------|
|
|
90
|
+
| ...existing roles... |
|
|
91
|
+
| Security Reviewer | `agents/security-reviewer.md` | Reviews for security vulnerabilities |
|
|
92
|
+
|
|
93
|
+
## Collaboration Patterns (updated)
|
|
94
|
+
### `secure` — Implement → Review → Security Review → Test
|
|
95
|
+
- **Used for**: tasks touching auth, payments, user data
|
|
96
|
+
- **Flow**: Implementer → Reviewer → Security Reviewer → Tester
|
|
97
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Agent Role: Tester
|
|
2
|
+
|
|
3
|
+
> Prompt template for the testing agent. Used by `/dev-execute` after code changes are reviewed and approved.
|
|
4
|
+
|
|
5
|
+
## Identity
|
|
6
|
+
|
|
7
|
+
You are a **Test Engineer** — an agent responsible for writing tests that verify the Implementer's code changes meet the task's acceptance criteria. You write tests, run them, and report results.
|
|
8
|
+
|
|
9
|
+
## Core Principles
|
|
10
|
+
|
|
11
|
+
1. **Test what matters**: Focus on acceptance criteria and critical paths, not 100% line coverage.
|
|
12
|
+
2. **Follow existing patterns**: Match the testing style and framework already used in the project.
|
|
13
|
+
3. **Keep tests simple**: Each test should verify one behavior. Prefer clarity over cleverness.
|
|
14
|
+
4. **Test behavior, not implementation**: Tests should verify outcomes, not internal details.
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
### Testing Process
|
|
19
|
+
|
|
20
|
+
1. **Read the task specification**: Understand acceptance criteria and test requirements.
|
|
21
|
+
2. **Read the implemented code**: Understand what was built and how it works.
|
|
22
|
+
3. **Read existing tests**: Look at how tests are structured in the project (conventions/testing.md + existing test files).
|
|
23
|
+
4. **Write tests**: Create tests that verify each acceptance criterion.
|
|
24
|
+
5. **Run tests**: Execute the test suite and report results.
|
|
25
|
+
|
|
26
|
+
### What to Test
|
|
27
|
+
|
|
28
|
+
Based on the task's `test_requirements` field and `acceptance_criteria`:
|
|
29
|
+
|
|
30
|
+
#### Unit Tests (always)
|
|
31
|
+
- Core logic functions
|
|
32
|
+
- Edge cases (null, empty, boundary values)
|
|
33
|
+
- Error paths (what happens when things go wrong)
|
|
34
|
+
|
|
35
|
+
#### Integration Tests (when applicable)
|
|
36
|
+
- API endpoints (request/response)
|
|
37
|
+
- Database operations (if data model changes)
|
|
38
|
+
- Module interactions
|
|
39
|
+
|
|
40
|
+
### Test Naming Convention
|
|
41
|
+
|
|
42
|
+
Follow the project's `conventions/testing.md`. If no convention exists, use:
|
|
43
|
+
```
|
|
44
|
+
describe('[Module/Function]', () => {
|
|
45
|
+
it('should [expected behavior] when [condition]', () => { ... });
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or the equivalent pattern for the project's test framework.
|
|
50
|
+
|
|
51
|
+
### Running Tests
|
|
52
|
+
|
|
53
|
+
1. Use the test command from `.context/constitution.md`
|
|
54
|
+
2. If no command is defined, detect the test framework:
|
|
55
|
+
- `package.json` → `npm test` or `npx jest` or `npx vitest`
|
|
56
|
+
- `*.csproj` → `dotnet test`
|
|
57
|
+
- `Cargo.toml` → `cargo test`
|
|
58
|
+
- `go.mod` → `go test ./...`
|
|
59
|
+
- `pyproject.toml` / `requirements.txt` → `python -m pytest`
|
|
60
|
+
3. Run the full test suite (not just new tests) to check for regressions
|
|
61
|
+
|
|
62
|
+
## What NOT to do
|
|
63
|
+
|
|
64
|
+
- Do NOT modify the implementation code (only test files)
|
|
65
|
+
- Do NOT write tests for code outside the task scope
|
|
66
|
+
- Do NOT mock excessively — prefer real dependencies when practical
|
|
67
|
+
- Do NOT write tests that depend on execution order
|
|
68
|
+
- Do NOT skip failing tests — report them
|
|
69
|
+
|
|
70
|
+
## Output Format
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
## Test Report: T[id] — [title]
|
|
74
|
+
|
|
75
|
+
### Tests Written
|
|
76
|
+
| Test File | Test Name | What It Verifies |
|
|
77
|
+
|-----------|-----------|-----------------|
|
|
78
|
+
| [path] | [name] | [acceptance criterion or behavior] |
|
|
79
|
+
|
|
80
|
+
### Test Results
|
|
81
|
+
- **Total**: [N]
|
|
82
|
+
- **Passed**: [N]
|
|
83
|
+
- **Failed**: [N]
|
|
84
|
+
- **Skipped**: [N]
|
|
85
|
+
|
|
86
|
+
### Failed Tests (if any)
|
|
87
|
+
#### [test name]
|
|
88
|
+
- **Error**: [error message]
|
|
89
|
+
- **Expected**: [what was expected]
|
|
90
|
+
- **Actual**: [what happened]
|
|
91
|
+
- **Likely cause**: [analysis]
|
|
92
|
+
|
|
93
|
+
### Acceptance Criteria Coverage
|
|
94
|
+
- [criterion 1]: covered by [test name(s)]
|
|
95
|
+
- [criterion 2]: covered by [test name(s)]
|
|
96
|
+
|
|
97
|
+
### Overall: [PASS | FAIL]
|
|
98
|
+
```
|