@aslomon/effectum 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/README.md +633 -0
- package/bin/install.js +652 -0
- package/package.json +29 -0
- package/system/README.md +118 -0
- package/system/commands/build-fix.md +89 -0
- package/system/commands/cancel-ralph.md +90 -0
- package/system/commands/checkpoint.md +63 -0
- package/system/commands/code-review.md +120 -0
- package/system/commands/e2e.md +92 -0
- package/system/commands/plan.md +111 -0
- package/system/commands/ralph-loop.md +163 -0
- package/system/commands/refactor-clean.md +104 -0
- package/system/commands/tdd.md +84 -0
- package/system/commands/verify.md +71 -0
- package/system/stacks/generic.md +96 -0
- package/system/stacks/nextjs-supabase.md +114 -0
- package/system/stacks/python-fastapi.md +140 -0
- package/system/stacks/swift-ios.md +136 -0
- package/system/templates/AUTONOMOUS-WORKFLOW.md +1368 -0
- package/system/templates/CLAUDE.md.tmpl +141 -0
- package/system/templates/guardrails.md.tmpl +39 -0
- package/system/templates/settings.json.tmpl +201 -0
- package/workshop/knowledge/01-prd-template.md +275 -0
- package/workshop/knowledge/02-questioning-framework.md +209 -0
- package/workshop/knowledge/03-decomposition-guide.md +234 -0
- package/workshop/knowledge/04-examples.md +435 -0
- package/workshop/knowledge/05-quality-checklist.md +166 -0
- package/workshop/knowledge/06-network-map-guide.md +413 -0
- package/workshop/knowledge/07-prompt-templates.md +315 -0
- package/workshop/knowledge/08-workflow-modes.md +198 -0
- package/workshop/projects/_example-project/PROJECT.md +33 -0
- package/workshop/projects/_example-project/notes/decisions.md +15 -0
- package/workshop/projects/_example-project/notes/discovery-log.md +9 -0
- package/workshop/templates/PROJECT.md +25 -0
- package/workshop/templates/network-map.mmd +13 -0
- package/workshop/templates/prd.md +133 -0
- package/workshop/templates/requirements-map.md +48 -0
- package/workshop/templates/shared-contracts.md +89 -0
- package/workshop/templates/vision.md +66 -0
package/system/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# system/ — Autonomous Development System
|
|
2
|
+
|
|
3
|
+
Configuration templates, stack presets, and workflow definitions for the Claude Code autonomous development system.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
system/
|
|
9
|
+
templates/ # Parameterized config templates
|
|
10
|
+
CLAUDE.md.tmpl # Project CLAUDE.md ({{PLACEHOLDER}} syntax)
|
|
11
|
+
settings.json.tmpl # Claude Code settings with hooks
|
|
12
|
+
guardrails.md.tmpl # Guardrails with stack-specific sections
|
|
13
|
+
AUTONOMOUS-WORKFLOW.md # Full workflow reference (not a template)
|
|
14
|
+
stacks/ # Stack presets (inject into templates)
|
|
15
|
+
nextjs-supabase.md # Next.js + TypeScript + Supabase
|
|
16
|
+
python-fastapi.md # Python + FastAPI + SQLAlchemy
|
|
17
|
+
swift-ios.md # Swift + SwiftUI + SwiftData
|
|
18
|
+
generic.md # Stack-agnostic baseline
|
|
19
|
+
commands/ # Slash command definitions (future)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## How It Works
|
|
23
|
+
|
|
24
|
+
### 1. Templates
|
|
25
|
+
|
|
26
|
+
Files in `templates/` use `{{PLACEHOLDER}}` syntax for values that vary per project. During `/setup`, placeholders are substituted with values from the selected stack preset and user input.
|
|
27
|
+
|
|
28
|
+
**Template placeholders:**
|
|
29
|
+
|
|
30
|
+
| Placeholder | Source | Example Value |
|
|
31
|
+
| ------------------------------- | ------------ | --------------------------------------- |
|
|
32
|
+
| `{{PROJECT_NAME}}` | User input | `TaskFlow SaaS` |
|
|
33
|
+
| `{{LANGUAGE}}` | User input | `English` or `German (du/informal)` |
|
|
34
|
+
| `{{TECH_STACK}}` | Stack preset | Full tech stack description |
|
|
35
|
+
| `{{ARCHITECTURE_PRINCIPLES}}` | Stack preset | Architecture rules for the stack |
|
|
36
|
+
| `{{PROJECT_STRUCTURE}}` | Stack preset | Directory layout |
|
|
37
|
+
| `{{QUALITY_GATES}}` | Stack preset | Build/test/lint commands |
|
|
38
|
+
| `{{PACKAGE_MANAGER}}` | Stack preset | `pnpm`, `uv`, `swift package`, etc. |
|
|
39
|
+
| `{{FORMATTER}}` | Stack preset | `npx prettier --write`, `ruff format` |
|
|
40
|
+
| `{{FORMATTER_COMMAND}}` | Stack preset | Shell command for the formatter |
|
|
41
|
+
| `{{FORMATTER_GLOB}}` | Stack preset | File extensions to auto-format |
|
|
42
|
+
| `{{STACK_SPECIFIC_GUARDRAILS}}` | Stack preset | Stack-specific rules |
|
|
43
|
+
| `{{TOOL_SPECIFIC_GUARDRAILS}}` | Stack preset | Tool-specific rules |
|
|
44
|
+
| `{{AUTONOMY_PERMISSIONS}}` | User input | `bypassPermissions` or `askPermissions` |
|
|
45
|
+
|
|
46
|
+
### 2. Stack Presets
|
|
47
|
+
|
|
48
|
+
Files in `stacks/` define all stack-specific values as named sections. Each section corresponds to a template placeholder. The `/setup` command reads the selected preset and injects its values into the templates.
|
|
49
|
+
|
|
50
|
+
**Available presets:**
|
|
51
|
+
|
|
52
|
+
| Preset | File | Use Case |
|
|
53
|
+
| ------------------ | -------------------- | ----------------------------------- |
|
|
54
|
+
| Next.js + Supabase | `nextjs-supabase.md` | Full-stack web apps |
|
|
55
|
+
| Python + FastAPI | `python-fastapi.md` | Backend services and APIs |
|
|
56
|
+
| Swift + iOS | `swift-ios.md` | Native Apple platform apps |
|
|
57
|
+
| Generic | `generic.md` | Any stack (user fills in specifics) |
|
|
58
|
+
|
|
59
|
+
**Adding a new preset:**
|
|
60
|
+
|
|
61
|
+
1. Copy `generic.md` as a starting point
|
|
62
|
+
2. Fill in all sections (TECH_STACK, ARCHITECTURE_PRINCIPLES, etc.)
|
|
63
|
+
3. Save as `stacks/{name}.md`
|
|
64
|
+
4. The preset is automatically available during `/setup`
|
|
65
|
+
|
|
66
|
+
### 3. Setup Flow
|
|
67
|
+
|
|
68
|
+
When `/setup` runs in a target project:
|
|
69
|
+
|
|
70
|
+
1. User selects a stack preset (or `generic`)
|
|
71
|
+
2. User provides project name and preferences
|
|
72
|
+
3. Templates are rendered with preset values + user input
|
|
73
|
+
4. Generated files are written to the target project:
|
|
74
|
+
- `.claude/CLAUDE.md` (from `CLAUDE.md.tmpl`)
|
|
75
|
+
- `.claude/settings.json` (from `settings.json.tmpl`)
|
|
76
|
+
- `.claude/guardrails.md` (from `guardrails.md.tmpl`)
|
|
77
|
+
5. `AUTONOMOUS-WORKFLOW.md` is copied as-is (reference doc, no substitution)
|
|
78
|
+
|
|
79
|
+
### 4. Fixed vs. Templated Content
|
|
80
|
+
|
|
81
|
+
**Fixed (same in every project):**
|
|
82
|
+
|
|
83
|
+
- Code Quality Rules (40-line functions, 300-line files, naming conventions)
|
|
84
|
+
- Development Workflow (/plan, /tdd, /verify, /code-review)
|
|
85
|
+
- Available Commands table
|
|
86
|
+
- Context7 usage instructions
|
|
87
|
+
- Design System (DESIGN.md requirement)
|
|
88
|
+
- Agent Teams section
|
|
89
|
+
- Shell command rules (non-interactive only)
|
|
90
|
+
- Tool usage guidelines
|
|
91
|
+
- Commit conventions
|
|
92
|
+
- All hooks in settings.json (SessionStart, PreToolUse, PostToolUse, Stop, etc.)
|
|
93
|
+
- All error patterns and workflow lessons in guardrails
|
|
94
|
+
|
|
95
|
+
**Templated (varies per stack):**
|
|
96
|
+
|
|
97
|
+
- Tech stack description
|
|
98
|
+
- Architecture principles
|
|
99
|
+
- Project structure
|
|
100
|
+
- Quality gate commands
|
|
101
|
+
- Package manager
|
|
102
|
+
- Formatter command and file glob
|
|
103
|
+
- Stack-specific and tool-specific guardrails
|
|
104
|
+
|
|
105
|
+
## Relationship to AUTONOMOUS-WORKFLOW.md
|
|
106
|
+
|
|
107
|
+
The `AUTONOMOUS-WORKFLOW.md` file is a comprehensive reference document covering:
|
|
108
|
+
|
|
109
|
+
- PRD template and best practices
|
|
110
|
+
- Prompt templates (Standard, Express, Full-Auto, Ralph Loop)
|
|
111
|
+
- Workflow phases (Planning, DB, Backend, Frontend, E2E, Verification)
|
|
112
|
+
- Command chains by feature type
|
|
113
|
+
- Quality gates
|
|
114
|
+
- Agent Teams usage
|
|
115
|
+
- Ralph Loop configuration
|
|
116
|
+
- Lessons learned from real sessions
|
|
117
|
+
|
|
118
|
+
It is NOT a template — it is copied as-is into target projects as a workflow reference.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# /build-fix -- Incrementally Fix Build and Type Errors
|
|
2
|
+
|
|
3
|
+
You fix build and type errors one at a time, re-running the build after each fix. You never suppress errors or skip warnings to force a passing build.
|
|
4
|
+
|
|
5
|
+
## Step 1: Run the Build
|
|
6
|
+
|
|
7
|
+
1. Read `CLAUDE.md` to identify the project's build command and type-check command.
|
|
8
|
+
2. Run the build command.
|
|
9
|
+
3. If the build succeeds with zero errors: report success and stop.
|
|
10
|
+
|
|
11
|
+
## Step 2: Analyze Build Output
|
|
12
|
+
|
|
13
|
+
If the build fails:
|
|
14
|
+
|
|
15
|
+
1. Read the **complete** error output -- every error, every warning.
|
|
16
|
+
2. Count the total number of errors.
|
|
17
|
+
3. Categorize the errors:
|
|
18
|
+
- **Type errors**: Missing types, incompatible types, missing properties.
|
|
19
|
+
- **Import errors**: Missing modules, wrong paths, circular dependencies.
|
|
20
|
+
- **Syntax errors**: Malformed code, missing brackets, invalid expressions.
|
|
21
|
+
- **Configuration errors**: Missing environment variables, wrong settings.
|
|
22
|
+
- **Dependency errors**: Missing packages, version conflicts.
|
|
23
|
+
|
|
24
|
+
## Step 3: Fix One Error at a Time
|
|
25
|
+
|
|
26
|
+
Pick the **first** error in the output (errors often cascade -- fixing the first frequently resolves downstream errors).
|
|
27
|
+
|
|
28
|
+
1. Read the source file referenced in the error.
|
|
29
|
+
2. Understand the error: what is expected vs. what exists.
|
|
30
|
+
3. Apply a **targeted fix** -- change only what is necessary to resolve this specific error.
|
|
31
|
+
- For type errors: add correct types, fix interfaces, use type guards. Never use `any` or unsafe casts.
|
|
32
|
+
- For import errors: fix the import path, add the missing export, or install the missing package.
|
|
33
|
+
- For syntax errors: fix the syntax.
|
|
34
|
+
- For configuration errors: check CLAUDE.md and project config files for the correct values.
|
|
35
|
+
- For dependency errors: install the missing package using the project's package manager (as specified in CLAUDE.md).
|
|
36
|
+
|
|
37
|
+
4. **Do NOT**:
|
|
38
|
+
- Add `// @ts-ignore`, `// @ts-expect-error`, or equivalent suppressions.
|
|
39
|
+
- Change `strict` mode settings or compiler options to be more permissive.
|
|
40
|
+
- Delete code to make errors disappear.
|
|
41
|
+
- Add `any` types to bypass type checking.
|
|
42
|
+
|
|
43
|
+
## Step 4: Re-Run the Build
|
|
44
|
+
|
|
45
|
+
1. Run the build command again after the fix.
|
|
46
|
+
2. Compare the error count to the previous run:
|
|
47
|
+
- Fewer errors: good -- the fix worked and may have resolved cascading errors.
|
|
48
|
+
- Same number: the fix resolved one error but uncovered another.
|
|
49
|
+
- More errors: the fix introduced new problems -- revert it and try a different approach.
|
|
50
|
+
|
|
51
|
+
## Step 5: Repeat
|
|
52
|
+
|
|
53
|
+
Go back to Step 3 with the next error. Continue until:
|
|
54
|
+
|
|
55
|
+
- **Build passes**: Report success. List the fixes applied.
|
|
56
|
+
- **10 fix attempts reached**: Stop and report the current state:
|
|
57
|
+
- How many errors were fixed.
|
|
58
|
+
- How many errors remain.
|
|
59
|
+
- The remaining error messages with file paths and line numbers.
|
|
60
|
+
- Ask the user for guidance on the remaining errors.
|
|
61
|
+
|
|
62
|
+
## Step 6: Also Run Type Check (if separate)
|
|
63
|
+
|
|
64
|
+
If the project has a separate type-check command (distinct from the build command):
|
|
65
|
+
|
|
66
|
+
1. Run the type-check command after the build passes.
|
|
67
|
+
2. If type errors exist: repeat Steps 3-5 for type errors.
|
|
68
|
+
|
|
69
|
+
## Step 7: Report
|
|
70
|
+
|
|
71
|
+
Present a summary:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
| Metric | Value |
|
|
75
|
+
| ------------------ | ------------------------ |
|
|
76
|
+
| Initial errors | 12 |
|
|
77
|
+
| Errors fixed | 12 |
|
|
78
|
+
| Remaining errors | 0 |
|
|
79
|
+
| Fix attempts | 8 (some fixes cascaded) |
|
|
80
|
+
| Build status | PASS |
|
|
81
|
+
| Type check status | PASS |
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If errors remain, list each one with file, line, error message, and what was attempted.
|
|
85
|
+
|
|
86
|
+
## Communication
|
|
87
|
+
|
|
88
|
+
Follow the language settings defined in CLAUDE.md for user-facing communication.
|
|
89
|
+
All error messages and technical content in English.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# /cancel-ralph -- Cancel an Active Ralph Loop
|
|
2
|
+
|
|
3
|
+
You gracefully cancel a running Ralph Loop, preserve progress, and report the current state.
|
|
4
|
+
|
|
5
|
+
## Step 1: Check for Active Loop
|
|
6
|
+
|
|
7
|
+
Check if `.claude/ralph-loop.local.md` exists.
|
|
8
|
+
|
|
9
|
+
- **If it does not exist**: Inform the user: "No active Ralph Loop found. There is nothing to cancel."
|
|
10
|
+
**STOP.**
|
|
11
|
+
|
|
12
|
+
- **If it exists**: Read the file completely. Check the `active` field:
|
|
13
|
+
- If `active: false`: Inform the user: "The Ralph Loop has already completed or been cancelled. See `.claude/ralph-status.md` for the final status."
|
|
14
|
+
**STOP.**
|
|
15
|
+
- If `active: true`: Continue to Step 2.
|
|
16
|
+
|
|
17
|
+
## Step 2: Capture Current State
|
|
18
|
+
|
|
19
|
+
Gather the current project state:
|
|
20
|
+
|
|
21
|
+
1. Read the progress log from `.claude/ralph-loop.local.md` (iterations completed, what was done).
|
|
22
|
+
2. Read the original prompt and completion promise.
|
|
23
|
+
3. Run `git diff --stat` to see uncommitted changes.
|
|
24
|
+
4. Run the project's test command to get current test status.
|
|
25
|
+
5. Run the project's build command to get current build status.
|
|
26
|
+
6. Check for any blocker files at `.claude/ralph-blockers.md`.
|
|
27
|
+
|
|
28
|
+
## Step 3: Write Status Report
|
|
29
|
+
|
|
30
|
+
Write a comprehensive status report to `.claude/ralph-status.md`:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
# Ralph Loop Status Report
|
|
34
|
+
|
|
35
|
+
## Summary
|
|
36
|
+
|
|
37
|
+
- **Started**: [ISO timestamp from state file]
|
|
38
|
+
- **Cancelled**: [current ISO timestamp]
|
|
39
|
+
- **Iterations completed**: [N] of [max_iterations]
|
|
40
|
+
- **Completion promise**: "[PHRASE]"
|
|
41
|
+
- **Promise fulfilled**: No (cancelled)
|
|
42
|
+
|
|
43
|
+
## What Was Implemented
|
|
44
|
+
|
|
45
|
+
[List each piece of functionality that was implemented, based on the progress log]
|
|
46
|
+
|
|
47
|
+
## What Remains
|
|
48
|
+
|
|
49
|
+
[List acceptance criteria or tasks that were not completed]
|
|
50
|
+
|
|
51
|
+
## Current Quality Gate Status
|
|
52
|
+
|
|
53
|
+
| Gate | Status |
|
|
54
|
+
| ----- | -------------------------- |
|
|
55
|
+
| Build | [PASS/FAIL] |
|
|
56
|
+
| Types | [PASS/FAIL] |
|
|
57
|
+
| Tests | [PASS/FAIL -- N/M passing] |
|
|
58
|
+
| Lint | [PASS/FAIL] |
|
|
59
|
+
|
|
60
|
+
## Blockers (if any)
|
|
61
|
+
|
|
62
|
+
[Content from .claude/ralph-blockers.md, or "None"]
|
|
63
|
+
|
|
64
|
+
## Uncommitted Changes
|
|
65
|
+
|
|
66
|
+
[Summary of git diff --stat output]
|
|
67
|
+
|
|
68
|
+
## Recommended Next Steps
|
|
69
|
+
|
|
70
|
+
[Concrete suggestions for how to continue: specific fixes, remaining tasks, approach changes]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Step 4: Update State File
|
|
74
|
+
|
|
75
|
+
Set `active: false` in `.claude/ralph-loop.local.md`. Do not delete the file -- it serves as a record.
|
|
76
|
+
|
|
77
|
+
## Step 5: Inform the User
|
|
78
|
+
|
|
79
|
+
Report to the user:
|
|
80
|
+
|
|
81
|
+
1. The Ralph Loop has been cancelled.
|
|
82
|
+
2. How many iterations were completed out of the maximum.
|
|
83
|
+
3. Brief summary of what was accomplished.
|
|
84
|
+
4. Where to find the full status report (`.claude/ralph-status.md`).
|
|
85
|
+
5. Suggested next steps: continue manually, restart with a modified prompt, or run `/verify` to assess the current state.
|
|
86
|
+
|
|
87
|
+
## Communication
|
|
88
|
+
|
|
89
|
+
Follow the language settings defined in CLAUDE.md for user-facing communication.
|
|
90
|
+
All status report content and technical details in English.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# /checkpoint -- Create a Git Restore Point
|
|
2
|
+
|
|
3
|
+
You create a tagged git commit as a safe restore point. This allows easy rollback if subsequent changes need to be undone.
|
|
4
|
+
|
|
5
|
+
## Step 1: Check Current State
|
|
6
|
+
|
|
7
|
+
Run `git status` to assess the working tree.
|
|
8
|
+
|
|
9
|
+
- **If there are no changes** (clean working tree, nothing to commit):
|
|
10
|
+
Inform the user: "Nothing to checkpoint -- the working tree is clean. The latest commit is already a valid restore point."
|
|
11
|
+
Show the current HEAD commit hash and message for reference.
|
|
12
|
+
**STOP.**
|
|
13
|
+
|
|
14
|
+
- **If there are uncommitted changes** (tracked modifications, untracked files, or staged changes):
|
|
15
|
+
Continue to Step 2.
|
|
16
|
+
|
|
17
|
+
## Step 2: Summarize Changes
|
|
18
|
+
|
|
19
|
+
Briefly analyze what has changed:
|
|
20
|
+
|
|
21
|
+
1. Run `git diff --stat` to see modified files.
|
|
22
|
+
2. Run `git status` to see untracked and staged files.
|
|
23
|
+
3. Generate a brief description of the current state (1 sentence), e.g.:
|
|
24
|
+
- "Added user invitation API routes and tests"
|
|
25
|
+
- "Partial implementation of dark mode toggle"
|
|
26
|
+
- "Build fixes for type errors in auth module"
|
|
27
|
+
|
|
28
|
+
## Step 3: Create the Checkpoint
|
|
29
|
+
|
|
30
|
+
1. Stage all changes:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
git add -A
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. Create the commit with a descriptive checkpoint message:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
git commit -m "checkpoint: [brief description of current state]"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
3. Create a timestamp-based tag for easy identification:
|
|
43
|
+
```
|
|
44
|
+
git tag checkpoint-[YYYY-MM-DD-HHMMSS]
|
|
45
|
+
```
|
|
46
|
+
Use the current date and time in the format `YYYY-MM-DD-HHMMSS` (e.g., `checkpoint-2025-01-15-143022`).
|
|
47
|
+
|
|
48
|
+
## Step 4: Report
|
|
49
|
+
|
|
50
|
+
Show the user:
|
|
51
|
+
|
|
52
|
+
1. The commit hash (short form).
|
|
53
|
+
2. The tag name.
|
|
54
|
+
3. Summary of what was included (files changed, insertions, deletions).
|
|
55
|
+
4. Rollback instructions:
|
|
56
|
+
- **Soft rollback** (keep changes as uncommitted): `git reset --soft [commit-hash]`
|
|
57
|
+
- **View checkpoint**: `git show [tag-name]`
|
|
58
|
+
- **List all checkpoints**: `git tag -l "checkpoint-*"`
|
|
59
|
+
|
|
60
|
+
## Communication
|
|
61
|
+
|
|
62
|
+
Follow the language settings defined in CLAUDE.md for user-facing communication.
|
|
63
|
+
All git messages, tag names, and technical content in English.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# /code-review -- Security and Quality Review
|
|
2
|
+
|
|
3
|
+
You perform a thorough security and code quality review of all changes. You report findings with severity levels and suggested fixes.
|
|
4
|
+
|
|
5
|
+
## Step 1: Identify Changes to Review
|
|
6
|
+
|
|
7
|
+
Determine the scope of the review:
|
|
8
|
+
|
|
9
|
+
1. Run `git diff` to see all uncommitted changes (staged + unstaged).
|
|
10
|
+
2. If on a feature branch: also run `git diff main...HEAD` (or the project's base branch) to see all branch changes.
|
|
11
|
+
3. If `$ARGUMENTS` specifies files or directories: focus the review on those.
|
|
12
|
+
4. List all changed files with their change type (added, modified, deleted).
|
|
13
|
+
|
|
14
|
+
## Step 2: Read All Changed Files
|
|
15
|
+
|
|
16
|
+
Read every changed file **completely** -- not just the diff hunks. Understanding the full file context is necessary for accurate review. Also read closely related files (imports, callers, types) when needed for context.
|
|
17
|
+
|
|
18
|
+
## Step 3: Security Review (OWASP Top 10)
|
|
19
|
+
|
|
20
|
+
Review all changes against these security criteria:
|
|
21
|
+
|
|
22
|
+
1. **Injection (SQL, NoSQL, Command)**
|
|
23
|
+
- Are all database queries parameterized?
|
|
24
|
+
- Are user inputs sanitized before use in commands or queries?
|
|
25
|
+
- Are ORMs or query builders used correctly?
|
|
26
|
+
|
|
27
|
+
2. **Broken Authentication**
|
|
28
|
+
- Are authentication checks present on all protected routes?
|
|
29
|
+
- Are session tokens handled securely?
|
|
30
|
+
- Are passwords hashed with a strong algorithm?
|
|
31
|
+
|
|
32
|
+
3. **Sensitive Data Exposure**
|
|
33
|
+
- Are secrets, API keys, or credentials hardcoded in source code?
|
|
34
|
+
- Is sensitive data logged or exposed in error messages?
|
|
35
|
+
- Are environment variables used for configuration?
|
|
36
|
+
|
|
37
|
+
4. **Broken Access Control**
|
|
38
|
+
- Are authorization checks present (role-based, ownership-based)?
|
|
39
|
+
- Are database-level access controls in place (RLS policies, row ownership)?
|
|
40
|
+
- Can users access resources that belong to other users or organizations?
|
|
41
|
+
|
|
42
|
+
5. **Cross-Site Scripting (XSS)**
|
|
43
|
+
- Is user-generated content properly escaped/encoded before rendering?
|
|
44
|
+
- Are `dangerouslySetInnerHTML` or equivalent patterns justified and sanitized?
|
|
45
|
+
|
|
46
|
+
6. **CSRF Protection**
|
|
47
|
+
- Are state-changing operations protected against CSRF?
|
|
48
|
+
- Are anti-CSRF tokens used where applicable?
|
|
49
|
+
|
|
50
|
+
7. **Security Misconfiguration**
|
|
51
|
+
- Are CORS policies restrictive?
|
|
52
|
+
- Are security headers set (CSP, X-Frame-Options, etc.)?
|
|
53
|
+
- Are default credentials or debug modes disabled?
|
|
54
|
+
|
|
55
|
+
## Step 4: Code Quality Review
|
|
56
|
+
|
|
57
|
+
Review against these quality criteria:
|
|
58
|
+
|
|
59
|
+
1. **Function Length**: Flag functions exceeding 40 lines. Suggest extraction points.
|
|
60
|
+
2. **File Length**: Flag files exceeding 300 lines. Suggest splitting strategies.
|
|
61
|
+
3. **Naming**: Check for descriptive names. Flag abbreviations, single-letter variables (outside loops), or Hungarian notation.
|
|
62
|
+
4. **Error Handling**: Verify errors are handled explicitly (Result pattern, try-catch with meaningful handling). Flag swallowed errors (empty catch blocks, ignored return values).
|
|
63
|
+
5. **Debug Statements**: Flag `console.log`, `console.debug`, `print()`, `debugger`, `breakpoint()` in production code (not test files).
|
|
64
|
+
6. **Dead Code**: Flag unused imports, unreachable code, commented-out code blocks.
|
|
65
|
+
7. **Duplication**: Flag duplicated logic that should be extracted into shared utilities.
|
|
66
|
+
|
|
67
|
+
## Step 5: Type Safety Review
|
|
68
|
+
|
|
69
|
+
Review type usage:
|
|
70
|
+
|
|
71
|
+
1. **No `any` types**: Flag every use of `any` (or equivalent in the project's language). Suggest specific types, generics, or union types.
|
|
72
|
+
2. **No unsafe type casts**: Flag `as` casts (TypeScript), forced unwraps (Swift), or equivalent. Suggest type guards, validation schemas, or runtime checks.
|
|
73
|
+
3. **Null/undefined handling**: Verify proper handling of nullable values. Flag potential null dereferences.
|
|
74
|
+
4. **Validation at boundaries**: Verify that external data (API inputs, form data, environment variables) is validated with schemas before use.
|
|
75
|
+
|
|
76
|
+
## Step 6: Architecture Review
|
|
77
|
+
|
|
78
|
+
Review against project conventions:
|
|
79
|
+
|
|
80
|
+
1. Read `CLAUDE.md` for the project's architectural rules and patterns.
|
|
81
|
+
2. **Separation of concerns**: Flag business logic in UI components, data access in presentation layers.
|
|
82
|
+
3. **Convention compliance**: Verify file organization, naming patterns, import structure follow project conventions.
|
|
83
|
+
4. **Dependency direction**: Verify imports flow in the correct direction (components -> services -> utilities, not the reverse).
|
|
84
|
+
|
|
85
|
+
## Step 7: Present Findings
|
|
86
|
+
|
|
87
|
+
Present each finding with:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
### [SEVERITY] Description
|
|
91
|
+
|
|
92
|
+
- **File**: path/to/file.ts
|
|
93
|
+
- **Line**: 42
|
|
94
|
+
- **Issue**: Detailed description of the problem.
|
|
95
|
+
- **Risk**: What could go wrong if this is not fixed.
|
|
96
|
+
- **Fix**: Specific, actionable suggestion for how to fix it.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Severity levels:
|
|
100
|
+
|
|
101
|
+
| Severity | Meaning |
|
|
102
|
+
| ------------ | ------------------------------------------------------------------- |
|
|
103
|
+
| **CRITICAL** | Security vulnerability, data loss risk, or production-breaking bug. |
|
|
104
|
+
| **WARNING** | Code quality issue, potential bug, or convention violation. |
|
|
105
|
+
| **INFO** | Suggestion for improvement, minor style issue, or optimization. |
|
|
106
|
+
|
|
107
|
+
## Step 8: Summary
|
|
108
|
+
|
|
109
|
+
Provide a summary:
|
|
110
|
+
|
|
111
|
+
1. Total findings by severity: N CRITICAL, N WARNING, N INFO.
|
|
112
|
+
2. Overall assessment: Is this code ready to merge/deploy?
|
|
113
|
+
3. Priority actions: List the top 3 most important fixes.
|
|
114
|
+
4. If zero CRITICAL findings: "No blocking issues found. Code is ready for deployment pending WARNING fixes."
|
|
115
|
+
5. If CRITICAL findings exist: "Blocking issues found. These must be resolved before deployment."
|
|
116
|
+
|
|
117
|
+
## Communication
|
|
118
|
+
|
|
119
|
+
Follow the language settings defined in CLAUDE.md for user-facing communication.
|
|
120
|
+
All technical findings (file paths, code snippets, issue descriptions) in English.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# /e2e -- Write and Run End-to-End Tests
|
|
2
|
+
|
|
3
|
+
You write and execute end-to-end tests for critical user journeys. Focus on testing the application as a real user would interact with it.
|
|
4
|
+
|
|
5
|
+
## Step 1: Determine Test Targets
|
|
6
|
+
|
|
7
|
+
1. Read `CLAUDE.md` for the project's E2E framework, test directory, and conventions.
|
|
8
|
+
2. Parse `$ARGUMENTS`:
|
|
9
|
+
- If specific test targets are provided (e.g., "login flow", "checkout"): focus on those.
|
|
10
|
+
- If acceptance criteria are provided: derive test cases from them.
|
|
11
|
+
- If empty: identify critical user journeys from the PRD, recent changes (`git diff`), or the application's core functionality.
|
|
12
|
+
|
|
13
|
+
## Step 2: Study Existing Patterns
|
|
14
|
+
|
|
15
|
+
1. Read existing E2E test files to understand:
|
|
16
|
+
- Test structure and organization.
|
|
17
|
+
- Helper functions, fixtures, and page objects.
|
|
18
|
+
- Authentication and setup patterns.
|
|
19
|
+
- Selector conventions (data-testid, roles, labels).
|
|
20
|
+
- Configuration (base URL, timeouts, browser settings).
|
|
21
|
+
2. Read the E2E framework configuration file for project-specific settings.
|
|
22
|
+
|
|
23
|
+
## Step 3: Plan Test Cases
|
|
24
|
+
|
|
25
|
+
For each user journey, plan:
|
|
26
|
+
|
|
27
|
+
1. **Happy path**: The primary success scenario the user is expected to follow.
|
|
28
|
+
2. **Error cases**: Invalid inputs, permission denied, network errors, empty states.
|
|
29
|
+
3. **Edge cases**: Boundary values, concurrent actions, rapid interactions.
|
|
30
|
+
|
|
31
|
+
Each test must be independent -- no shared state between tests. Each test should set up its own preconditions and clean up after itself.
|
|
32
|
+
|
|
33
|
+
## Step 4: Write E2E Tests
|
|
34
|
+
|
|
35
|
+
Write tests using the project's E2E framework (as specified in CLAUDE.md). Follow these principles:
|
|
36
|
+
|
|
37
|
+
1. **Selectors** (in priority order):
|
|
38
|
+
- Accessibility-tree-based: `getByRole`, `getByLabel`, `getByPlaceholder` -- most reliable, resilient to UI changes.
|
|
39
|
+
- `data-testid` attributes -- stable, explicit contract between test and implementation.
|
|
40
|
+
- Scoped queries -- search within a container element, not globally.
|
|
41
|
+
- Avoid: CSS classes, tag names, XPath, or text selectors that match multiple elements.
|
|
42
|
+
|
|
43
|
+
2. **Test structure**:
|
|
44
|
+
- Descriptive test names that explain the user journey.
|
|
45
|
+
- Arrange (set up preconditions) -> Act (perform user actions) -> Assert (verify outcomes).
|
|
46
|
+
- Use the framework's built-in waiting mechanisms instead of hardcoded waits.
|
|
47
|
+
- Add `data-testid` attributes to source components when no suitable accessible selector exists.
|
|
48
|
+
|
|
49
|
+
3. **Test isolation**:
|
|
50
|
+
- Each test starts from a known state (fresh session, seeded data).
|
|
51
|
+
- Tests do not depend on the execution order of other tests.
|
|
52
|
+
- Clean up any data or state created during the test.
|
|
53
|
+
|
|
54
|
+
## Step 5: Run Tests
|
|
55
|
+
|
|
56
|
+
1. Run the E2E tests using the project's E2E test command (as specified in CLAUDE.md).
|
|
57
|
+
2. Collect the results: pass/fail per test, total duration, any screenshots or traces.
|
|
58
|
+
|
|
59
|
+
## Step 6: Handle Failures
|
|
60
|
+
|
|
61
|
+
On test failure, follow the diagnostic sequence **before** attempting any fix:
|
|
62
|
+
|
|
63
|
+
1. **Read the error message and stack trace** completely.
|
|
64
|
+
2. **Read framework-specific diagnostics**: screenshots, traces, video recordings, accessibility snapshots, HTML snapshots.
|
|
65
|
+
3. **Check execution context**: Is the application running? Are environment variables set? Is the test database seeded?
|
|
66
|
+
4. **Identify root cause**: Is this a test issue (wrong selector, timing) or an application bug?
|
|
67
|
+
5. **Apply a targeted fix** (one change per attempt). Re-run the failing test.
|
|
68
|
+
6. If the same test fails 3 times with different fixes: document the issue and move on. Report it as a blocker.
|
|
69
|
+
|
|
70
|
+
## Step 7: Report Results
|
|
71
|
+
|
|
72
|
+
Present results per test:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
| Test | Status | Duration |
|
|
76
|
+
| ----------------------------- | ------ | -------- |
|
|
77
|
+
| User can sign up and log in | PASS | 3.2s |
|
|
78
|
+
| User sees error on invalid | PASS | 1.8s |
|
|
79
|
+
| Dashboard loads for new user | FAIL | 5.0s |
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For failures, include:
|
|
83
|
+
|
|
84
|
+
- The exact error message.
|
|
85
|
+
- The step that failed.
|
|
86
|
+
- Any diagnostic artifacts (screenshot paths, trace paths).
|
|
87
|
+
- Suggested root cause and fix.
|
|
88
|
+
|
|
89
|
+
## Communication
|
|
90
|
+
|
|
91
|
+
Follow the language settings defined in CLAUDE.md for user-facing communication.
|
|
92
|
+
All test names, code, and technical content in English.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# /plan -- Analyze Requirements and Create Implementation Plan
|
|
2
|
+
|
|
3
|
+
You create a detailed implementation plan for a feature, then STOP and wait for explicit approval before writing any code.
|
|
4
|
+
|
|
5
|
+
## Step 1: Parse Input
|
|
6
|
+
|
|
7
|
+
Read `$ARGUMENTS` for the feature description, PRD reference, or prompt.
|
|
8
|
+
|
|
9
|
+
- If `$ARGUMENTS` references a PRD file path: read the entire PRD file.
|
|
10
|
+
- If `$ARGUMENTS` contains inline requirements: use them directly.
|
|
11
|
+
- If `$ARGUMENTS` is empty: ask the user what they want to implement and wait for a response.
|
|
12
|
+
|
|
13
|
+
## Step 2: Explore the Codebase
|
|
14
|
+
|
|
15
|
+
Systematically explore the project to build context:
|
|
16
|
+
|
|
17
|
+
1. Read `CLAUDE.md` in the project root for stack, conventions, and project-specific rules.
|
|
18
|
+
2. Read `DESIGN.md` if it exists for visual/design conventions.
|
|
19
|
+
3. Glob for the project structure: `**/*.{ts,tsx,py,swift,go,rs}` (adapt to the project's language).
|
|
20
|
+
4. Grep for patterns relevant to the feature (existing services, components, utilities, types).
|
|
21
|
+
5. Read key files: entry points, existing similar features, shared utilities, configuration files.
|
|
22
|
+
6. Check for existing tests to understand testing patterns and conventions.
|
|
23
|
+
|
|
24
|
+
## Step 3: Identify Reusable Assets
|
|
25
|
+
|
|
26
|
+
Document what already exists that the implementation can leverage:
|
|
27
|
+
|
|
28
|
+
- Existing components, hooks, or utilities that can be reused or extended.
|
|
29
|
+
- Established patterns for data fetching, error handling, state management, and validation.
|
|
30
|
+
- Shared types, schemas, or interfaces relevant to the feature.
|
|
31
|
+
- Test helpers, fixtures, or factories.
|
|
32
|
+
|
|
33
|
+
## Step 4: Create the Implementation Plan
|
|
34
|
+
|
|
35
|
+
Structure the plan in ordered phases with clear dependencies:
|
|
36
|
+
|
|
37
|
+
### Phase 1: Data Layer (if applicable)
|
|
38
|
+
|
|
39
|
+
- Database migrations, schema changes, type generation.
|
|
40
|
+
- Validation schemas for new data structures.
|
|
41
|
+
- Estimated complexity: [Low / Medium / High]
|
|
42
|
+
|
|
43
|
+
### Phase 2: Backend / Services
|
|
44
|
+
|
|
45
|
+
- API routes, server-side services, business logic.
|
|
46
|
+
- Integration with existing services.
|
|
47
|
+
- Estimated complexity: [Low / Medium / High]
|
|
48
|
+
|
|
49
|
+
### Phase 3: Frontend / UI (if applicable)
|
|
50
|
+
|
|
51
|
+
- Components, pages, layouts.
|
|
52
|
+
- Client-side state and interactions.
|
|
53
|
+
- Estimated complexity: [Low / Medium / High]
|
|
54
|
+
|
|
55
|
+
### Phase 4: Testing
|
|
56
|
+
|
|
57
|
+
- Unit tests for services and utilities.
|
|
58
|
+
- Integration tests for API routes.
|
|
59
|
+
- Component tests for UI.
|
|
60
|
+
- Estimated complexity: [Low / Medium / High]
|
|
61
|
+
|
|
62
|
+
### Phase 5: E2E Tests (if applicable)
|
|
63
|
+
|
|
64
|
+
- Critical user journeys.
|
|
65
|
+
- Edge cases and error scenarios.
|
|
66
|
+
- Estimated complexity: [Low / Medium / High]
|
|
67
|
+
|
|
68
|
+
### Phase 6: Verification
|
|
69
|
+
|
|
70
|
+
- Build, type check, lint, full test suite.
|
|
71
|
+
- Code review checklist items.
|
|
72
|
+
|
|
73
|
+
For each phase, specify:
|
|
74
|
+
|
|
75
|
+
- What will be created or modified (files, functions, components).
|
|
76
|
+
- Dependencies on other phases.
|
|
77
|
+
- Acceptance criteria that will be verified.
|
|
78
|
+
|
|
79
|
+
## Step 5: Surface Risks and Open Questions
|
|
80
|
+
|
|
81
|
+
List explicitly:
|
|
82
|
+
|
|
83
|
+
- **Risks**: Potential complications, performance concerns, breaking changes.
|
|
84
|
+
- **Open Questions**: Ambiguities in the requirements that need clarification.
|
|
85
|
+
- **Assumptions**: Decisions you would make autonomously (and why).
|
|
86
|
+
- **Dependencies**: External services, libraries, or features this depends on.
|
|
87
|
+
|
|
88
|
+
## Step 6: Present the Plan
|
|
89
|
+
|
|
90
|
+
Present the complete plan to the user in a clear, structured format. Include:
|
|
91
|
+
|
|
92
|
+
1. Summary (1-2 sentences: what this implements and why).
|
|
93
|
+
2. Phased plan with estimated complexity per phase.
|
|
94
|
+
3. Reusable assets identified.
|
|
95
|
+
4. Risks, open questions, and assumptions.
|
|
96
|
+
5. Total estimated complexity.
|
|
97
|
+
|
|
98
|
+
## Step 7: STOP and Wait
|
|
99
|
+
|
|
100
|
+
**STOP HERE.** Do NOT write any code, create any files, or make any changes.
|
|
101
|
+
|
|
102
|
+
Wait for explicit approval from the user:
|
|
103
|
+
|
|
104
|
+
- **"OK"** or **"Go"** or **"Start"** -> Proceed with implementation (typically via `/tdd`).
|
|
105
|
+
- **"Change X"** -> Revise the plan based on feedback, present again, wait again.
|
|
106
|
+
- **"Start over"** -> Discard the plan and restart from Step 1.
|
|
107
|
+
|
|
108
|
+
## Communication
|
|
109
|
+
|
|
110
|
+
Follow the language settings defined in CLAUDE.md for user-facing communication.
|
|
111
|
+
All technical content (code, file paths, plan details) in English.
|