cc-workspace 4.0.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/LICENSE +21 -0
- package/README.md +382 -0
- package/bin/cli.js +735 -0
- package/global-skills/agents/implementer.md +39 -0
- package/global-skills/agents/team-lead.md +143 -0
- package/global-skills/agents/workspace-init.md +207 -0
- package/global-skills/bootstrap-repo/SKILL.md +70 -0
- package/global-skills/constitution.md +58 -0
- package/global-skills/cross-service-check/SKILL.md +67 -0
- package/global-skills/cycle-retrospective/SKILL.md +133 -0
- package/global-skills/dispatch-feature/SKILL.md +168 -0
- package/global-skills/dispatch-feature/references/anti-patterns.md +31 -0
- package/global-skills/dispatch-feature/references/frontend-ux-standards.md +73 -0
- package/global-skills/dispatch-feature/references/spawn-templates.md +109 -0
- package/global-skills/hooks/notify-user.sh +30 -0
- package/global-skills/hooks/permission-auto-approve.sh +16 -0
- package/global-skills/hooks/session-start-context.sh +85 -0
- package/global-skills/hooks/subagent-start-context.sh +35 -0
- package/global-skills/hooks/task-completed-check.sh +21 -0
- package/global-skills/hooks/teammate-idle-check.sh +29 -0
- package/global-skills/hooks/track-file-modifications.sh +20 -0
- package/global-skills/hooks/user-prompt-guard.sh +19 -0
- package/global-skills/hooks/validate-spawn-prompt.sh +79 -0
- package/global-skills/hooks/worktree-create-context.sh +22 -0
- package/global-skills/incident-debug/SKILL.md +86 -0
- package/global-skills/merge-prep/SKILL.md +87 -0
- package/global-skills/plan-review/SKILL.md +70 -0
- package/global-skills/qa-ruthless/SKILL.md +102 -0
- package/global-skills/refresh-profiles/SKILL.md +22 -0
- package/global-skills/rules/constitution-en.md +67 -0
- package/global-skills/rules/context-hygiene.md +43 -0
- package/global-skills/rules/model-routing.md +42 -0
- package/global-skills/templates/claude-md.template.md +124 -0
- package/global-skills/templates/constitution.template.md +18 -0
- package/global-skills/templates/workspace.template.md +33 -0
- package/package.json +28 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# task-completed-check.sh
|
|
3
|
+
# TaskCompleted hook: reminds teammates to verify tests/dead code/constitution.
|
|
4
|
+
# Exit 0 + stdout = inject reminder as context (non-blocking, v4.0).
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
INPUT=$(cat)
|
|
8
|
+
|
|
9
|
+
# Extract task output if available
|
|
10
|
+
TASK_OUTPUT=$(echo "$INPUT" | jq -r '.task_output // empty' 2>/dev/null) || true
|
|
11
|
+
|
|
12
|
+
# Check for explicit failure signals across common test runners
|
|
13
|
+
# PHPUnit: FAILURES!, ERRORS!, Tests: X, Failures: Y
|
|
14
|
+
# pytest/vitest/jest: FAILED, failed, ✗, Error
|
|
15
|
+
# Pest (Laravel): FAIL, Tests: X, X failed
|
|
16
|
+
# Generic: exit code non-zero indicators, AssertionError (Python), AssertionError (various)
|
|
17
|
+
if echo "$TASK_OUTPUT" | grep -qiE '(tests?\s*fail|FAIL(ED|URES?)|error.*test|test.*error|ERRORS?:|failures?:|AssertionError|exit\s*code\s*[1-9])' 2>/dev/null; then
|
|
18
|
+
echo "[Warning] Tests appear to have failed. Verify before marking complete."
|
|
19
|
+
fi
|
|
20
|
+
echo "Task completion checklist: 1) Verify tests passed 2) Check for dead code 3) Verify constitution compliance."
|
|
21
|
+
exit 0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# teammate-idle-check.sh
|
|
3
|
+
# TeammateIdle hook
|
|
4
|
+
# Checks if unfinished tasks remain in active plans.
|
|
5
|
+
# NOTE: Uses CLAUDE_PROJECT_DIR to locate the workspace.
|
|
6
|
+
# If this hook runs in a teammate context where the plans/ directory is
|
|
7
|
+
# not accessible, it will harmlessly exit 0.
|
|
8
|
+
# v4.0: Warning only (exit 0). Never blocks.
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
cat > /dev/null
|
|
12
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
13
|
+
|
|
14
|
+
# Check for pending tasks in active plans
|
|
15
|
+
if [ -d "$PROJECT_DIR/plans" ]; then
|
|
16
|
+
PENDING=$(find "$PROJECT_DIR/plans" -name '*.md' \
|
|
17
|
+
! -name '_TEMPLATE.md' \
|
|
18
|
+
! -name 'service-profiles.md' \
|
|
19
|
+
-exec grep -l '⏳' {} \; 2>/dev/null)
|
|
20
|
+
|
|
21
|
+
if [ -n "$PENDING" ]; then
|
|
22
|
+
PLAN_NAMES=$(echo "$PENDING" | xargs -I{} basename {} | tr '\n' ', ' | sed 's/,$//')
|
|
23
|
+
echo "[Warning] Unassigned tasks remain in: $PLAN_NAMES. Consider claiming the next pending task."
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# No pending tasks — teammate can go idle
|
|
29
|
+
exit 0
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# track-file-modifications.sh
|
|
3
|
+
# PostToolUse hook (async): logs modified files for merge-prep.
|
|
4
|
+
# Matcher: Write|Edit|MultiEdit
|
|
5
|
+
# Appends to .claude/modified-files.log
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
INPUT=$(cat)
|
|
9
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
10
|
+
LOG_FILE="$PROJECT_DIR/.claude/modified-files.log"
|
|
11
|
+
|
|
12
|
+
# Extract file path from tool input
|
|
13
|
+
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.filePath // empty' 2>/dev/null) || true
|
|
14
|
+
|
|
15
|
+
if [ -n "$FILE_PATH" ]; then
|
|
16
|
+
mkdir -p "$(dirname "$LOG_FILE")"
|
|
17
|
+
echo "$(date +%Y-%m-%dT%H:%M:%S) $FILE_PATH" >> "$LOG_FILE"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
exit 0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# user-prompt-guard.sh
|
|
3
|
+
# UserPromptSubmit hook: conditionally reminds the orchestrator of its role.
|
|
4
|
+
# Only injects the reminder when the user prompt contains patterns suggesting
|
|
5
|
+
# a direct code request. This saves tokens on routine messages.
|
|
6
|
+
# Non-blocking (exit 0 + stdout = context injection).
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
INPUT=$(cat)
|
|
10
|
+
|
|
11
|
+
# Extract the user prompt text from stdin JSON
|
|
12
|
+
PROMPT=$(echo "$INPUT" | jq -r '.prompt // empty' 2>/dev/null) || true
|
|
13
|
+
|
|
14
|
+
# Only inject reminder if user prompt matches code-request patterns
|
|
15
|
+
if echo "$PROMPT" | grep -qiE '(dans le repo|dans [a-z-]+/|modifie.*repo|édite.*(api|front|light|spring|scraper|krakend|dashboard)|patch.*service)' 2>/dev/null; then
|
|
16
|
+
echo "Role reminder: Writing in sibling repos is for teammates. You can write in orchestrator/ (plans, workspace.md, constitution.md). For repo changes, spawn a teammate."
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
exit 0
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# validate-spawn-prompt.sh
|
|
3
|
+
# PreToolUse hook (matcher: Teammate): validates that teammate spawn prompts
|
|
4
|
+
# contain the required context before allowing the spawn.
|
|
5
|
+
# v4.0: ALL checks are non-blocking warnings (exit 0 + stdout).
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
INPUT=$(cat)
|
|
9
|
+
|
|
10
|
+
# Extract the spawn prompt from tool input
|
|
11
|
+
PROMPT=$(echo "$INPUT" | jq -r '.tool_input.prompt // empty' 2>/dev/null) || true
|
|
12
|
+
|
|
13
|
+
if [ -z "$PROMPT" ]; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
WARNINGS=""
|
|
18
|
+
BLOCKERS=""
|
|
19
|
+
|
|
20
|
+
# Check 1: Project-specific rules — require numbered rules (13., 14., etc.)
|
|
21
|
+
# or explicit section header, not just mention of the word "rules"
|
|
22
|
+
RULES_FOUND=0
|
|
23
|
+
if echo "$PROMPT" | grep -qiE '(## project rules|## non-negotiable|project-specific rules|rules spécifiques)' 2>/dev/null; then
|
|
24
|
+
RULES_FOUND=1
|
|
25
|
+
fi
|
|
26
|
+
if echo "$PROMPT" | grep -qE '(1[3-9]\.|[2-9][0-9]\.).*\*\*' 2>/dev/null; then
|
|
27
|
+
RULES_FOUND=1
|
|
28
|
+
fi
|
|
29
|
+
if echo "$PROMPT" | grep -qiE '(constitution|project rules)' 2>/dev/null && echo "$PROMPT" | grep -cqiE '(tenant|scoping|precision|rollback|feature flag)' 2>/dev/null; then
|
|
30
|
+
RULES_FOUND=1
|
|
31
|
+
fi
|
|
32
|
+
if [ "$RULES_FOUND" -eq 0 ]; then
|
|
33
|
+
BLOCKERS+="- Missing project-specific rules in spawn prompt. Include the project constitution rules (numbered rules from workspace constitution.md, translated to English).\n"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Check 2: Tasks section must be present with actual task content
|
|
37
|
+
if ! echo "$PROMPT" | grep -qiE '(your tasks|## tasks|assigned tasks|tâches|### tasks)' 2>/dev/null; then
|
|
38
|
+
BLOCKERS+="- Missing tasks section in spawn prompt. Include the specific tasks from the plan.\n"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Check 3: CLAUDE.md instruction
|
|
42
|
+
if ! echo "$PROMPT" | grep -qiE '(CLAUDE\.md|read the repo|repo conventions|read.*conventions)' 2>/dev/null; then
|
|
43
|
+
WARNINGS+="- Missing instruction to read repo CLAUDE.md.\n"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Check 4: Frontend teammates need UX standards — check for actual UX content
|
|
47
|
+
if echo "$PROMPT" | grep -qiE '(front|frontend|vue|quasar|nuxt|react|ui|ux)' 2>/dev/null; then
|
|
48
|
+
UX_SIGNALS=0
|
|
49
|
+
echo "$PROMPT" | grep -qiE '(4 (mandatory )?states|skeleton|empty state)' 2>/dev/null && UX_SIGNALS=$((UX_SIGNALS + 1))
|
|
50
|
+
echo "$PROMPT" | grep -qiE '(responsive|mobile.first)' 2>/dev/null && UX_SIGNALS=$((UX_SIGNALS + 1))
|
|
51
|
+
echo "$PROMPT" | grep -qiE '(accessib|aria.label|wcag)' 2>/dev/null && UX_SIGNALS=$((UX_SIGNALS + 1))
|
|
52
|
+
echo "$PROMPT" | grep -qiE '(ux standard|error.state|loading.state)' 2>/dev/null && UX_SIGNALS=$((UX_SIGNALS + 1))
|
|
53
|
+
if [ "$UX_SIGNALS" -lt 2 ]; then
|
|
54
|
+
BLOCKERS+="- Frontend teammate detected but UX standards not sufficiently included (found $UX_SIGNALS/4 UX signals). Inject frontend-ux-standards content.\n"
|
|
55
|
+
fi
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Check 5: API teammates need contract shapes
|
|
59
|
+
if echo "$PROMPT" | grep -qiE '(api|backend|endpoint|rest|graphql)' 2>/dev/null; then
|
|
60
|
+
if ! echo "$PROMPT" | grep -qiE '(contract|response shape|request shape|interface|payload|schema|GET /|POST /|PUT /|DELETE /)' 2>/dev/null; then
|
|
61
|
+
WARNINGS+="- API teammate detected but no contract/shapes found in prompt. Consider including the API contract.\n"
|
|
62
|
+
fi
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# Check 6: Escalation instruction
|
|
66
|
+
if ! echo "$PROMPT" | grep -qiE '(escalat|STOP and report|STOP and escalate|report.*dilemma|architectural decision)' 2>/dev/null; then
|
|
67
|
+
WARNINGS+="- Missing escalation instruction. Include: 'If you hit an architectural decision NOT covered by the plan: STOP and escalate.'\n"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# Report — ALL checks are warnings only (v4.0)
|
|
71
|
+
ISSUES=""
|
|
72
|
+
[ -n "$BLOCKERS" ] && ISSUES+="$BLOCKERS"
|
|
73
|
+
[ -n "$WARNINGS" ] && ISSUES+="$WARNINGS"
|
|
74
|
+
|
|
75
|
+
if [ -n "$ISSUES" ]; then
|
|
76
|
+
echo -e "Spawn prompt validation warnings (non-blocking):\n$ISSUES"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
exit 0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# worktree-create-context.sh
|
|
3
|
+
# WorktreeCreate hook: logs worktree creation and reminds teammate to read repo CLAUDE.md.
|
|
4
|
+
# Parses stdin JSON to extract the worktree path for a specific reminder.
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
INPUT=$(cat)
|
|
8
|
+
|
|
9
|
+
WORKTREE_PATH=$(echo "$INPUT" | jq -r '.worktree_path // empty' 2>/dev/null) || true
|
|
10
|
+
|
|
11
|
+
if [ -n "$WORKTREE_PATH" ]; then
|
|
12
|
+
echo "[WorktreeCreate] Worktree created at: $WORKTREE_PATH"
|
|
13
|
+
if [ -f "$WORKTREE_PATH/CLAUDE.md" ]; then
|
|
14
|
+
echo "Read $WORKTREE_PATH/CLAUDE.md first — follow its conventions."
|
|
15
|
+
else
|
|
16
|
+
echo "WARNING: No CLAUDE.md found in $WORKTREE_PATH. Check repo root or run bootstrap-repo."
|
|
17
|
+
fi
|
|
18
|
+
else
|
|
19
|
+
echo "[WorktreeCreate] Worktree created. Read the CLAUDE.md in the repo root first."
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
exit 0
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incident-debug
|
|
3
|
+
description: >
|
|
4
|
+
Debug incidents across a multi-service stack. Spawns parallel
|
|
5
|
+
investigators per layer. Use when user reports a bug, says "erreur",
|
|
6
|
+
"500", "bug", "debug", "ça marche pas", "investigate", or pastes
|
|
7
|
+
stack traces or error logs.
|
|
8
|
+
argument-hint: "[error description or stack trace]"
|
|
9
|
+
context: fork
|
|
10
|
+
allowed-tools: Read, Write, Glob, Grep, Task, Teammate, SendMessage
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Incident Debug — Multi-Layer Investigation
|
|
14
|
+
|
|
15
|
+
You investigate. You do NOT fix. You produce a diagnosis.
|
|
16
|
+
|
|
17
|
+
## Phase 1: Triage
|
|
18
|
+
|
|
19
|
+
Read `./workspace.md` for the service map.
|
|
20
|
+
Parse the user's report for signals:
|
|
21
|
+
|
|
22
|
+
| Signal | Start with |
|
|
23
|
+
|--------|-----------|
|
|
24
|
+
| HTTP 4xx/5xx | API layer |
|
|
25
|
+
| JS error / white screen | Frontend |
|
|
26
|
+
| Auth loop / 401/403 | Auth + middleware |
|
|
27
|
+
| Slow / timeout | DB + gateway |
|
|
28
|
+
| Wrong data | Data layer + API |
|
|
29
|
+
| 502/503 | Infra |
|
|
30
|
+
|
|
31
|
+
If unclear, investigate all layers.
|
|
32
|
+
|
|
33
|
+
## Phase 2: Investigate (parallel)
|
|
34
|
+
|
|
35
|
+
Spawn investigators via Agent Teams (Teammate tool):
|
|
36
|
+
- **API/Backend**: full Sonnet teammate with write-capable investigation. Use the **LSP tool** (go-to-definition, find-references) to trace error call chains
|
|
37
|
+
- **Frontend, Gateway, Infra, Auth**: lightweight Explore subagents (Task, Haiku) for read-only scan. Use LSP tool where available for tracing
|
|
38
|
+
|
|
39
|
+
Multiple teammates can share findings and challenge each other's hypotheses.
|
|
40
|
+
This adversarial pattern finds root causes faster than sequential investigation.
|
|
41
|
+
|
|
42
|
+
### LSP investigation patterns
|
|
43
|
+
|
|
44
|
+
Instruct investigators to use these specific LSP workflows:
|
|
45
|
+
|
|
46
|
+
| Signal | LSP action |
|
|
47
|
+
|--------|-----------|
|
|
48
|
+
| HTTP 500 in controller | `go-to-definition` on the controller method → trace into service layer → trace into repository/query |
|
|
49
|
+
| Type mismatch frontend | `find-references` on the TypeScript interface → verify all usages match the API shape |
|
|
50
|
+
| Auth loop / 401 | `hover` on auth middleware → verify configuration → `find-references` on token validation |
|
|
51
|
+
| N+1 query suspicion | `find-references` on the relationship method → check all callers for eager loading |
|
|
52
|
+
| Dead import / unused function | `find-references` → if 0 references outside tests, flag as dead code |
|
|
53
|
+
| Unknown error class | `go-to-definition` on the exception class → check parent hierarchy and catch blocks |
|
|
54
|
+
|
|
55
|
+
## Phase 3: Correlate
|
|
56
|
+
|
|
57
|
+
Build request flow timeline with ✅/❌ markers.
|
|
58
|
+
Cross-reference findings between layers.
|
|
59
|
+
|
|
60
|
+
## Phase 4: Write diagnosis
|
|
61
|
+
|
|
62
|
+
Create `./plans/incident-{date}-{name}.md`:
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
# Incident: [title]
|
|
66
|
+
> Date: [DATE] | Severity: 🔴/🟡/🟢
|
|
67
|
+
|
|
68
|
+
## Symptôme
|
|
69
|
+
[what the user sees]
|
|
70
|
+
|
|
71
|
+
## Request timeline
|
|
72
|
+
[flow with pass/fail markers]
|
|
73
|
+
|
|
74
|
+
## Root cause
|
|
75
|
+
[explanation with file:line evidence]
|
|
76
|
+
|
|
77
|
+
## Fix plan
|
|
78
|
+
| # | Service | Action | File | Complexity |
|
|
79
|
+
|---|---------|--------|------|------------|
|
|
80
|
+
|
|
81
|
+
## Regression prevention
|
|
82
|
+
- Test: [description]
|
|
83
|
+
- Monitoring: [alert/metric]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Ask: "Diagnostic posé. Dispatcher les fixes ?"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merge-prep
|
|
3
|
+
description: >
|
|
4
|
+
Prepare branches for merge after QA passes. Checks for conflicts between
|
|
5
|
+
teammate branches, generates PR summaries, lists review points.
|
|
6
|
+
Use after qa-ruthless passes, or when user says "merge", "PR", "pull request",
|
|
7
|
+
"prépare le merge", "merge-prep", "ready to merge".
|
|
8
|
+
argument-hint: "[feature-name]"
|
|
9
|
+
context: fork
|
|
10
|
+
disable-model-invocation: true
|
|
11
|
+
allowed-tools: Read, Write, Glob, Grep, Bash, Task
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Merge Prep — Pre-Merge Checklist
|
|
15
|
+
|
|
16
|
+
You prepare the merge. You do NOT merge. You produce a merge readiness report.
|
|
17
|
+
|
|
18
|
+
## Phase 1: Collect branch info
|
|
19
|
+
|
|
20
|
+
1. Read `./workspace.md` for the service map
|
|
21
|
+
2. Read `./plans/{feature-name}.md` for the active plan
|
|
22
|
+
3. For each service with status ✅, identify the feature branch name
|
|
23
|
+
|
|
24
|
+
## Phase 2: Conflict detection
|
|
25
|
+
|
|
26
|
+
For each service with status ✅:
|
|
27
|
+
- Run `git -C ../[repo] log --oneline [target]..HEAD` to list commits on the feature branch
|
|
28
|
+
- Run `git -C ../[repo] diff --name-only [target]...HEAD` to list modified files
|
|
29
|
+
- Run `git -C ../[repo] fetch origin && git -C ../[repo] merge-base --is-ancestor origin/[target] HEAD` to check if up-to-date
|
|
30
|
+
- Cross-check: do any two branches modify the same shared files (types, configs, schemas)?
|
|
31
|
+
- Report potential merge conflicts
|
|
32
|
+
|
|
33
|
+
For lightweight read-only cross-checks, spawn Explore subagents (Task, Haiku).
|
|
34
|
+
|
|
35
|
+
## Phase 3: PR summary generation
|
|
36
|
+
|
|
37
|
+
For each service, generate a PR summary:
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
### [service] — PR: feature/[name] → [target]
|
|
41
|
+
|
|
42
|
+
**Changes**: [N] files modified, [M] files created, [D] files deleted
|
|
43
|
+
|
|
44
|
+
**What changed**:
|
|
45
|
+
- [concise description of changes based on plan tasks]
|
|
46
|
+
|
|
47
|
+
**Key review points**:
|
|
48
|
+
- [specific areas that need human review attention]
|
|
49
|
+
- [any architectural decisions made during implementation]
|
|
50
|
+
- [constitution compliance notes]
|
|
51
|
+
|
|
52
|
+
**Tests**: [pass/fail status from QA]
|
|
53
|
+
|
|
54
|
+
**Dependencies**: [other PRs that must be merged first/after]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Phase 4: Merge order
|
|
58
|
+
|
|
59
|
+
Determine the correct merge order based on dependency waves:
|
|
60
|
+
1. Wave 1 services (API, data, auth) merge first
|
|
61
|
+
2. Wave 2 services (frontend) merge after wave 1 is on target branch
|
|
62
|
+
3. Wave 3 services (infra) merge last
|
|
63
|
+
|
|
64
|
+
## Output
|
|
65
|
+
|
|
66
|
+
Write to `./plans/{feature-name}.md`:
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
## Merge Prep — [DATE]
|
|
70
|
+
|
|
71
|
+
### Merge readiness
|
|
72
|
+
| Service | Branch | Up-to-date | Conflicts | Tests | Ready |
|
|
73
|
+
|---------|--------|-----------|-----------|-------|-------|
|
|
74
|
+
| [name] | feature/[x] | ✅/❌ | none/[list] | ✅/❌ | ✅/❌ |
|
|
75
|
+
|
|
76
|
+
### Merge order
|
|
77
|
+
1. [service] — [branch] → [target]
|
|
78
|
+
2. [service] — [branch] → [target]
|
|
79
|
+
|
|
80
|
+
### PR summaries
|
|
81
|
+
[per-service summaries]
|
|
82
|
+
|
|
83
|
+
### Blockers
|
|
84
|
+
[list or "none — ready to merge"]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Ask user: "Merge prep terminé. [N] services prêts. Procéder aux PRs ?"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-review
|
|
3
|
+
description: >
|
|
4
|
+
Quick sanity check on a plan before the user validates it. Verifies
|
|
5
|
+
structural completeness: all tasks have a service, waves respect
|
|
6
|
+
dependencies, API contract has concrete shapes, no orphan tasks.
|
|
7
|
+
Use when a plan was just written or user says "review plan", "vérifie le plan".
|
|
8
|
+
argument-hint: "[plan-name.md]"
|
|
9
|
+
context: fork
|
|
10
|
+
disable-model-invocation: true
|
|
11
|
+
model: haiku
|
|
12
|
+
allowed-tools: Read, Glob, Grep
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Plan Review — Sanity Check
|
|
16
|
+
|
|
17
|
+
You review a plan for structural completeness. You do NOT review code.
|
|
18
|
+
|
|
19
|
+
## Steps
|
|
20
|
+
|
|
21
|
+
1. Read the plan file from `./plans/`
|
|
22
|
+
2. Read `./workspace.md` for the service map
|
|
23
|
+
|
|
24
|
+
## Checklist
|
|
25
|
+
|
|
26
|
+
### Structure
|
|
27
|
+
- [ ] Every task has a service assigned
|
|
28
|
+
- [ ] Every impacted service has at least one task
|
|
29
|
+
- [ ] Wave assignments respect dependencies (producers before consumers)
|
|
30
|
+
- [ ] No service appears in two waves simultaneously
|
|
31
|
+
- [ ] One teammate per repo per wave — never two on the same repo
|
|
32
|
+
|
|
33
|
+
### Contracts
|
|
34
|
+
- [ ] API contract has concrete response shapes (not just `{}`)
|
|
35
|
+
- [ ] Field names and types are explicit
|
|
36
|
+
- [ ] Error response shapes are defined
|
|
37
|
+
- [ ] If frontend tasks exist, they reference the API contract
|
|
38
|
+
|
|
39
|
+
### Constitution compliance
|
|
40
|
+
- [ ] Multi-tenant scoping mentioned if data access is involved
|
|
41
|
+
- [ ] Test requirements mentioned per task
|
|
42
|
+
- [ ] Rollback strategy mentioned if migrations exist
|
|
43
|
+
- [ ] Feature flag mentioned if ClickHouse/irreversible changes exist
|
|
44
|
+
|
|
45
|
+
### Scale
|
|
46
|
+
- [ ] No single service has more than 15 tasks (risk of context overflow for teammate)
|
|
47
|
+
- [ ] Total plan size is under 500 lines (if larger, consider splitting into sub-plans)
|
|
48
|
+
- [ ] API contract shapes are concrete but not bloated (no full DB schemas)
|
|
49
|
+
- [ ] No duplicate tasks across waves (check for copy-paste from previous iterations)
|
|
50
|
+
- [ ] No near-identical task descriptions within the same service
|
|
51
|
+
|
|
52
|
+
### Completeness
|
|
53
|
+
- [ ] Context section explains the "why"
|
|
54
|
+
- [ ] Clarification answers are recorded (if clarify happened)
|
|
55
|
+
- [ ] Session log has at least a creation entry
|
|
56
|
+
|
|
57
|
+
## Output
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
## Plan Review — [PLAN NAME]
|
|
61
|
+
|
|
62
|
+
✅ Passed: [list]
|
|
63
|
+
⚠️ Warnings: [list]
|
|
64
|
+
❌ Failed: [list — these MUST be fixed before dispatch]
|
|
65
|
+
|
|
66
|
+
Recommendation: [APPROVE / FIX REQUIRED]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If all checks pass: "Plan looks solid. Ready for dispatch."
|
|
70
|
+
If critical issues: list them and suggest specific fixes.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qa-ruthless
|
|
3
|
+
description: >
|
|
4
|
+
Adversarial QA review after feature implementation. MUST find problems —
|
|
5
|
+
a clean report is a failed review. Executes tests, hunts dead code,
|
|
6
|
+
checks edge cases, validates UX standards compliance on frontend.
|
|
7
|
+
Use after dispatch-feature completes, or when user says "QA", "review",
|
|
8
|
+
"teste", "qualité", "qa ruthless", "cherche les bugs".
|
|
9
|
+
argument-hint: "[plan-name or 'all']"
|
|
10
|
+
context: fork
|
|
11
|
+
allowed-tools: Read, Write, Glob, Grep, Task, Teammate, SendMessage
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# QA Ruthless — Adversarial Quality Review
|
|
15
|
+
|
|
16
|
+
You are a hostile auditor. Your job is to FIND PROBLEMS.
|
|
17
|
+
A review with zero findings = YOU failed.
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
1. Read `./workspace.md` for repo paths
|
|
22
|
+
2. Read `./plans/{feature-name}.md` for what was implemented
|
|
23
|
+
3. Read `./constitution.md` (project-specific rules)
|
|
24
|
+
|
|
25
|
+
> **v4.0**: The constitution rule is scoped to orchestrator/ only.
|
|
26
|
+
> Teammates do NOT receive it automatically. You MUST include all 12 universal
|
|
27
|
+
> principles + project-specific rules in every QA teammate spawn prompt.
|
|
28
|
+
|
|
29
|
+
## Rules
|
|
30
|
+
|
|
31
|
+
1. You DO NOT fix. You report. Fixes are for teammates.
|
|
32
|
+
2. MINIMUM 3 findings per service reviewed. No exceptions.
|
|
33
|
+
3. Categories: 🔴 BUG, 🟡 SMELL, 🟠 DEAD CODE, 🔵 MISSING TEST, 🟣 UX VIOLATION, ⚪ NITPICK
|
|
34
|
+
4. You RUN tests — don't just read code.
|
|
35
|
+
5. You CHECK constitution compliance.
|
|
36
|
+
6. 🟣 UX violations are merge-blocking, same severity as 🔴 bugs.
|
|
37
|
+
|
|
38
|
+
## Spawn QA investigators (parallel teammates)
|
|
39
|
+
|
|
40
|
+
Spawn one teammate per service impacted. All run in parallel via Agent Teams.
|
|
41
|
+
|
|
42
|
+
### Backend/API QA teammate prompt
|
|
43
|
+
|
|
44
|
+
Include in spawn prompt: **full constitution (12 universal principles + project-specific rules)**, plan context, then these steps:
|
|
45
|
+
1. Run test suite — report pass/fail with details
|
|
46
|
+
2. Use the **LSP tool** (go-to-definition, find-references) to trace call chains
|
|
47
|
+
3. **Constitution check**: multi-tenant scoping, secrets, rollback, test coverage
|
|
48
|
+
4. **Code quality**: missing validation, missing auth checks, N+1, error handling, race conditions
|
|
49
|
+
5. **Dead code hunt**: unused imports, unreachable methods, abandoned feature flags
|
|
50
|
+
6. **Migration check** (if applicable): rollback, nullable defaults, indexes
|
|
51
|
+
7. Describe 3 adversarial test scenarios that SHOULD exist
|
|
52
|
+
8. Output format: tests status, constitution violations, findings (min 3), dead code, missing tests
|
|
53
|
+
|
|
54
|
+
### Frontend QA teammate prompt
|
|
55
|
+
|
|
56
|
+
Include in spawn prompt: **full constitution (12 universal principles + project-specific rules)**, plan context, UX standards, then these steps:
|
|
57
|
+
1. Run tests — report pass/fail
|
|
58
|
+
2. Use the **LSP tool** for tracing component dependencies and store usage
|
|
59
|
+
3. **UX audit** on every new/modified component: 4 states (skeleton not spinner, empty+CTA, error+retry, smooth success), responsive, a11y, interactions (debounce, optimistic, confirmation), forms (inline validation, error messages, preserve data)
|
|
60
|
+
4. **Constitution check**: data precision, feedback <200ms
|
|
61
|
+
5. **Code quality**: TypeScript `any`, unsafe `as`, infinite loops, XSS via v-html
|
|
62
|
+
6. **Dead code hunt**: unused components, store actions, composables, dead CSS
|
|
63
|
+
7. **API integration**: TS interfaces match API shapes? All error codes handled?
|
|
64
|
+
8. Describe 3 adversarial test scenarios
|
|
65
|
+
9. Output: tests, UX audit (🟣 violations), constitution, findings (min 3), dead code, missing tests
|
|
66
|
+
|
|
67
|
+
### Infra QA (lightweight Explore subagent via Task, Haiku)
|
|
68
|
+
|
|
69
|
+
Only if infra was impacted. Check: outdated images, missing resource limits,
|
|
70
|
+
config mismatches, deployment risks. Report inconsistencies.
|
|
71
|
+
|
|
72
|
+
## Consolidation
|
|
73
|
+
|
|
74
|
+
Write to `./plans/{feature-name}.md`:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
## QA Report — [DATE]
|
|
78
|
+
|
|
79
|
+
### Summary
|
|
80
|
+
- 🔴 Bugs: [n] | 🟡 Smells: [n] | 🟠 Dead code: [n]
|
|
81
|
+
- 🔵 Missing tests: [n] | 🟣 UX violations: [n] | ⚪ Nitpicks: [n]
|
|
82
|
+
|
|
83
|
+
### Critical (block merge)
|
|
84
|
+
[🔴 and 🟣 items]
|
|
85
|
+
|
|
86
|
+
### Should fix
|
|
87
|
+
[🟡 and 🟠 items]
|
|
88
|
+
|
|
89
|
+
### Recommended
|
|
90
|
+
[🔵 and ⚪ items]
|
|
91
|
+
|
|
92
|
+
### Dead code inventory
|
|
93
|
+
| File | What | Why dead |
|
|
94
|
+
|------|------|----------|
|
|
95
|
+
|
|
96
|
+
### Missing test scenarios
|
|
97
|
+
[list]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Ask user: "QA a trouvé [N] problèmes dont [M] bloquants. Dispatcher les fixes ?"
|
|
101
|
+
If yes, spawn teammates for 🔴, 🟣, and 🟡 items.
|
|
102
|
+
After fixes, re-run QA on fixed files only.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refresh-profiles
|
|
3
|
+
description: >
|
|
4
|
+
Regenerate service-profiles.md by reading CLAUDE.md from all repos
|
|
5
|
+
listed in workspace.md. Use when conventions changed, or user says
|
|
6
|
+
"refresh profiles", "mets à jour les profils", "relis les CLAUDE.md".
|
|
7
|
+
context: fork
|
|
8
|
+
disable-model-invocation: true
|
|
9
|
+
model: haiku
|
|
10
|
+
allowed-tools: Read, Write, Glob, Grep
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Refresh Service Profiles
|
|
14
|
+
|
|
15
|
+
1. Read `./workspace.md` to get the list of repos and their paths
|
|
16
|
+
2. For each repo listed, read its CLAUDE.md
|
|
17
|
+
3. Extract per repo: stack, patterns, auth, tests, conventions, special notes
|
|
18
|
+
4. Write result to `./plans/service-profiles.md`
|
|
19
|
+
5. Add today's date in the header
|
|
20
|
+
|
|
21
|
+
If a repo doesn't exist or has no CLAUDE.md, mark it as "[not found]".
|
|
22
|
+
Do NOT invent information — only extract what's explicitly stated.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Non-negotiable engineering principles for all agents, teammates, and subagents
|
|
3
|
+
globs: ["workspace.md", "constitution.md", "plans/**", "templates/**"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Constitution
|
|
7
|
+
|
|
8
|
+
Non-negotiable principles. Apply to ALL projects, ALL teammates.
|
|
9
|
+
The orchestrator and every teammate must follow these rules without exception.
|
|
10
|
+
|
|
11
|
+
## Security & data
|
|
12
|
+
|
|
13
|
+
1. **Multi-tenancy is sacred.** No query may return data from one tenant to
|
|
14
|
+
another. Every query, endpoint, and view is scoped by tenant. When in doubt,
|
|
15
|
+
the teammate refuses to implement and escalates to the orchestrator.
|
|
16
|
+
|
|
17
|
+
2. **No hardcoded secrets.** Zero passwords, API keys, or tokens in code.
|
|
18
|
+
Everything goes through environment variables.
|
|
19
|
+
|
|
20
|
+
3. **Rollback always possible.** Every migration is reversible. Every deployment
|
|
21
|
+
can be rolled back. If a feature cannot be rolled back, it must be behind
|
|
22
|
+
a feature flag.
|
|
23
|
+
|
|
24
|
+
## UX & quality
|
|
25
|
+
|
|
26
|
+
4. **Feedback under 200ms.** Every user action triggers immediate visual feedback
|
|
27
|
+
(spinner, skeleton, optimistic update). The user must never doubt their click
|
|
28
|
+
was registered.
|
|
29
|
+
|
|
30
|
+
5. **4 mandatory states.** Every component that displays data must handle:
|
|
31
|
+
loading, empty, error, success. No blank screens, ever.
|
|
32
|
+
|
|
33
|
+
6. **Mobile-first.** Responsive is not a nice-to-have. Design for mobile first,
|
|
34
|
+
then enrich for desktop.
|
|
35
|
+
|
|
36
|
+
7. **Simple and solid beats complex and fragile.** A simple feature that works
|
|
37
|
+
perfectly is worth more than a complete feature that breaks. Cut scope rather
|
|
38
|
+
than ship fragile code.
|
|
39
|
+
|
|
40
|
+
## Code & architecture
|
|
41
|
+
|
|
42
|
+
8. **No dead code.** Every implementation cleans up what it makes obsolete.
|
|
43
|
+
Dead code is debt that accumulates silently.
|
|
44
|
+
|
|
45
|
+
9. **No feature without tests.** Every new behavior has at minimum one test
|
|
46
|
+
proving it works and one test proving it handles errors.
|
|
47
|
+
|
|
48
|
+
10. **Consistency over preference.** Follow existing patterns in the repo, even
|
|
49
|
+
if you'd prefer to do it differently. Codebase uniformity matters more than
|
|
50
|
+
local elegance.
|
|
51
|
+
|
|
52
|
+
## Process
|
|
53
|
+
|
|
54
|
+
11. **Plan before coding.** No teammate starts without a validated plan. The plan
|
|
55
|
+
is written in markdown, tracked, and survives sessions.
|
|
56
|
+
|
|
57
|
+
12. **QA is hostile.** A QA that finds nothing has failed. Complacency is the
|
|
58
|
+
enemy of quality.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
> **v4.0 change**: This rule is now scoped to orchestrator/ files only.
|
|
63
|
+
> It is no longer auto-injected into ALL sessions globally.
|
|
64
|
+
>
|
|
65
|
+
> Consequence: teammates do NOT receive these principles automatically.
|
|
66
|
+
> The orchestrator MUST include all 12 universal principles + project rules
|
|
67
|
+
> in every teammate spawn prompt.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Proactive context management to prevent pollution and slowdown. Applies to the orchestrator session (not to teammates — they manage their own context).
|
|
3
|
+
globs: ["workspace.md", "plans/**", "constitution.md", "templates/**"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Hygiene
|
|
7
|
+
|
|
8
|
+
> These rules target the **orchestrator** session. Teammates manage their own context
|
|
9
|
+
> independently. If you are a teammate reading this, you can ignore these rules.
|
|
10
|
+
|
|
11
|
+
## After each teammate report
|
|
12
|
+
- Summarize the report in 3 lines max in the markdown plan
|
|
13
|
+
- Do NOT keep code details in your context
|
|
14
|
+
- Only status (✅/❌) and critical findings persist
|
|
15
|
+
|
|
16
|
+
## Response limits
|
|
17
|
+
- No code in repos — delegate repo code to teammates
|
|
18
|
+
- Writing in orchestrator/ (plans, workspace.md, constitution.md) is allowed and expected
|
|
19
|
+
- Teammate results: summarize to status + files + problems, then compact
|
|
20
|
+
|
|
21
|
+
## Compaction
|
|
22
|
+
- Context compaction triggers automatically (Opus 4.6 adaptive)
|
|
23
|
+
- Additionally, compact manually after each full cycle
|
|
24
|
+
(plan → teammates → collect → QA)
|
|
25
|
+
- Also compact when responses visibly slow down
|
|
26
|
+
|
|
27
|
+
## Triggers for /clear
|
|
28
|
+
- Switching to a completely different feature/epic
|
|
29
|
+
- After merging a completed feature
|
|
30
|
+
- Start of day / new work session
|
|
31
|
+
|
|
32
|
+
## Monitoring
|
|
33
|
+
- The `SessionStart` hook automatically injects active plan context
|
|
34
|
+
at startup or after a `/clear`
|
|
35
|
+
- If a config issue is suspected, use `/hooks` to inspect
|
|
36
|
+
|
|
37
|
+
## Context compaction (Opus 4.6)
|
|
38
|
+
- Opus 4.6 supports native context compaction — the model can summarize
|
|
39
|
+
its own context to continue longer-running tasks without hitting limits
|
|
40
|
+
- The 1M context window (beta) is available but token-intensive.
|
|
41
|
+
Disable with `CLAUDE_CODE_DISABLE_1M_CONTEXT=1` if cost is a concern
|
|
42
|
+
- For orchestration sessions, prefer compact-after-cycle over 1M context:
|
|
43
|
+
smaller context = faster responses = cheaper
|