diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e8a20..92f69dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,338 @@ Format follows [Keep a Changelog](https://keepachangelog.com/). ## [Unreleased] +## [3.2.1] — 2026-04-07 + +### Fixed +- `agents/plugin-advisor.md`: 4 signals had entries in the signal table but no conditional rule — added rules for `skill-creation`, `browser-qa`, `design-system`, and `complex-arch` + +### Changed +- `version.txt`: 3.2.0 → 3.2.1 + +## [3.2.0] — 2026-04-07 + +### Fixed +- `doctor.sh`: EXPECTED_SKILLS pass message uses `${#EXPECTED_SKILLS[@]}` (dynamic count) instead of hardcoded 9 +- `agents/plugin-advisor.md`: `setup.py` and `pyproject.toml` added as counterindicators for embedded signal — prevents Python C-extensions from false-triggering embedded +- `agents/status-reporter.md`: PHP phpunit added to manifest fallback (`composer.json` → `./vendor/bin/phpunit`) +- `skills/health/SKILL.md`: post-result guidance added — CRITICAL/WARNING/errors/warnings/all-pass handling + +### Added +- `USAGE.md`: "Erreurs fréquentes" — embedded signal not detected entry + +### Changed +- `version.txt`: 3.1.0 → 3.2.0 + +## [3.1.0] — 2026-04-07 + +### Fixed +- `agents/plugin-advisor.md`: `Makefile` restored as embedded indicator — `Makefile` + `src/*.c` + no Node/Rust/Go manifest = embedded; `.c` files alone still not sufficient (Rust FFI counterindicated) +- `agents/onboarder.md`: PHASE 6 — check `command -v gsd` before generating ROADMAP.md; if absent, ROADMAP.md still generated with install instructions; same pattern as init-project STEP 13 + +### Added +- `doctor.sh`: expected skills check — verifies all 9 skills (analyze, health, init-project, onboard, plugin-check, readme, refactor, ship-feature, status) present in `~/.claude/skills/` +- `skills/analyze/SKILL.md`: description updated to mention DEBUG mode (read-only analysis OR error/stack trace → DEBUG mode) +- `USAGE.md`: token cost estimates on workflow patterns (Pattern A ~3000-5000t, B ~1500-2500t/session, D ~500-800t, E ~600-900t); budget note at top of Patterns section + +### Changed +- `version.txt`: 3.0.0 → 3.1.0 + +## [3.0.0] — 2026-04-07 + +### Fixed +- `agents/plugin-advisor.md`: embedded false positive removed — `src/*.c` alone no longer triggers embedded signal (Rust FFI projects have .c files); only `platformio.ini` or `*.ld`/`*.lds` linker scripts are reliable triggers +- `agents/status-reporter.md`: flat awk scoped to `## Milestone` headings — no longer matches `## Prerequisites`, `## Notes`, or other non-milestone `##` headings in ROADMAP.md + +### Added +- `agents/status-reporter.md`: Go test runner in manifest fallback (`go.mod` → "go test ./...") +- `USAGE.md`: GSD v2 active/interrupted node in decision tree — /gsd auto, /gsd steer, /gsd forensics +- `skills/analyze/SKILL.md`: argument-hint updated to mention DEBUG mode (pass error/stack trace) + +### Breaking +- `agents/plugin-advisor.md`: embedded detection no longer triggers on C/C++ files alone — projects relying on .c file detection must add `platformio.ini` or a `*.ld` linker script + +### Changed +- `version.txt`: 2.9.0 → 3.0.0 + +## [2.9.0] — 2026-04-07 + +### Fixed +- `agents/plugin-advisor.md`: PHASE 1 — filesystem embedded detection added (platformio.ini, *.ld linker scripts, src/*.c without package.json/Dockerfile); signal description updated +- `agents/status-reporter.md`: PHASE 3 — flat ROADMAP fallback awk command for milestones with tasks directly under ## (no ### slices); marked with "(flat)" in output +- `agents/status-reporter.md`: pytest cache parsing — JSON `{}` = "all passing" instead of "0 failing"; uses python3 for proper JSON parse instead of `cat | head` + +### Added +- `USAGE.md`: analyze → refactor → analyze cycle documented in decision tree (refactoring profond) +- `README.md`: link to USAGE.md in intro section + +### Changed +- `version.txt`: 2.8.0 → 2.9.0 + +## [2.8.0] — 2026-04-07 + +### Fixed +- `agents/status-reporter.md`: awk milestone detection uses `index()` instead of regex negation — portable across macOS nawk and GNU awk +- `agents/status-reporter.md`: Tests field fallback improved — shows "run '' to check" when no result found but test manifest exists; shows "N/A" only when no test infrastructure at all + +### Added +- `agents/plugin-advisor.md`: `embedded` signal added — firmware/bare-metal/microcontroller detection; DECISION TABLE row; conditional rule disabling all toggles, superpowers optional +- `doctor.sh`: agents pass message now lists all 8 agent names inline for quick visual confirmation +- `USAGE.md`: section "Quel skill utiliser ?" — decision tree for all 9 skills with quick-reference table +- `README.md`: `/status` added to Maintenance Diagnostic section alongside `/health` + +### Changed +- `version.txt`: 2.7.0 → 2.8.0 + +## [2.7.0] — 2026-04-07 + +### Fixed +- `agents/status-reporter.md`: milestone detection algorithm — uses `awk` to find first `##` heading with pending `###` slices (top-to-bottom scan), not `tail -5` of all `##` headings +- `skills/ship-feature/SKILL.md`: `git log` now uses `--format="%h %<(50,trunc)%s"` to truncate long commit messages at 50 chars + +### Added +- `agents/status-reporter.md`: PHASE 2 — best-effort build/test status check (pytest cache, Jest coverage, log files); `Tests` field in output +- `doctor.sh`: `check_symlink "lib"` added; `_EXPECTED_LINKS` updated 6 → 7 +- `agents/plugin-advisor.md`: `skill-creation` signal added to PHASE 2; WARN rule if skill-creator active without skill-creation signal +- `USAGE.md`: Exemple 9 — firmware C/C++ STM32, workflow minimaliste sans superpowers ni GSD + +### Changed +- `version.txt`: 2.6.0 → 2.7.0 + +## [2.6.0] — 2026-04-07 + +### Fixed +- `agents/status-reporter.md`: PHASE 3 now counts slices (### headings) not tasks (- [ ]) — correct progress metric matching GSD v2 dashboard +- `hooks/session-start.sh`: continuation line uses 13-space prefix (verified 60 bytes) for consistent box alignment +- `agents/onboarder.md`: PHASE 5b clarifies .gitignore target path per mode (A=workspace root, B=PACKAGE_ROOT, C=per-package) + +### Added +- `skills/ship-feature/SKILL.md`: STEP 0b now prints PROJECT CONTEXT header when CLAUDE.md found — project name, stack, current branch, last 3 commits, GSD milestone +- `USAGE.md`: Exemple 8 — full session resume workflow with /status + GSD v2 step mode + /gsd discuss + +### Changed +- `version.txt`: 2.5.0 → 2.6.0 + +## [2.5.0] — 2026-04-07 + +### Fixed +- `skills/init-project/SKILL.md`: STEP 1 — checks both `CLAUDE.md` and `.claude/CLAUDE.md`; pre-fills interview from either location +- `agents/status-reporter.md`: PHASE 3 GSD — replaced fragile `STATUS.md` read with robust ROADMAP.md checkbox parsing; handles missing ROADMAP.md; never reads binary `state.db` +- `agents/onboarder.md`: PHASE 5b added — .gitignore safety check; appends `.claude/settings.local.json` to existing .gitignore or creates minimal one; applies to all monorepo options + +### Added +- `doctor.sh`: expected agents check in Consistency section — warns if any of 8 expected `.md` agent files are missing from `~/.claude/agents/` +- `README.md` + `USAGE.md`: `/status` added to Pattern B (multi-session) and Pattern C (onboarding) workflows +- `hooks/session-start.sh`: 2-line display for >4 active/inactive plugins — all plugin names shown, split at 4 per line + +### Changed +- `version.txt`: 2.4.0 → 2.5.0 + +## [2.4.0] — 2026-04-07 + +### Fixed +- `skills/init-project/SKILL.md`: STEP 1 — reads existing CLAUDE.md if present; pre-fills interview answers already documented; asks only genuinely missing fields +- `agents/onboarder.md`: Option B fully implemented — explicit PACKAGE_ROOT scoping; all PHASE 3-5 paths relative to selected package; no root CLAUDE.md generated +- `agents/plugin-advisor.md`: upstream monorepo detection in PHASE 1 — checks `../turbo.json`, `../pnpm-workspace.yaml`, `../../turbo.json` for sub-package context; signal table updated to describe upstream detection + +### Added +- `agents/status-reporter.md` + `skills/status/SKILL.md`: new `/status` skill — consolidated read-only snapshot (plugins + token cost + git state + recent commits + GSD v2 milestone) +- `USAGE.md`: section "Erreurs fréquentes" — quick-reference table of 14 common errors with causes and solutions +- `doctor.sh`: symlink counter — reports `N/6 OK` after symlink checks +- `hooks/session-start.sh`: `+N more` display — shows first 2 active/inactive plugins + count of remaining instead of truncated string +- `README.md`: /status added to skill table and file tree + +### Changed +- `version.txt`: 2.3.0 → 2.4.0 + +## [2.3.0] — 2026-04-07 + +### Fixed +- `skills/ship-feature/SKILL.md`: STEP 0b added — checks for CLAUDE.md before starting; blocks with `/onboard` instruction if missing +- `skills/ship-feature/SKILL.md`: STEP 4b option B enhanced — scans remaining tasks for dependents before skipping a failed task; prompts to skip dependent tasks too +- `agents/onboarder.md`: Option C (sequential monorepo onboarding) fully implemented — iterates all packages, generates per-package CLAUDE.md + settings + .claudeignore, summary table, optional root ROADMAP.md +- `agents/plugin-advisor.md`: `monorepo` signal added to PHASE 1 detection (turbo.json, pnpm-workspace, nx.json), PHASE 2 signal table, DECISION TABLE, and conditional rules — recommends plugins per-package, not for the whole repo +- `doctor.sh`: `check_symlink "templates"` added — detects missing templates/ symlink (pre-v2.0.0 installations) +- `hooks/session-start.sh`: ACTIVE_STR and INACTIVE_STR truncated to 37 chars + `…` indicator when overflow detected + +### Added +- `USAGE.md`: Exemple 7 — refactoring module Python legacy; full `/analyze` → `/refactor` → `/analyze` cycle; shows report-before-modify behavior and test-first recommendation + +### Changed +- `version.txt`: 2.2.0 → 2.3.0 + +## [2.2.0] — 2026-04-07 + +### Fixed (bugs identified via case study simulation) +- `skills/init-project/SKILL.md`: STEP 13 — guard `command -v gsd` before running `gsd init`; prints install instructions if GSD v2 not in PATH instead of failing silently +- `skills/ship-feature/SKILL.md`: STEP 4b added — structured error recovery when a subagent fails (build error, failing test, type error); DEBUG mode analysis + user gate before any fix; max 2 retry attempts; never auto-patches +- `agents/onboarder.md`: monorepo detection added (PHASE 1) — detects `apps/`, `packages/`, `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json`; interactive gate (onboard whole workspace / single package / each separately) +- `agents/plugin-advisor.md`: `mobile` signal added to PHASE 2 signal table + DECISION TABLE + conditional rules — React Native / Expo / Flutter explicitly handled; gstack disabled for mobile, Docker N/A +- `doctor.sh`: GStack `skills/` subdirectory check added after symlink verification — warns if GStack is symlinked but has no skills (needs `./setup`) +- `hooks/session-start.sh`: TOKEN_WARN truncated to 44 chars to prevent box overflow with emoji width + +### Added +- `USAGE.md`: Exemple 6 — CLI Rust from scratch; illustrates minimal workflow (superpowers only, no frontend plugins, cargo check as verify, no GSD v2) + +### Changed +- `version.txt`: 2.1.0 → 2.2.0 + +## [2.1.0] — 2026-04-07 + +### Added +- `agents/scaffolder.md`: React Native/Expo + Flutter support — PHASE 0 (Docker exclusion), PHASE 3 (stack templates), PHASE 4 (install commands), PHASE 5 (verify commands per stack) +- `agents/analyzer.md`: DEBUG MODE section — structured error diagnosis with root cause hypotheses, trace, and affected files +- `agents/onboarder.md`: new agent — onboard existing projects (discovery → interview → CLAUDE.md + settings + .claudeignore + optional GSD v2 ROADMAP) +- `skills/onboard/SKILL.md`: new skill `/onboard` invoking the onboarder agent +- `skills/init-project/SKILL.md`: STEP 13 (optional) — propose GSD v2 init at end of init-project when multi-session signal detected +- `Makefile`: `make onboard` target +- `README.md`: Workflow patterns section (5 patterns: new short, new long, onboarding, hotfix, refactor); /onboard in skill table and tree; make onboard in maintenance + +### Fixed +- `agents/plugin-advisor.md`: "Next.js + context7 not configured" moved from BLOCK → WARN with force option — Context7 requires manual API key, should not hard-block project start +- `lib/detect-plugins.sh`: `detect_ruflo()` now uses 3-level fallback (npm binary → MCP config grep + ruvnet/claude-flow variants → `claude mcp list`) +- `hooks/session-start.sh`: passive token cost estimate added to session display — warns at >25%, alerts at >50% of Pro session budget + +### Changed +- `version.txt`: 2.0.0 → 2.1.0 + +## [2.0.0] — 2026-04-06 + +### Breaking +- GSD v1 (`glittercowboy/get-shit-done-cc`) removed entirely +- GSD v1 commands (`/gsd:discuss-phase`, `/gsd:plan-phase`, `/gsd:execute-phase`, `/gsd:ship`, `/gsd:next`) no longer available — these were Claude Code slash commands; they do not exist in v2 +- GSD v2 (`gsd-pi`) is a standalone CLI (Pi SDK), not a Claude Code plugin — usage model is entirely different + +### Added +- **GSD v2 integration** (`gsd-build/gsd-2`, npm: `gsd-pi` 2.64.0) — standalone CLI with autonomous mode (`/gsd auto`), state machine per-task execution, crash recovery, cost tracking, parallel workers, worktree isolation +- **Ruflo plugin** (`ruvnet/ruflo`, npm: `ruflo` 3.5.58) — enterprise multi-agent MCP server (formerly claude-flow), 310+ tools, 100+ agent types, WASM kernel; 🔄 TOGGLE, ~500-1500t passive +- **Full plugin compatibility matrix** in `agents/plugin-advisor.md` — all 12 plugins analyzed pairwise, conditional rules, recommended sets by project type +- **Ruflo auto-detection** in `lib/detect-plugins.sh`, `doctor.sh`, `hooks/session-start.sh` +- **GSD v2 CLI status** in `session-start.sh` — dedicated `🖥️ CLI` line (separate from CC plugin toggles) +- **8 new deny rules** in `settings.json`: `source /dev/stdin`, `mkfifo *`, `python3 -c *`, `node -e *`, `xargs * .env*`, `tar * .env*`, `zip * .env*`, `base64 .env*` — covers runtime secret access and exfiltration vectors +- **`disableAutoMode: "disable"`** added to global `settings.json` # TODO: VERIFY syntax in CC v2.1.89 +- **`templates/` symlink** in `link.sh` — `~/.claude/templates/` now resolves correctly for scaffolder and init-project +- **Token budget breakdown** in `doctor.sh` — CLAUDE.md + skill descriptions + plugin passive cost, thresholds vs Pro session budget (~11k tokens/5h) +- **GStack pinning warning** in `doctor.sh` and `update-all.sh` (confirmation prompt before `--remote` update) +- **GStack false-positive fix** in `doctor.sh` — submodule check now requires `.git` presence, not just directory existence +- Ruflo install instructions in `install-plugins.sh` (Step 5, manual — enterprise tool) +- Ruflo update step in `update-all.sh` +- GSD v2 update step in `update-all.sh` + +### Changed +- `plugins.lock.json`: GSD v1 (`npm:get-shit-done-cc`) → GSD v2 (`npm:gsd-pi` 2.64.0); ruflo (`npm:ruflo` 3.5.58) added +- `install-plugins.sh`: STEP 4 GSD v2 (`npm install -g gsd-pi`), STEP 5 ruflo (manual instructions), steps renumbered 6-7 +- `lib/detect-plugins.sh`: `detect_gsd()` now checks `command -v gsd` (not `~/.claude/skills/` grep); `detect_ruflo()` added +- `doctor.sh`: GSD v2 check, ruflo check, GStack false-positive fix, GStack pinning warning, EXPECTED_DENY 92→100, token budget Pro-aware with breakdown, `readlink -f` portability fix +- `hooks/session-start.sh`: GSD v2 removed from toggle loop → dedicated `🖥️ CLI` line; ruflo added to toggle loop +- `update-all.sh`: GStack confirmation prompt, GSD v2 update step, ruflo update step, steps renumbered 1-7 +- `agents/plugin-advisor.md`: complete rewrite — PHASE 1 detection (GSD v2, ruflo), PHASE 2 signal table, full compatibility matrix, conditional rules, recommended sets by project type, WARN/BLOCK updated +- `link.sh`: `templates/` added to symlink loop +- `settings.json`: 92→100 deny rules, `disableAutoMode` added +- `README.md`: comprehensive update — GSD v2 full usage guide, ruflo install/usage, plugin compatibility matrix section, updated plugin table (GSD v2 as CLI, ruflo as TOGGLE), version pinning examples, troubleshooting entries for GSD v2 and ruflo, Known Limitations updated +- `version.txt`: 1.0.4 → 2.0.0 + +### Fixed +- `link.sh`: `templates/` not symlinked — scaffolder and init-project now find `~/.claude/templates/project-CLAUDE.md` +- `doctor.sh`: GStack submodule check was a false positive when directory existed but submodule was uninitialised +- `doctor.sh`: `readlink -f` fallback made explicit for BSD macOS compatibility +- `doctor.sh`: token budget used incorrect "~8000 tokens" reference — now uses Pro session budget (~11k) +- `doctor.sh`: EXPECTED_DENY hardcoded at 92 — updated to 100 after new deny rules +- `update-all.sh`: GStack update had no confirmation prompt — added; GStack step structure had mismatched `if/fi` +- `agents/plugin-advisor.md`: GSD detection used `ls ~/.claude/skills/ | grep gsd` — broken for v2 (CLI not a skill) +- `hooks/session-start.sh`: GSD v2 (standalone CLI) was in the CC plugin toggle loop — incorrect, moved to dedicated CLI line + +## [1.0.4] — 2026-04-05 + +### Fixed +- `skills/*/SKILL.md`: agent paths changed from `.claude/agents/` to `$HOME/.claude/agents/` — unambiguous user-scope resolution regardless of working directory +- `hooks/session-start.sh`: `CONFIG_VERSION` now displayed in session-start box (was computed but never shown) +- `settings.json` + templates: removed non-standard `_readme` key (silently ignored by Claude Code but triggers schema warnings) +- `agents/plugin-advisor.md`: RTK detection re-added in PHASE 1 (was removed in v1.0.3 compression) +- `skills/health/SKILL.md`: fallback command simplified — removed 3-level quote nesting +- `install-plugins.sh`: removed duplicate "→ Restart Claude Code" line + +### Changed +- README: Superpowers command table now shows actual skill names (`superpowers:brainstorming`, `superpowers:writing-plans`, `superpowers:subagent-driven-development`, etc.) +- README: install step 6 — replaced `/reload-plugins` (nonexistent command) with "Restart Claude Code — plugins load automatically" +- README: Context7 API key URL corrected from `context7.com` to `upstash.com` +- README: Known Limitations — clarified agent frontmatter fields ARE enforced in v2.1.x; added `disableAutoMode` note +- README: Makefile command list in Maintenance section now includes `make new-skill` +- `lib/detect-plugins.sh`: `detect_context7()` no longer spawns `claude` CLI — reads `~/.claude.json` and `~/.mcp.json` directly (no subprocess overhead at session start) + +## [1.0.3] — 2026-04-05 + +### Token savings (~57% reduction across agents/skills) +- `CLAUDE.md`: 1414t → 418t (-70%) — rewritten as dense rule list, no prose padding +- `agents/plugin-advisor.md`: 1251t → 536t (-57%) — DECISION MATRIX removed (duplicated THRESHOLDS), output template compressed +- `agents/interviewer.md`: 1088t → 438t (-60%) — PROJECT BRIEF ASCII art → compact YAML-style, question groups flattened +- `agents/readme-updater.md`: 2224t → 792t (-64%) — Docker detection unified to one block, template skeleton condensed, phases as tight checklists +- `agents/scaffolder.md`: 2402t → 1041t (-57%) — Dockerfile/compose templates replaced by 3-line descriptions, Phase 0 compressed +- `skills/init-project/SKILL.md`: 2452t → 915t (-63%) — AGENTS LOADED section removed, each STEP condensed to 2-4 lines +- `skills/ship-feature/SKILL.md`: 1236t → 537t (-57%) — same treatment as init-project + +### Changed behavior +- `agents/interviewer.md`: if prompt already contains name + purpose + stack + features + architecture → generate BRIEF directly, no questions asked +- `agents/readme-updater.md`: Docker detection defined once at top, referenced in all modes (no duplication) +- `hooks/session-start.sh`: always-on plugins (security-guidance, rtk, superpowers) now explicitly shown in session start display +- `skills/health/SKILL.md`: fallback path when `~/.claude/doctor.sh` not found (follows CLAUDE.md symlink to locate repo) +- `skills/plugin-check/SKILL.md`: argument-hint now shows concrete example + +### Added +- `Makefile`: `make new-skill name=` — scaffolds agent + skill files from template in one command +- `templates/project-CLAUDE.md`: inline examples per section (FastAPI-based) — usable without /init-project +- README: bundled skills section (`/batch`, `/debug`, `/simplify`) +- README: accurate progressive loading explanation (description only at startup, body on-demand) +- `link.sh`: idempotent — reports "already up to date" or count of updated symlinks + +## [1.0.2] — 2026-04-04 + +### Security +- `Bash(git add .env*)` and `Bash(git add **/.env*)` added to deny — prevents staging secrets +- `Bash(cp **/id_rsa*)`, `Bash(cp **/id_ed25519*)`, `Bash(cp **/.ssh/*)` added to deny — closes SSH key copy bypass +- `deny` total: 87 → 92 rules +- `npx *` moved from allow to ask in project template settings — arbitrary npm package execution now requires confirmation +- `docker stop *` and `docker rm *` moved from allow to ask in project template settings + +### Changed +- `skill-creator` and `pr-review-toolkit` reclassified from ALWAYS ON to TOGGLE — saves ~400 tokens/session by default +- `agents/scaffolder.md`: removed Go, PHP/WordPress, Flutter/Dart stack templates (unused) +- `CLAUDE.md`: STRICT MODE section removed — rules inlined into `skills/init-project/SKILL.md` and `skills/ship-feature/SKILL.md` where they apply, reducing global context weight +- `CLAUDE.md`: FAIL FAST MODE cleaned up (removed contradictory "override all" claim) +- `agents/readme-updater.md`: mode detection changed from substring match to exact first-word match — `/readme update X` no longer silently triggers SYNC mode +- `templates/settings/SETTINGS.md`: stripped sections duplicating README (precedence table, what-goes-where) — 132 → 58 lines +- `plugins.lock.json`: removed unused `install_cmd` and `node` fields +- README: GStack 14-command table collapsed to a single reference line +- README: plugin table updated to reflect new toggle status + +### Fixed +- `install-plugins.sh`: GStack `./setup` now runs in subshell with existence+executable guard (same fix as update-all.sh) +- `install-plugins.sh`: log setup guarded against read-only filesystem — no longer crashes before output +- `install-plugins.sh`: `rtk init -g` now skipped if RTK hook already present in settings.json +- `doctor.sh`: CRLF detection ported from `grep -qP` (Linux-only) to `grep -c $'\r'` (portable macOS/Linux) +- `doctor.sh`: token budget breakdown now lists top consumers per file when estimate exceeds 2000 tokens +- `lib/detect-plugins.sh`: removed three never-called functions (`detect_security_guidance`, `detect_skill_creator`, `detect_pr_review_toolkit`) +- `hooks/session-start.sh`: removed unreachable inline fallback — replaced with clean exit message + +## [1.0.1] — 2026-04-03 + +### Security +- `env` and `printenv *` moved from allow to deny — blocks secret exposure via process environment +- `export *` added to deny — prevents environment variable injection +- `cp .env*`, `cp **/.env*`, `mv .env*`, `mv **/.env*` added to deny — closes copy-then-read bypass on secret files +- `cp **/secrets/*`, `mv **/secrets/*` added to deny — extends secret move protection to secrets/ directory +- `sed *` moved from allow to ask — all sed (including in-place `-i`) now requires confirmation +- `sed -i *` and `sed -i'' *` removed from ask (consolidated into `sed *`) + +### Changed +- `git stash*` (broad allow) split into safe variants in allow (`git stash`, `push*`, `list*`, `show*`) and destructive variants in ask (`pop*`, `drop*`, `clear`) +- `doctor.sh` token budget estimate now uses full skill/agent file sizes instead of description-only char count — produces accurate token estimates (~4 chars/token) +- `doctor.sh` deny rule count now checks against expected value (87) and warns on mismatch +- `doctor.sh` python3 one-liner wrapped in `|| echo "?"` — diagnosis no longer crashes on missing python3 + +### Fixed +- `update-all.sh` GStack `./setup` now runs in a subshell — upstream setup failure no longer crashes the update script mid-execution under `set -euo pipefail` +- `update-all.sh` guards `./setup` existence and executable bit before invoking it + ## [1.0.0] — 2025-04-03 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index 640616a..92c2725 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,159 +1,58 @@ # Global coding preferences -Apply these preferences across all projects unless repository-specific -instructions override them. +Apply unless repo-specific instructions override. -## General philosophy +## Code style -I prefer clean, readable, maintainable code with strong structural discipline, -inspired by 42-style constraints but adapted pragmatically to each language, -framework, and project. +- Simple, readable, maintainable > clever or compact. +- One responsibility per function/method. +- Preserve existing behavior unless asked otherwise. +- Scope changes to the task. No unrelated edits. -These rules are important, but they are not absolute dogma: -- apply them by default -- report clearly when code does not follow them -- if a deviation is justified, keep it and explain why -- if a deviation is not clearly justified, ask whether it should be kept or fixed +## Limits (adapt to language) -## Design principles +- Max 25 lines of logic per function (excl. comments, error handling). +- Max 80 chars/line. +- Max 5 params per function → group into a struct/object if more needed. +- Max 5 local vars per function → split or extract. +- No global state. Prefer explicit data flow. -- Prefer simple, readable, maintainable code over clever or overly compact code. -- Each function, method, or equivalent unit should have one clear responsibility. -- Preserve existing behavior unless explicitly asked to change it. -- Avoid unrelated changes during a fix or refactor. -- Keep modifications scoped and intentional. +## Comments -## Function and method size - -- Prefer keeping the core logic of a function or method within 25 useful lines. -- Empty lines do not count toward this limit. -- Multi-line wrapped statements count as one logical instruction for this rule. -- Error handling may extend the total size when necessary, but the main logic - should remain compact and easy to understand. -- If a unit becomes too large, split it into small helpers. -- Use private/internal/file-local helpers when the language supports them. - -## Line length - -- Prefer a maximum of 80 characters per line when reasonably possible. -- If a line is too long, split it cleanly for readability. -- Long calls, conditions, and expressions should be formatted clearly. - -## Parameters - -- Prefer no more than 5 parameters per function or method. -- If more inputs are needed, group them into a meaningful structure adapted - to the language, such as an object, record, struct, dataclass, DTO, - config object, or equivalent. - -## Local variables - -- Prefer no more than 5 local variables per function or method. -- If more local state is needed, consider: - - splitting the logic - - extracting a helper - - introducing a dedicated small structure adapted to the language - -## Shared and global state - -- Global state is discouraged. -- Prefer explicit data flow through parameters, return values, objects, - context structures, dependency injection, or another justified mechanism. -- If shared or global state is used, mention it explicitly and justify it. - -## Comments and documentation - -- Functions and methods should be documented when their purpose, parameters, - return value, or intent are not immediately obvious. -- The comment should help explain intent and usage, not restate the code line by line. -- Apply the documentation style that fits the language and project conventions - (docstring, block comment, JSDoc, Doxygen, XML docs, etc.). -- Internal/private helpers are not exempt if their role is unclear. +- Document purpose/intent when not obvious. Not line-by-line restating. +- Use the project's doc style (docstring, JSDoc, Doxygen, etc.). ## Readability -- Use explicit, consistent, and meaningful names. -- Prefer straightforward control flow. -- Simplify or extract complex conditions. -- Avoid hidden side effects unless clearly necessary. -- Prefer code that is easy to review, test, and modify. +- Explicit, consistent, meaningful names. +- Straight control flow. Extract complex conditions. +- No hidden side effects. -## Refactoring and modifications +## Refactoring -- During refactoring, prioritize: - 1. safety - 2. readability - 3. consistency with the project -- Keep behavior unchanged unless explicitly asked otherwise. -- After modifying a function, feature, or behavior, verify that no residue from - the previous implementation remains. -- Remove obsolete code, dead branches, unused helpers, stale flags, outdated - comments, legacy conditions, and old-version leftovers when they are no longer needed. -- If something from the previous implementation is intentionally retained, - explain why. +- Priority: safety → readability → consistency. +- Remove dead code, obsolete comments, stale flags after changes. +- After modifying behavior: verify no old residue remains. -## Handling deviations from the standard +## Deviations -- Treat these rules as strong preferences, not rigid mechanical laws. -- If existing code is outside the standard, report it clearly. -- If the deviation is minor and acceptable, mention it briefly. -- If the deviation is significant and not obviously justified, ask whether to: - - keep the deviation - - or refactor toward compliance -- If a deviation is clearly justified by language constraints, framework style, - performance needs, safety requirements, or project architecture, keep it and explain it. +- Report deviations from the above clearly. +- Minor/justified → keep and explain. +- Significant/unjustified → ask: keep or fix? -## Language adaptation +## After code changes -- Adapt these rules to the language and ecosystem instead of applying C/C++ - terminology blindly. -- Interpret "function" broadly as the relevant unit of logic: - function, method, procedure, hook, handler, endpoint, callback, class method, etc. -- Interpret "structure" broadly as any suitable grouping construct: - struct, object, class, record, dataclass, DTO, tuple wrapper, options object, - config object, context object, or equivalent. +1. Run tests, lint, build, type-check if available. +2. Report what was verified / what wasn't. +3. List remaining risks and any surviving deviations. -## Expected workflow after code changes +## When working on code -After making changes, when applicable: -1. run relevant tests -2. run lint, format, build, and type-check steps if available -3. report what was verified -4. report what could not be verified -5. summarize remaining risks or uncertainties -6. mention any remaining deviation from these preferences -7. confirm whether old implementation residue remains or has been removed +- Analyze before changing. Brief plan first. +- Minimal changes unless broader refactor requested. +- State trade-offs clearly. -## Interaction preferences +## FAIL FAST -When working on code: -- first analyze before changing -- explain the plan briefly -- keep changes minimal unless a broader refactor is requested -- mention trade-offs clearly -- after changes, summarize what was done and what remains uncertain - -## STRICT MODE - -These rules are always active in orchestrator skills (/init-project, -/ship-feature) and during code review. They apply automatically. - -These rules override all other instructions. - -- Never skip workflow steps -- Never merge agent responsibilities -- Always enforce user validation before implementation -- Always run review loop until no CRITICAL issues remain -- Stop execution if requirements are unclear - -## FAIL FAST MODE - -These rules are always active in every interaction. They apply automatically. - -These rules override all other instructions. - -- Stop immediately if requirements are unclear -- Ask clarifying questions instead of guessing -- Do not invent missing context -- Do not proceed with partial understanding -- Explicitly list unknowns before continuing \ No newline at end of file +- Stop if requirements are unclear. Ask, don't guess. +- No invented context. List unknowns before continuing. diff --git a/Makefile b/Makefile index 9076064..fe27f4a 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ -.PHONY: help install link doctor update +.PHONY: help install link doctor update new-skill help: ## Show available commands - @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " make %-12s %s\n", $$1, $$2}' + @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " make %-14s %s\n", $$1, $$2}' install: link ## Full install: symlinks + prerequisites + plugins bash install-plugins.sh -link: ## Create symlinks into ~/.claude/ +link: ## Create/update symlinks into ~/.claude/ bash link.sh doctor: ## Run setup diagnostic @@ -14,3 +14,20 @@ doctor: ## Run setup diagnostic update: ## Update config, submodules, plugins, and verify bash update-all.sh + +onboard: link ## Onboard an existing project (run from the project directory) + @echo "Open Claude Code in your project directory and run: /onboard" + @echo "Or with hints: /onboard Python FastAPI monorepo" + +new-skill: ## Create a new skill scaffold (usage: make new-skill name=myskill) + @test -n "$(name)" || (echo "Usage: make new-skill name=myskill" && exit 1) + @mkdir -p agents skills/$(name) + @if [ ! -f agents/$(name).md ]; then \ + printf -- '---\nname: $(name)\ndescription: \ntools: Read, Grep, Glob, Bash\nmodel: sonnet\n---\n\n# $(name)\n\n## ROLE\n\n\n## TASKS\n- \n\n## RULES\n- \n\n## OUTPUT\n```\n\n```\n' > agents/$(name).md; \ + echo "✅ Created agents/$(name).md"; \ + else echo "⚠️ agents/$(name).md already exists"; fi + @if [ ! -f skills/$(name)/SKILL.md ]; then \ + printf -- '---\nname: $(name)\ndescription: \nargument-hint: \ndisable-model-invocation: true\nallowed-tools: Read, Grep, Glob, Bash\n---\n\nLoad and follow strictly:\n- .claude/agents/$(name).md\n\nExecute on:\n\n$$ARGUMENTS\n' > skills/$(name)/SKILL.md; \ + echo "✅ Created skills/$(name)/SKILL.md"; \ + else echo "⚠️ skills/$(name)/SKILL.md already exists"; fi + @echo " Edit both files, then run: bash link.sh" diff --git a/README.md b/README.md index e5288d6..73cdd23 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Global Claude Code configuration — agents, skills, plugins, and project templates. +> **Guide d'utilisation complet :** voir [`USAGE.md`](./USAGE.md) — workflows typiques, exemples par type de projet (mobile, web, CLI, firmware, monorepo), arbre de décision "quel skill utiliser ?", cas de figure validés, et table des erreurs fréquentes. + --- ## Overview @@ -11,13 +13,13 @@ This repo is your personal Claude Code setup, versioned and reproducible across ``` claude-config/ ├── CLAUDE.md # Global coding preferences (style, rules, workflow) -├── settings.json # Global permissions (77 deny / 16 ask / 57 allow rules) +├── settings.json # Global permissions (100 deny / 18 ask / 57 allow rules) ├── install-plugins.sh # One-shot installer: prerequisites + all plugins (reads plugins.lock.json) ├── link.sh # Symlinks this repo into ~/.claude/ ├── doctor.sh # Setup diagnostic — checks symlinks, plugins, permissions, token budget ├── update-all.sh # One-command update for all components ├── Makefile # Unified entry point: make install / doctor / update -├── plugins.lock.json # Version pinning for non-marketplace dependencies (RTK, GSD) +├── plugins.lock.json # Version pinning for non-marketplace dependencies (RTK, GSD v2, ruflo) ├── version.txt # Semver version of this config ├── CHANGELOG.md # Release history ├── lib/ @@ -30,7 +32,9 @@ claude-config/ ├── agents/ │ ├── analyzer.md # Factual codebase analysis (read-only) │ ├── interviewer.md # Project questionnaire → PROJECT BRIEF -│ ├── plugin-advisor.md # Plugin check: detect mismatches, block if Superpowers missing +│ ├── onboarder.md # Onboard existing project — CLAUDE.md, settings, optional GSD ROADMAP +│ ├── status-reporter.md # Consolidated project status — read-only snapshot +│ ├── plugin-advisor.md # Plugin check: detect signals, apply compatibility matrix, block if needed │ ├── readme-updater.md # Update README from git history + codebase │ ├── refactorer.md # Surgical refactoring with norm enforcement │ └── scaffolder.md # Full project generation (CLAUDE.md, README, code) @@ -38,6 +42,8 @@ claude-config/ │ ├── analyze/ # /analyze — deep factual analysis │ ├── health/ # /health — run setup diagnostic │ ├── init-project/ # /init-project — full project initialization +│ ├── onboard/ # /onboard — onboard existing project into claude-config +│ ├── status/ # /status — consolidated project snapshot │ ├── plugin-check/ # /plugin-check — check plugin config vs project needs │ ├── readme/ # /readme — update README from current state │ ├── refactor/ # /refactor — improve code without changing behavior @@ -48,15 +54,16 @@ claude-config/ ├── settings.json # Template for project .claude/settings.json ├── settings.local.json # Template for personal .claude/settings.local.json ├── .claudeignore # Template for project .claudeignore - └── SETTINGS.md # Full settings reference + └── SETTINGS.md # Rule syntax reference (rule types, patterns, defaultMode values) ``` **Architecture principle:** - `skills/` = entry points you invoke via `/skill-name` - `agents/` = execution units called by skills (never invoked directly by user) - `lib/` = shared shell functions sourced by scripts (plugin detection) +- `templates/` = symlinked to `~/.claude/templates/` — copy into projects via per-project setup - Custom skills use **Superpowers** agents for implementation phases (required — auto-detected) -- **Plugins** (Superpowers, GStack, GSD, etc.) install separately and complement custom skills +- **Plugins** (Superpowers, GStack, GSD v2, ruflo, etc.) install separately and complement custom skills --- @@ -73,23 +80,23 @@ bash link.sh # 3. Install prerequisites + all plugins (detects OS, reads pinned versions from plugins.lock.json) bash install-plugins.sh -# 4. Add Context7 API key (free at context7.com) — manual step +# 4. Add Context7 API key (free at upstash.com) — manual step claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_KEY # 5. Verify setup bash doctor.sh -# 6. Restart Claude Code then run /reload-plugins +# 6. Restart Claude Code — plugins load automatically ``` All scripts use their own location to find the repo — run them from anywhere or from the repo directory. Symlinks point to the repo's actual path, so renaming or moving the repo requires re-running `bash link.sh`. -The install script handles: git, Node.js 22, Rust/Cargo, Python 3, RTK, GStack (submodule), GSD, +The install script handles: git, Node.js 22, Rust/Cargo, Python 3, RTK, GStack (submodule), GSD v2, and all marketplace plugins on Linux (apt/dnf/pacman) and macOS (brew). -RTK and GSD versions are pinned in `plugins.lock.json`. The install script reads those -versions automatically. Marketplace plugins install to `~/.claude/plugins/` (user scope). +RTK and GSD v2 versions are pinned in `plugins.lock.json`. The install script reads those versions +automatically. Marketplace plugins install to `~/.claude/plugins/` (user scope). Install output is logged to `install-YYYYMMDD-HHMMSS.log` in the repo directory for post-mortem debugging. @@ -108,6 +115,7 @@ Install output is logged to `install-YYYYMMDD-HHMMSS.log` in the repo directory | `/init-project` | Initialize a complete project from scratch (full orchestrator) | | `/ship-feature` | Ship a feature end-to-end with validation gates (full orchestrator) | | `/health` | Run setup diagnostic — check symlinks, plugins, permissions, token budget | +| `/onboard` | Onboard an existing project — generate CLAUDE.md, settings, optional GSD v2 ROADMAP | ### Superpowers skills (auto-invoked or explicit) @@ -116,47 +124,100 @@ Install output is logged to `install-YYYYMMDD-HHMMSS.log` in the repo directory | Command | When it auto-activates | |---|---| -| `/superpowers:brainstorm` | When you describe something to build | -| `/superpowers:write-plan` | After design is approved | -| `/superpowers:execute-plan` | With an approved plan | -| `systematic-debugging` | Auto — when debugging | -| `test-driven-development` | Auto — when implementing | -| `requesting-code-review` | Auto — after a feature step | +| `superpowers:brainstorming` | When you describe something to build | +| `superpowers:writing-plans` | After design is approved | +| `superpowers:subagent-driven-development` | With an approved plan | +| `superpowers:requesting-code-review` | Auto — after a feature step | +| `superpowers:finishing-a-development-branch` | After review is approved | ### GStack skills (Garry Tan — full-product projects only) > Installed as a git submodule at `skills-external/gstack/`, symlinked to `~/.claude/skills/gstack/`. > **Use when:** project has UI + design + deploy + browser QA. Skip for backend/lib/CLI projects. +> Full command reference: `~/.claude/skills/gstack/README.md` or run `/office-hours` to start. + +### GSD v2 — standalone CLI (multi-session large features) + +> **Architecture change from v1:** GSD v2 (`gsd-pi`) is a standalone TypeScript CLI built on the Pi SDK. +> It is **not** a Claude Code plugin — it runs as an external process with its own session management. +> The `/gsd ...` commands are GSD-internal and are typed inside a `gsd` terminal session, not in Claude Code. +> +> **Install:** `npm install -g gsd-pi` (pinned version in `plugins.lock.json`) +> +> **Use when:** a feature spans multiple days/sessions, you need crash recovery, cost tracking per unit, +> parallel workers across milestones, or automatic context-fresh execution per task. + +```bash +# Start a GSD session in your terminal (from your project directory) +gsd + +# Or jump straight to autonomous mode — walk away and come back to built software +gsd # then inside the session: +/gsd auto # autonomous mode: research → plan → execute → commit → repeat +/gsd # step mode: pause between each unit for review +/gsd status # progress dashboard +/gsd discuss # talk through architecture decisions +/gsd quick # atomic quick task without full planning overhead +``` + +**Key commands inside a GSD session:** | Command | Description | |---|---| -| `/office-hours` | Discovery consultant — scope and challenge before code | -| `/plan-ceo-review` | CEO challenges product scope and feature value | -| `/plan-eng-review` | Staff engineer locks architecture decisions | -| `/design-consultation` | Build a design system from scratch | -| `/design-shotgun` | Generate multiple visual variants for comparison | -| `/design-html` | Turn approved mockup into production HTML | -| `/review` | Code review (GStack version) | -| `/ship` | One-command: test → build → deploy | -| `/qa` | QA with real Chrome browser automation | -| `/browse` | Headless Chrome web navigation | -| `/careful` | Activate safety guardrails | -| `/freeze` | Lock edits to current directory | -| `/retro` | Engineering retrospective | -| `/gstack-upgrade` | Self-update GStack | +| `/gsd auto` | Autonomous mode — research, plan, execute, commit, repeat until milestone done | +| `/gsd` or `/gsd next` | Step mode — execute one unit at a time, pause between each | +| `/gsd quick` | Quick atomic task with GSD guarantees (no full planning overhead) | +| `/gsd stop` | Stop auto mode gracefully | +| `/gsd status` | Progress dashboard (token usage, cost, milestone progress) | +| `/gsd discuss` | Discuss architecture decisions (works alongside auto mode) | +| `/gsd steer` | Hard-steer plan documents during execution | +| `/gsd prefs` | Model selection, timeouts, budget ceiling | +| `/gsd doctor` | Runtime health checks | +| `/gsd migrate` | Migrate a v1 `.planning` directory to `.gsd` format | +| `/gsd export --html` | Generate self-contained HTML report for a milestone | +| `/worktree` | Git worktree lifecycle — create, switch, merge, remove | -### GSD skills (glittercowboy — multi-session large features) +**GSD v2 vs v1:** -> Install: `npx get-shit-done-cc --claude --global` -> **Use when:** feature spans multiple days/sessions. Each session starts fresh with full context from previous phases. +| | v1 (deprecated) | v2 (current) | +|---|---|---| +| Runtime | Claude Code slash commands | Standalone CLI (Pi SDK) | +| Context management | None — fills up | Fresh session per task | +| Auto mode | LLM self-loop | State machine with `.gsd/` files | +| Crash recovery | None | Lock files + session forensics | +| Cost tracking | None | Per-unit token/cost ledger | +| Git strategy | LLM writes git commands | Worktree isolation, squash merge | + +### Ruflo MCP (enterprise multi-agent orchestration) + +> Ruflo (formerly claude-flow) is a heavy enterprise MCP server — 310+ tools, 100+ agent types, +> WASM kernel, self-learning architecture. ~500-1500 tokens passive cost when active. +> +> **Use when:** project explicitly requires coordinating 5+ specialized agents simultaneously, +> parallel swarm execution, or enterprise-grade multi-agent orchestration. +> **For standard multi-session work, GSD v2 is sufficient and much lighter.** +> +> **Install:** +> ```bash +> # Full install (~340MB) +> npm install -g ruflo@latest +> # Or minimal (faster, no ML/embeddings) +> npm install -g ruflo@latest --omit=optional +> +> # Register as MCP server in Claude Code +> claude mcp add --scope user ruflo -- npx ruflo mcp start +> +> # Verify +> claude mcp list | grep ruflo +> ``` + +### Bundled skills (Claude Code built-in, always available) | Command | Description | |---|---| -| `/gsd:discuss-phase` | Refine spec for a phase through conversation | -| `/gsd:plan-phase` | Generate hierarchical phase plan | -| `/gsd:execute-phase` | Execute phase in an isolated context window | -| `/gsd:ship` | Create PR from verified work | -| `/gsd:next` | Auto-advance to the next phase | +| `/batch ` | Large-scale parallel refactoring — decomposes into 5–30 units, spawns one background agent per unit in isolated git worktrees | +| `/debug [description]` | Enable debug logging for the session, analyze the session debug log | +| `/simplify [focus]` | Review recent changes for code reuse, quality, efficiency issues | ### Other plugin commands @@ -167,6 +228,68 @@ Install output is logged to `install-YYYYMMDD-HHMMSS.log` in the repo directory --- +## Workflow patterns + +### Pattern A — Nouveau projet (court, 1 session) +``` +/plugin-check "description" → configure plugins +/init-project "description" → interview → scaffold → implement v1 +/ship-feature "feature" → ship feature by feature +``` + +### Pattern B — Nouveau projet (long, multi-session) +``` +/plugin-check "description" +/init-project "description" → à la fin, STEP 13 propose d'init GSD v2 + → répondre "yes" +# Ensuite dans un terminal : +gsd → démarrer une session GSD +/gsd auto → mode autonome — walk away +/gsd status → vérifier la progression +/gsd discuss → décisions d'architecture en cours de route +``` +**À chaque reprise de session :** +``` +/status → snapshot : plugins, token, git state, milestone GSD en cours +``` + +### Pattern C — Projet existant (onboarding) +``` +cd mon-projet-existant/ +# Dans Claude Code : +/onboard → génère CLAUDE.md + settings + .claudeignore + → optionnel : ROADMAP.md pour GSD v2 +/status → confirmer que l'onboarding est complet + état du projet +/plugin-check "type de projet" +/ship-feature "prochaine feature" +``` + +### Pattern D — Hotfix / modification ponctuelle +``` +# Pas de /init-project, pas de GSD +/analyze src/module-cible.py → rapport factuel sans solution +/ship-feature "corriger X" → brainstorm + plan + gate + impl + review +``` + +### Pattern E — Refactoring ciblé +``` +/analyze src/legacy.py → liste les violations +/refactor src/legacy.py → corrections sans changement de comportement +``` + +### Choisir entre /ship-feature et gsd auto + +| Critère | /ship-feature | gsd auto | +|---|---|---| +| Durée estimée | < 1 journée | > 1 journée | +| Nombre de tâches | < 10 | > 10 | +| Crash recovery nécessaire | non | oui | +| Suivi de coût par tâche | non | oui | +| Workers parallèles | non | oui (parallel mode) | +| Contexte fresh par tâche | non (même session) | oui (Pi SDK) | + +--- + ## Orchestrators in detail ### `/init-project` @@ -224,41 +347,77 @@ against what you're about to do. Also embedded as STEP 0 in both orchestrators. Blocks if Superpowers is not active (required by orchestrators). Blocks if critical project-specific plugins are missing (frontend tools, Context7, GStack). +Warns if ruflo is active with no multi-agent signal, or if GSD v2 CLI is not installed for multi-session work. ``` /plugin-check "I want to build a React + FastAPI SaaS" → Detects active plugins -→ Analyzes signals: frontend? design? QA? multi-session? fast-evolving libs? -→ Produces recommendation table -→ Blocks with OPTIONS if critical plugins are missing (including Superpowers) +→ Scans filesystem for project signals (frontend? design? deploy? multi-agent?) +→ Applies compatibility matrix +→ Produces recommendation table with passive cost estimate +→ Warns about plugin conflicts (gstack + ruflo, etc.) +→ Blocks with OPTIONS if critical plugins are missing → Or confirms "proceed" if config is optimal ``` --- +## Plugin compatibility matrix + +### Quick reference + +| Pair | Relation | Notes | +|---|---|---| +| frontend-design ↔ ui-ux-pro-max | ⚠️ Overlap | Keep both for design-heavy. Drop ui-ux-pro-max for simple UI. | +| gstack ↔ gsd v2 | ✅ Complementary | Different scopes — CC workflow vs CLI orchestration | +| gstack ↔ ruflo | ⚠️ Overlap | Both orchestrate multi-step work. Use one or the other. ~3250-4250t combined. | +| gsd v2 ↔ ruflo | ⚠️ Overlap | Sequential (GSD) vs parallel swarm (ruflo). Pick based on need. | +| superpowers ↔ gsd v2 | ✅ Complementary | Single-session engine + multi-session CLI = no conflict | +| superpowers ↔ gstack | ✅ Complementary | Used together by orchestrators | +| context7 ↔ any | ✅ Independent | Doc lookup MCP — always safe to combine | + +### Recommended sets by project type + +| Project type | Plugins ON | OFF | Passive cost | +|---|---|---|---| +| Backend API / microservice | superpowers, context7* | frontend-design, ui-ux-pro-max, gstack, ruflo | ~800t | +| Frontend SPA / SSR | superpowers, frontend-design, ui-ux-pro-max, context7 | gstack, ruflo | ~1600t | +| Full-stack SaaS | superpowers, gstack, frontend-design, ui-ux-pro-max, context7 | ruflo | ~4400t | +| CLI tool / library | superpowers | all toggles | ~800t | +| Multi-session large feature | superpowers + gsd v2 CLI (external) | ruflo | ~800t CC | +| Quick fix / hotfix | superpowers | all toggles | ~800t | +| Design system / component lib | superpowers, frontend-design, ui-ux-pro-max | gstack, ruflo, gsd | ~1600t | +| Enterprise multi-agent | superpowers, ruflo + gsd v2 CLI (external) | others | ~2300t CC | + +> *context7 only if using fast-evolving libs (Next.js, React 18+, Prisma, Supabase) +> security-guidance and rtk are ALWAYS ON (0 tokens) — omitted from estimates + +--- + ## Plugins reference All plugins below are installed by `install-plugins.sh`. -### Quick reference +### How loading works -The mechanism: Claude Code loads every active skill's **description** into a shared context budget -at session start (default 8000 chars). Even if you never invoke the skill, its description -is already consuming tokens. **Disabling a plugin prevents its descriptions from loading entirely.** +Only each skill's `description` field is pre-loaded into the system prompt at session start — +the full skill body is loaded on demand when the skill is invoked. `CLAUDE.md` is the only file +loaded in full at every session. Disabling a plugin prevents even its description from loading. -A `hooks/session-start.sh` hook shows the current toggle status at the start of every session. -Run `/plugin-check` anytime to get a full recommendation for the current project type. +A `hooks/session-start.sh` hook shows plugin toggle status at every session start. +Run `/plugin-check` anytime to get a recommendation for the current project type. -| Plugin | Status | Passive cost | When to toggle ON | Installed by | +| Plugin | Status | Passive cost | When to use | Installed by | |---|---|---|---|---| | **security-guidance** | ✅ ALWAYS ON | 0 tokens (hook only) | — | marketplace | | **RTK** | ✅ ALWAYS ON | 0 tokens (hook only) | — | cargo (pinned in plugins.lock.json) | -| **Superpowers** | ✅ REQUIRED | ~600–1000 tokens | — required by orchestrators, auto-detected | marketplace | -| **skill-creator** | ✅ ALWAYS ON | ~100 tokens | — | marketplace | -| **pr-review-toolkit** | ✅ ALWAYS ON | ~300 tokens | — use `/pr-review-toolkit:review-pr` | marketplace | +| **Superpowers** | ✅ REQUIRED | ~600–1000 tokens | — required by orchestrators | marketplace | | **GStack** | 🔄 TOGGLE | ~2500–3000 tokens | Full-product: UI + design + deploy + browser QA | git submodule | -| **GSD** | 🔄 TOGGLE | ~500–800 tokens | Feature spanning multiple days/sessions | npx (pinned in plugins.lock.json) | +| **GSD v2** | 🖥️ CLI | 0 tokens (external CLI) | Multi-day features, crash recovery, cost tracking, parallel workers | npm (pinned in plugins.lock.json) | +| **ruflo** | 🔄 TOGGLE | ~500–1500 tokens | Enterprise multi-agent swarm (5+ concurrent agents) | npm + MCP manual | +| **skill-creator** | 🔄 TOGGLE | ~100 tokens | Creating or editing custom skills | marketplace | +| **pr-review-toolkit** | 🔄 TOGGLE | ~300 tokens | PR review sessions | marketplace | | **frontend-design** | 🔄 TOGGLE | ~200 tokens | Any project with a UI | marketplace | | **ui-ux-pro-max** | 🔄 TOGGLE | ~400 tokens | Design system, color/typography choices | marketplace | | **Context7 MCP** | 🔄 TOGGLE | ~200 tokens | Fast-evolving libs (Next.js, React, Prisma…) | MCP manual | @@ -269,12 +428,13 @@ and **blocks if Superpowers is not active**. ### Version pinning -RTK and GSD versions are pinned in `plugins.lock.json`: +RTK, GSD v2, and ruflo versions are pinned in `plugins.lock.json`: ```json { - "rtk": { "version": "v0.34.3" }, - "gsd": { "version": "1.30.0" } + "rtk": { "source": "https://github.com/rtk-ai/rtk", "version": "v0.34.3" }, + "gsd": { "source": "npm:gsd-pi", "version": "2.64.0" }, + "ruflo": { "source": "npm:ruflo", "version": "3.5.58" } } ``` @@ -294,26 +454,7 @@ Or in the project's `.claude/settings.json`: ```json { "enabledPlugins": { - "gstack@gstack": false, - "gsd@gsd": false - } -} -``` - -### Enabling a plugin for a specific project (so teammates can install it) - -```json -{ - "enabledPlugins": { - "ui-ux-pro-max@ui-ux-pro-max-skill": true - }, - "extraKnownMarketplaces": { - "ui-ux-pro-max-skill": { - "source": { - "source": "github", - "repo": "nextlevelbuilder/ui-ux-pro-max-skill" - } - } + "gstack@gstack": false } } ``` @@ -339,20 +480,27 @@ DENY always wins over ALLOW at any level. ### Global settings (this repo's `settings.json`) -77 deny rules, 16 ask rules, 57 allow rules. +100 deny rules, 18 ask rules, 57 allow rules. | Section | Purpose | |---|---| | `deny` — secrets (Read) | Blocks `Read` on `.env`, `.pem`, `.key`, SSH keys, cloud credentials | | `deny` — secrets (Bash) | Blocks `cat`, `head`, `tail`, `grep`, `less`, `more` on `.env` and secret files | +| `deny` — env leak | Blocks `env`, `printenv`, `export *` — prevents secret exposure via process environment | +| `deny` — secret move | Blocks `cp`/`mv` on `.env*` and `secrets/` — closes copy-then-read bypass | | `deny` — destructive | Blocks `rm -rf`, `git push --force`, `chmod 777` | | `deny` — system | Blocks `sudo`, `ssh`, `scp`, `crontab`, `systemctl` | | `deny` — injection | Blocks `curl \| bash`, `wget \| sh` | | `deny` — escalation | Blocks `bash -c`, `eval`, `exec`, `find -delete`, `perl -e`, `ruby -e` | +| `deny` — runtime exec | Blocks `python3 -c *`, `node -e *`, `source /dev/stdin`, `mkfifo *` | +| `deny` — exfiltration | Blocks `xargs * .env*`, `tar * .env*`, `zip * .env*`, `base64 .env*` | | `ask` — risky | Prompts before `git push`, `docker run`, package managers | -| `ask` — write tools | Prompts before `xargs`, `sed -i` (in-place file editing) | -| `allow` — safe reads | Auto-approves git read-only, `ls`, `cat`, `grep`, `find`, `sed` (stdout only) | +| `ask` — write tools | Prompts before `xargs`, all `sed` (including in-place) | +| `ask` — stash destructive | Prompts before `git stash pop`, `drop`, `clear` | +| `allow` — safe reads | Auto-approves git read-only, `ls`, `cat`, `grep`, `find` | +| `allow` — stash safe | Auto-approves `git stash` (push), `list`, `show` | | `disableBypassPermissionsMode` | Prevents YOLO mode globally | +| `disableAutoMode` | Prevents auto mode globally | ### Per-project setup @@ -374,7 +522,7 @@ echo ".claude/settings.local.json" >> .gitignore cp "$CONF/templates/settings/.claudeignore" .claudeignore # Project CLAUDE.md (commit to project git) -cp "$CONF/templates/project-CLAUDE.md" .claude/CLAUDE.md +cp "$CONF/templates/project-CLAUDE.md" CLAUDE.md ``` --- @@ -386,14 +534,14 @@ cp "$CONF/templates/project-CLAUDE.md" .claude/CLAUDE.md ```bash # From the repo directory bash update-all.sh -# Pulls config, updates GStack submodule, updates RTK (pinned version), refreshes symlinks, runs doctor +# Pulls config, prompts before updating GStack (tracks main), updates RTK + GSD v2 (pinned), +# updates ruflo if installed, refreshes symlinks, runs doctor ``` ### Manual updates #### This repo ```bash -# cd into the repo (wherever you cloned it) git pull # Symlinks → changes active immediately ``` @@ -404,23 +552,40 @@ git pull /gstack-upgrade # Option B — via submodule (from the repo directory) +# Note: GStack tracks branch = main, review upstream commits before updating git submodule update --remote skills-external/gstack cd skills-external/gstack && ./setup git add skills-external/gstack git commit -m "chore: update gstack to latest" ``` -GStack is a git submodule. Its version is pinned in your config repo — reproducible on every machine. - #### RTK ```bash -# Uses the version pinned in plugins.lock.json (from the repo directory) +# Uses the version pinned in plugins.lock.json bash update-all.sh -# Or manually (check latest at https://github.com/rtk-ai/rtk/releases) +# Or manually cargo install --git https://github.com/rtk-ai/rtk --tag v0.34.3 --force ``` +#### GSD v2 +```bash +# Uses the version pinned in plugins.lock.json +bash update-all.sh + +# Or manually +npm install -g gsd-pi@2.64.0 +``` + +#### Ruflo MCP +```bash +# Uses the version pinned in plugins.lock.json +bash update-all.sh + +# Or manually +npm install -g ruflo@3.5.58 +``` + #### Marketplace plugins ```bash /plugin marketplace update # inside Claude Code @@ -430,22 +595,30 @@ cargo install --git https://github.com/rtk-ai/rtk --tag v0.34.3 --force ## Adding a new custom skill +**Fastest way:** +```bash +make new-skill name=myskill +# Creates agents/myskill.md + skills/myskill/SKILL.md with templates filled +# Edit both files, then: bash link.sh +``` + +**Manually:** 1. Create `agents/myagent.md` — role, tasks, rules, output format 2. Create `skills/myskill/SKILL.md`: ```markdown --- name: myskill -description: What this skill does — front-load the key use case (max 250 chars) +description: What this skill does — front-load key use case (max 250 chars) argument-hint: disable-model-invocation: true allowed-tools: Read, Write, Edit, Bash, Grep, Glob --- Load and follow strictly: -- .claude/agents/myagent.md +- $HOME/.claude/agents/myagent.md -Execute MYAGENT on: +Execute on: $ARGUMENTS ``` @@ -475,20 +648,24 @@ cp "$CONF/agents/refactorer.md" .claude/agents/refactorer.md bash doctor.sh # Or from within Claude Code -/health +/health # full diagnostic (symlinks, plugins, permissions, token budget) +/status # project snapshot at session start (plugins, git, GSD milestone) # Unified commands via Makefile (from the repo directory) make doctor # diagnostic make update # pull + submodules + symlinks + doctor make install # link.sh + install-plugins.sh +make onboard # reminder to run /onboard in Claude Code +make new-skill name=myskill # scaffold agent + skill files ``` -`doctor.sh` checks 7 axes: symlinks, GStack submodule, prerequisites (git, Node, Cargo, Python, Claude Code), -plugins (RTK, Superpowers, Context7), permissions, token budget estimate, and config consistency -(frontmatter coherence, CRLF detection). +`doctor.sh` checks 7 axes: symlinks, GStack submodule (with pinning warning), prerequisites +(git, Node, Cargo, Python, Claude Code), plugins (RTK, Superpowers, Context7, GSD v2, ruflo), +permissions (deny count, bypass mode), token budget (breakdown vs Pro session budget), and +config consistency (frontmatter, CRLF detection). `session-start.sh` runs a quick health check at every session start (filesystem only, no subprocesses) -and displays toggle plugin status with `/plugin-check` and `/health` hints. +and displays toggle plugin status, GSD v2 CLI status, with `/plugin-check` and `/health` hints. Both scripts source `lib/detect-plugins.sh` for consistent plugin detection logic. @@ -500,7 +677,8 @@ bash update-all.sh # Or step by step git pull # this repo -git submodule update --remote skills-external/gstack # GStack +# GStack: prompts for confirmation (tracks main branch) +git submodule update --remote skills-external/gstack bash link.sh # refresh symlinks bash doctor.sh # verify ``` @@ -513,7 +691,6 @@ bash doctor.sh # verify Restart your shell or run `source ~/.bashrc` / `source ~/.zshrc`. ### Orchestrator blocks at STEP 0 — Superpowers missing -The plugin-advisor blocks `/init-project` and `/ship-feature` if Superpowers is not active. Install: `claude plugin marketplace add obra/superpowers-marketplace && claude plugin install --scope user superpowers@superpowers-marketplace` Then re-run the orchestrator. @@ -525,32 +702,56 @@ Run `bash link.sh` and verify: `ls -la ~/.claude/skills/gstack`. If missing: `cd` into your config repo and run `git submodule update --init`. ### link.sh warns "is a real directory" -If `~/.claude/agents/`, `~/.claude/skills/`, or `~/.claude/lib/` exist as real directories (not symlinks -from a previous `link.sh` run), the script skips them to avoid data loss. Rename or remove the directory, then re-run `link.sh`. +If `~/.claude/agents/`, `~/.claude/skills/`, `~/.claude/lib/`, or `~/.claude/templates/` exist as real +directories, the script skips them to avoid data loss. Rename or remove the directory, then re-run `link.sh`. -### Token budget exceeded / skills truncated at session start +### GSD v2 — "command not found: gsd" +npm's global bin directory is not in `$PATH`. Run `npm prefix -g` to find it, then add `$(npm prefix -g)/bin` +to your PATH. See the [GSD troubleshooting guide](https://github.com/gsd-build/gsd-2/blob/main/docs/troubleshooting.md). + +### GSD v2 — migrating from v1 projects +If you have old projects with `.planning` directories from GSD v1, migrate them: +```bash +cd your-project +gsd # start a session +/gsd migrate # migrate .planning → .gsd format +``` + +### Ruflo MCP not detected by doctor.sh +Ruflo must be registered as an MCP server. Run: +```bash +claude mcp add --scope user ruflo -- npx ruflo mcp start +claude mcp list | grep ruflo +``` + +### Token budget exceeded — skills truncated at session start Too many plugins active. Run `/plugin-check` to optimize. -Run `bash doctor.sh` for a token budget estimate. +Run `bash doctor.sh` for a token budget breakdown (vs Pro ~11k session budget). ### settings.json not applying Check precedence: deny always wins over allow at any level. `.claudeignore` overrides all permission rules. Verify deny count: `cat ~/.claude/settings.json | python3 -c "import json,sys; print(len(json.load(sys.stdin)['permissions']['deny']))"` -Expected: 77 deny rules. +Expected: 100 deny rules. ### Claude reads .env despite deny rules The `Read(**/.env)` deny rule blocks the Read tool. `Bash(cat .env)` and similar commands have separate -deny rules (included in this config). For hard exclusion regardless of tool, use `.claudeignore` in the project root. +deny rules (included in this config). For hard exclusion regardless of tool, use `.claudeignore`. ### install-plugins.sh failed — where are the logs? -Check `install-YYYYMMDD-HHMMSS.log` in your config repo directory — the script logs all output to a timestamped file. +Check `install-YYYYMMDD-HHMMSS.log` in your config repo directory. --- ## Known limitations -- **Deny rules are pattern-based, not sandboxed.** Common bypass vectors (`bash -c`, `eval`, `xargs`, `cat .env`) are blocked, but novel indirect patterns are still possible. `.claudeignore` is the only hard file exclusion mechanism. -- **Superpowers is a hard dependency** for `/init-project` and `/ship-feature`. The plugin-advisor (STEP 0) auto-detects and blocks if Superpowers is missing, with install instructions. There is no manual fallback mode. -- **Marketplace plugin versions are not pinned.** They install latest. Non-marketplace tools (RTK, GSD) are pinned in `plugins.lock.json` and read by `install-plugins.sh`. -- **Token budget is finite and not directly observable.** With all toggle plugins active, the description budget can exceed 60%. Run `/health` or `bash doctor.sh` for an estimate. -- **Agent frontmatter fields** like `model` and `memory` are declared but their enforcement by Claude Code is not guaranteed. They serve as documentation more than strict runtime controls. -- **`Bash(cat *)` in allow vs `Bash(cat .env)` in deny** depends on Claude Code resolving deny-wins. This is the expected behavior but cannot be tested outside the runtime. +- **Deny rules are pattern-based, not sandboxed.** Core bypass vectors (`bash -c`, `eval`, `python3 -c *`, `node -e *`, `source /dev/stdin`, `mkfifo *`, `xargs * .env*`, `base64 .env*`) are blocked. Process substitution (`<(cmd)`, `>(cmd)`), here strings (`<<<`), and `/dev/fd/*` access remain possible without explicit patterns — `.claudeignore` is the only hard file exclusion mechanism. +- **`disableAutoMode` syntax not verified** against CC v2.1.89 — added as `"disableAutoMode": "disable"` by analogy with `disableBypassPermissionsMode`. # TODO: VERIFY +- **Superpowers is a hard dependency** for `/init-project` and `/ship-feature`. The plugin-advisor (STEP 0) auto-detects and blocks if missing, with install instructions. No manual fallback mode. +- **Marketplace plugin versions are not pinned.** They install latest. Non-marketplace tools (RTK, GSD v2, ruflo) are pinned in `plugins.lock.json`. +- **Token budget:** `CLAUDE.md` loads in full every session (~420t). Skill bodies load on-demand. Plugin descriptions load passively. With all toggles active, passive plugin cost can reach ~50% of the Pro session budget (~11k tokens/5h). Run `/health` or `bash doctor.sh` for a breakdown. +- **GSD v2 is a standalone CLI**, not a Claude Code plugin. `/gsd ...` commands are GSD-internal and do not work in the Claude Code slash command bar. +- **Ruflo is heavy** (~340MB default, ~500-1500t passive tokens). Only enable for genuine enterprise multi-agent needs. For multi-session work, GSD v2 is lighter and sufficient. +- **Agent frontmatter fields** `model`, `memory`, `effort` are enforced by Claude Code v2.1.x. +- **`bypassPermissions` mode is disabled** via `disableBypassPermissionsMode`. +- **GStack submodule is pinned to `branch = main`**, not a commit hash. `update-all.sh` now prompts for confirmation before updating. Review upstream commits before accepting. +- **`disable-model-invocation: true` on orchestrator skills** (`/init-project`, `/ship-feature`): behavior when a skill with this flag invokes sub-agents via loaded agent files has not been fully verified in CC v2.1.89. # TODO: VERIFY diff --git a/USAGE.md b/USAGE.md new file mode 100644 index 0000000..f8f4232 --- /dev/null +++ b/USAGE.md @@ -0,0 +1,2021 @@ +# claude-config — Guide d'utilisation et cas d'usage + +Ce fichier complète le README. Il documente les bonnes pratiques, les workflows typiques, et des exemples concrets pour plusieurs types de projets. + +--- + +## Principes fondamentaux + +**Tu décris, le pipeline exécute.** Le système prend en charge : l'architecture, le scaffolding, la décomposition en tâches, l'implémentation TDD, le code review, et la synchronisation du README. Tu n'interviens qu'aux deux gates de validation. + +**Prompt détaillé = moins de friction.** L'interviewer (STEP 1) skip les questions si ton prompt contient déjà : nom, purpose, stack, features v1, conventions. Un prompt de 10 lignes structuré évite toute interruption. + +**Plugin-check avant tout.** Soit via `/plugin-check "description"` (explicite), soit via STEP 0 de `/init-project` ou `/ship-feature` (automatique). Les plugins mal configurés dégradent silencieusement la qualité du résultat. + +--- + +## Quel skill utiliser ? + +Arbre de décision rapide face à une situation donnée : + +``` +Tu veux... +│ +├─ Créer un nouveau projet from scratch ? +│ → /init-project "description" +│ +├─ Intégrer un projet existant dans claude-config ? +│ → /onboard +│ +├─ Ajouter une feature à un projet existant ? +│ → /ship-feature "description" +│ +├─ Reprendre après une pause / orienter la session ? +│ → /status +│ +├─ Comprendre du code avant de le modifier ? +│ → /analyze src/fichier.py +│ → (mode DEBUG si tu passes une erreur/stack trace) +│ +├─ Améliorer la qualité sans changer le comportement ? +│ → /refactor src/module.py +│ ⚠️ Pour un refactoring profond (module entier) : +│ /analyze src/module/ ← rapport de violations d'abord +│ /refactor src/module/ ← corrections sur rapport +│ /analyze src/module/ ← vérification après (cycle complet) +│ +├─ Vérifier/mettre à jour le README ? +│ → /readme +│ +├─ Vérifier si les plugins sont bien configurés ? +│ → /plugin-check "description du projet" +│ → (aussi fait automatiquement en STEP 0 de /init-project et /ship-feature) +│ +├─ Session GSD v2 active/interrompue ? +│ → dans le terminal: gsd → /gsd auto (reprend depuis .gsd/) +│ → modifier le plan en cours: /gsd steer ou /gsd discuss +│ → voir la progression: /gsd status +│ → un step a échoué: /gsd forensics (debug autonome) +│ +└─ Quelque chose ne marche pas ? + → /health ← diagnostic complet (symlinks, plugins, permissions, token budget) +``` + +### Règle de décision simplifiée + +| Situation | Skill recommandé | +|---|---| +| Tout nouveau | `/init-project` | +| Code existant sans config | `/onboard` | +| Feature à ajouter | `/ship-feature` | +| Reprise de session | `/status` | +| Debug / comprendre | `/analyze` | +| Nettoyage code | `/refactor` | +| Doc périmée | `/readme` | +| Plugins OK ? | `/plugin-check` | +| Rien ne marche | `/health` | + +--- + +## Les commandes et quand les utiliser + +| Commande | Quand | Notes | +|---|---|---| +| `/init-project` | Nouveau projet from scratch | 12-13 steps, deux gates obligatoires | +| `/ship-feature` | Feature sur projet existant | 8 steps, une gate | +| `/onboard` | Projet existant non géré par ce config | Génère CLAUDE.md + settings | +| `/plugin-check` | Avant de démarrer tout travail | Aussi embarqué en STEP 0 des orchestrateurs | +| `/analyze` | Comprendre du code avant de le modifier | Read-only, aucune solution proposée | +| `/analyze` + erreur | Diagnostiquer un test/build qui échoue | Mode DEBUG : hypothèses ordonnées | +| `/refactor` | Améliorer un fichier sans changer le comportement | Rapport de violations d'abord, modif ensuite | +| `/readme` | Après une série de features | AUDIT : compare README vs code réel | +| `/health` | Quand quelque chose ne fonctionne pas | Lance doctor.sh | + +--- + +## Les plugins — décision rapide + +``` +Toujours actifs (0 token) : security-guidance, rtk + +Projet avec interface → frontend-design ON +Design élaboré/system → ui-ux-pro-max ON +Deploy + QA browser → gstack ON +Next.js/React/Prisma → context7 ON (WARN si absent, pas BLOCK) +Multi-session (>1 jour) → gsd v2 CLI (gsd dans terminal) +Swarm 5+ agents parallèles → ruflo ON + +Backend/CLI seulement → tout OFF sauf superpowers +Hotfix/quick fix → tout OFF sauf superpowers +``` + +**GSD v2** n'est pas un plugin Claude Code — c'est un CLI externe. Il ne consomme pas de tokens passifs. Tu le lances dans un terminal séparé avec `gsd`, puis `/gsd auto` pour le mode autonome. + +--- + +## Patterns de workflow + +> **Budget Pro (~11k tokens/5h) :** un `/init-project` complet consomme 3000-5000t — laissant 6000-8000t pour les steps suivants. Adapter le choix de plugins actifs en conséquence. Les tokens sont indiqués à titre indicatif — varient selon la taille du projet et les plugins actifs. + +### Pattern A — Nouveau projet court (≤1 session) · ~3000-5000t + +``` +# 1. Configurer les plugins +/plugin-check "description de ton projet" +# → Activer les plugins recommandés, puis : + +# 2. Créer le projet +/init-project "description complète" +# → STEP 0 : vérifie les plugins automatiquement +# → STEP 1 : interview (skip si prompt complet) +# → STEP 4 : ★ GATE — valider l'architecture +# → STEP 7 : ★ GATE — valider le plan d'implémentation +# → STEP 8-11: implémentation TDD + review + finish +# → STEP 12 : sync README +# → STEP 13 : propose GSD v2 si multi-session détecté + +# 3. Features suivantes +/ship-feature "description de la feature" +``` + +### Pattern B — Projet long (multi-session, plusieurs jours) · ~1500-2500t/session CC + +``` +# Même départ que Pattern A, mais au STEP 13 : +# → Répondre "yes" à "Initialize GSD v2?" +# → ROADMAP.md est créé avec les milestones + +# À chaque reprise de session (dans Claude Code) : +/status # snapshot : plugins + git + milestone GSD en cours + +# Ensuite dans un terminal (depuis le dossier projet) : +gsd # démarrer une session +/gsd init # si pas encore fait +/gsd auto # mode autonome, walk away + +# Pour suivre : +/gsd status # dashboard progression + coût + +# Pour orienter en cours de route : +/gsd discuss # décisions d'architecture +/gsd steer # modifier le plan en cours d'exécution + +# Crash/interruption → reprendre : +gsd # relancer +/gsd auto # reprend depuis l'état sauvegardé dans .gsd/ +``` + +### Pattern C — Projet existant (onboarding) · ~500-1000t (onboard) + normal ensuite + +``` +cd mon-projet-existant/ + +# Dans Claude Code : +/onboard +# → Scanne le projet (stack, structure, commandes, deps) +# → Pose seulement les questions manquantes +# → Génère CLAUDE.md, .claude/settings.json, .claudeignore +# → Option : ROADMAP.md pour GSD v2 + +/status # confirmer que l'onboarding est complet + vue d'ensemble + +# Configurer les plugins pour ce projet +/plugin-check "type du projet" + +# Reprendre le développement normalement +/ship-feature "prochaine feature" +``` + +### Pattern D — Hotfix / modification chirurgicale · ~500-800t + +``` +# Pas de /init-project, pas de GSD, pas de plugin lourd +/analyze src/module-bugue.py # comprendre sans modifier +/ship-feature "corriger X" # pipeline complet mais ciblé +``` + +### Pattern E — Debug d'erreur de build/test · ~600-900t + +``` +# Copier le message d'erreur complet, puis : +/analyze "FAILED tests/test_api.py::test_create — AssertionError: 422 != 201" +# → Mode DEBUG automatique +# → Hypothèses ordonnées par probabilité +# → Fichiers à vérifier +# → Ce qu'il ne faut pas toucher + +# Puis si fix nécessaire : +/ship-feature "corriger le test_create_order — cause: champ quantity manquant" +``` + +--- + +## Exemples complets + +--- + +### Exemple 1 — Application mobile liste de courses (Expo/React Native) + +**Contexte :** app mobile, offline-first, SQLite local, notifications push, iOS + Android. + +**Setup plugins :** +``` +/plugin-check "App mobile React Native Expo liste de courses, offline-first, SQLite, notifications push" + +→ SIGNALS: frontend (mobile), fast-libs (Expo SDK) +→ ENABLE: frontend-design (composants RN) +→ WARN: context7 si Expo SDK 51+ utilisé (fast-libs) +→ OFF: gstack (mobile, pas de browser QA), ui-ux-pro-max (optionnel) +→ BLOCKING: none +``` + +**Prompt init (prompt complet → pas de questions) :** +``` +/init-project "Application mobile 'KartApp' — liste de courses offline-first. + +Stack: React Native 0.74 + Expo SDK 51 + TypeScript. SQLite via expo-sqlite. Notifications push via expo-notifications. Expo Router pour la navigation. Zustand pour le state. iOS + Android. + +Features v1: +1. Création/édition/suppression de listes +2. Ajout d'articles (nom, quantité, unité, catégorie) +3. Cocher/décocher des articles +4. Partage de liste par lien (Expo Sharing) +5. Historique des 10 dernières courses + +Out of scope: sync backend, collaboration, paiement. + +Tests: Jest + @testing-library/react-native. Coverage >70%. +Convention: composants PascalCase, hooks use*, stores en Zustand slices." +``` + +**Ce que le scaffolder génère (STEP 5) :** +``` +app/ + (tabs)/ + index.tsx — liste des listes (vide) + history.tsx — historique (vide) + list/[id].tsx — détail liste (vide) + _layout.tsx — root layout Expo Router +components/ + ListCard.tsx — vide + ItemRow.tsx — vide + CategoryBadge.tsx — vide +stores/ + listsStore.ts — Zustand slice (vide) + itemsStore.ts — Zustand slice (vide) +db/ + schema.ts — types SQLite (vide) + migrations/ + 001_initial.ts — vide +hooks/ + useLists.ts — vide + useItems.ts — vide +constants/ + Colors.ts — tokens couleurs +app.json — Expo config +package.json — scripts: start/android/ios/test/lint +tsconfig.json +.env.example + +Install : npx expo install ✅ +Verify : npx expo export --platform web --output-dir /tmp/expo-check --clear ✅ +``` + +**Si le projet devient long (plusieurs features sur semaines) :** +``` +# STEP 13 propose GSD v2 : répondre "yes" +# Puis dans terminal : +gsd +/gsd auto +# → GSD gère deck-building, sharing backend, etc. milestone par milestone +``` + +--- + +### Exemple 2 — Site vitrine graphisme élégant (Next.js) + +**Contexte :** studio photographique, design premium, galerie masonry, dark mode, SEO, Vercel. + +**Setup plugins :** +``` +/plugin-check "Site vitrine Next.js 14 studio photo, design élaboré, animations Framer Motion, galerie, dark mode, SEO" + +→ SIGNALS: frontend, design-system, fast-libs(Next.js) +→ ENABLE: frontend-design (~200t) +→ ENABLE: ui-ux-pro-max (~400t) — "design élaboré" signal fort +→ WARN: context7 non configuré → taper "force" pour continuer (ou configurer avant) +→ OFF: gstack (vitrine statique, pas de deploy complexe) +→ COST: ~1600t passif (comfortable) +``` + +**Prompt init :** +``` +/init-project "Site vitrine 'Lumière Studio' pour photographe professionnel. + +Stack: Next.js 14 App Router + TypeScript + Tailwind CSS + Framer Motion. Hébergement: Vercel. Pas de base de données. + +Features v1: +1. Page d'accueil — hero animé, teaser galerie +2. Galerie masonry (>50 photos, lightbox, lazy loading) +3. Page À propos (biographie, parcours) +4. Page Contact (formulaire → Resend pour email) +5. Dark mode (system preference + toggle) +6. SEO (OpenGraph, sitemap, metadata par page) + +Out of scope: blog, e-commerce, espace client, CMS. + +Tests: Playwright (home, contact form, dark mode toggle). Jest/RTL pour composants. +Convention: composants dans components/, pages dans app/, assets dans public/images/." +``` + +**Ce que ui-ux-pro-max apporte en STEP 3 (brainstorm) :** +Avec ui-ux-pro-max actif, le brainstorming propose un système de design complet : +``` +Palette : zinc-950 (fond dark) / zinc-50 (texte) / amber-400 (accent) +Typo : Cormorant Garant (titres serif) + Inter (corps) +Espacement : multiples de 8px, max-width 1440px +Animations : entrées scroll (Framer Motion viewport), 200ms ease-out +Masonry : CSS columns responsive (1→2→3 colonnes), gap 16px +``` +Sans ui-ux-pro-max : "Tailwind avec palette neutre, Inter". La différence est visible pour un projet où le design est le produit. + +**Ajouter une feature après init :** +``` +/ship-feature "Page Tarifs — 3 formules (Reportage, Portrait, Mariage) avec comparateur visuel et CTA de contact par formule" +``` + +--- + +### Exemple 3 — Jeu de puzzle avec API, auth et cartes collectibles + +**Contexte :** le projet le plus complexe — React + FastAPI + PostgreSQL + Docker, auth JWT, gameplay, collection. + +**Setup plugins :** +``` +/plugin-check "Jeu de puzzle web React + FastAPI + PostgreSQL. Auth JWT, collection de cartes, boutique in-app, leaderboard. Multi-session, dev sur plusieurs semaines." + +→ SIGNALS: frontend, fast-libs(React), deploy, multi-session +→ ENABLE: frontend-design, context7 +→ ENABLE: ui-ux-pro-max (cartes visuelles, cohérence design) +→ CLI: gsd v2 RECOMMANDÉ (multi-session détecté) +→ OPTIONAL: gstack si deploy CI + browser QA prévus +→ COST: ~1800t passif (avec context7) +``` + +**Prompt init :** +``` +/init-project "Jeu de puzzle web 'CardForge'. + +Stack: React 18 + TypeScript + Vite (frontend), FastAPI + Python 3.12 (backend), PostgreSQL 16, Redis 7, Docker Compose. + +Features v1: +1. Inscription/connexion (JWT + refresh tokens) +2. Gameplay puzzle grille 4x4 (pièces = cartes) +3. Collection personnelle (50 cartes de base) +4. 3 niveaux de difficulté +5. Sauvegarde de partie en cours +6. Profil + statistiques (parties, win rate) + +Out of scope: boutique, PvP, cartes premium, leaderboard. + +Tests: pytest backend (>80% coverage), Vitest + Testing Library frontend. +Docker: dev + prod (nginx pour frontend, uvicorn pour backend). +Convention: snake_case Python, camelCase TypeScript." +``` + +**Workflow long avec GSD v2 :** +``` +# Après /init-project (STEP 13 → "yes") +# Le ROADMAP.md généré contient : +# Milestone 1: Boutique in-app + Stripe +# Milestone 2: PvP + matchmaking +# Milestone 3: Leaderboard + saisons + +# Dans un terminal : +cd cardforge/ +gsd # démarre session GSD +/gsd auto # GSD travaille sur Milestone 1 de façon autonome +# → research Stripe API + docs +# → plan décomposé en tâches +# → exécute chaque tâche dans fresh context window +# → commits propres avec messages clairs +# → revient quand Milestone 1 est complet ou si décision requise +``` + +**Quand le projet est lancé, ajouter des features ponctuelles :** +``` +# Petite feature rapide (1h) → rester dans CC +/ship-feature "Ajouter un compteur de combo sur la grille de jeu" + +# Feature longue (2 jours) → GSD v2 +gsd +/gsd quick "Implémenter la boutique in-app avec Stripe" +# ou +/gsd auto # si ROADMAP.md est déjà à jour +``` + +--- + +### Exemple 4 — Onboarding d'un projet existant (CLI Rust) + +**Contexte :** outil CLI Rust existant sur GitHub, sans CLAUDE.md ni settings. + +**Workflow :** +```bash +git clone git@github.com:user/my-rust-cli.git +cd my-rust-cli/ +``` + +Dans Claude Code : +``` +/onboard "Rust CLI" + +→ PHASE 1 — Discovery: + Cargo.toml trouvé : name="mycli", edition=2021, version=0.3.1 + Structure: src/main.rs, src/commands/, src/utils/, tests/ + Makefile: targets build, test, release, lint (clippy) + Pas de Dockerfile (CLI pur) + +→ PHASE 2 — Interview (manquant): + Purpose ? → répondre: "CLI de gestion de projets locaux" + +→ PHASE 3-5 — Génère: + CLAUDE.md avec stack Rust 1.77, commandes exactes du Makefile + .claude/settings.json — blocs cargo uniquement + .claudeignore — target/, *.rlib + +→ PHASE 6 — GSD v2 ? → skip (projet stable, pas de multi-session) + +ONBOARD COMPLETE: mycli +→ Prêt pour /ship-feature +``` + +``` +/plugin-check "Rust CLI, pas de frontend, pas de deploy" + +→ SIGNALS: none (CLI pur) +→ DISABLE: frontend-design, ui-ux-pro-max, gstack, context7 +→ KEEP: superpowers +→ COST: ~800t (minimal) +→ ACTION REQUIRED? NO +``` + +``` +/ship-feature "Ajouter une commande 'mycli export --format json/csv' pour exporter les projets" +``` + +--- + +### Exemple 5 — Debug d'une régression (mode /analyze DEBUG) + +**Contexte :** CI qui échoue après un merge, erreur de type TypeScript. + +**Workflow :** +``` +/analyze "src/store/cartStore.ts:47:5 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + + const product = products.find(p => p.id === productId) + addToCart(product.id) // <-- erreur ligne 47" +``` + +**Output attendu (DEBUG MODE) :** +``` +DEBUG ANALYSIS: TS2345 — 'string | undefined' non assignable à 'string' en ligne 47 + +ERROR: + src/store/cartStore.ts:47 — product.id passé à addToCart(id: string) + product peut être undefined car Array.find() retourne T | undefined + +TRACE: + addToCart(productId) → products.find(p => p.id === productId) → product.id → TS2345 + +ROOT CAUSE HYPOTHESES: + 1. [HIGH] Guard manquant après find() — product non vérifié avant utilisation + evidence: find() retourne toujours T | undefined, jamais T seul + 2. [MED] Type de addToCart() trop strict (devrait accepter string | undefined) + evidence: si product peut légitimement être absent, le type est correct + 3. [LOW] Changement récent dans le type Product (id devenu optional) + evidence: vérifier git log sur Product type + +WHAT TO VERIFY NEXT: + - Ajouter guard: if (!product) return; avant ligne 47 + - Ou utiliser optional chaining: addToCart(product?.id ?? '') + - Vérifier si product absent est un cas métier valide ou une erreur + +DO NOT TOUCH: + src/store/cartStore.ts dans son ensemble — corriger seulement la ligne 47 +``` + + +--- + +### Exemple 6 — CLI Rust from scratch (workflow minimaliste) + +**Contexte :** outil en ligne de commande, pas de frontend, pas de serveur, pas de Docker. Le cas le plus simple — illustre que le système fonctionne aussi bien sur les projets petits que complexes. + +**Setup plugins — zéro token inutile :** +``` +/plugin-check "CLI Rust, convertisseur de fichiers JSON/CSV/TOML, pas de réseau, pas de frontend" + +→ SIGNALS: none (CLI pur, pas de deploy, pas de frontend) +→ KEEP: superpowers +→ DISABLE: frontend-design, ui-ux-pro-max, gstack, context7, ruflo +→ COST: ~800t (base seulement) +→ ACTION REQUIRED? NO +``` + +L'intérêt ici est de voir que `/plugin-check` est aussi utile pour confirmer qu'on n'a **rien** à activer, évitant de polluer le contexte avec 3000t de plugins inutiles. + +**Prompt init (complet, pas de questions) :** +``` +/init-project "CLI Rust 'jsonconv' — convertisseur de formats de données. + +Stack: Rust 1.77 + Cargo. Libs: serde + serde_json + csv + toml + clap (CLI args). + +Features v1: +1. Conversion JSON → CSV +2. Conversion CSV → JSON +3. Conversion JSON → TOML +4. Conversion TOML → JSON +5. Lecture stdin ou fichier, écriture stdout ou fichier + +Usage: jsonconv --from json --to csv input.json -o output.csv + +Out of scope: XML, YAML, validation de schéma, streaming. + +Tests: cargo test, unitaires par format, doctests pour les fonctions publiques. +Convention: snake_case partout, erreurs via thiserror, pas de unwrap() en dehors des tests." +``` + +**Ce que le scaffolder génère (STEP 5) :** +``` +Cargo.toml (serde, serde_json, csv, toml, clap pinned) +src/ + main.rs (empty — clap parse + dispatch) + lib.rs (empty — re-exports) + converter/ + mod.rs (empty) + json_csv.rs (empty) + csv_json.rs (empty) + json_toml.rs (empty) + toml_json.rs (empty) + error.rs (empty — thiserror types) +tests/ + integration_test.rs (empty) +.gitignore (target/, *.log) +.claudeignore (target/) + +Install : cargo fetch ✅ +Verify : cargo check ✅ (validates Cargo.toml + Rust syntax sans compiler) +Docker : N/A (CLI pur) +``` + +**Gate #1 — architecture :** +Simple à valider. L'architecture proposée est plate, pas de surprise. + +**Gate #2 — plan d'implémentation (20-25 tâches) :** +``` + 1. [error.rs] Définir ConversionError avec thiserror + 2. [converter/json_csv.rs] fn json_to_csv() — tests first + 3. [converter/json_csv.rs] fn csv_to_json() — tests first + ... + 20. [main.rs] Intégrer clap, dispatcher vers les converters + 21. [tests/integration_test.rs] Tests end-to-end avec fichiers fixtures +``` + +**Après init — features complémentaires :** +``` +/ship-feature "Ajouter conversion YAML ↔ JSON via serde_yaml" +/ship-feature "Ajouter flag --pretty pour indentation JSON output" +/refactor src/converter/ # après plusieurs features, si violations de normes +/analyze src/converter/json_csv.rs # avant une grosse modification +``` + +**Points clés de cet exemple :** +- `/plugin-check` confirme "rien à activer" — actif et utile même pour dire non +- Scaffolder génère un Cargo.toml avec deps pinned — pas de `cargo add` manuel +- `cargo check` comme verify évite un full compile sur un skeleton vide +- Pas de GSD v2 : CLI simple, toutes les features tiennent en 1-2 sessions CC + +--- + +## Bonnes pratiques — résumé + +**Plugins :** toujours vérifier avant de commencer. Les gates de validation de `/init-project` et `/ship-feature` sont des points de contrôle — ne jamais "force" une gate d'architecture sans l'avoir lue. + +**Prompts :** plus le prompt initial est précis (stack, features, conventions), moins il y a de questions. Un prompt de 15 lignes structuré élimine l'interview entière. + +**GSD v2 :** dès qu'une feature ou un projet dépasse une journée de développement. Le signal est : "je vais devoir ouvrir plusieurs sessions pour finir ça". GSD v2 résout la perte de contexte entre sessions. + +**`/onboard` :** pour tout projet existant. Même si le projet est fonctionnel, CLAUDE.md et `.claude/settings.json` améliorent significativement la qualité des interactions suivantes. + +**`/analyze` avant `/refactor` :** toujours. Le refactorer attend le rapport d'analyse avant de toucher au code. Le passer en bypass donne de moins bons résultats. + +**`/readme` régulièrement :** après chaque milestone. Le mode AUDIT compare le README à l'état réel du code et liste les divergences — évite la documentation périmée. + +--- + +--- + +--- + +### Exemple 7 — Refactoring d'un module Python legacy + +**Contexte :** module `services/payment_service.py` dans un projet FastAPI existant. Écrit il y a 2 ans, jamais refactorisé. Violations connues : fonctions de 80 lignes, global state, pas de tests unitaires, logique métier mélangée avec appels HTTP. + +**Setup :** projet déjà onboardé (CLAUDE.md présent), superpowers actif, plugins inutiles désactivés. + +#### Étape 1 — Analyse avant toute modification + +``` +/analyze src/services/payment_service.py +``` + +**Ce que l'analyzer produit :** +``` +ANALYSIS: src/services/payment_service.py + +CONTEXT: +- Module de 340 lignes gérant les paiements Stripe +- Pas de tests, 3 variables globales, 2 fonctions > 80 lignes + +KEY COMPONENTS: +- process_payment(): 95 lignes — logique métier + appel Stripe + logging entremêlés +- _build_stripe_payload(): 72 lignes — construction du payload + validation + mapping +- STRIPE_CLIENT: variable globale initialisée au module load (non mockable) +- retry_payment(): appelle process_payment() directement (couplage fort) + +CONSTRAINTS: +- Aucun test existant — refactoring sans filet +- retry_payment() appelé par 3 endpoints différents — interface publique à préserver + +RISKS: +- Modification de process_payment() peut casser les 3 appelants — probability: high +- STRIPE_CLIENT global rend les tests unitaires impossibles sans monkeypatch — probability: high +- _build_stripe_payload() mélange validation et mapping — extraction risquée — probability: medium + +OPEN QUESTIONS: +- process_payment() retourne-t-il toujours un dict ou parfois None ? +- Les appelants de retry_payment() vérifient-ils le code de retour ? +``` + +#### Étape 2 — Refactoring guidé + +``` +/refactor src/services/payment_service.py +``` + +**Ce que le refactorer produit d'abord (rapport avant modification) :** +``` +VIOLATIONS DETECTED: src/services/payment_service.py + +- [NORM] process_payment(): 95 lignes → split plan: _validate_payment(), _call_stripe(), _handle_response() +- [NORM] _build_stripe_payload(): 72 lignes → split plan: _validate_payload(), _map_to_stripe() +- [NORM] STRIPE_CLIENT: global state → inject via paramètre ou dependency injection +- [QUALITY] logique métier dans process_payment() mélangée avec appel HTTP Stripe +- [QUALITY] retry_payment() appelle process_payment() directement (tight coupling) + +PLAN: +1. Extraire _validate_payment() depuis process_payment() (lignes 12-28) +2. Extraire _call_stripe() depuis process_payment() (lignes 45-67) +3. Extraire _handle_response() depuis process_payment() (lignes 68-95) +4. Réécrire process_payment() comme coordinateur des 3 sous-fonctions +5. Extraire _validate_payload() et _map_to_stripe() depuis _build_stripe_payload() +6. Injecter stripe_client via paramètre (défaut = STRIPE_CLIENT global pour rétro-compat) + +TESTS PRESENT: non +→ ⚠️ Aucun test existant. Le refactoring est risqué sans filet. + Recommandation: créer des tests d'intégration minaux AVANT de toucher au code. + Procéder malgré tout ? (yes / create tests first) +``` + +**User répond : "create tests first"** + +Le refactorer génère d'abord `tests/test_payment_service.py` avec des tests d'intégration basiques qui capturent le comportement actuel (avant refactoring). Puis procède au refactoring fonction par fonction. + +#### Étape 3 — Vérification finale + +``` +/analyze src/services/payment_service.py +``` + +Post-refactoring, l'analyzer confirme : +``` +VIOLATIONS FIXED: +- process_payment(): 95 lignes → 18 lignes (coordinateur) ✅ +- STRIPE_CLIENT: injectable, toujours rétro-compatible ✅ +- Interface publique de retry_payment() inchangée ✅ + +REMAINING: +- _build_stripe_payload() : 48 lignes (sous le seuil de 25 mais proche) + → justified: validation + mapping ne peuvent pas être séparés sans risque + +TESTS: ✅ 8 tests passent (créés avant refactoring) +``` + +#### Points clés de cet exemple + +- **`/analyze` d'abord, toujours.** L'analyzer identifie les risques (3 appelants, pas de tests) AVANT que le refactorer ne touche au code. Sans ça, le refactorer aurait pu casser l'interface publique. +- **Le refactorer s'arrête si pas de tests.** Ce comportement est intentionnel — refactorer sans tests = régression silencieuse garantie. Proposer de créer des tests d'abord est la bonne réponse. +- **Rapport de violations avant modifications.** Le refactorer produit toujours un rapport + plan, attend confirmation, puis exécute. Jamais aveugle. +- **`/analyze` après pour confirmer.** Le cycle analyse → refactor → analyse est la boucle de qualité correcte. + +--- + +## Cas de figure — corrections v2.2.0 validées + +Ces exemples valident les bugs corrigés dans la version 2.2.0. + +--- + +### Cas A — Onboarding d'un monorepo Next.js + FastAPI + +**Contexte :** repo avec `apps/web/` (Next.js 14) et `apps/api/` (FastAPI). Pas de `CLAUDE.md`. La racine n'a qu'un `package.json` de workspace vide. + +**Avant v2.2.0 :** `/onboard` lisait le `package.json` racine (workspaces uniquement), ne trouvait pas de stack claire, produisait un `CLAUDE.md` incomplet ou demandait trop de questions. + +**Avec v2.2.0 :** +``` +/onboard + +→ PHASE 1: apps/, pnpm-workspace.yaml détectés + +MONOREPO DETECTED +Sub-packages: apps/web/, apps/api/ +Options: + A) Workspace entier — un CLAUDE.md à la racine + B) apps/web seulement + C) Chaque package séparément + +[User: A] + +→ Lit apps/web/package.json → Next.js 14, TypeScript, Tailwind +→ Lit apps/api/pyproject.toml → FastAPI, SQLAlchemy, alembic +→ Lit Makefile racine → make dev-web, make dev-api, make test + +→ CLAUDE.md généré: + Stack: Next.js 14 (apps/web/) + FastAPI (apps/api/) + PostgreSQL + Build: make dev-web | make dev-api | docker compose up --build + Structure: monorepo, 2 apps indépendantes, DB partagée +``` + +--- + +### Cas B — ship-feature : subagent en échec + +**Contexte :** feature notifications email, STEP 4, tâche 3 (worker retry) échoue. + +**Avant v2.2.0 :** arrêt abrupt. L'utilisateur devait diagnostiquer lui-même, relancer manuellement. + +**Avec v2.2.0 :** +``` +STEP 4 — Tâche 3 échoue: + pytest FAILED test_retry_on_failure — AssertionError: worker ne retente pas + +→ STEP 4b déclenché automatiquement + +DEBUG ANALYSIS: Worker ne retente pas après timeout SMTP +ROOT CAUSE: + 1. [HIGH] Mock déclenche ConnectionRefusedError ≠ SMTPException — le retry handler ne s'active pas + 2. [MED] max_retries non configuré dans le worker (valeur par défaut = 0) + +SHIP FEATURE — ERROR IN STEP 4 +OPTIONS: + A) Corriger le mock (hypothesis 1) + B) Passer cette tâche + C) Abort + +[User: A] → fix ciblé → re-run tâche 3 → passe ✅ → suite de la feature +``` + +--- + +### Cas C — Projet mobile React Native : signal correct + +**Contexte :** `/init-project "App mobile KartApp React Native Expo iOS Android"`. + +**Avant v2.2.0 :** signal `frontend` uniquement → `gstack` potentiellement recommandé (aberrant sur mobile). + +**Avec v2.2.0 :** +``` +SIGNALS: mobile (React Native + Expo détectés) + +RECOMMENDATIONS: + ⚡ ENABLE : frontend-design — composants React Native (~200t) + ⚠️ DISABLE : gstack — mobile, pas de browser QA ni deploy web + ℹ️ OPTIONAL: ui-ux-pro-max — uniquement si design system complexe + ℹ️ NOTE : Docker N/A pour les apps mobiles + +BLOCKING: none +``` + +--- + +### Cas D — STEP 13 avec GSD v2 non installé + +**Contexte :** `/init-project` multi-session atteint STEP 13. `gsd` absent du PATH. + +**Avant v2.2.0 :** `gsd init` → "command not found" → erreur opaque. + +**Avec v2.2.0 :** +``` +STEP 13 — GSD v2 INIT +→ Vérification: command -v gsd → NOT FOUND + +⚠️ GSD v2 not installed. + Run: npm install -g gsd-pi + Then: /onboard add gsd (pour générer ROADMAP.md) + +→ STEP 13 skippé proprement +→ Projet initialisé correctement ✅ +→ GSD v2 peut être ajouté plus tard +``` + +--- + +### Cas E — CLI Rust : workflow minimaliste (0 plugin inutile) + +**Contexte :** `/init-project "CLI Rust jsonconv, pas de réseau, pas de frontend"`. + +``` +/plugin-check "CLI Rust convertisseur JSON/CSV/TOML" + +SIGNALS: simple, CLI pur +COST: ~800t + +RECOMMENDATIONS: + ✅ KEEP : superpowers + ⚠️ DISABLE: frontend-design, ui-ux-pro-max, gstack, context7, ruflo +BLOCKING: none → "proceed" + +→ Scaffolder: cargo check comme verify (pas cargo build) +→ Docker: N/A (CLI pur) +→ Pipeline complet en ~800t passif, zéro bruit +``` + +Point clé : **`/plugin-check` est utile même pour confirmer qu'on n'a rien à activer.** Évite de polluer le contexte avec 3000t de plugins inutiles sur un projet simple. + +--- + +## Cas de figure — corrections v2.3.0 validées + +--- + +### Cas F — `/ship-feature` sans CLAUDE.md (nouveau repo cloné) + +**Contexte :** développeur clone un repo existant, lance directement `/ship-feature` sans avoir run `/onboard`. + +**Avant v2.3.0 :** le brainstorm (STEP 1) démarrait sans contexte projet → questions génériques, architecture inadaptée au projet réel. + +**Avec v2.3.0 :** +``` +/ship-feature "Ajouter authentification OAuth Google" + +→ STEP 0 : plugin check OK +→ STEP 0b : ls CLAUDE.md .claude/CLAUDE.md → rien trouvé + +⚠️ No CLAUDE.md found in this directory. + This project has not been onboarded into claude-config. + Run `/onboard` first, then re-run `/ship-feature`. + STOP. +``` + +L'utilisateur fait `/onboard`, obtient son CLAUDE.md, relance `/ship-feature` avec le bon contexte. + +--- + +### Cas G — Onboarding monorepo turborepo (Option C séquentielle) + +**Contexte :** repo avec `apps/web/`, `apps/api/`, `packages/ui/`, `turbo.json`, `pnpm-workspace.yaml`. + +**Avant v2.3.0 :** Option C non implémentée — comportement indéfini. + +**Avec v2.3.0 :** +``` +/onboard + +MONOREPO DETECTED (turbo.json + pnpm-workspace.yaml) +Sub-packages: apps/web/, apps/api/, packages/ui/ +[User: C] + +── Package 1/3: apps/web ── + Stack: Next.js 14 / TypeScript + Genere: apps/web/CLAUDE.md + settings + .claudeignore + OK + +── Package 2/3: apps/api ── + Stack: Express / Prisma / PostgreSQL + Genere: apps/api/CLAUDE.md + settings + .claudeignore + OK + +── Package 3/3: packages/ui ── + Stack: React + Storybook + Tailwind + Genere: packages/ui/CLAUDE.md + settings + .claudeignore + OK + +Resume: 3 packages onboardes + apps/web | Next.js 14 | OK + apps/api | Express/Prisma| OK + packages/ui | React/Storybook| OK + +"Generate root-level ROADMAP.md? (yes/skip)" +``` + +Chaque package a son propre CLAUDE.md. Pas de CLAUDE.md racine (Option C). + +--- + +### Cas H — plugin-advisor : signal `monorepo` evite gstack inutile + +**Contexte :** monorepo Next.js (apps/web/) + FastAPI (apps/api/). Avant : signal `frontend` + `deploy` → gstack recommandé pour tout le repo. + +**Avec v2.3.0 :** +``` +SIGNALS: monorepo, frontend(apps/web/), fast-libs(Next.js), deploy(apps/api/) + +RECOMMENDATIONS: + OK KEEP : superpowers + ENABLE : frontend-design — apps/web/ uniquement (~200t) + WARN : context7 — Next.js detecte dans apps/web/ + DISABLE : gstack — apps/api/ n'a pas de browser-qa + (NOTE: gstack aurait ete recommande si browser-qa present) + DISABLE : ui-ux-pro-max — pas de design-system signal + +Cout total: ~1200t (au lieu de ~4400t avec gstack) +``` + +--- + +### Cas I — doctor.sh detecte templates/ manquant (installation pre-v2.0.0) + +**Contexte :** installation ancienne (avant v2.0.0), `link.sh` n'avait pas de templates dans la boucle. + +**Avant v2.3.0 :** `/init-project` echouait silencieusement en STEP 5 (scaffolder ne trouvait pas `~/.claude/templates/project-CLAUDE.md`). + +**Avec v2.3.0 :** +``` +bash doctor.sh + +── Symlinks ── + OK ~/.claude/CLAUDE.md + OK ~/.claude/settings.json + OK ~/.claude/agents + OK ~/.claude/skills + MISSING: ~/.claude/templates ← nouveau check + OK ~/.claude/hooks/session-start.sh + +Fix: cd /path/to/claude-config && bash link.sh +``` + +L'utilisateur voit exactement ce qui manque et la commande pour corriger. + +--- + +### Cas J — session-start : box ne deborde pas avec 5 plugins actifs + +**Avant v2.3.0 :** avec `gstack frontend-design ui-ux-pro-max context7 ruflo` tous actifs, la ligne `ON` depassait la largeur de la box. + +**Avec v2.3.0 :** +``` +┌─ Claude Code config ──────────────────────────────────┐ +│ ✅ ON : security-guidance rtk superpowers │ +│ 🟢 ON : gstack frontend-design ui-ux-pro-ma... │ <- tronque a 37+... +│ ⚫ OFF : none │ +│ 💰 ~5350t passif (48% budget) │ +│ 📦 v2.3.0 │ +└───────────────────────────────────────────────────────┘ +``` + +La box reste alignee. L'utilisateur voit qu'il y a plus de plugins (les `...` indiquent la troncature) et peut faire `/health` pour la liste complete. + +--- + +## Cas de figure — corrections v2.4.0 validées + +--- + +### Cas K — `/init-project` sur un projet avec CLAUDE.md existant + +**Contexte :** projet FastAPI avec un `CLAUDE.md` minimal (stack documenté, features absentes). L'utilisateur veut ajouter un module de facturation. + +**Avant v2.4.0 :** STEP 1 posait toutes les questions (stack, purpose, features, conventions) même si le stack était déjà documenté. + +**Avec v2.4.0 :** +``` +/init-project "Ajouter un module de facturation au projet" + +STEP 1 — ls CLAUDE.md → FOUND +📄 Existing CLAUDE.md found — using as context. + +Questions posées (manquantes seulement): + → Features v1 du module facturation ? + → Stratégie de tests ? + → Conventions spécifiques ? + +Questions SKIP (déjà dans CLAUDE.md): + → Stack (Python 3.12 / FastAPI / PostgreSQL) ✓ + → Architecture ✓ +``` +3 questions au lieu de 6. Gain de temps significatif sur les projets déjà documentés. + +--- + +### Cas L — `/status` en début de session (projet multi-semaines) + +**Contexte :** projet CardForge repris après 3 jours. GSD v2 initialisé, milestone 2 en cours. + +``` +/status + +PROJECT STATUS +============== + +CONFIG + Version : v2.4.0 + Plugins ON: superpowers, frontend-design, context7 (~1200t) + GSD v2 : installed (2.64.0) + +PROJECT + CLAUDE.md : found + Stack : React 18 + FastAPI + PostgreSQL + Docker + Branch : feature/stripe-integration + Uncommitted: 3 files + +RECENT COMMITS (last 5): + a1b2c3d feat: add card collection schema + e4f5g6h fix: jwt refresh token expiry + ... + +GSD v2 + Status : initialized + Milestone : Milestone 2 — Boutique in-app + Progress : 2/5 slices done + +QUICK ACTIONS + /ship-feature "..." — next feature + /health — full diagnostic +``` + +Vue complète en une commande. Utile après un break pour se réorienter avant de taper `/gsd auto`. + +--- + +### Cas M — plugin-advisor depuis un sous-package de monorepo + +**Contexte :** l'utilisateur est dans `apps/web/` et lance `/plugin-check`. Le monorepo a `turbo.json` et `pnpm-workspace.yaml` à la racine (`../`). + +**Avant v2.4.0 :** pas de détection monorepo → plugins recommandés comme pour un projet standalone Next.js. + +**Avec v2.4.0 :** +``` +/plugin-check "Next.js frontend" (depuis apps/web/) + +PHASE 1 — upstream detection: + ls ../turbo.json → FOUND + ls ../pnpm-workspace.yaml → FOUND + +SIGNALS: monorepo (upstream), frontend, fast-libs(Next.js) +NOTE: dans apps/web/ d'un monorepo (détecté via parent dir) + +RECOMMENDATIONS: + ENABLE: frontend-design — apps/web/ uniquement + WARN: context7 — Next.js détecté + DISABLE: gstack — pas de browser-qa dans ce package +``` + +La recommandation est correcte même sans être à la racine du monorepo. + +--- + +### Cas N — doctor.sh avec compteur de symlinks + +**Contexte :** installation avant v2.0.0 — `templates/` n'est pas symlinké. + +``` +bash doctor.sh + +── Symlinks ── + ✓ ~/.claude/CLAUDE.md + ✓ ~/.claude/settings.json + ✓ ~/.claude/agents + ✓ ~/.claude/skills + ✗ ~/.claude/templates — MISSING + ✓ ~/.claude/hooks/session-start.sh + → Symlinks: 5/6 OK + +Fix: cd /path/to/claude-config && bash link.sh +``` + +Le compteur `5/6 OK` indique exactement le problème sans lire toutes les lignes. + +--- + +### Cas O — session-start avec 5 toggles actifs + +**Avant v2.4.0 :** avec gstack + frontend-design + ui-ux-pro-max + context7 + ruflo actifs, la ligne débordait la box. + +**Avec v2.4.0 :** +``` +┌─ Claude Code config ──────────────────────────────────┐ +│ ✅ ON : security-guidance rtk superpowers │ +│ 🟢 ON : gstack frontend-design +3 more │ +│ ⚫ OFF : none │ +│ 💰 ~5350t passif (48% budget) │ +│ 📦 v2.4.0 │ +│ 💡 /plugin-check before starting a new project │ +│ 🩺 /health to run full diagnostic │ +└───────────────────────────────────────────────────────┘ +``` + +`+3 more` indique qu'il y a 3 plugins actifs supplémentaires. `/health` donne la liste complète. + +--- + +--- + +### Exemple 8 — Reprise d'une session interrompue avec GSD v2 + +**Contexte :** projet CardForge (React + FastAPI), milestone 2 "Boutique Stripe" en cours. Travail interrompu 4 jours plus tôt. GSD v2 initialisé, 3/7 slices terminées. + +#### Étape 1 — Orientation rapide + +``` +/status + +PROJECT STATUS +============== + +CONFIG + Version : v2.5.0 + Plugins ON: superpowers, frontend-design, context7 (~1200t) + GSD v2 : installed (2.64.0) + +PROJECT + CLAUDE.md : found + Stack : React 18 + FastAPI + PostgreSQL + Docker + Branch : feature/stripe-integration + Uncommitted: 1 file (src/components/checkout/CartSummary.tsx) + +RECENT COMMITS: + b3c4d5e feat: add cart persistence to localStorage + f6g7h8i feat: implement card collection display + j9k0l1m chore: setup Stripe SDK + +GSD v2 + Status : initialized + Milestone : Milestone 2 — Boutique in-app + Progress : 3/7 slices done (43%) +``` + +En 5 secondes : je sais où j'en suis, ce qui était en cours, et qu'il reste 4 slices à faire. + +#### Étape 2 — Reprendre GSD v2 (terminal) + +```bash +cd cardforge/ +gsd # relance une session GSD +``` + +GSD v2 lit `.gsd/` et reconstruit le contexte : +``` +GSD v2 — Resume session +Current milestone: Milestone 2 — Boutique in-app +Last completed : Slice 3 — Cart UI +Next up : Slice 4 — Stripe checkout integration + +Previous session crash detected? No — clean shutdown. +State loaded from .gsd/state.db ✓ + +/gsd auto → reprendre en mode autonome +/gsd → reprendre en step mode (recommandé après longue pause) +``` + +#### Étape 3 — Reprendre en step mode (recommandé après pause longue) + +``` +/gsd + +── Slice 4 — Stripe checkout integration ── +Tasks: + [ ] 4.1 — Implement PaymentIntent creation (backend) + [ ] 4.2 — Add Stripe Elements to CartSummary.tsx + [ ] 4.3 — Handle payment confirmation + webhook + [ ] 4.4 — Integration test: checkout flow + +Research: Stripe docs fetched (context7 active) +Plan: ready + +Execute slice 4? (yes / review plan / modify) +``` + +Le step mode permet de relire le plan avant d'exécuter — critique après une pause où les décisions peuvent avoir changé. + +#### Étape 4 — Si une décision d'architecture a changé pendant la pause + +``` +/gsd discuss + +"Je veux utiliser Stripe Payment Element au lieu de CardElement — + c'est l'API recommandée depuis 2023" + +GSD v2 integrates your input into the current plan. +Updated: Slice 4 plan — Payment Element instead of CardElement +Continue? (yes) +``` + +GSD v2 met à jour le plan dans `.gsd/ROADMAP.md` sans perdre le travail déjà fait. + +#### Ce que ce workflow démontre + +- **`/status`** est le point d'entrée naturel après une pause — snapshot complet en 1 commande. +- **GSD v2 `step mode`** est préférable à `auto` après une longue pause — permet de vérifier que les décisions sont toujours valides. +- **`.gsd/ROADMAP.md`** est la source de vérité du progress — parsé par `/status` et par GSD lui-même. +- **`/gsd discuss`** permet de modifier l'architecture en cours de route sans recommencer depuis zéro. + +--- + +## Cas de figure — corrections v2.5.0 validées + +--- + +### Cas P — `/init-project` détecte `.claude/CLAUDE.md` + +**Contexte :** projet Node.js/Express avec CLAUDE.md dans `.claude/` (pas à la racine). + +**Avant v2.5.0 :** `ls CLAUDE.md` ne trouvait rien → 6 questions pour redécouvrir le stack. + +**Avec v2.5.0 :** +``` +/init-project "Ajouter notifications push" + +STEP 1: ls CLAUDE.md .claude/CLAUDE.md → .claude/CLAUDE.md FOUND +📄 Existing CLAUDE.md found — using as context. + +Questions posées (manquantes seulement): + → Service push ? (Firebase/OneSignal/APNs ?) + → Types ? (in-app/email/mobile ?) + +Questions SKIP (déjà dans .claude/CLAUDE.md): + → Stack (Node.js 20 / Express / MongoDB) ✓ + → Purpose ✓ +``` +2 questions au lieu de 6. + +--- + +### Cas Q — `/status` avec GSD v2 et ROADMAP.md présent + +**Contexte :** projet CardForge avec `.gsd/ROADMAP.md` contenant des checkboxes GSD. + +**Avant v2.5.0 :** `cat .gsd/STATUS.md` → fichier inexistant → `"no STATUS.md"`. + +**Avec v2.5.0 :** +``` +/status + +PHASE 3 — parse ROADMAP.md: + - [x] Slice 1 — Schema DB ✓ + - [x] Slice 2 — Auth JWT ✓ + - [x] Slice 3 — Collection cards ✓ + - [ ] Slice 4 — Boutique Stripe (en cours) + - [ ] Slice 5 — PvP + ... + +GSD v2 + Status : initialized + Milestone : Milestone 2 — Boutique in-app + Progress : 3/7 slices done (43%) +``` + +--- + +### Cas R — `/status` avec `.gsd/` vide (pas de ROADMAP.md) + +**Contexte :** `gsd init` fait mais `/gsd discuss` pas encore lancé. + +``` +/status + +GSD v2 + Status : initialized + Milestone : N/A + Progress : N/A + + GSD v2 initialized — no ROADMAP.md yet. + Run /gsd init or /gsd discuss to create one. +``` + +Message actionnable au lieu d'une erreur silencieuse. + +--- + +### Cas S — `doctor.sh` détecte `status-reporter.md` manquant + +**Contexte :** installation v2.3.0 ou antérieure — `status-reporter.md` n'existait pas. + +``` +bash doctor.sh + +── Consistency ── + ✓ All skills have disable-model-invocation + ⚠ Missing agents: status-reporter.md — run: bash link.sh + ✓ No CRLF line endings detected +``` + +Sans ce check : `/status` chargerait un agent inexistant → erreur cryptique. + +--- + +### Cas T — session-start avec 6 plugins actifs (tous affichés) + +**Avant v2.5.0 :** `gstack frontend-design +4 more` — 4 plugins masqués. + +**Avec v2.5.0 :** +``` +┌─ Claude Code config ──────────────────────────────────┐ +│ ✅ ON : security-guidance rtk superpowers │ +│ 🟢 ON : gstack frontend-design ui-ux-pro-max context7│ +│ + ruflo skill-creator │ +│ ⚫ OFF : none │ +│ 💰 ~5750t passif (52% budget) │ +│ 📦 v2.5.0 │ +└───────────────────────────────────────────────────────┘ +``` + +Tous les noms visibles, box alignée. + +--- + +### Cas U — onboarder crée `.gitignore` pour protéger `settings.local.json` + +**Contexte :** monorepo, Option B (apps/api/), aucun `.gitignore` dans le package. + +``` +/onboard B apps/api + +PHASE 5b — .gitignore check: + ls .gitignore → absent + + Créé: apps/api/.gitignore + # claude-config — personal settings (never commit) + .claude/settings.local.json + +📝 Created .gitignore with .claude/settings.local.json entry +``` + +Sans ce check : `settings.local.json` risquait d'être commité avec les clés API et credentials. + +--- + +--- + +### Exemple 9 — Firmware C/C++ embarqué (workflow sans superpowers) + +**Contexte :** firmware pour microcontrôleur STM32 (C, bare-metal). Pas de réseau, pas de frontend, pas de Docker. L'outillage standard de superpowers (brainstorming Socratique, subagent pipeline) est surdimensionné pour ce contexte. + +**Setup plugins :** +``` +/plugin-check "Firmware C STM32, bare-metal, pas de réseau, pas de frontend, pas de Docker" + +SIGNALS: simple, CLI/embedded +COST: ~800t (superpowers seul) + +RECOMMENDATIONS: + OK KEEP : superpowers (peut être utile pour brainstorm initial) + DISABLE : frontend-design, ui-ux-pro-max, gstack, context7, ruflo + NOTE : Pour un firmware vraiment simple (hotfix, modification ciblée), + même superpowers peut être désactivé → ~0t passif +``` + +**Workflow minimaliste — modification d'un driver existant :** + +``` +# Pas de /init-project, pas de GSD, pas de superpowers + +# 1. Comprendre avant de modifier +/analyze src/drivers/uart.c + +OUTPUT: + ANALYSIS: src/drivers/uart.c + CONTEXT: Driver UART pour STM32F4, DMA en mode circulaire + KEY COMPONENTS: + uart_init(): 45 lignes — config registres + DMA + uart_send(): 12 lignes — écriture dans ring buffer + UART_IRQHandler(): 28 lignes — ISR, gère overrun + RISKS: + - uart_init() dépasse 25 lignes → split candidat + - Accès non-atomique à ring_buffer_head dans ISR — probability: high + OPEN QUESTIONS: + - Quid si DMA transfer pas terminé avant appel uart_send() ? +``` + +**Modification chirurgicale :** +``` +/ship-feature "Corriger l'accès non-atomique au ring_buffer_head dans l'ISR" + +STEP 0b — CLAUDE.md found +STEP 0 — plugin check: superpowers OK (ou désactivé si YOLO mode) + +STEP 1 — BRAINSTORM (rapide, contexte déjà clair depuis /analyze): + Design: protéger ring_buffer_head avec __disable_irq()/__enable_irq() + ou utiliser un flag volatile + memory barrier + +STEP 3 — VALIDATION GATE: + TASKS: 2 + 1. [src/drivers/uart.c] Ajouter protection atomique dans UART_IRQHandler + 2. [tests/test_uart.c] Ajouter test simulant ISR concurrent + +STEP 4 — IMPLEMENT (subagents légers, modifications chirurgicales) +``` + +**Alternative : workflow encore plus minimaliste (sans /ship-feature) :** +``` +# Pour un hotfix ultra-ciblé, ignorer l'orchestrateur +/analyze src/drivers/uart.c # comprendre +# → modifier directement avec Edit tool +# → vérifier avec make + flash sur hardware +``` + +**Points clés :** +- `/plugin-check` confirme "superpowers seulement" → aucun plugin inutile actif. +- `/analyze` est particulièrement utile sur du code C bas-niveau : l'analyzer identifie les accès non-atomiques, les race conditions, les violations de normes, **sans proposer de fix**. +- Pour un firmware, le workflow `analyze → ship-feature` peut se réduire à `analyze → edit direct` si la modification est triviale. +- GSD v2 n'est jamais pertinent pour du firmware : les sessions sont courtes et les tâches atomiques. + +--- + +## Cas de figure — corrections v2.6.0 validées + +--- + +### Cas V — `/status` compte les slices, pas les tasks + +**Contexte :** `.gsd/ROADMAP.md` avec 3 milestones, chacun subdivisé en slices (`###`) contenant des tasks (`- [ ]`). + +**Avant v2.6.0 :** comptait `- [x]` = nombre de tasks terminées → résultat faux (ex: `6/8 "slices"` alors que c'était des tasks). + +**Avec v2.6.0 :** +``` +ROADMAP.md: + ## Milestone 1 — Auth [x] + ### Slice 1 — JWT setup [x] ← slice terminée + ### Slice 2 — Login UI [x] ← slice terminée + ## Milestone 2 — Boutique + ### Slice 3 — Cart UI [x] ← slice terminée + ### Slice 4 — Stripe checkout ← en cours + ### Slice 5 — Webhook handler ← en attente + +/status → GSD v2 : Progress = 3/5 slices done (60%) + Milestone actuel : Milestone 2 — Boutique +``` + +3/5 correspond exactement au dashboard GSD v2. + +--- + +### Cas W — `/ship-feature` affiche le contexte projet dès STEP 0b + +**Avant v2.6.0 :** STEP 0b trouvait CLAUDE.md → continuait silencieusement. Pas de rappel de contexte. + +**Avec v2.6.0 :** +``` +/ship-feature "Ajouter webhook Stripe" + +STEP 0b — CLAUDE.md found +📋 PROJECT CONTEXT + Project : CardForge + Stack : React 18 + FastAPI + PostgreSQL + Docker + Branch : feature/stripe-integration + Recent : feat: add cart persistence + feat: implement collection display + chore: setup Stripe SDK + GSD : Milestone 2 — Boutique (3/5 slices) + +→ STEP 1 — BRAINSTORM +``` + +Developer se réoriente instantanément — pas de risque d'implémenter sur la mauvaise branche. + +--- + +### Cas X — session-start : 6 plugins actifs, tous affichés + +``` +┌─ Claude Code config ──────────────────────────────────┐ +│ ✅ ON : security-guidance rtk superpowers │ +│ 🟢 ON : gstack frontend-design ui-ux-pro-max context7│ +│ ruflo skill-creator │ +│ ⚫ OFF : none │ +│ 💰 ~5750t passif (52% budget) │ +│ 📦 v2.6.0 │ +└───────────────────────────────────────────────────────┘ +``` + +Tous les 6 plugins actifs visibles. Ligne de continuation alignée avec la ligne principale. + +--- + +### Cas Y — Exemple 8 en action : reprise de session CardForge + +``` +# Dans Claude Code +/status +→ 3/5 slices, branche feature/stripe-integration, 1 fichier uncommitted + +# Dans un terminal +gsd +/gsd (step mode — relire le plan avant d'exécuter) + +# Architecture change détectée pendant la pause +/gsd discuss "Je veux PaymentElement pas CardElement" +→ Plan mis à jour + +# Reprendre l'exécution autonome +/gsd auto +→ GSD exécute Slice 4 avec le plan mis à jour, commits propres +``` + +Cycle complet : orientation → vérification plan → décision → exécution. Zero perte de contexte. + +--- + +## Cas de figure — corrections v2.7.0 validées + +--- + +### Cas Z1 — `/status` détecte le bon milestone courant + +**Avant v2.7.0 :** `grep -E '^## ' | tail -5` → retournait les 5 derniers headings `##`, pouvait inclure des milestones **terminés** comme courant. + +**Avec v2.7.0 :** +``` +ROADMAP.md: + ## Milestone 1 — Auth [x] + ### Slice 1 — JWT [x] + ## Milestone 2 — Boutique + ### Slice 3 — Cart UI [x] + ### Slice 4 — Stripe checkout ← première slice en attente + +awk scan top-to-bottom: + → Slice 4 n'a pas [x] → milestone courant = "Milestone 2 — Boutique" ✓ +``` + +--- + +### Cas Z2 — `/status` affiche l'état des tests + +**Contexte :** projet Python, dernier pytest avec 1 test échoué. + +``` +/status + +PROJECT + CLAUDE.md : found + Stack : FastAPI / PostgreSQL + Branch : feature/notifications + Uncommitted : 2 files + Tests : 1 failing (test_email_worker.py::test_retry) +``` + +Developer voit immédiatement le test cassé avant de relancer GSD. + +--- + +### Cas Z3 — `/ship-feature` : commits tronqués à 50 chars + +``` +📋 PROJECT CONTEXT + Recent : a1b2c3d feat: add Stripe PaymentIntent creation wi... + e4f5g6h fix: jwt token refresh not working on mobi... + i7j8k9l chore: update all dependencies to latest v... +``` + +Messages complets disponibles via `git log` — le contexte PROJECT affiche uniquement les 50 premiers caractères. + +--- + +### Cas Z4 — `doctor.sh` détecte `lib/` non symlinké + +``` +bash doctor.sh + +── Symlinks ── + ✓ ~/.claude/CLAUDE.md + ... + ⚠ ~/.claude/lib exists but is NOT a symlink + ✓ ~/.claude/hooks/session-start.sh + → Symlinks: 6/7 OK + +Fix: mv ~/.claude/lib ~/.claude/lib.bak && bash link.sh +``` + +Si `lib/` n'est pas un symlink vers le repo, `detect-plugins.sh` sourcé est la version installée localement — potentiellement périmée. + +--- + +### Cas Z5 — plugin-advisor warn sur skill-creator inactif + +**Contexte :** projet React SaaS, `skill-creator` resté actif par oubli. + +``` +/plugin-check "React SaaS avec FastAPI" + +SIGNALS: frontend, deploy, fast-libs(React) + +WARN: skill-creator ON — aucun signal skill-creation détecté + → ~100t économisés si désactivé + → Activer uniquement quand vous créez des skills custom +``` + +--- + +### Cas Z6 — Firmware C STM32 : aucun plugin inutile + +``` +/plugin-check "Firmware C STM32, bare-metal, I2C driver" + +SIGNALS: simple, embedded +COST: ~800t (superpowers seul) + +DISABLE: frontend-design, ui-ux-pro-max, gstack, context7, ruflo, skill-creator +NOTE: Pour hotfix ultra-ciblé, superpowers aussi optionnel +``` + +Pipeline complet disponible : `/analyze` → `/ship-feature` avec 0 overhead de plugins inutiles. Voir Exemple 9 pour le détail. + +--- + +## Cas de figure — corrections v2.8.0 validées + +--- + +### Cas AA — awk portable : milestone courant sur macOS et Linux + +``` +ROADMAP: + ## Milestone 1 — Auth [x] + ### Slice 1 — JWT [x] + ## Milestone 2 — Boutique + ### Slice 3 — Cart UI [x] + ### Slice 4 — Stripe checkout ← pas de [x] + +awk scan (index() au lieu de regex): + ## Milestone 2 → ms = "## Milestone 2 — Boutique" + ### Slice 3 [x] → index = 14 ≠ 0 → skip + ### Slice 4 → index = 0 → PRINT "## Milestone 2" → EXIT ✓ +``` + +Fonctionne identiquement sur GNU awk (Linux) et nawk (macOS). + +--- + +### Cas AB — Tests field : fallback sur la commande de test + +``` +Projet Node.js, pas de run récent, mais package.json présent: + +/status → Tests: run 'jest --coverage' to check + +Projet Rust (pas de CI log): +/status → Tests: run 'cargo test' to check + +Firmware C (pas de test infra du tout): +/status → Tests: N/A +``` + +Plus jamais "unknown" quand il y a un test script défini. + +--- + +### Cas AC — signal `embedded` sur firmware ESP32 + +``` +/plugin-check "Firmware ESP32 WiFi driver, FreeRTOS, C" + +SIGNALS: embedded (ESP32, Firmware, FreeRTOS détectés) +NOTE: embedded project detected — minimal plugin footprint + +RECOMMENDATIONS: + superpowers OPTIONAL + DISABLE: tout le reste (frontend-design, gstack, context7, ruflo, skill-creator) + gsd v2: NOT recommended + +Workflow: /analyze src/wifi_driver.c → /ship-feature si multi-fichiers +COST: ~800t (ou 0 si superpowers désactivé) +``` + +--- + +### Cas AD — doctor.sh liste les 8 agents + +``` +── Consistency ── + ✓ All 8 agents present (analyzer, interviewer, plugin-advisor, readme-updater, + refactorer, scaffolder, onboarder, status-reporter) +``` + +Confirme visuellement la présence de `onboarder` et `status-reporter` (ajoutés en v2.4.0). + +--- + +### Cas AE — Arbre de décision "Quel skill utiliser ?" + +| Situation | Skill | +|---|---| +| Bug dans API FastAPI existante | `/ship-feature` | +| Comprendre un module avant modifier | `/analyze` | +| Reprise après 4 jours | `/status` | +| Install Claude Code cassée | `/health` | +| App Flutter from scratch | `/init-project` | +| Quels plugins pour React ? | `/plugin-check` | + +L'arbre de décision est maintenant disponible en début de USAGE.md (section "Quel skill utiliser ?"). + +--- + +## Cas de figure — corrections v2.9.0 validées + +--- + +### Cas AF — signal `embedded` détecté depuis le filesystem + +**Contexte :** dossier firmware ESP32, `platformio.ini` présent, `src/*.c`, pas de `package.json`. L'utilisateur tape `/plugin-check` sans argument. + +**Avant v2.9.0 :** aucun signal détecté → recommandations génériques. + +**Avec v2.9.0 :** +``` +/plugin-check (sans argument, depuis le dossier firmware) + +PHASE 1 filesystem scan: + platformio.ini → FOUND → signal embedded + +SIGNALS: embedded (platformio.ini) +NOTE: embedded project detected — minimal plugin footprint + +KEEP : superpowers (optional) +DISABLE: frontend-design, ui-ux-pro-max, gstack, context7, ruflo, skill-creator +gsd v2 : NOT recommended (sessions courtes, tâches atomiques) +``` + +--- + +### Cas AG — ROADMAP.md flat (pas de `###` slices) + +**Contexte :** GSD v2 initialisé avec un ROADMAP minimal : tasks directement sous `##`, sans `### Slice`. + +**Avant v2.9.0 :** awk ne trouvait aucun `###` → retournait `"all milestones complete"` → faux. + +**Avec v2.9.0 :** +``` +ROADMAP: + ## Milestone 2 — Core + - [x] Create models + - [ ] Implement CRUD ← task en attente + +awk fallback flat: + → "## Milestone 2 — Core (flat)" + +/status → GSD v2: Milestone 2 — Core (flat) +``` + +--- + +### Cas AH — pytest cache `{}` = all passing + +**Avant v2.9.0 :** `cat .pytest_cache/.../lastfailed` affichait `{}` littéralement. + +**Avec v2.9.0 :** +```python +d = json.load(open('.pytest_cache/v/cache/lastfailed')) +# d = {} → n = 0 +# Output: "pytest: all passing" +``` + +--- + +### Cas AI — Refactoring profond : cycle `/analyze` → `/refactor` → `/analyze` + +``` +# Étape 1 : comprendre avant de toucher +/analyze src/payment/ +→ RISKS: process_payment 95 lignes, global non-mockable, 0 tests + +# Étape 2 : corriger sur la base du rapport +/refactor src/payment/ +→ split, injection, tests ajoutés + +# Étape 3 : confirmer que les violations sont résolues +/analyze src/payment/ +→ VIOLATIONS FIXED: 95→18 lignes, injectable ✓ +→ TESTS: 8 passing +``` + +Ce cycle est maintenant documenté dans l'arbre de décision ("Quel skill utiliser ?"). + +--- + +### Cas AJ — README renvoie vers USAGE.md + +``` +# claude-config + +Global Claude Code configuration... + +> Guide d'utilisation complet : voir USAGE.md — workflows typiques, exemples +> par type de projet, arbre de décision, cas validés... +``` + +Un nouvel utilisateur trouve immédiatement le guide pratique. + +--- + +## Cas de figure — corrections v3.0.0 validées + +--- + +### Cas AK — Rust FFI : plus de faux positif embedded + +**Contexte :** bibliothèque Rust avec bindings C (FFI). `tests/c_binding_test.c` présent mais c'est du Rust, pas du firmware. + +**Avant v3.0.0 :** présence de `.c` → signal embedded → recommandations firmware inutiles. + +**Avec v3.0.0 :** +``` +PHASE 1: ls platformio.ini → absent, ls *.ld → absent +Signal embedded: NOT detected ✓ + +SIGNALS: none (Rust library) +→ workflow normal Rust, superpowers + context7 +``` + +Seuls `platformio.ini` ou un linker script `*.ld` déclenchent le signal embedded. + +--- + +### Cas AL — ROADMAP avec `## Prerequisites` (faux positif évité) + +**Contexte :** ROADMAP.md avec sections `## Overview`, `## Prerequisites`, puis `## Milestone 1`. + +**Avant v3.0.0 :** awk flat matchait `## Prerequisites → - [ ] Node 22` → fausse progression. + +**Avec v3.0.0 :** +``` +awk scoped: + ## Overview → ms="" (non-Milestone) + - [ ] review → ms="" → SKIP ✓ + ## Prerequisites → ms="" (non-Milestone) + - [ ] Node 22 → ms="" → SKIP ✓ + ## Milestone 1 — Auth → ms="## Milestone 1" + - [ ] Login UI → PRINT "## Milestone 1 (flat)" ✓ +``` + +--- + +### Cas AM — Projet Go : commande de test affichée + +``` +/status (projet Go avec go.mod) + +Tests: run 'go test ./...' to check +``` + +Couverture: Python (`pytest`), Node.js (`jest`), Rust (`cargo test`), Go (`go test ./...`). + +--- + +### Cas AN — `/analyze` : mode DEBUG découvrable via argument-hint + +``` +Dans Claude Code, argument-hint visible: + /analyze + +→ /analyze "TypeError at CartSummary.tsx:47 — Cannot read 'map' of undefined" +→ DEBUG MODE activé automatiquement ✓ +``` + +--- + +### Cas AO — GSD v2 interrompu : reprise depuis l'arbre de décision + +``` +Arbre: "Session GSD v2 interrompue ?" +→ gsd → /gsd auto (reprend depuis .gsd/) +→ /gsd steer (modifier le plan) +→ /gsd forensics (analyser un échec) +``` + +GSD v2 reprend automatiquement depuis `.gsd/` — l'utilisateur n'a pas besoin de recommencer. + +--- + +## Cas de figure — corrections v3.1.0 validées + +--- + +### Cas AP — STM32 avec Makefile+C : signal embedded retrouvé + +**Contexte :** firmware STM32, `Makefile` + `src/main.c`, pas de `platformio.ini`, pas de `*.ld` séparé (linker inline dans Makefile). + +**Avant v3.1.0 :** `Makefile` retiré en v3.0.0 → signal absent → recommandations génériques. + +**Avec v3.1.0 :** +``` +PHASE 1: ls Makefile → FOUND, ls src/*.c → 3 fichiers C + ls package.json Cargo.toml go.mod → absent + +Signal embedded: DETECTED (Makefile + .c + no ecosystem) +→ DISABLE all toggles, superpowers optional ✓ +``` + +--- + +### Cas AQ — Rust FFI : toujours pas de faux positif + +``` +Cargo.toml présent + src/ffi.c +→ Signal embedded: NOT detected (Cargo.toml = contre-indicateur) ✓ +``` + +--- + +### Cas AR — Onboarder PHASE 6 : ROADMAP.md généré même sans GSD installé + +**Avant v3.1.0 :** `gsd init` échouait silencieusement si GSD absent. + +**Avec v3.1.0 :** +``` +PHASE 6 — command -v gsd → NOT FOUND + +⚠️ GSD v2 not installed — run: npm install -g gsd-pi +ROADMAP.md generated (ready to use once GSD is installed). +After installing: gsd → /gsd auto +``` + +ROADMAP.md est utile même sans GSD installé — l'utilisateur peut l'installer plus tard. + +--- + +### Cas AS — `doctor.sh` détecte skill `/status` manquant + +``` +bash doctor.sh + +── Consistency ── + ⚠ Missing skills: status/ — run: bash link.sh + ✓ All 8 agents present (...) +``` + +--- + +### Cas AT — Token cost visible sur les patterns + +``` +### Pattern A — Nouveau projet court (≤1 session) · ~3000-5000t + +Budget Pro note: + /init-project ≈ 3000-5000t ≈ 30-45% d'une session Pro (~11k tokens) + Planifier les grosses features sur des sessions séparées. +``` + +--- + +## Erreurs fréquentes — diagnostic rapide + +| Erreur / Symptôme | Cause probable | Solution | +|---|---|---| +| `⚠️ No CLAUDE.md found` | `/ship-feature` dans un projet non onboardé | `/onboard` d'abord, puis relancer | +| `command not found: gsd` | GSD v2 non installé ou pas dans PATH | `npm install -g gsd-pi` puis `source ~/.bashrc` | +| `MISSING: ~/.claude/templates` dans doctor.sh | Installation pre-v2.0.0, `link.sh` pas rejoué | `cd /path/to/claude-config && bash link.sh` | +| Scaffolder échoue sur projet Flutter | `flutter` non installé ou pas dans PATH | Installer Flutter SDK, puis `flutter doctor` | +| Scaffolder échoue sur projet Expo | `npx` non disponible ou Node < 18 | `node --version` → mettre à jour Node si < 18 | +| Plugin-check recommande gstack sur mobile | Signal `mobile` non détecté (manque RN/Expo/Flutter dans description) | Ajouter "React Native" ou "Flutter" explicitement dans le prompt | +| Plugin-check recommande gstack sur monorepo sans browser QA | Signal `monorepo` non détecté | Vérifier que `apps/` ou `turbo.json` est détecté ; relancer depuis la racine du monorepo | +| Session-start box mal alignée | Version < v2.3.0 | Mettre à jour depuis l'archive v2.3.0+ | +| `/init-project` pose des questions déjà dans le prompt | Prompt incomplet (stack ou features manquants) | Ajouter stack, features v1, et conventions dans le prompt initial | +| STEP 13 `gsd init` : "command not found" | GSD v2 non installé au moment de init-project | `npm install -g gsd-pi`, puis `/onboard add gsd` | +| Plugin-check recommande plugins web sur firmware | signal `embedded` non détecté | Vérifier: `platformio.ini` ou `*.ld` présent, ou `Makefile` + `.c` + pas de `package.json`/`Cargo.toml`/`setup.py` | +| `detect_ruflo` retourne faux positif | `claude-flow` ou `ruvnet` dans un autre fichier config | Inspecter `~/.claude.json` et `~/.mcp.json` manuellement | +| `doctor.sh` : deny rules count mismatch | `settings.json` modifié manuellement | Vérifier avec `python3 -c "import json; print(len(json.load(open('~/.claude/settings.json'))['permissions']['deny']))"` — attendu : 100 | +| Subagent échoue en STEP 4, pas de guidance | Version < v2.2.0 | Mettre à jour, le STEP 4b est ajouté en v2.2.0 | +| `/analyze` ne passe pas en mode DEBUG | L'erreur n'est pas passée en argument | Copier l'erreur exacte dans l'argument : `/analyze "FAILED test_foo — TypeError: ..."`| +| GStack skills/ manquant | Submodule initialisé mais `./setup` pas exécuté | `cd skills-external/gstack && ./setup` | + +--- + +## Référence rapide — signaux → plugins + +``` +Description contient... → Plugin +───────────────────────────────────────────────────── +React / Vue / Svelte → frontend-design ON +Next.js 13+ / App Router → context7 WARN +Prisma / Supabase → context7 ON +"design élaboré" / tokens → ui-ux-pro-max ON +Docker + QA browser → gstack ON +"plusieurs semaines" → gsd v2 CLI +"5+ agents parallèles" → ruflo ON +Rust / Python / Go / C → tout OFF sauf superpowers +Mobile / Flutter / RN → frontend-design ON, gstack OFF +Hotfix / script rapide → tout OFF sauf superpowers +``` diff --git a/agents/analyzer.md b/agents/analyzer.md index 22fb568..69090f1 100644 --- a/agents/analyzer.md +++ b/agents/analyzer.md @@ -67,3 +67,52 @@ OPEN QUESTIONS: ``` Update project memory with discovered patterns and conventions. + +--- + +## DEBUG MODE + +Activated when called with a failing test, error output, or broken build as target. + +### INPUTS EXPECTED +- Exact error message or stack trace +- File(s) involved +- Last action that triggered the failure + +### PROCESS +1. Read all files mentioned in the error (no guessing) +2. Trace execution path from entry point to failure site +3. Identify the exact line/expression that produces the error +4. List all state at the point of failure (vars, imports, types) + +### OUTPUT FORMAT (DEBUG MODE) + +``` +DEBUG ANALYSIS: + +ERROR: + + +TRACE: + + +ROOT CAUSE HYPOTHESES (ordered by probability): + 1. [HIGH] — evidence: + 2. [MED] — evidence: + 3. [LOW] — evidence: + +AFFECTED FILES: + - : + +WHAT TO VERIFY NEXT: + - — expected result if hypothesis 1 is correct + - + +DO NOT TOUCH: + - +``` + +Rules in DEBUG MODE: +- Never propose a fix. Only diagnose. +- Never touch files. +- Stop after the report. The orchestrator or user decides next steps. diff --git a/agents/interviewer.md b/agents/interviewer.md index af1acf9..f0eb232 100644 --- a/agents/interviewer.md +++ b/agents/interviewer.md @@ -1,6 +1,6 @@ --- name: interviewer -description: Gather all information needed to initialize a project. Asks targeted questions, synthesizes answers into a complete PROJECT BRIEF. Use as the first step of any project initialization. +description: Gather project info. Ask targeted questions, produce PROJECT BRIEF. First step of project init. tools: Read model: sonnet --- @@ -8,126 +8,56 @@ model: sonnet # INTERVIEWER ## ROLE -Gather all necessary context before any design or implementation begins. - -## GOAL -Produce a complete, unambiguous PROJECT BRIEF that all subsequent agents -can use as their single source of truth. - ---- +Gather context. Produce complete PROJECT BRIEF as single source of truth. ## BEHAVIOR -- Ask ALL questions upfront in a single structured block. -- Never make assumptions about missing information. -- If the user's initial prompt already answers some questions clearly, - skip those and only ask what remains genuinely unclear. -- Group questions logically so the user can answer efficiently. -- After receiving answers, synthesize everything into a PROJECT BRIEF. -- If any answer is ambiguous or contradictory, ask one follow-up before - producing the brief. +- If the initial prompt already provides name + purpose + stack + features + architecture → skip questions and generate the BRIEF directly. +- Otherwise ask only what's genuinely missing, in a single structured block. +- After answers: produce BRIEF. One follow-up allowed if answer is ambiguous. ---- +## QUESTIONS (skip answered ones) -## QUESTION GROUPS - -Present questions in this order, skipping any already answered -by the initial prompt: - -### 1. PROJECT IDENTITY -- What is the project name? -- What is the project's purpose in one sentence? -- Who are the target users? - -### 2. CORE FEATURES -- List the top 5–10 features the first version must include. -- Which features are strictly out of scope for now? - -### 3. TECH STACK -- Preferred language(s)? -- Framework(s) if applicable? -- Database / storage needs? -- External APIs or services to integrate? -- Any hard constraint on dependencies (license, size, etc.)? - -### 4. ARCHITECTURE & DEPLOYMENT -- Where will this run? (local, cloud, Docker, embedded, etc.) -- Expected scale / performance constraints? -- Monolith, microservices, library, CLI, or other? -- Any existing codebase or code to integrate? - -### 5. QUALITY & WORKFLOW -- Minimum test coverage expected? -- Specific linting / formatting tools required? -- CI/CD pipeline needed? -- Any exceptions to the global CLAUDE.md coding rules for this project? - -### 6. CONVENTIONS -- Naming style preferences (snake_case, camelCase, PascalCase, etc.)? -- Any domain-specific terminology to use consistently? -- Language for code comments and docs (English strongly recommended)? - ---- +1. PROJECT: name, purpose (1 sentence), target users +2. FEATURES: top 5–10 v1 features, what's out of scope +3. STACK: language, framework, DB, external APIs, dependency constraints +4. ARCH: runtime (local/cloud/Docker/embedded), scale, shape (monolith/micro/lib/CLI), existing code? +5. QUALITY: test coverage, lint/format tools, CI/CD, exceptions to global CLAUDE.md rules +6. CONVENTIONS: naming style, domain terms, comment language (English recommended) ## OUTPUT — PROJECT BRIEF -After gathering answers, produce this document exactly: - ``` -================================================================ -PROJECT BRIEF -================================================================ +PROJECT: +PURPOSE: +USERS: +LANG: -PROJECT NAME : -PURPOSE : -TARGET USERS : -LANGUAGE : - ----------------------------------------------------------------- STACK ----------------------------------------------------------------- -Language : -Framework : -Database : -External services : -Runtime target : -Architecture : + Language : + Framework: + DB : + Services : + Runtime : + Shape : ----------------------------------------------------------------- -CORE FEATURES (v1) ----------------------------------------------------------------- -1. -2. -... +V1 FEATURES + 1. + ... + OUT OF SCOPE: -OUT OF SCOPE -- - ----------------------------------------------------------------- QUALITY ----------------------------------------------------------------- -Tests : -Lint / Format : -CI/CD : + Tests : + Lint : + CI/CD : ----------------------------------------------------------------- CONVENTIONS ----------------------------------------------------------------- -Naming :