Browse Source

refactor: Consolidate commands and enhance plan.md

- Remove deprecated commands: agent-genesis, g-slave, init-tools,
  loadplan, saveplan, showplan
- Significantly enhance plan.md with expanded functionality
- Rename test.md to testgen.md with improved test generation
- Update plugin.json and README to reflect command changes
- Update DASH.md and settings.local.json

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0xDarkMatter 4 months ago
parent
commit
7c56f24bda
13 changed files with 1366 additions and 2152 deletions
  1. 11 10
      .claude-plugin/plugin.json
  2. 8 3
      .claude/settings.local.json
  3. 18 20
      README.md
  4. 0 334
      commands/agent-genesis.md
  5. 0 299
      commands/g-slave.md
  6. 0 227
      commands/init-tools.md
  7. 0 251
      commands/loadplan.md
  8. 542 222
      commands/plan.md
  9. 0 231
      commands/saveplan.md
  10. 0 174
      commands/showplan.md
  11. 0 370
      commands/test.md
  12. 779 0
      commands/testgen.md
  13. 8 11
      docs/DASH.md

+ 11 - 10
.claude-plugin/plugin.json

@@ -17,15 +17,12 @@
     "commands": [
     "commands": [
       "commands/sync.md",
       "commands/sync.md",
       "commands/plan.md",
       "commands/plan.md",
-      "commands/saveplan.md",
-      "commands/loadplan.md",
-      "commands/showplan.md",
       "commands/review.md",
       "commands/review.md",
-      "commands/test.md",
+      "commands/testgen.md",
       "commands/explain.md",
       "commands/explain.md",
-      "commands/agent-genesis.md",
-      "commands/g-slave.md",
-      "commands/init-tools.md",
+      "commands/spawn.md",
+      "commands/delegate.md",
+      "commands/setperms.md",
       "commands/pulse.md"
       "commands/pulse.md"
     ],
     ],
     "agents": [
     "agents": [
@@ -46,23 +43,27 @@
       "agents/project-organizer.md",
       "agents/project-organizer.md",
       "agents/python-expert.md",
       "agents/python-expert.md",
       "agents/react-expert.md",
       "agents/react-expert.md",
-      "agents/rest-expert.md",
       "agents/sql-expert.md",
       "agents/sql-expert.md",
-      "agents/tailwind-expert.md",
       "agents/typescript-expert.md",
       "agents/typescript-expert.md",
       "agents/vue-expert.md",
       "agents/vue-expert.md",
       "agents/wrangler-expert.md"
       "agents/wrangler-expert.md"
     ],
     ],
     "skills": [
     "skills": [
-      "skills/agent-discovery",
       "skills/code-stats",
       "skills/code-stats",
       "skills/data-processing",
       "skills/data-processing",
+      "skills/file-search",
+      "skills/find-replace",
       "skills/git-workflow",
       "skills/git-workflow",
+      "skills/mcp-patterns",
       "skills/project-docs",
       "skills/project-docs",
       "skills/project-planner",
       "skills/project-planner",
       "skills/python-env",
       "skills/python-env",
+      "skills/rest-patterns",
       "skills/safe-file-reader",
       "skills/safe-file-reader",
+      "skills/sql-patterns",
+      "skills/sqlite-ops",
       "skills/structural-search",
       "skills/structural-search",
+      "skills/tailwind-patterns",
       "skills/task-runner",
       "skills/task-runner",
       "skills/tool-discovery"
       "skills/tool-discovery"
     ],
     ],

+ 8 - 3
.claude/settings.local.json

@@ -41,12 +41,17 @@
       "Bash(certutil -hashfile:*)",
       "Bash(certutil -hashfile:*)",
       "Bash(grep:*)",
       "Bash(grep:*)",
       "Bash(xargs basename:*)",
       "Bash(xargs basename:*)",
-      "Bash(FIRECRAWL_API_KEY=fc-62620190118f4aa0907781f3f6f3278e python scripts/pulse_fetch.py:*)",
-      "Bash(FIRECRAWL_API_KEY=fc-62620190118f4aa0907781f3f6f3278e python:*)",
       "Bash(dir:*)",
       "Bash(dir:*)",
       "Bash(cut:*)",
       "Bash(cut:*)",
       "Bash(tr:*)",
       "Bash(tr:*)",
-      "Bash(test:*)"
+      "Bash(test:*)",
+      "Bash(gemini --version:*)",
+      "Bash(gemini:*)",
+      "Bash(codex:*)",
+      "Bash(printenv:*)",
+      "Bash(sed:*)",
+      "Bash(perplexity:*)",
+      "Bash(findstr:*)"
     ],
     ],
     "deny": [],
     "deny": [],
     "ask": []
     "ask": []

+ 18 - 20
README.md

@@ -2,13 +2,13 @@
 
 
 A comprehensive extension toolkit for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) that transforms your AI coding assistant into a powerhouse development environment.
 A comprehensive extension toolkit for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) that transforms your AI coding assistant into a powerhouse development environment.
 
 
-**21 expert agents. 12 slash commands. 18 skills. One plugin install.**
+**21 expert agents. 9 slash commands. 18 skills. One plugin install.**
 
 
 ## Why claude-mods?
 ## Why claude-mods?
 
 
 Claude Code is powerful out of the box, but it has gaps. This toolkit fills them:
 Claude Code is powerful out of the box, but it has gaps. This toolkit fills them:
 
 
-- **Session continuity** — TodoWrite tasks vanish when sessions end. We fix that with `/saveplan` and `/loadplan`, implementing Anthropic's [recommended pattern](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) for long-running agents.
+- **Session continuity** — TodoWrite tasks vanish when sessions end. We fix that with `/plan --save` and `/plan --load`, implementing Anthropic's [recommended pattern](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) for long-running agents.
 
 
 - **Expert-level knowledge on demand** — 24 specialized agents covering React, TypeScript, Python, AWS, PostgreSQL, and more. Each agent is deeply researched with real-world patterns, not generic advice.
 - **Expert-level knowledge on demand** — 24 specialized agents covering React, TypeScript, Python, AWS, PostgreSQL, and more. Each agent is deeply researched with real-world patterns, not generic advice.
 
 
@@ -34,7 +34,7 @@ Claude Code is powerful out of the box, but it has gaps. This toolkit fills them
 claude-mods/
 claude-mods/
 ├── .claude-plugin/     # Plugin metadata
 ├── .claude-plugin/     # Plugin metadata
 ├── agents/             # Expert subagents (21)
 ├── agents/             # Expert subagents (21)
-├── commands/           # Slash commands (12)
+├── commands/           # Slash commands (9)
 ├── skills/             # Custom skills (18)
 ├── skills/             # Custom skills (18)
 ├── hooks/              # Hook examples & docs
 ├── hooks/              # Hook examples & docs
 ├── rules/              # Claude Code rules
 ├── rules/              # Claude Code rules
@@ -91,16 +91,14 @@ Then symlink or copy to your Claude directories:
 | Command | Description |
 | Command | Description |
 |---------|-------------|
 |---------|-------------|
 | [sync](commands/sync.md) | Session bootstrap - read project context (README, AGENTS, docs, skills, agents). Quick orientation. |
 | [sync](commands/sync.md) | Session bootstrap - read project context (README, AGENTS, docs, skills, agents). Quick orientation. |
-| [loadplan](commands/loadplan.md) | Restore plan session state. Loads TodoWrite tasks, plan progress from saved state. |
-| [saveplan](commands/saveplan.md) | Save plan session state. Persists TodoWrite tasks, current plan step, and git context. |
-| [showplan](commands/showplan.md) | Show plan status: progress, active tasks, git state. Quick read-only view. |
-| [plan](commands/plan.md) | Create and persist project plans. Captures Plan Mode state and writes to git-trackable PLAN.md. |
-| [g-slave](commands/g-slave.md) | Dispatch Gemini CLI to analyze large codebases. Gemini does the grunt work, Claude gets the summary. |
-| [agent-genesis](commands/agent-genesis.md) | Generate Claude Code expert agent prompts for any technology platform. |
+| [plan](commands/plan.md) | Unified planning command: create plans, save/load session state, show status. Interactive by default. |
 | [review](commands/review.md) | Code review staged changes or specific files. Analyzes bugs, security, performance, style. |
 | [review](commands/review.md) | Code review staged changes or specific files. Analyzes bugs, security, performance, style. |
-| [test](commands/test.md) | Generate tests with automatic framework detection (Jest, Vitest, pytest, etc.). |
+| [testgen](commands/testgen.md) | Generate tests with expert routing, framework detection, focus/depth modes. |
 | [explain](commands/explain.md) | Deep explanation of complex code, files, or concepts. Architecture, data flow, design decisions. |
 | [explain](commands/explain.md) | Deep explanation of complex code, files, or concepts. Architecture, data flow, design decisions. |
-| [init-tools](commands/init-tools.md) | Initialize and verify CLI tool dependencies for skills. |
+| [spawn](commands/spawn.md) | Generate expert agents with PhD-level patterns and code examples. |
+| [delegate](commands/delegate.md) | Delegate to external LLMs (Gemini, OpenAI). Use each model's strengths or get consensus. |
+| [pulse](commands/pulse.md) | Generate Claude Code ecosystem news digest from blogs, repos, and community sources. |
+| [setperms](commands/setperms.md) | Set tool permissions and CLI preferences. |
 
 
 ### Skills
 ### Skills
 
 
@@ -217,13 +215,13 @@ just list-agents  # List all agents
 
 
 ## Session Continuity
 ## Session Continuity
 
 
-These commands fill a gap in Claude Code's native session management.
+The `/plan` command fills a gap in Claude Code's native session management.
 
 
 **The problem:** Claude Code's `--resume` flag restores conversation history, but **TodoWrite task state does not persist between sessions—by design**. Claude Code treats each session as isolated; the philosophy is that persistent state belongs in files you control.
 **The problem:** Claude Code's `--resume` flag restores conversation history, but **TodoWrite task state does not persist between sessions—by design**. Claude Code treats each session as isolated; the philosophy is that persistent state belongs in files you control.
 
 
 TodoWrite tasks are stored at `~/.claude/todos/[session-id].json` and deleted when the session ends. This is intentional.
 TodoWrite tasks are stored at `~/.claude/todos/[session-id].json` and deleted when the session ends. This is intentional.
 
 
-**The solution:** `/saveplan` and `/loadplan` implement the pattern from Anthropic's [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents):
+**The solution:** `/plan --save` and `/plan --load` implement the pattern from Anthropic's [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents):
 
 
 > "Every subsequent session asks the model to make incremental progress, then leave structured updates."
 > "Every subsequent session asks the model to make incremental progress, then leave structured updates."
 
 
@@ -242,20 +240,20 @@ TodoWrite tasks are stored at `~/.claude/todos/[session-id].json` and deleted wh
 Session 1:
 Session 1:
   /sync                              # Bootstrap - read project context
   /sync                              # Bootstrap - read project context
   [work on tasks]
   [work on tasks]
-  /saveplan "Stopped at auth module" # Writes .claude/session-cache.json
+  /plan --save "Stopped at auth module"  # Writes .claude/session-cache.json
 
 
 Session 2:
 Session 2:
   /sync                              # Read project context
   /sync                              # Read project context
-  /loadplan                          # Restore TodoWrite, show what changed
+  /plan --load                       # Restore TodoWrite, show what changed
   → "In progress: Auth module refactor"
   → "In progress: Auth module refactor"
   → "Notes: Stopped at auth module"
   → "Notes: Stopped at auth module"
-  /showplan                          # Quick status check anytime
+  /plan --status                     # Quick status check anytime
 ```
 ```
 
 
 ### Why Not Just Use `--resume`?
 ### Why Not Just Use `--resume`?
 
 
-| Feature | `--resume` | `/saveplan` + `/loadplan` |
-|---------|------------|---------------------------|
+| Feature | `--resume` | `/plan --save/--load` |
+|---------|------------|-----------------------|
 | Conversation history | Yes | No |
 | Conversation history | Yes | No |
 | TodoWrite tasks | **No** | Yes |
 | TodoWrite tasks | **No** | Yes |
 | Git context | No | Yes |
 | Git context | No | Yes |
@@ -264,7 +262,7 @@ Session 2:
 | Works across machines | No | Yes (if committed) |
 | Works across machines | No | Yes (if committed) |
 | Team sharing | No | Yes |
 | Team sharing | No | Yes |
 
 
-**Use both together:** `claude --resume` for conversation context, `/loadplan` for task state.
+**Use both together:** `claude --resume` for conversation context, `/plan --load` for task state.
 
 
 ## Updating
 ## Updating
 
 
@@ -282,7 +280,7 @@ PRs welcome. Run `cd tests && just test` before submitting.
 
 
 - [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices) — Official Anthropic guide
 - [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices) — Official Anthropic guide
 - [Claude Code Plugins](https://claude.com/blog/claude-code-plugins) — Plugin system documentation
 - [Claude Code Plugins](https://claude.com/blog/claude-code-plugins) — Plugin system documentation
-- [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) — The pattern behind `/saveplan`
+- [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) — The pattern behind `/plan --save`
 
 
 ---
 ---
 
 

+ 0 - 334
commands/agent-genesis.md

@@ -1,334 +0,0 @@
----
-description: Generate Claude Code expert agent prompts for any technology platform
----
-
-# Agent Genesis - Expert Agent Prompt Generator
-
-Generate high-quality, comprehensive expert agent prompts for Claude Code.
-
-## Usage Modes
-
-### Mode 1: Single Agent Generation
-Generate one expert agent prompt for a specific technology platform.
-
-**Prompt for:**
-- Technology platform/framework name
-- Scope (project-level or global/user-level)
-- Focus areas (optional: specific features, patterns, use cases)
-- Output format (markdown file or clipboard-ready text)
-
-### Mode 2: Batch Agent Generation
-Create multiple agent prompts from a list of technology platforms.
-
-**Accept:**
-- Multi-line list of technology platforms
-- Scope (project-level or global/user-level)
-- Common focus areas (optional)
-- Output format (individual .md files or consolidated text)
-
-### Mode 3: Architecture Analysis
-Analyze a tech stack or architecture description and suggest relevant agents.
-
-**Process:**
-1. Read architecture description (from user input or file)
-2. Identify all technology platforms/services
-3. Ask for scope (project or global)
-4. Present checkbox selector for agent creation
-5. Generate selected agents
-
-## Agent File Format
-
-All agents MUST be created as Markdown files with **YAML frontmatter**:
-- **Project-level**: `.claude/agents/` (current project only)
-- **Global/User-level**: `~/.claude/agents/` or `C:\Users\[username]\.claude\agents\` (all projects)
-
-**File Structure:**
-```markdown
----
-name: technology-name-expert
-description: When this agent should be used. Can include examples and use cases. No strict length limit - be clear and specific. Include "use PROACTIVELY" for automatic invocation.
-model: inherit
-color: blue
----
-
-[Agent system prompt content here]
-```
-
-**YAML Frontmatter Fields:**
-- `name` (required): Unique identifier, lowercase-with-hyphens (e.g., "asus-router-expert")
-- `description` (required): Clear, specific description of when to use this agent
-  - No strict length limit - prioritize clarity over brevity
-  - Can include examples, use cases, and context
-  - Use "use PROACTIVELY" or "MUST BE USED" to encourage automatic invocation
-  - Multi-line YAML string format is fine for lengthy descriptions
-- `tools` (optional): Comma-separated list of allowed tools (e.g., "Read, Grep, Glob, Bash")
-  - If omitted, agent inherits all tools from main session
-  - **Best practice**: Only grant tools necessary for the agent's purpose (improves security and focus)
-- `model` (optional): Specify model ("sonnet", "opus", "haiku", or "inherit" to use main session model)
-- `color` (optional): Visual identifier in UI ("blue", "green", "purple", etc.)
-
-**File Creation:**
-Agents can be created programmatically using the Write tool:
-```
-Project-level: .claude/agents/[platform]-expert.md
-Global/User-level: ~/.claude/agents/[platform]-expert.md (or C:\Users\[username]\.claude\agents\ on Windows)
-```
-
-**Choosing Scope:**
-- **Project Agent** (`.claude/agents/`): Specific to the current project, can be version controlled and shared with team
-- **Global Agent** (`~/.claude/agents/`): Available across all projects on your machine
-
-After creation, the agent is immediately available for use with the Task tool.
-
-## Claude Code Agent Documentation
-
-**Essential Reading:**
-- **Subagents Overview**: https://docs.claude.com/en/docs/claude-code/sub-agents
-- **Subagents in SDK**: https://docs.claude.com/en/api/agent-sdk/subagents
-- **Agent SDK Overview**: https://docs.claude.com/en/api/agent-sdk/overview
-- **Agent Skills Guide**: https://docs.claude.com/en/docs/claude-code/skills
-- **Agent Skills in SDK**: https://docs.claude.com/en/api/agent-sdk/skills
-- **Skill Authoring Best Practices**: https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices
-- **Using Agent Skills with API**: https://docs.claude.com/en/api/skills-guide
-- **Agent Skills Quickstart**: https://docs.claude.com/en/docs/agents-and-tools/agent-skills/quickstart
-- **Claude Code Settings**: https://docs.claude.com/en/docs/claude-code/settings
-- **Common Workflows**: https://docs.claude.com/en/docs/claude-code/common-workflows
-- **Claude Code Overview**: https://docs.claude.com/en/docs/claude-code/overview
-- **Plugins Reference**: https://docs.claude.com/en/docs/claude-code/plugins-reference
-
-**Key Concepts from Documentation:**
-- Subagents operate in separate context windows with customized system prompts
-- Each subagent can have restricted tool access for focused capabilities
-- Multiple subagents can run concurrently for parallel processing
-- User-level agents (`~/.claude/agents/`) are available across all projects
-- Project-level agents (`.claude/agents/`) are project-specific and shareable
-- Use `/agents` command for the recommended UI to manage agents
-- Start with Claude-generated agents, then customize for best results
-- Version control project-level subagents for team collaboration
-
-## Generation Requirements
-
-For each agent, create a comprehensive expert prompt with:
-
-**Agent Content Structure:**
-```markdown
-# [Technology Platform] Expert Agent
-
-**Purpose**: [1-2 sentence description]
-
-**Core Capabilities**:
-- [Key capability 1]
-- [Key capability 2]
-- [Key capability 3]
-
-**Official Documentation & Resources**:
-- [Official Docs URL]
-- [Best Practices URL]
-- [Architecture Patterns URL]
-- [API Reference URL]
-- [GitHub/Examples URL]
-- [Community Resources URL]
-- [Blog/Articles URL]
-- [Video Tutorials URL]
-- [Troubleshooting Guide URL]
-- [Migration Guide URL]
-- [Minimum 10 authoritative URLs]
-
-**Expertise Areas**:
-- [Specific feature/pattern 1]
-- [Specific feature/pattern 2]
-- [Specific feature/pattern 3]
-
-**When to Use This Agent**:
-- [Scenario 1]
-- [Scenario 2]
-- [Scenario 3]
-
-**Integration Points**:
-- [How this tech integrates with common tools/platforms]
-
-**Common Patterns**:
-- [Pattern 1 with canonical reference]
-- [Pattern 2 with canonical reference]
-
-**Anti-Patterns to Avoid**:
-- [What NOT to do]
-
----
-
-*Refer to canonical resources for code samples and detailed implementations.*
-```
-
-**Requirements:**
-- YAML frontmatter at top with required fields (name, description)
-- Concise, actionable system prompt (not verbose)
-- Minimum 10 official/authoritative URLs
-- No code samples in prompt (agent will generate as needed)
-- Focus on patterns, best practices, architecture
-- Include canonical references for expansion
-- Markdown formatted for direct use
-- Description field can be lengthy with examples if needed for clarity
-
-## Output Options
-
-**Ask user to choose scope:**
-1. **Project Agent** - Save to `.claude/agents/` (project-specific, version controlled)
-2. **Global Agent** - Save to `~/.claude/agents/` or `C:\Users\[username]\.claude\agents\` (all projects)
-
-**Ask user to choose format:**
-1. **Clipboard-ready** - Output complete markdown (with YAML frontmatter) in code block
-2. **File creation** - Use Write tool to save to appropriate agents directory based on scope
-3. **Both** - Create file using Write tool AND show complete content in chat for review
-
-**File Creation Process:**
-When creating files programmatically:
-1. Generate complete agent content with YAML frontmatter
-2. Determine path based on scope selection:
-   - Project: `.claude/agents/[platform-name]-expert.md`
-   - Global: `~/.claude/agents/[platform-name]-expert.md` (or Windows equivalent)
-3. Use Write tool with appropriate path
-4. Verify file was created successfully
-5. Agent is immediately available for use
-
-## Examples
-
-### Example 1: Single Agent
-```
-User: /agent-genesis
-Agent: [Shows multi-tab AskUserQuestion with 5 tabs]
-  Tab 1 (Mode): Single Agent / Batch Generation / Architecture Analysis
-  Tab 2 (Scope): Project Agent / Global Agent
-  Tab 3 (Output): Create File / Show in Chat / Both
-  Tab 4 (Platform): Custom Platform / [or popular options]
-  Tab 5 (Focus): [Multi-select] General Coverage / Caching Patterns / Pub/Sub / etc.
-User: [Selects all answers and submits once]
-  Mode: Single Agent
-  Scope: Global Agent
-  Output: Both
-  Platform: Redis (via Other field)
-  Focus: General Coverage, Caching Patterns, Pub/Sub
-Agent: [Generates Redis expert prompt and saves to ~/.claude/agents/redis-expert.md]
-```
-
-### Example 2: Batch Generation
-```
-User: /agent-genesis
-Agent: [Shows multi-tab AskUserQuestion with 3 tabs]
-  Tab 1 (Mode): Single Agent / Batch Generation / Architecture Analysis
-  Tab 2 (Scope): Project Agent / Global Agent
-  Tab 3 (Output): Create Files / Show in Chat / Both
-User: [Submits]
-  Mode: Batch Generation
-  Scope: Project Agent
-  Output: Create Files
-Agent: Please provide platforms (one per line):
-User: PostgreSQL
-Redis
-RabbitMQ
-
-Agent: [Creates 3 .md files in .claude/agents/ (project directory)]
-```
-
-### Example 3: Architecture Analysis
-```
-User: /agent-genesis
-Agent: [Shows multi-tab AskUserQuestion with 3 tabs]
-  Tab 1 (Mode): Single Agent / Batch Generation / Architecture Analysis
-  Tab 2 (Scope): Project Agent / Global Agent
-  Tab 3 (Output): Create Files / Show in Chat / Both
-User: [Submits]
-  Mode: Architecture Analysis
-  Scope: Global Agent
-  Output: Both
-Agent: Describe your architecture or provide file path:
-User: E-commerce platform: Next.js frontend, Node.js API, PostgreSQL, Redis cache, Stripe payments, AWS S3 storage, SendGrid emails
-Agent: Found platforms: Next.js, Node.js, PostgreSQL, Redis, Stripe, AWS S3, SendGrid
-[Shows multi-select AskUserQuestion]
-User: [Selects: nextjs-expert, postgres-expert, redis-expert, stripe-expert]
-Agent: [Generates 4 selected agents in ~/.claude/agents/]
-```
-
-## Implementation Steps
-
-1. **Ask All Questions at Once** using a single multi-question AskUserQuestion call:
-   - **Question 1** (header: "Mode"): Single Agent / Batch Generation / Architecture Analysis
-   - **Question 2** (header: "Scope"): Project Agent (this project only) / Global Agent (all projects)
-   - **Question 3** (header: "Output"): Create File / Show in Chat / Both
-
-   For Single Mode, also ask in the same call:
-   - **Question 4** (header: "Platform"): Offer "Custom Platform" option (user types in Other field)
-   - **Question 5** (header: "Focus", multiSelect: true): General Coverage / [2-3 common focus areas for that tech]
-
-2. **For Single Mode:**
-   - If user selected "Custom Platform", prompt for the platform name in chat
-   - Generate comprehensive prompt based on answers
-   - Create file and/or display based on output preference
-
-3. **For Batch Mode:**
-   - Ask user to provide multi-line platform list in chat
-   - For each platform:
-     - Generate expert prompt
-     - Save to `.claude/agents/[platform]-expert.md`
-   - Report completion with file paths
-
-4. **For Architecture Analysis:**
-   - Ask user for architecture description in chat
-   - Parse and identify technologies
-   - Present checkbox selector using AskUserQuestion (multiSelect: true)
-   - Generate selected agents
-   - Save to files based on output preference
-
-5. **Generate Each Agent Prompt:**
-   - Research official docs (WebSearch or WebFetch)
-   - Find 10+ authoritative URLs
-   - Structure according to template above
-   - Focus on patterns and best practices
-   - Keep concise (500-800 words)
-   - Markdown formatted
-
-6. **Output:**
-   - Determine file path based on Scope selection:
-     - **Project Agent**: `.claude/agents/[platform]-expert.md`
-     - **Global Agent**: `~/.claude/agents/[platform]-expert.md` (Unix/Mac) or `C:\Users\[username]\.claude\agents\[platform]-expert.md` (Windows)
-   - If "Create File" or "Both": Use Write tool with appropriate path and complete YAML frontmatter + system prompt
-   - If "Show in Chat" or "Both": Display complete markdown (including frontmatter) in code block
-   - Confirm creation with full file path
-   - Remind user agent is immediately available via Task tool
-
-**Important**: Always use a single AskUserQuestion call with multiple questions (2-4) to create the multi-tab interface. Never ask questions sequentially one at a time.
-
-## Quality Checklist
-
-Before outputting each agent prompt, verify:
-- ✅ YAML frontmatter present with required fields (name, description)
-- ✅ Name uses lowercase-with-hyphens format
-- ✅ Description is clear and specific (length is flexible)
-- ✅ Tools field specified if restricting access (best practice: limit to necessary tools)
-- ✅ 10+ authoritative URLs included in system prompt
-- ✅ No code samples (agent generates as needed)
-- ✅ Concise and scannable system prompt
-- ✅ Clear use cases defined
-- ✅ Integration points identified
-- ✅ Common patterns referenced
-- ✅ Anti-patterns listed
-- ✅ Proper markdown formatting throughout
-- ✅ Filename matches name field: `[name].md`
-- ✅ Follows Claude Code subagent best practices (see documentation links above)
-
-## Post-Generation
-
-After creating agents, remind user:
-1. Review generated prompts
-2. Test agent with sample questions
-3. Refine based on actual usage
-4. Add to version control if satisfied
-5. Consult Claude Code documentation links above for advanced features and best practices
-
-**Additional Resources:**
-- Use `/agents` command to view and manage all available agents
-- Refer to https://docs.claude.com/en/docs/claude-code/sub-agents for detailed subagent documentation
-- Check https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices for authoring guidelines
-
----
-
-**Execute this command to generate expert agent prompts on demand!**

+ 0 - 299
commands/g-slave.md

@@ -1,299 +0,0 @@
----
-description: Dispatch Gemini CLI to analyze large codebases. Gemini does the grunt work with its 1M token context, returns distilled intel to Claude.
----
-
-# G-SLAVE: Gemini Large-context Analysis & Verification Engine
-
-> Dispatch Gemini CLI to analyze large codebases. Gemini does the grunt work with its 1M token context; Claude gets distilled intel.
-
-You are dispatching Gemini CLI as a subordinate tool to analyze code that would bloat your context window. Gemini does the heavy lifting; you receive distilled intelligence.
-
-## Target
-
-$ARGUMENTS
-
-If no arguments provided, analyze current working directory.
-
-## Execution Protocol
-
-### Step 1: Verify Gemini CLI is Available
-
-```bash
-which gemini || echo "ERROR: Gemini CLI not installed. Install: https://github.com/google-gemini/gemini-cli"
-```
-
-### Step 2: Check for Agent Configuration Files
-
-Before analysis, check if the project has any agent instruction files that Gemini should respect:
-
-```bash
-# Check for common agent config files
-ls -la AGENTS.md GEMINI.md CLAUDE.md WARP.md COPILOT.md CURSOR.md CODEX.md README.md CONTRIBUTING.md .github/AGENTS.md .claude/CLAUDE.md 2>/dev/null
-```
-
-If found, inform the user:
-- **GEMINI.md**: Gemini CLI will automatically use this
-- **Other agent files**: Suggest including them in the prompt with `@AGENTS.md` etc. so Gemini respects the project conventions
-
-### Step 3: Parse Arguments & Determine Mode
-
-**Modes:**
-
-| Pattern | Mode | Description |
-|---------|------|-------------|
-| `/g-slave <path>` | **Analyze** | Full analysis of target |
-| `/g-slave ask "<question>"` | **Ask** | Direct question about codebase |
-| `/g-slave verify "<statement>"` | **Verify** | Yes/no verification check |
-| `/g-slave compare <path1> <path2>` | **Compare** | Diff analysis between two targets |
-
-**Flags:**
-
-| Flag | Effect |
-|------|--------|
-| `--arch` | Focus: Architecture, structure, design patterns |
-| `--security` | Focus: Security vulnerabilities, auth, injection risks |
-| `--deps` | Focus: Dependencies, imports, coupling analysis |
-| `--quality` | Focus: Code quality, tech debt, antipatterns |
-| `--test` | Focus: Test coverage, testing patterns, gaps |
-| `--perf` | Focus: Performance bottlenecks, optimization opportunities |
-| `--brief` | Output: ~500 char summary |
-| `--detailed` | Output: ~5000 char comprehensive breakdown |
-| `--raw` | Output: Unfiltered Gemini response (no distillation) |
-| `--save <file>` | Export: Save analysis to specified file |
-| `--exclude <patterns>` | Ignore: Comma-separated patterns (e.g., `node_modules,dist,.git`) |
-| `--prompt "<custom>"` | Custom: Use provided prompt instead of default |
-| `--all` | Scope: Use `--all_files` flag for entire project |
-
-### Step 4: Construct Default Exclusions
-
-Always recommend excluding these token-wasters unless user specifically needs them:
-- `node_modules/`, `vendor/`, `venv/`, `.venv/`, `__pycache__/`
-- `.git/`, `.svn/`, `.hg/`
-- `dist/`, `build/`, `out/`, `target/`
-- `*.lock`, `*.log`, `coverage/`
-
-Use the `--exclude` flag or advise user to add exclusions to their GEMINI.md.
-
-### Step 5: Execute Gemini Command
-
-**CRITICAL: Gemini must operate in READ-ONLY mode. No code execution, no file modifications.**
-
-Add to all prompts: `"IMPORTANT: This is a read-only analysis. Do not execute code or modify files."`
-
----
-
-#### Mode: Analyze (default)
-
-```bash
-gemini -p "@<path>/ IMPORTANT: Read-only analysis only. Analyze this codebase. Focus: <focus_area>. Provide: 1) Architecture overview 2) Key patterns 3) Notable issues 4) Recommendations. Be thorough but concise."
-```
-
-#### Mode: Ask
-
-```bash
-gemini -p "@<path>/ IMPORTANT: Read-only analysis only. <user_question> Provide a direct, specific answer with file paths and line references where applicable."
-```
-
-#### Mode: Verify
-
-```bash
-gemini -p "@<path>/ IMPORTANT: Read-only analysis only. Verify: <statement>. Answer with: YES/NO followed by evidence (file paths, code snippets) supporting your answer."
-```
-
-#### Mode: Compare
-
-```bash
-gemini -p "@<path1>/ @<path2>/ IMPORTANT: Read-only analysis only. Compare these two codebases/directories. Identify: 1) Structural differences 2) Logic changes 3) Added/removed features 4) Potential issues from changes."
-```
-
-#### With Custom Prompt
-
-```bash
-gemini -p "@<path>/ IMPORTANT: Read-only analysis only. <custom_prompt>"
-```
-
-#### Full Project Scan
-
-```bash
-gemini --all_files -p "IMPORTANT: Read-only analysis only. <prompt>"
-```
-
-### Step 6: Detect Framework & Tailor Analysis
-
-Before executing, quickly identify the stack and adjust analysis focus:
-
-| Detected | Tailor Prompt To Include |
-|----------|--------------------------|
-| `package.json` | React/Vue/Node patterns, npm security |
-| `requirements.txt` / `pyproject.toml` | Django/Flask/FastAPI patterns, Python idioms |
-| `Cargo.toml` | Rust ownership patterns, unsafe usage |
-| `go.mod` | Go concurrency patterns, error handling |
-| `composer.json` | Laravel/Symfony patterns, PHP security |
-| `Gemfile` | Rails patterns, Ruby idioms |
-| `pom.xml` / `build.gradle` | Spring patterns, Java architecture |
-
-### Step 7: Distill Results
-
-**If `--raw` flag: Skip distillation, return full Gemini output.**
-
-Otherwise, extract and present based on verbosity:
-
-**--brief (~500 chars):**
-```markdown
-## Gemini Analysis: <target>
-<3-4 sentence executive summary covering architecture, main issues, top recommendation>
-```
-
-**Default (~2000 chars):**
-```markdown
-## Gemini Analysis: <target>
-
-**Scope:** <what was analyzed>
-**Focus:** <focus area or "general">
-
-### Architecture
-<concise 3-5 line summary>
-
-### Key Patterns
-- Pattern 1
-- Pattern 2
-
-### Issues (prioritized)
-1. **High:** <critical issue>
-2. **Medium:** <notable concern>
-3. **Low:** <minor item>
-
-### Recommendations
-1. <actionable recommendation>
-2. <actionable recommendation>
-
----
-*Analysis via Gemini CLI (1M token context) | Distilled for Claude*
-```
-
-**--detailed (~5000 chars):**
-Include all of the above plus:
-- Detailed file-by-file breakdown of key components
-- Dependency analysis with version concerns
-- Security considerations
-- Performance observations
-- Testing gaps
-- Technical debt inventory
-
-### Step 8: Handle --save Flag
-
-If `--save <filename>` provided:
-1. Write the analysis output to the specified file
-2. Confirm save location to user
-3. Still display summary in conversation
-
-```bash
-# Example save
-echo "<analysis_output>" > <filename>
-```
-
-## Response Templates
-
-### For Ask Mode
-```markdown
-## Answer: <question summary>
-
-<direct answer>
-
-**Evidence:**
-- `path/to/file.py:42` - <relevant code/context>
-- `path/to/other.js:17` - <relevant code/context>
-
----
-*Via Gemini CLI | Read-only analysis*
-```
-
-### For Verify Mode
-```markdown
-## Verification: <statement>
-
-**Result:** YES / NO / PARTIAL
-
-**Evidence:**
-- <supporting finding 1>
-- <supporting finding 2>
-
-**Location(s):** `file:line`, `file:line`
-
----
-*Via Gemini CLI | Read-only analysis*
-```
-
-### For Compare Mode
-```markdown
-## Comparison: <path1> vs <path2>
-
-### Structural Differences
-- <difference 1>
-- <difference 2>
-
-### Logic Changes
-- <change 1>
-- <change 2>
-
-### Added/Removed
-| Added | Removed |
-|-------|---------|
-| <item> | <item> |
-
-### Risk Assessment
-<potential issues from changes>
-
----
-*Via Gemini CLI | Read-only analysis*
-```
-
-## Error Handling
-
-| Error | Action |
-|-------|--------|
-| Gemini CLI not found | Provide install link: https://github.com/google-gemini/gemini-cli |
-| Path doesn't exist | Report error, ask for correct path |
-| Analysis timeout | Suggest narrower scope or `--exclude` patterns |
-| Output too large | Summarize more aggressively (unless `--raw`) |
-| Rate limited | Inform user, suggest waiting or reducing scope |
-| Permission denied | Check file permissions, suggest alternatives |
-
-## Usage Examples
-
-```bash
-# Basic analysis
-/g-slave src/
-
-# Direct question
-/g-slave ask "Where is user authentication implemented?"
-
-# Verification check
-/g-slave verify "All API endpoints have rate limiting"
-
-# Security audit with exclusions
-/g-slave . --security --exclude node_modules,dist,coverage
-
-# Compare branches (checkout both first)
-/g-slave compare ./main-branch ./feature-branch
-
-# Custom analysis saved to file
-/g-slave . --prompt "Find all API endpoints and document their HTTP methods, parameters, and auth requirements" --save api-docs.md
-
-# Quick overview
-/g-slave . --brief
-
-# Full deep-dive
-/g-slave . --detailed --save full-analysis.md
-
-# Raw Gemini output (no distillation)
-/g-slave . --arch --raw
-```
-
-## Remember
-
-1. **You are the commander.** Gemini is the grunt. Extract value, don't relay noise.
-2. **Read-only always.** Never let Gemini execute or modify.
-3. **Distill by default.** Only pass raw output when explicitly requested.
-4. **Check for agent files.** Respect project conventions.
-5. **Exclude junk.** Don't waste the 1M context on node_modules.

+ 0 - 227
commands/init-tools.md

@@ -1,227 +0,0 @@
----
-name: init-tools
-description: "Initialize Claude Code with dev-shell-tools. Creates permissions, rules, and tool preferences in .claude/ directory."
----
-
-# /init-tools
-
-Initialize Claude Code with modern dev-shell-tools for a comfortable development experience.
-
-## What This Does
-
-**Installs complete dev environment setup:**
-
-1. **Permissions** (`.claude/settings.local.json`) - Pre-approved CLI tools
-2. **Rules** (`.claude/rules/cli-tools.md`) - Instructions to prefer modern tools
-
-Tools from [dev-shell-tools](https://github.com/0xDarkMatter/dev-shell-tools):
-
-**Core Tools:**
-- **Git**: Full git access, lazygit, gh (GitHub CLI)
-- **File ops**: ls, mkdir, cat, wc, tree, eza, bat
-- **Search**: rg (ripgrep), fd, fzf, ast-grep/sg
-- **Navigation**: zoxide/z, broot/br
-- **Data processing**: jq, yq, sd
-- **Diff tools**: delta, difft (difftastic)
-- **Analysis**: tokei, procs, hyperfine
-
-**Dev Tools:**
-- **Package managers**: npm, node, python, uv, pip
-- **Task runners**: just
-- **Network**: curl, http (httpie)
-- **Windows**: powershell
-
-## Execution Flow
-
-```
-/init-tools
-    |
-    +-- Check for existing .claude/ files
-    |     +-- If exists: Ask to overwrite or skip
-    |     +-- If not: Proceed
-    |
-    +-- Create .claude directory
-    +-- Create .claude/rules directory
-    |
-    +-- Write settings.local.json (permissions)
-    +-- Write rules/cli-tools.md (tool preferences)
-```
-
-## Instructions
-
-### Step 1: Check for existing settings
-
-```bash
-ls -la .claude/settings.local.json 2>/dev/null
-ls -la .claude/rules/cli-tools.md 2>/dev/null
-```
-
-If files exist, ask user:
-- **Overwrite**: Replace entirely
-- **Skip**: Keep existing, do nothing
-
-### Step 2: Create directories
-
-```bash
-mkdir -p .claude/rules
-```
-
-### Step 3: Write permissions file
-
-Write to `.claude/settings.local.json`:
-
-```json
-{
-  "permissions": {
-    "allow": [
-      "Bash(git:*)",
-      "Bash(ls:*)",
-      "Bash(mkdir:*)",
-      "Bash(cat:*)",
-      "Bash(wc:*)",
-      "Bash(tree:*)",
-      "Bash(curl:*)",
-      "Bash(rg:*)",
-      "Bash(fd:*)",
-      "Bash(fzf:*)",
-      "Bash(z:*)",
-      "Bash(zoxide:*)",
-      "Bash(br:*)",
-      "Bash(broot:*)",
-      "Bash(ast-grep:*)",
-      "Bash(sg:*)",
-      "Bash(bat:*)",
-      "Bash(eza:*)",
-      "Bash(delta:*)",
-      "Bash(difft:*)",
-      "Bash(jq:*)",
-      "Bash(yq:*)",
-      "Bash(sd:*)",
-      "Bash(lazygit:*)",
-      "Bash(gh:*)",
-      "Bash(tokei:*)",
-      "Bash(uv:*)",
-      "Bash(just:*)",
-      "Bash(http:*)",
-      "Bash(procs:*)",
-      "Bash(hyperfine:*)",
-      "Bash(npm:*)",
-      "Bash(node:*)",
-      "Bash(python:*)",
-      "Bash(pip:*)",
-      "Bash(powershell -Command:*)",
-      "Bash(powershell.exe:*)"
-    ],
-    "deny": [],
-    "ask": []
-  },
-  "hooks": {}
-}
-```
-
-### Step 4: Write rules file
-
-Write to `.claude/rules/cli-tools.md`:
-
-```markdown
-# CLI Tool Preferences (dev-shell-tools)
-
-ALWAYS prefer modern CLI tools over traditional alternatives.
-
-## File Search & Navigation
-
-| Instead of | Use | Why |
-|------------|-----|-----|
-| `find` | `fd` | 5x faster, respects .gitignore |
-| `grep` | `rg` (ripgrep) | 10x faster, respects .gitignore |
-| `ls` | `eza` | Git status, tree view |
-| `cat` | `bat` | Syntax highlighting |
-| `cd` + manual | `z`/`zoxide` | Frecent directories |
-| `tree` | `eza --tree` | Interactive |
-
-## Data Processing
-
-| Instead of | Use |
-|------------|-----|
-| `sed` | `sd` |
-| Manual JSON | `jq` |
-| Manual YAML | `yq` |
-
-## Git Operations
-
-| Instead of | Use |
-|------------|-----|
-| `git diff` | `delta` or `difft` |
-| Manual git | `lazygit` |
-| GitHub web | `gh` |
-
-## Code Analysis
-
-- Line counts: `tokei`
-- AST search: `ast-grep` / `sg`
-- Benchmarks: `hyperfine`
-
-## Python
-
-| Instead of | Use |
-|------------|-----|
-| `pip` | `uv` |
-| `python -m venv` | `uv venv` |
-
-## Task Running
-
-Prefer `just` over Makefiles.
-
-Reference: https://github.com/0xDarkMatter/dev-shell-tools
-```
-
-### Step 5: Confirm
-
-Report to user:
-```
-Initialized Claude Code with dev-shell-tools:
-
-Created:
-  .claude/settings.local.json  (37 tool permissions)
-  .claude/rules/cli-tools.md   (modern tool preferences)
-
-Claude will now:
-  - Auto-approve dev-shell-tools commands
-  - Prefer fd over find, rg over grep, bat over cat, etc.
-
-To customize: edit files in .claude/
-To add to git: git add .claude/
-```
-
-## Options
-
-| Flag | Effect |
-|------|--------|
-| `--force` | Overwrite existing without asking |
-| `--perms-only` | Only install permissions, skip rules |
-| `--rules-only` | Only install rules, skip permissions |
-| `--minimal` | Minimal permissions (git, ls, cat, mkdir only) |
-| `--full` | Add cloud/container tools (docker, kubectl, terraform, etc.) |
-
-### Full Template (--full)
-
-Adds to permissions:
-```json
-"Bash(docker:*)",
-"Bash(docker-compose:*)",
-"Bash(kubectl:*)",
-"Bash(helm:*)",
-"Bash(terraform:*)",
-"Bash(aws:*)",
-"Bash(gcloud:*)",
-"Bash(az:*)",
-"Bash(wrangler:*)"
-```
-
-## Notes
-
-- Permissions are project-local (don't affect other projects)
-- Rules instruct Claude to prefer modern tools
-- Global settings in `~/.claude/` still apply
-- Restart Claude Code session for changes to take effect
-- Tools from: https://github.com/0xDarkMatter/dev-shell-tools

+ 0 - 251
commands/loadplan.md

@@ -1,251 +0,0 @@
----
-description: "Restore plan session state. Loads TodoWrite tasks, plan progress, and notes from saved .claude/session-cache.json."
----
-
-# LoadPlan - Restore Plan Session State
-
-Restore your session context from a previous save. Shows plan progress, restores tasks, and displays what's changed.
-
-## Architecture
-
-```
-/loadplan
-    │
-    ├─→ Read .claude/session-cache.json
-    │     ├─ TodoWrite tasks
-    │     ├─ Plan context
-    │     └─ Git context at save time
-    │
-    ├─→ Analyze changes since save
-    │     ├─ New commits
-    │     ├─ File modifications
-    │     └─ Plan updates
-    │
-    ├─→ Restore TodoWrite state
-    │     └─ Populate with saved tasks
-    │
-    └─→ Display unified summary
-          ├─ Plan context
-          ├─ Restored tasks
-          ├─ What changed
-          └─ Suggested next action
-```
-
-## Output Format
-
-```
-📂 Plan Session Loaded
-
-┌─ Time ─────────────────────────────────────────────────────────────────────────────────────────┐
-│ Saved: 2 hours ago (2025-11-27 10:30 AM)                                                       │
-│ Branch: feature/auth                                                                           │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Plan Context ─────────────────────────────────────────────────────────────────────────────────┐
-│ Goal: Add user authentication with OAuth2                                                      │
-│                                                                                                │
-│ ✓ Step 1: Research OAuth providers                                                             │
-│ ✓ Step 2: Set up Google OAuth app                                                              │
-│ ◐ Step 3: Implement OAuth flow  ← YOU WERE HERE                                                │
-│ ○ Step 4: Add token refresh                                                                    │
-│ ○ Step 5: Write integration tests                                                              │
-│                                                                                                │
-│ Progress: ██████░░░░ 40% (2/5)                                                                 │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Restored Tasks ───────────────────────────────────────────────────────────────────────────────┐
-│ ◐ Fix callback URL handling                                                                    │
-│ ○ Add token refresh logic                                                                      │
-│ ✓ Set up OAuth credentials                                                                     │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Since Last Save ──────────────────────────────────────────────────────────────────────────────┐
-│ Commits: 0 new                                                                                 │
-│ Files: 3 still uncommitted (+45/-12)                                                           │
-│ Plan: unchanged                                                                                │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Notes ────────────────────────────────────────────────────────────────────────────────────────┐
-│ "Stopped at callback URL issue - need to fix redirect"                                         │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Suggested Next Action ────────────────────────────────────────────────────────────────────────┐
-│ Continue with: Fix callback URL handling                                                       │
-│                                                                                                │
-│ Context: You were implementing OAuth flow (Plan Step 3) and stopped at a redirect issue.       │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-```
-
-## Execution Steps
-
-### Step 1: Check for State Files
-
-```bash
-ls -la .claude/session-cache.json 2>/dev/null
-```
-
-If missing:
-```
-┌─ Session ──────────────────────────────────────────────────────────────────────────────────────┐
-│ ⚠  State: No saved state found in .claude/session-cache.json                                    │
-│                                                                                                │
-│    To create one, use: /saveplan                                                               │
-│    Or check current status: /dash                                                              │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-```
-
-### Step 2: Read State
-
-Parse `.claude/session-cache.json`:
-- Extract todos (completed, in_progress, pending)
-- Extract plan context (goal, current step, progress)
-- Extract git context (branch, last commit)
-- Extract notes
-
-### Step 3: Calculate Time Since Save
-
-```bash
-# Compare timestamps
-# Format as: "2 hours ago", "3 days ago"
-```
-
-### Step 4: Analyze Changes
-
-```bash
-# Commits since save
-git log --oneline <saved_commit>..HEAD
-
-# Current uncommitted
-git status --porcelain
-
-# Check if plan was modified
-git log -1 --format="%H" -- docs/PLAN.md
-```
-
-### Step 5: Restore TodoWrite
-
-Use TodoWrite tool:
-```json
-{
-  "todos": [
-    {"content": "Fix callback URL handling", "status": "in_progress"},
-    {"content": "Add token refresh logic", "status": "pending"},
-    {"content": "Set up OAuth credentials", "status": "completed"}
-  ]
-}
-```
-
-### Step 6: Generate Suggestion
-
-Based on saved state:
-- If `in_progress` task exists → "Continue with: <task>"
-- If all complete → "Start next pending task"
-- If blocked → "Resolve blocker: <blocker>"
-
-## Edge Cases
-
-### Stale State (>7 days)
-
-```
-⚠ Saved state is 12 days old
-
-A lot may have changed since then.
-
-Options:
-  1. Load anyway (tasks may still be relevant)
-  2. Check current status: /dash
-  3. Start fresh: /loadplan --clear
-```
-
-### Branch Changed
-
-```
-⚠ Branch changed since save
-
-Saved on: feature/old-branch
-Current:  feature/new-branch
-
-The saved context may not apply. Options:
-  1. Switch back: git checkout feature/old-branch
-  2. Load anyway (some tasks may apply)
-  3. Clear and start fresh: /loadplan --clear
-```
-
-### Plan Updated Since Save
-
-```
-ℹ Plan was updated since you saved
-
-Changes to docs/PLAN.md:
-  • Step 3 marked complete (was in-progress)
-  • Step 4 now in-progress
-
-Your saved context shows Step 3, but plan shows Step 4.
-Consider: /plan --review to see current state
-```
-
-## Flags
-
-| Flag | Effect |
-|------|--------|
-| `--verbose` | Show full git log since save |
-| `--no-restore` | Preview without restoring TodoWrite |
-| `--clear` | Clear saved state after loading |
-| `--force` | Load even if stale or branch mismatch |
-
-## Usage Examples
-
-```bash
-# Basic load
-/loadplan
-
-# Preview without restoring
-/loadplan --no-restore
-
-# Load with full git history
-/loadplan --verbose
-
-# Load and clear state
-/loadplan --clear
-```
-
-## Integration
-
-Part of the session management suite:
-
-```
-Session Lifecycle
-─────────────────────────────────────────────────────────────────────────────────────────────────
-
-  ┌──────────────────────────────────────────────────────────────────────────────────────────────┐
-  │                                                                                              │
-  │         ┌─────────┐                   ┌─────────┐                   ┌─────────┐              │
-  │         │  START  │                   │  WORK   │                   │   END   │              │
-  │         └────┬────┘                   └────┬────┘                   └────┬────┘              │
-  │              │                             │                             │                   │
-  │              ▼                             ▼                             ▼                   │
-  │      ┌───────────┐                   ┌──────────┐                 ┌───────────┐             │
-  │      │   /sync   │                   │  /dash   │                 │ /saveplan │             │
-  │      │     +     │──────────────────▶│          │────────────────▶│           │             │
-  │      │ /loadplan │                   └──────────┘                 └─────┬─────┘             │
-  │      └───────────┘                                                      │                   │
-  │           │                                                             │                   │
-  │        Restore                                                       Persist               │
-  │        context                                                        state                │
-  │           │                                                             │                   │
-  │           └─────────────────────────────────────────────────────────────┘                   │
-  │                                            │                                                │
-  │                                            ▼                                                │
-  │                               .claude/session-cache.json                                     │
-  │                               docs/PLAN.md                                                  │
-  │                                            │                                                │
-  └────────────────────────────────────────────┘                                                │
-                                    Next Session                                                │
-```
-
-## Notes
-
-- Automatically restores TodoWrite unless `--no-restore`
-- Shows plan context from saved state + current plan
-- Detects and warns about state/branch mismatches
-- Notes from `/saveplan` are prominently displayed

+ 542 - 222
commands/plan.md

@@ -1,350 +1,670 @@
 ---
 ---
-description: "Create, review, and persist project plans. Captures Claude Code Plan Mode state and writes to git-trackable docs/PLAN.md."
+description: "Unified project planning and session continuity. Create plans, save/load state, track progress. Smart defaults with context detection."
 ---
 ---
 
 
-# Plan - Persistent Project Planning
+# Plan - Project Planning & Session Continuity
 
 
-Create, review, and update project plans. Automatically captures Claude Code's internal Plan Mode state and persists to `docs/PLAN.md`.
-
-## Why This Exists
-
-Claude Code's native Plan Mode (Shift+Tab) is powerful for exploration, but **the plan state doesn't persist**. When your session ends, the strategic thinking is lost.
-
-This command bridges that gap:
-- **Captures** any active Plan Mode context
-- **Persists** to `docs/PLAN.md` (git-trackable)
-- **Survives** across sessions and machines
-- **Pairs** with `/save` + `/load` for complete session continuity
+Unified command for strategic planning and session state management. Creates persistent plans, saves/loads session state, and provides intelligent context-aware defaults.
 
 
 ## Arguments
 ## Arguments
 
 
 $ARGUMENTS
 $ARGUMENTS
 
 
-- `<goal>` - Create/update plan for a goal
-- `--review` - Display current plan
-- `--status` - Update progress on steps
-- `--capture` - Capture conversation context only (no new planning)
-- `--sync` - Auto-update status from recent git commits
-- `--diff` - Show what changed since last plan update
-- `--clear` - Archive current plan and start fresh
+- No args: **Interactive mode** - detects context, suggests action
+- `<goal>`: Create or update plan for goal
+- `save "notes"` or `--save`: Save session state (TodoWrite, plan context, git)
+- `load` or `--load`: Restore session state from previous save
+- `status` or `--status`: Quick read-only status view
+- `sync` or `--sync`: Auto-update plan progress from git commits
+- `diff` or `--diff`: Show what changed since last update
+- `clear` or `--clear`: Archive current plan and start fresh
 
 
-## Default Behavior: Capture First
+**Note:** Subcommands work with or without the `--` prefix.
 
 
-**Every invocation of `/plan` attempts to capture internal state first.**
+## Architecture
 
 
 ```
 ```
-/plan <anything>
-  │
-  ├─→ Step 0: Capture internal state (ALWAYS RUNS)
-  │     ├─ Detect if Plan Mode was recently active
-  │     ├─ Extract plan-related context from conversation
-  │     ├─ Check for temp files (.claude/plan*, docs/PLAN.md)
-  │     ├─ Gather git context (uncommitted changes, recent commits)
-  │     └─ Merge into working state
-  │
-  ├─→ Step 1: Check existing docs/PLAN.md
-  │     └─ Load and parse if exists
-  │
-  └─→ Step 2: Execute requested action
-        ├─ Create new plan
-        ├─ Update existing plan
-        └─ Review/display plan
+/plan [goal] [--save|--load|--status|--sync|--clear]
+    │
+    ├─→ No args: INTERACTIVE MODE
+    │     │
+    │     ├─ No plan exists?
+    │     │   └─ "No plan found. Create one: /plan 'your goal'"
+    │     │
+    │     ├─ Plan exists + saved state exists?
+    │     │   ├─ State is stale (>2 hours)?
+    │     │   │   └─ "Welcome back! Load previous session? (Y/n)"
+    │     │   └─ State is fresh?
+    │     │       └─ Show status + "Continue: <in_progress_task>"
+    │     │
+    │     └─ Plan exists + no saved state?
+    │         └─ Show status + "Save before leaving: /plan --save"
+    │
+    ├─→ /plan "goal"
+    │     ├─ Capture conversation context (goals, decisions, approaches)
+    │     ├─ Capture git context (branch, uncommitted, recent commits)
+    │     ├─ Merge with existing docs/PLAN.md if present
+    │     └─ Write updated plan
+    │
+    ├─→ /plan --save "notes"
+    │     ├─ Capture TodoWrite state
+    │     ├─ Capture current plan step
+    │     ├─ Capture git context
+    │     ├─ Write .claude/session-cache.json
+    │     └─ Write .claude/claude-progress.md (human-readable)
+    │
+    ├─→ /plan --load
+    │     ├─ Read .claude/session-cache.json
+    │     ├─ Restore TodoWrite tasks
+    │     ├─ Show what changed since save
+    │     └─ Suggest next action
+    │
+    ├─→ /plan --status
+    │     ├─ Read docs/PLAN.md
+    │     ├─ Read TodoWrite state
+    │     ├─ Read git state
+    │     └─ Display unified view
+    │
+    ├─→ /plan --sync
+    │     ├─ Parse recent git commits
+    │     ├─ Match to plan steps
+    │     └─ Auto-update step status
+    │
+    └─→ /plan --clear
+          ├─ Archive to docs/PLAN-<date>.md
+          └─ Start fresh
 ```
 ```
 
 
-This ensures you never lose Plan Mode thinking, even if you forget to explicitly save.
+---
 
 
-## Execution Steps
+## Interactive Mode (No Args)
 
 
-### Step 0: Capture Internal State (Always)
+When you run `/plan` with no arguments, it detects your context and suggests the right action:
 
 
-```bash
-# Check for Plan Mode artifacts
-ls -la .claude/plan* docs/PLAN.md 2>/dev/null
+### Scenario 1: No Plan Exists
 
 
-# Gather git context
-git status --short
-git diff --stat
-git log --oneline -5
+```
+📋 Plan Status
 
 
-# Check conversation for plan-related discussion
-# (Analyze recent messages for: goals, approaches, decisions, steps)
+No plan found at docs/PLAN.md
+
+Get started:
+  /plan "your project goal"    Create a new plan
+  /plan --status               View current tasks and git state
 ```
 ```
 
 
-**Extract from conversation:**
-- Goal statements ("I want to...", "We need to...")
-- Approach discussions ("Option A vs B", "We could...")
-- Decisions made ("Let's go with...", "The best approach is...")
-- Steps identified ("First... then... finally...")
-- Open questions ("Should we...", "What about...")
+### Scenario 2: Plan Exists, Saved State Available
 
 
-**Git context to capture:**
-- Uncommitted changes (files, insertions, deletions)
-- Recent commits that may relate to plan steps
-- Current branch and status
+```
+📋 Plan Status
+
+┌─ Welcome Back ─────────────────────────────────────────────────────────────────┐
+│ Last saved: 3 hours ago                                                        │
+│ Branch: feature/auth                                                           │
+│                                                                                 │
+│ You were working on:                                                           │
+│   ◐ Step 3: Implement OAuth flow                                               │
+│   Task: Fix callback URL handling                                              │
+│                                                                                 │
+│ Notes: "Stopped at redirect issue"                                             │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+Load previous session? [Y/n]
+```
 
 
-### Step 1: Check Existing docs/PLAN.md
+### Scenario 3: Plan Exists, No Saved State
 
 
-```bash
-# Read existing plan if present
-cat docs/PLAN.md 2>/dev/null
+```
+📋 Plan Status
+
+┌─ Plan ─────────────────────────────────────────────────────────────────────────┐
+│ Goal: Add user authentication with OAuth2                                      │
+│                                                                                 │
+│ ✓ Step 1: Research OAuth providers                                             │
+│ ✓ Step 2: Set up Google OAuth app                                              │
+│ ◐ Step 3: Implement OAuth flow  ← CURRENT                                      │
+│ ○ Step 4: Add token refresh                                                    │
+│ ○ Step 5: Write integration tests                                              │
+│                                                                                 │
+│ Progress: ██████░░░░ 40% (2/5)                                                 │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Tasks ────────────────────────────────────────────────────────────────────────┐
+│ ◐ Fix callback URL handling                                                    │
+│ ○ Add token refresh logic                                                      │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Git ──────────────────────────────────────────────────────────────────────────┐
+│ Branch: feature/auth                                                           │
+│ Uncommitted: 3 files (+45/-12)                                                 │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+Suggestions:
+  → Continue: Fix callback URL handling
+  → Save before leaving: /plan --save
 ```
 ```
 
 
-Parse structure:
-- Current goal
-- Completed steps
-- In-progress steps
-- Pending steps
-- Blockers
-- Open questions
-- Decision log
+---
 
 
-### Step 2: Merge and Execute
+## Create/Update Plan: `/plan "goal"`
 
 
-Combine:
-1. Captured conversation context
-2. Existing docs/PLAN.md content
-3. Git context (uncommitted changes, recent commits)
-4. New goal/instructions from command
+Creates or updates `docs/PLAN.md` with strategic planning.
 
 
-### Step 3: Write docs/PLAN.md
+### What It Captures
+
+**From conversation:**
+- Goal statements ("I want to...", "We need to...")
+- Approach discussions ("Option A vs B")
+- Decisions made ("Let's go with...")
+- Steps identified ("First... then...")
+- Open questions
+
+**From git:**
+- Current branch
+- Uncommitted changes
+- Recent commits
+
+### Plan Format: `docs/PLAN.md`
 
 
 ```markdown
 ```markdown
 # Project Plan
 # Project Plan
 
 
-**Goal**: <primary objective>
-**Created**: <timestamp>
-**Last Updated**: <timestamp>
-**Status**: In Progress | Complete | Blocked
+**Goal**: Add user authentication with OAuth2
+**Created**: 2025-12-13
+**Last Updated**: 2025-12-13
+**Status**: In Progress
 
 
 ## Context
 ## Context
 
 
-<Brief description of current state and constraints>
+Building OAuth2 authentication for the web app. Need to support Google
+and GitHub providers initially, with ability to add more later.
 
 
 ## Approach
 ## Approach
 
 
-<High-level strategy chosen and why>
+Using JWT tokens with refresh rotation. Chose this over session-based
+auth for better scalability and API compatibility.
 
 
 ### Alternatives Considered
 ### Alternatives Considered
-- **Option A**: <description> - <why not chosen>
-- **Option B**: <description> - <why not chosen>
+- **Session-based auth**: Simpler but doesn't scale well
+- **Auth0/Clerk**: Good but adds external dependency
 
 
 ## Implementation Steps
 ## Implementation Steps
 
 
 ### Completed
 ### Completed
-- ✓ Step 1: <description> [S]
-  - Completed: <date>
-  - Commit: `abc123` <commit message>
-  - Notes: <any relevant context>
+- ✓ Step 1: Research OAuth providers [S]
+  - Completed: 2025-12-12
+  - Commit: `abc123` research: Compare OAuth providers
+
+- ✓ Step 2: Set up Google OAuth app [S]
+  - Completed: 2025-12-12
+  - Commit: `def456` feat: Add Google OAuth credentials
 
 
 ### In Progress
 ### In Progress
-- ◐ Step 2: <description> [M]
-  - Started: <date>
-  - Depends on: Step 1
-  - Notes: <current status>
+- ◐ Step 3: Implement OAuth flow [M]
+  - Started: 2025-12-13
+  - Notes: Working on callback URL handling
 
 
 ### Pending
 ### Pending
-- ○ Step 3: <description> [L]
-  - Depends on: Step 2
-- ○ Step 4: <description> [S]
-
-### Blocked
-- ⚠ Step 5: <description> [M]
-  - Blocker: <what's blocking this>
-  - Waiting on: <person/decision/external>
+- ○ Step 4: Add token refresh [S]
+- ○ Step 5: Write integration tests [M]
 
 
 ## Uncommitted Changes
 ## Uncommitted Changes
 
 
 ```
 ```
 📊 Working Tree Status:
 📊 Working Tree Status:
-  Modified:  X files (+Y/-Z lines)
-  Staged:    X files
-  Unstaged:  X files
-  Untracked: X files
+  Modified:  3 files (+127/-45)
 
 
   Files:
   Files:
-  • path/to/file.ts    +89/-12 (staged)
-  • path/to/other.ts   +38/-33 (unstaged)
+  • src/auth/oauth.ts        +89/-12
+  • src/auth/callback.ts     +25/-20
+  • tests/auth.test.ts       +13/-13
 ```
 ```
 
 
 ## Decision Log
 ## Decision Log
 
 
 | Date | Decision | Rationale |
 | Date | Decision | Rationale |
 |------|----------|-----------|
 |------|----------|-----------|
-| <date> | <what was decided> | <why this choice> |
+| 12-12 | Use JWT over sessions | Better API compatibility |
+| 12-12 | Start with Google only | Largest user base |
 
 
 ## Blockers
 ## Blockers
 
 
-- ⚠ <blocker 1>: <description and what's needed to unblock>
-- ⚠ <blocker 2>: <description>
+None currently.
 
 
 ## Open Questions
 ## Open Questions
 
 
-- ○ <question 1>
-- ○ <question 2>
+- Should we support "Remember me" functionality?
+- How long should refresh tokens last?
 
 
 ## Success Criteria
 ## Success Criteria
 
 
-- ○ <criterion 1>
-- ○ <criterion 2>
+- [ ] Users can sign in with Google
+- [ ] Tokens refresh automatically
+- [ ] 90% test coverage on auth module
+
+---
+*Plan managed by `/plan` command. Last captured: 2025-12-13 10:30*
+```
+
+### Execution Steps
+
+```bash
+# Step 1: Capture git context
+git branch --show-current
+git status --short
+git diff --stat
+git log --oneline -5
+
+# Step 2: Check existing plan
+cat docs/PLAN.md 2>/dev/null
 
 
-## Directory Structure
+# Step 3: Analyze conversation for plan-related content
+# (Extract goals, decisions, approaches, steps)
 
 
+# Step 4: Merge and write
+mkdir -p docs
+# Write updated docs/PLAN.md
 ```
 ```
-project/
-├── src/
-│   ├── core/           # Core functionality
-│   └── features/       # Feature modules
-├── tests/
-├── docs/
-│   └── PLAN.md         # This file
-└── config/
+
+---
+
+## Save State: `/plan --save "notes"`
+
+Persists session state for later restoration.
+
+### What It Saves
+
+| Data | Source | Destination |
+|------|--------|-------------|
+| TodoWrite tasks | Current session | `.claude/session-cache.json` |
+| Current plan step | `docs/PLAN.md` | `.claude/session-cache.json` |
+| Git context | `git status/log` | `.claude/session-cache.json` |
+| User notes | Command argument | `.claude/session-cache.json` |
+
+### Output Files
+
+**`.claude/session-cache.json`** (machine-readable):
+```json
+{
+  "version": "2.0",
+  "timestamp": "2025-12-13T10:30:00Z",
+  "todos": {
+    "completed": ["Set up OAuth credentials"],
+    "in_progress": ["Fix callback URL handling"],
+    "pending": ["Add token refresh"]
+  },
+  "plan": {
+    "file": "docs/PLAN.md",
+    "goal": "Add user authentication with OAuth2",
+    "current_step": "Step 3: Implement OAuth flow",
+    "current_step_index": 3,
+    "total_steps": 5,
+    "progress_percent": 40
+  },
+  "git": {
+    "branch": "feature/auth",
+    "last_commit": "abc123f",
+    "last_commit_message": "feat: Add OAuth config",
+    "uncommitted_count": 3
+  },
+  "notes": "Stopped at callback URL issue - need to fix redirect"
+}
 ```
 ```
 
 
-## Sources & References
+**`.claude/claude-progress.md`** (human-readable):
+```markdown
+# Session Progress
+
+**Saved**: 2025-12-13 10:30 AM
+**Branch**: feature/auth
+
+## Plan Context
+
+**Goal**: Add user authentication with OAuth2
+**Current Step**: ◐ Step 3 - Implement OAuth flow
+**Progress**: ██████░░░░ 40% (2/5 steps)
+
+## Tasks
 
 
-- [Official Documentation](https://example.com/docs)
-- [API Reference](https://example.com/api)
-- [Related RFC/Spec](https://example.com/spec)
+- ✓ Set up OAuth credentials
+- ◐ Fix callback URL handling
+- ○ Add token refresh logic
 
 
 ## Notes
 ## Notes
 
 
-<Additional context, decisions, or observations>
+> Stopped at callback URL issue - need to fix redirect
 
 
 ---
 ---
-*Plan managed by `/plan` command. Last captured: <timestamp>*
+*Restore with: /plan --load*
 ```
 ```
 
 
+### Output
+
+```
+✓ Session saved
+
+┌─ Saved State ──────────────────────────────────────────────────────────────────┐
+│ Plan: Step 3/5 (40%) - Implement OAuth flow                                    │
+│ Tasks: 1 completed, 1 in progress, 1 pending                                   │
+│ Git: 3 uncommitted files on feature/auth                                       │
+│ Notes: "Stopped at callback URL issue..."                                      │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+Files written:
+  • .claude/session-cache.json
+  • .claude/claude-progress.md
+
+Restore with: /plan --load
+```
+
+---
+
+## Load State: `/plan --load`
+
+Restores session from previous save.
+
+### What It Does
+
+1. Reads `.claude/session-cache.json`
+2. Restores TodoWrite tasks
+3. Shows what changed since save
+4. Suggests next action
+
+### Output
+
+```
+📂 Session Loaded
+
+┌─ Time ─────────────────────────────────────────────────────────────────────────┐
+│ Saved: 2 hours ago (2025-12-13 10:30 AM)                                       │
+│ Branch: feature/auth                                                           │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Plan Context ─────────────────────────────────────────────────────────────────┐
+│ Goal: Add user authentication with OAuth2                                      │
+│                                                                                 │
+│ ✓ Step 1: Research OAuth providers                                             │
+│ ✓ Step 2: Set up Google OAuth app                                              │
+│ ◐ Step 3: Implement OAuth flow  ← YOU WERE HERE                                │
+│ ○ Step 4: Add token refresh                                                    │
+│ ○ Step 5: Write integration tests                                              │
+│                                                                                 │
+│ Progress: ██████░░░░ 40% (2/5)                                                 │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Restored Tasks ───────────────────────────────────────────────────────────────┐
+│ ◐ Fix callback URL handling                                                    │
+│ ○ Add token refresh logic                                                      │
+│ ✓ Set up OAuth credentials                                                     │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Since Last Save ──────────────────────────────────────────────────────────────┐
+│ Commits: 0 new                                                                 │
+│ Files: 3 still uncommitted                                                     │
+│ Plan: unchanged                                                                │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Notes ────────────────────────────────────────────────────────────────────────┐
+│ "Stopped at callback URL issue - need to fix redirect"                         │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+→ Continue with: Fix callback URL handling
+```
+
+### Edge Cases
+
+**Stale state (>7 days):**
+```
+⚠ Saved state is 12 days old
+
+Options:
+  1. Load anyway (tasks may still be relevant)
+  2. Start fresh: /plan --clear
+```
+
+**Branch changed:**
+```
+⚠ Branch changed since save
+
+Saved on: feature/old-branch
+Current:  feature/new-branch
+
+Options:
+  1. Load anyway
+  2. Switch back: git checkout feature/old-branch
+```
+
+---
+
+## Status View: `/plan --status`
+
+Quick read-only view of current state.
+
+### Output
+
+```
+📊 Plan Status
+
+┌─ Plan ─────────────────────────────────────────────────────────────────────────┐
+│ Goal: Add user authentication with OAuth2                                      │
+│                                                                                 │
+│ ✓ Step 1: Research OAuth providers [S]                                         │
+│ ✓ Step 2: Set up Google OAuth app [S]                                          │
+│ ◐ Step 3: Implement OAuth flow [M]  ← CURRENT                                  │
+│ ○ Step 4: Add token refresh [S]                                                │
+│ ○ Step 5: Write integration tests [M]                                          │
+│                                                                                 │
+│ Progress: ██████░░░░ 40% (2/5)                                                 │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Active Tasks ─────────────────────────────────────────────────────────────────┐
+│ ◐ Fix callback URL handling                                                    │
+│ ○ Add token refresh logic                                                      │
+└────────────────────────────────────────────────────────────────────────────────┘
+
+┌─ Git ──────────────────────────────────────────────────────────────────────────┐
+│ Branch: feature/auth                                                           │
+│ Uncommitted: 3 files (+45/-12)                                                 │
+│ Recent: abc123f feat: Add OAuth config                                         │
+└────────────────────────────────────────────────────────────────────────────────┘
+```
+
+---
+
+## Sync from Git: `/plan --sync`
+
+Auto-updates plan step status from recent commits.
+
+### How It Works
+
+1. Parse recent git commits
+2. Match commit messages to plan steps
+3. Update step status in `docs/PLAN.md`
+
+```bash
+# Get recent commits
+git log --oneline -20
+
+# Match patterns like:
+#   "feat: Add OAuth config" → matches Step 2
+#   "fix: Token refresh" → matches Step 4
+```
+
+### Output
+
+```
+🔄 Syncing plan from git...
+
+Found matches:
+  • abc123f "feat: Add OAuth config" → Step 2 (marked complete)
+  • def456a "fix: Callback handling" → Step 3 (in progress)
+
+Updated docs/PLAN.md:
+  ✓ Step 2: now marked complete
+  ◐ Step 3: now marked in progress
+```
+
+---
+
+## Clear and Archive: `/plan --clear`
+
+Archives current plan and starts fresh.
+
+```bash
+/plan --clear "New feature: payment processing"
+```
+
+### What It Does
+
+1. Moves `docs/PLAN.md` → `docs/PLAN-2025-12-13.md`
+2. Clears `.claude/session-cache.json`
+3. Creates new plan with provided goal
+
+### Output
+
+```
+📦 Archived: docs/PLAN.md → docs/PLAN-2025-12-13.md
+
+Starting fresh plan...
+```
+
+---
+
 ## Status Markers
 ## Status Markers
 
 
-| Marker | Meaning | Usage |
-|--------|---------|-------|
-| ✓ | Completed | Task finished successfully |
-| ◐ | In Progress | Currently being worked on |
-| ○ | Pending | Not yet started |
-| ⚠ | Blocked | Cannot proceed, needs resolution |
+| Marker | Meaning |
+|--------|---------|
+| ✓ | Completed |
+| ◐ | In Progress |
+| ○ | Pending |
+| ⚠ | Blocked |
 
 
 ## Effort Indicators
 ## Effort Indicators
 
 
-| Tag | Meaning | Guidance |
-|-----|---------|----------|
-| `[S]` | Small | Quick task, minimal complexity |
-| `[M]` | Medium | Moderate effort, some complexity |
-| `[L]` | Large | Significant effort, high complexity |
+| Tag | Meaning |
+|-----|---------|
+| `[S]` | Small - Quick task |
+| `[M]` | Medium - Moderate effort |
+| `[L]` | Large - Significant effort |
 
 
-Effort is relative to the project, not absolute time. Avoid time estimates.
+Effort is relative to project, not time-based. Avoid time estimates.
+
+---
 
 
 ## Usage Examples
 ## Usage Examples
 
 
 ```bash
 ```bash
-# Create new plan (captures any Plan Mode context first)
+# Interactive mode - context-aware suggestions
+/plan
+
+# Create new plan
 /plan "Add user authentication with OAuth2"
 /plan "Add user authentication with OAuth2"
 
 
-# Just capture current conversation to plan (no new analysis)
-/plan --capture
+# Save session before leaving
+/plan --save "Stopped at redirect issue"
 
 
-# Review current plan
-/plan --review
+# Load previous session
+/plan --load
 
 
-# Update progress on steps
+# Quick status check
 /plan --status
 /plan --status
 
 
-# Sync status from recent git commits
+# Sync progress from git commits
 /plan --sync
 /plan --sync
 
 
-# Show what changed since last update
+# See what changed
 /plan --diff
 /plan --diff
 
 
-# Start fresh (archives old plan)
-/plan --clear "New feature: payment processing"
+# Archive and start fresh
+/plan --clear "New feature: payments"
 ```
 ```
 
 
-## Workflow Integration
+---
 
 
-### With Native Plan Mode
+## Flags Reference
 
 
-```
-1. [Shift+Tab] Enter Plan Mode
-2. [Explore codebase, discuss approaches]
-3. /plan --capture              # Persist the thinking
-4. [Shift+Tab] Exit Plan Mode
-5. [Implement]
-6. /plan --status               # Update progress
-```
+| Flag | Effect |
+|------|--------|
+| `save "notes"` or `--save` | Save session state with optional notes |
+| `load` or `--load` | Restore session from saved state |
+| `status` or `--status` | Quick read-only status view |
+| `sync` or `--sync` | Auto-update from git commits |
+| `diff` or `--diff` | Show changes since last update |
+| `clear` or `--clear` | Archive current plan, start fresh |
+| `--capture` | Only capture context, no new planning |
+| `--verbose` | Show detailed operation output |
 
 
-### With /save + /load
+---
 
 
-```
-Session 1:
-  /plan "Feature X"             # Strategic planning → docs/PLAN.md
-  [work on implementation]
-  /save "Completed step 2"      # Tactical state → session-cache.json
+## File Locations
 
 
-Session 2:
-  /load                         # Restore TodoWrite tasks
-  /plan --review                # See the strategy
-  [continue work]
-  /plan --status                # Update plan progress
-  /save "Completed step 3"
-```
+| File | Purpose | Git-tracked? |
+|------|---------|--------------|
+| `docs/PLAN.md` | Strategic plan | Yes |
+| `.claude/session-cache.json` | Session state | No (gitignored) |
+| `.claude/claude-progress.md` | Human-readable progress | No (gitignored) |
+| `docs/PLAN-<date>.md` | Archived plans | Yes |
 
 
-### Complete Session Continuity
+---
 
 
-| Command | Captures | Persists To |
-|---------|----------|-------------|
-| `/plan` | Strategic thinking, decisions | `docs/PLAN.md` |
-| `/save` | TodoWrite tasks, git context | `.claude/session-cache.json` |
-| `/load` | - | Restores from `.claude/` |
+## Workflow Examples
 
 
-## Flags
+### Daily Session
 
 
-| Flag | Effect |
-|------|--------|
-| `--review` | Display current plan without modifications |
-| `--status` | Interactive update of step progress |
-| `--capture` | Only capture conversation context, no new planning |
-| `--sync` | Auto-update step status from recent git commits |
-| `--diff` | Show what changed since last plan update |
-| `--clear` | Archive current plan to `docs/PLAN-<date>.md` and start fresh |
-| `--verbose` | Show detailed capture/merge process |
+```bash
+# Start of day
+/plan                        # Interactive: loads previous state if exists
 
 
-## Output
+# During work
+[implement features]
+/plan --status               # Quick check on progress
 
 
+# End of day
+/plan --save "Completed auth, starting tests tomorrow"
 ```
 ```
-🔍 Capturing internal state...
-  ✓ Plan Mode context detected (8 relevant messages)
-  ✓ Existing docs/PLAN.md found (3 steps complete)
-  ✓ Git context captured
-  ✗ No temp plan files
 
 
-📊 Uncommitted Changes:
-  Modified:  2 files (+127/-45)
-  • src/auth.ts        +89/-12
-  • tests/auth.test.ts +38/-33
+### With Native Plan Mode
 
 
-📋 Merging sources...
-  → Goal: "Add user authentication with OAuth2"
-  → Approach: JWT tokens with refresh rotation
-  → Progress: 3 complete, 1 in progress, 2 pending
+```bash
+# Enter Plan Mode for exploration
+[Shift+Tab]
+
+# Discuss approaches, make decisions
+[Explore codebase, discuss options]
+
+# Capture the thinking
+/plan --capture
 
 
-📝 Updated docs/PLAN.md
+# Exit and implement
+[Shift+Tab]
+```
 
 
-Summary:
-  ✓ Completed:     3 steps
-  ◐ In Progress:   1 step
-  ○ Pending:       2 steps
-  ⚠ Blocked:       0 steps
-  ? Open questions: 2
-  📋 Decisions:    4 logged
+### Multi-Session Feature
 
 
-Review with: /plan --review
+```bash
+# Session 1
+/plan "Implement payment processing"
+[work on steps 1-2]
+/plan --save "Done with Stripe setup"
+
+# Session 2
+/plan --load                 # Restore context
+[work on steps 3-4]
+/plan --sync                 # Update from commits
+/plan --save "Payment flow working"
+
+# Session 3
+/plan --load
+[complete remaining work]
+/plan --clear "Next: Add subscriptions"
 ```
 ```
 
 
+---
+
 ## Notes
 ## Notes
 
 
-- Always captures internal state first—you can't lose Plan Mode thinking
-- Archives old plans when using `--clear` (never destructive)
-- Works across machines if docs/PLAN.md is committed
-- Pairs with `/save` + `/load` for complete session continuity
-- Human-readable format works without Claude Code
-- Git context helps track what's changed since last session
-- Effort indicators are relative, not time-based
+- **Never destructive** - Always archives before clearing
+- **Git-aware** - Tracks uncommitted changes and recent commits
+- **Session-aware** - Knows when state is stale
+- **Human-readable** - Progress files work without Claude Code
+- **Smart defaults** - No args = intelligent context detection

+ 0 - 231
commands/saveplan.md

@@ -1,231 +0,0 @@
----
-description: "Save plan session state. Persists TodoWrite tasks, current plan step, and git context to .claude/session-cache.json."
----
-
-# SavePlan - Session State Persistence
-
-Save your current session state before ending work. Captures TodoWrite tasks, current plan step, and git context.
-
-## Architecture
-
-```
-/saveplan "optional notes"
-    │
-    ├─→ Capture TodoWrite state
-    │     └─ completed, in_progress, pending tasks
-    │
-    ├─→ Capture plan context
-    │     ├─ Current step from docs/PLAN.md
-    │     └─ Plan progress percentage
-    │
-    ├─→ Capture git context
-    │     ├─ Branch, last commit
-    │     └─ Uncommitted changes
-    │
-    └─→ Write state files
-          ├─ .claude/session-cache.json (machine)
-          └─ .claude/claude-progress.md (human)
-```
-
-## Why This Exists
-
-Claude Code's native features don't persist across sessions:
-
-| Feature | Persists? | Location |
-|---------|-----------|----------|
-| Conversation history | Yes | Internal (use `--resume`) |
-| CLAUDE.md context | Yes | `./CLAUDE.md` |
-| TodoWrite tasks | **No** | Deleted on session end |
-| Plan Mode state | **No** | In-memory only |
-
-This command bridges the gap by saving what Claude Code doesn't.
-
-## Output Files
-
-### .claude/session-cache.json (v2.0)
-
-```json
-{
-  "version": "2.0",
-  "timestamp": "2025-11-27T10:30:00Z",
-
-  "todos": {
-    "completed": ["Set up OAuth credentials"],
-    "in_progress": ["Fix callback URL handling"],
-    "pending": ["Add token refresh"]
-  },
-
-  "plan": {
-    "file": "docs/PLAN.md",
-    "goal": "Add user authentication with OAuth2",
-    "current_step": "Step 3: Implement OAuth flow",
-    "current_step_index": 3,
-    "total_steps": 5,
-    "progress_percent": 40
-  },
-
-  "git": {
-    "branch": "feature/auth",
-    "last_commit": "abc123f",
-    "last_commit_message": "feat: Add OAuth config",
-    "uncommitted_count": 3,
-    "uncommitted_files": [
-      "src/auth/oauth.ts",
-      "src/auth/callback.ts",
-      "tests/auth.test.ts"
-    ]
-  },
-
-  "notes": "Stopped at callback URL issue - need to fix redirect"
-}
-```
-
-### .claude/claude-progress.md
-
-```markdown
-# Session Progress
-
-**Saved**: 2025-11-27 10:30 AM
-**Branch**: feature/auth
-
-## Plan Context
-
-**Goal**: Add user authentication with OAuth2
-**Current Step**: ◐ Step 3 - Implement OAuth flow [M]
-**Progress**: ██████░░░░ 40% (2/5 steps)
-
-## Tasks
-
-### Completed
-- ✓ Set up OAuth credentials
-
-### In Progress
-- ◐ Fix callback URL handling
-
-### Pending
-- ○ Add token refresh
-
-## Git State
-
-- Last commit: `abc123f` feat: Add OAuth config
-- Uncommitted: 3 files
-
-## Notes
-
-> Stopped at callback URL issue - need to fix redirect
-
----
-*Restore with: /loadplan*
-```
-
-## Execution Steps
-
-### Step 1: Gather TodoWrite State
-
-Map current TodoWrite tasks by status:
-- `completed` → completed array
-- `in_progress` → in_progress array
-- `pending` → pending array
-
-### Step 2: Gather Plan Context
-
-```bash
-# Check if plan exists
-cat docs/PLAN.md 2>/dev/null
-```
-
-Parse from docs/PLAN.md:
-- Goal line: `**Goal**:`
-- Current step: line with `◐` marker
-- Count `✓` for completed, total for progress
-
-### Step 3: Gather Git Context
-
-```bash
-git branch --show-current
-git log -1 --format="%h %s"
-git status --porcelain
-git diff --stat
-```
-
-### Step 4: Create Directory
-
-```bash
-mkdir -p .claude
-```
-
-### Step 5: Write State Files
-
-Write both:
-- `.claude/session-cache.json` - machine-readable
-- `.claude/claude-progress.md` - human-readable
-
-### Step 6: Confirm
-
-```
-✓ Plan session saved
-
-┌─ Saved State ──────────────────────────────────────────────────────────────────────────────────┐
-│ Plan: Step 3/5 (40%) - Implement OAuth flow                                                    │
-│ Tasks: 1 completed, 1 in progress, 1 pending                                                   │
-│ Git: 3 uncommitted files                                                                       │
-│ Notes: "Stopped at callback URL issue..."                                                      │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-Files:
-  • .claude/session-cache.json
-  • .claude/claude-progress.md
-
-Restore with: /loadplan
-```
-
-## Usage Examples
-
-```bash
-# Basic save
-/saveplan
-
-# Save with notes
-/saveplan "Stopped at callback URL issue"
-
-# Save and commit state files
-/saveplan --commit
-
-# Save with notes and commit
-/saveplan "Ready for review" --commit
-```
-
-## Flags
-
-| Flag | Effect |
-|------|--------|
-| `--commit` | Git commit state files after saving |
-| `--force` | Overwrite without confirmation |
-| `--no-plan` | Skip plan context capture |
-
-## Integration
-
-Part of the plan management suite:
-
-```
-┌────────────────────────────────────────────────────────────────────────────────────────────────┐
-│                                    Session Lifecycle                                           │
-├────────────────────────────────────────────────────────────────────────────────────────────────┤
-│                                                                                                │
-│          START                        WORK                          END                        │
-│            │                           │                             │                         │
-│            ▼                           ▼                             ▼                         │
-│    /sync + /loadplan ─────────→ /showplan (anytime) ──────────→ /saveplan                     │
-│            │                           │                             │                         │
-│         Restore                      Status                       Persist                      │
-│         context                       view                        state                        │
-│                                                                                                │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-```
-
-## Notes
-
-- Always captures plan context if docs/PLAN.md exists
-- State files are gitignored by default
-- Use `--commit` to track state in git
-- Notes are preserved and shown on `/loadplan`

+ 0 - 174
commands/showplan.md

@@ -1,174 +0,0 @@
----
-description: "Show plan status: progress, active tasks, git state. Quick read-only view of current project state."
----
-
-# ShowPlan - Plan Status View
-
-Quick read-only view showing plan progress, active tasks, and git state.
-
-## What This Command Does
-
-```
-/showplan
-    │
-    ├─→ Read docs/PLAN.md
-    │     └─ Parse current step, progress, blockers
-    │
-    ├─→ Read TodoWrite state
-    │     └─ Get in-progress and pending tasks
-    │
-    ├─→ Read git state
-    │     └─ Branch, uncommitted changes, recent commits
-    │
-    └─→ Display unified status view
-```
-
-## Output Format
-
-```
-📊 Plan Status
-
-┌─ Plan ─────────────────────────────────────────────────────────────────────────────────────────┐
-│ docs/PLAN.md (updated 2 hours ago)                                                             │
-│                                                                                                │
-│ Goal: Add user authentication with OAuth2                                                      │
-│                                                                                                │
-│ ✓ Step 1: Research OAuth providers [S]                                                         │
-│ ✓ Step 2: Set up Google OAuth app [S]                                                          │
-│ ◐ Step 3: Implement OAuth flow [M]  ← CURRENT                                                  │
-│ ○ Step 4: Add token refresh [S]                                                                │
-│ ○ Step 5: Write integration tests [M]                                                          │
-│                                                                                                │
-│ Progress: ██████░░░░ 40% (2/5)                                                                 │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Active Tasks ─────────────────────────────────────────────────────────────────────────────────┐
-│ ◐ Fix callback URL handling                                                                    │
-│ ○ Add token refresh logic                                                                      │
-│ ✓ Set up OAuth credentials                                                                     │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Git ──────────────────────────────────────────────────────────────────────────────────────────┐
-│ Branch: feature/auth                                                                           │
-│ Uncommitted: 3 files (+45/-12)                                                                 │
-│   • src/auth/oauth.ts               +32/-8                                                     │
-│   • src/auth/callback.ts            +13/-4                                                     │
-│   • tests/auth.test.ts              (new)                                                      │
-│                                                                                                │
-│ Recent commits:                                                                                │
-│   • abc123f feat: Add OAuth config                                                             │
-│   • def456a fix: Handle token expiry                                                           │
-│   • 789ghij refactor: Extract auth utils                                                       │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-┌─ Suggestions ──────────────────────────────────────────────────────────────────────────────────┐
-│ → 3 files ready to commit                                                                      │
-│ → Plan is 2 days stale, run: /plan --sync                                                      │
-│ → Save before leaving: /saveplan                                                               │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-```
-
-## Execution Steps
-
-### Step 1: Check for Plan
-
-```bash
-# Check if plan exists
-cat docs/PLAN.md 2>/dev/null
-```
-
-If no plan found:
-```
-┌─ Plan ─────────────────────────────────────────────────────────────────────────────────────────┐
-│ ⚠  Plan: No docs/PLAN.md found                                                                 │
-│    Create one with: /plan "your project goal"                                                  │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-```
-
-If no saved state but plan exists:
-```
-┌─ Session ──────────────────────────────────────────────────────────────────────────────────────┐
-│ ⚠  State: No saved state found in .claude/session-cache.json                                    │
-│ ✅  Plan: Project plan found at docs/PLAN.md                                                    │
-└────────────────────────────────────────────────────────────────────────────────────────────────┘
-```
-
-### Step 2: Parse Plan
-
-Extract from docs/PLAN.md:
-- **Goal**: from `**Goal**:` line
-- **Steps**: lines starting with `✓`, `◐`, `○`, `⚠`
-- **Current step**: the one marked with `◐`
-- **Progress**: count completed vs total
-
-### Step 3: Get TodoWrite State
-
-Read current TodoWrite tasks:
-- `in_progress` → show with ◐
-- `pending` → show with ○
-- `completed` → show with ✓ (recent only)
-
-### Step 4: Get Git State
-
-```bash
-# Current branch
-git branch --show-current
-
-# Uncommitted changes with stats
-git diff --stat
-git diff --cached --stat
-
-# Count changes
-git status --porcelain
-```
-
-### Step 5: Generate Suggestions
-
-Based on state, suggest next actions:
-
-| Condition | Suggestion |
-|-----------|------------|
-| Uncommitted files > 0 | "X files ready to commit" |
-| Plan modified > 2 days ago | "Plan may be stale, run: /plan --sync" |
-| No saved state exists | "Save progress with: /saveplan" |
-| In-progress task exists | "Continue: <task name>" |
-| All tasks complete | "Mark plan step complete: /plan --status" |
-
-## Flags
-
-| Flag | Effect |
-|------|--------|
-| `--brief` | Compact single-line summary |
-| `--plan` | Show only plan section |
-| `--tasks` | Show only tasks section |
-| `--git` | Show only git section |
-
-## Brief Mode
-
-```bash
-/showplan --brief
-```
-
-Output:
-```
-📊 Plan: 2/5 (◐ Step 3) │ Tasks: 1 active, 2 pending │ Git: 3 uncommitted
-```
-
-## Integration
-
-Part of the plan management suite:
-
-| Command | Purpose |
-|---------|---------|
-| `/sync` | Read project context at session start |
-| `/loadplan` | Restore TodoWrite + plan state from saved JSON |
-| `/showplan` | **This command** - Quick status view |
-| `/saveplan` | Persist state before leaving |
-| `/plan` | Create or manage project plans |
-
-## Notes
-
-- Read-only command, never modifies files
-- Fast execution, can run frequently
-- Shows suggestions based on detected state
-- Works even without plan (shows tasks + git only)

+ 0 - 370
commands/test.md

@@ -1,370 +0,0 @@
----
-description: "Generate tests for code with automatic framework detection. Creates unit tests, integration tests, or test stubs based on your stack."
----
-
-# Test - Generate Tests
-
-Generate tests for your code with automatic framework detection.
-
-## Arguments
-
-$ARGUMENTS
-
-- File path: Generate tests for specific file
-- Function name: Generate tests for specific function
-- `--type <unit|integration|e2e>`: Specify test type
-- `--framework <jest|vitest|pytest|etc>`: Override detected framework
-
-## What This Command Does
-
-1. **Detect Test Framework**
-   - Scan package.json, pyproject.toml, etc.
-   - Identify existing test patterns
-   - Determine conventions in use
-
-2. **Analyze Target Code**
-   - Parse functions/classes
-   - Identify inputs/outputs
-   - Find edge cases
-
-3. **Generate Tests**
-   - Create test file in correct location
-   - Follow project conventions
-   - Include common edge cases
-
-## Framework Detection
-
-### JavaScript/TypeScript
-```bash
-# Check package.json for:
-- jest
-- vitest
-- mocha
-- ava
-- @testing-library/*
-```
-
-### Python
-```bash
-# Check for:
-- pytest (pyproject.toml, pytest.ini)
-- unittest (default)
-- nose2
-```
-
-### PHP
-```bash
-# Check composer.json for:
-- phpunit/phpunit
-- pestphp/pest
-- codeception/codeception
-- phpspec/phpspec
-- behat/behat
-
-# Check for config files:
-- phpunit.xml / phpunit.xml.dist
-- pest.php
-- codeception.yml
-```
-
-### E2E / Browser Testing
-```bash
-# Check package.json for:
-- cypress
-- playwright
-- @playwright/test
-- puppeteer
-- webdriverio
-```
-
-### Other
-- Go: built-in testing
-- Rust: built-in testing
-
-## Execution Steps
-
-### Step 1: Detect Framework
-
-```bash
-# JavaScript
-cat package.json | jq '.devDependencies | keys[]' | grep -E 'jest|vitest|mocha'
-
-# Python
-grep -l "pytest" pyproject.toml setup.py requirements*.txt 2>/dev/null
-```
-
-### Step 2: Analyze Target Code
-
-Read the target file and extract:
-- Function signatures
-- Input parameters and types
-- Return types
-- Dependencies/imports
-- Existing patterns
-
-### Step 3: Determine Test Location
-
-```
-# JavaScript conventions
-src/utils/helper.ts → src/utils/__tests__/helper.test.ts
-                   → src/utils/helper.test.ts
-                   → tests/utils/helper.test.ts
-
-# Python conventions
-app/utils/helper.py → tests/test_helper.py
-                   → app/utils/test_helper.py
-                   → tests/utils/test_helper.py
-
-# PHP conventions
-app/Services/UserService.php → tests/Unit/Services/UserServiceTest.php
-                             → tests/Feature/UserServiceTest.php
-
-# Cypress conventions
-src/components/Login.vue → cypress/e2e/login.cy.ts
-                        → cypress/component/Login.cy.ts
-```
-
-### Step 4: Generate Test File
-
-Create comprehensive tests including:
-- Happy path
-- Edge cases (null, empty, boundary values)
-- Error cases
-- Async handling (if applicable)
-
-## Output Format
-
-### Jest/Vitest (TypeScript)
-
-```typescript
-import { describe, it, expect, vi } from 'vitest';
-import { functionName } from '../path/to/module';
-
-describe('functionName', () => {
-  it('should handle normal input', () => {
-    const result = functionName('input');
-    expect(result).toBe('expected');
-  });
-
-  it('should handle empty input', () => {
-    expect(() => functionName('')).toThrow();
-  });
-
-  it('should handle null input', () => {
-    expect(functionName(null)).toBeNull();
-  });
-});
-```
-
-### pytest (Python)
-
-```python
-import pytest
-from app.module import function_name
-
-class TestFunctionName:
-    def test_normal_input(self):
-        result = function_name("input")
-        assert result == "expected"
-
-    def test_empty_input(self):
-        with pytest.raises(ValueError):
-            function_name("")
-
-    def test_none_input(self):
-        assert function_name(None) is None
-```
-
-### PHPUnit (PHP)
-
-```php
-<?php
-
-namespace Tests\Unit\Services;
-
-use PHPUnit\Framework\TestCase;
-use App\Services\UserService;
-
-class UserServiceTest extends TestCase
-{
-    public function test_it_creates_user_with_valid_data(): void
-    {
-        $service = new UserService();
-        $user = $service->create(['name' => 'John', 'email' => 'john@example.com']);
-
-        $this->assertNotNull($user);
-        $this->assertEquals('John', $user->name);
-    }
-
-    public function test_it_throws_on_invalid_email(): void
-    {
-        $this->expectException(\InvalidArgumentException::class);
-
-        $service = new UserService();
-        $service->create(['name' => 'John', 'email' => 'invalid']);
-    }
-}
-```
-
-### Pest (PHP)
-
-```php
-<?php
-
-use App\Services\UserService;
-
-describe('UserService', function () {
-    it('creates user with valid data', function () {
-        $service = new UserService();
-        $user = $service->create(['name' => 'John', 'email' => 'john@example.com']);
-
-        expect($user)->not->toBeNull()
-            ->and($user->name)->toBe('John');
-    });
-
-    it('throws on invalid email', function () {
-        $service = new UserService();
-        $service->create(['name' => 'John', 'email' => 'invalid']);
-    })->throws(\InvalidArgumentException::class);
-});
-```
-
-### Cypress (E2E)
-
-```typescript
-describe('Login Flow', () => {
-  beforeEach(() => {
-    cy.visit('/login');
-  });
-
-  it('should login with valid credentials', () => {
-    cy.get('[data-cy=email]').type('user@example.com');
-    cy.get('[data-cy=password]').type('password123');
-    cy.get('[data-cy=submit]').click();
-
-    cy.url().should('include', '/dashboard');
-    cy.get('[data-cy=welcome]').should('contain', 'Welcome');
-  });
-
-  it('should show error with invalid credentials', () => {
-    cy.get('[data-cy=email]').type('user@example.com');
-    cy.get('[data-cy=password]').type('wrong');
-    cy.get('[data-cy=submit]').click();
-
-    cy.get('[data-cy=error]').should('be.visible');
-  });
-});
-```
-
-### Cypress (Component)
-
-```typescript
-import Login from './Login.vue';
-
-describe('Login Component', () => {
-  it('renders login form', () => {
-    cy.mount(Login);
-
-    cy.get('[data-cy=email]').should('exist');
-    cy.get('[data-cy=password]').should('exist');
-    cy.get('[data-cy=submit]').should('contain', 'Login');
-  });
-
-  it('emits submit event with credentials', () => {
-    const onSubmit = cy.spy().as('submitSpy');
-    cy.mount(Login, { props: { onSubmit } });
-
-    cy.get('[data-cy=email]').type('user@example.com');
-    cy.get('[data-cy=password]').type('password123');
-    cy.get('[data-cy=submit]').click();
-
-    cy.get('@submitSpy').should('have.been.calledWith', {
-      email: 'user@example.com',
-      password: 'password123'
-    });
-  });
-});
-```
-
-## Usage Examples
-
-```bash
-# Generate tests for a file
-/test src/utils/auth.ts
-
-# Generate tests for specific function
-/test src/utils/auth.ts:validateToken
-
-# Specify test type
-/test src/api/users.ts --type integration
-
-# Override framework detection
-/test src/helpers.js --framework jest
-
-# Generate test stubs only (no implementation)
-/test src/complex.ts --stubs
-```
-
-## Test Types
-
-| Type | Purpose | Generated For |
-|------|---------|---------------|
-| `unit` | Test isolated functions | Pure functions, utilities |
-| `integration` | Test component interactions | API routes, services |
-| `e2e` | End-to-end flows | User journeys |
-| `snapshot` | UI snapshot tests | React components |
-
-## Flags
-
-| Flag | Effect |
-|------|--------|
-| `--type <type>` | Specify test type |
-| `--framework <fw>` | Override framework detection |
-| `--stubs` | Generate empty test stubs only |
-| `--coverage` | Focus on uncovered code paths |
-| `--verbose` | Explain test reasoning |
-
-## Smart Features
-
-### Dependency Mocking
-Automatically detects and mocks:
-- External API calls
-- Database operations
-- File system operations
-- Environment variables
-
-### Edge Case Generation
-Automatically includes tests for:
-- Null/undefined values
-- Empty strings/arrays
-- Boundary values (0, -1, MAX_INT)
-- Invalid types
-- Async error handling
-
-### Convention Following
-Matches existing project patterns:
-- Test file naming
-- Directory structure
-- Import styles
-- Assertion library
-
-## Integration
-
-After generating tests:
-
-```bash
-# Run the new tests
-npm test -- --watch <test-file>
-pytest <test-file> -v
-
-# Check coverage
-npm test -- --coverage
-pytest --cov=app
-```
-
-## Notes
-
-- Generated tests are starting points, refine as needed
-- Review mocks for accuracy
-- Add integration tests manually for complex flows
-- Use `--stubs` when you want to write tests yourself

+ 779 - 0
commands/testgen.md

@@ -0,0 +1,779 @@
+---
+description: "Generate tests with expert routing, framework detection, and auto-TodoWrite. Creates unit, integration, or E2E tests following project conventions."
+---
+
+# TestGen - AI Test Generation
+
+Generate comprehensive tests for your code with automatic framework detection, expert agent routing, and project convention matching. Routes to specialized experts (python-expert, react-expert, cypress-expert) for domain-specific test patterns.
+
+## Arguments
+
+$ARGUMENTS
+
+- `<file>`: Generate tests for specific file
+- `<file>:<function>`: Generate tests for specific function/method
+- `<directory>`: Generate tests for all files in directory
+- `--type <unit|integration|e2e|component>`: Specify test type
+- `--framework <jest|vitest|pytest|...>`: Override detected framework
+- `--focus <happy|edge|error|all>`: Focus on specific test cases
+- `--depth <quick|normal|thorough>`: Generation depth
+- `--stubs`: Generate empty test stubs only
+
+## Architecture
+
+```
+/testgen <target> [--type] [--focus] [--depth]
+    │
+    ├─→ Step 1: Analyze Target
+    │     ├─ File exists? → Read and parse
+    │     ├─ Function specified? → Extract signature
+    │     ├─ Directory? → List source files
+    │     └─ Find existing tests (avoid duplicates)
+    │
+    ├─→ Step 2: Detect Framework (parallel)
+    │     ├─ package.json → jest/vitest/mocha/cypress/playwright
+    │     ├─ pyproject.toml → pytest/unittest
+    │     ├─ composer.json → phpunit/pest
+    │     ├─ Check existing test patterns
+    │     └─ Fallback: infer from file extension
+    │
+    ├─→ Step 3: Load Project Standards
+    │     ├─ AGENTS.md, CLAUDE.md conventions
+    │     ├─ Existing test file structure
+    │     ├─ Import styles and assertion library
+    │     └─ Naming conventions (*.test.ts vs *.spec.ts)
+    │
+    ├─→ Step 4: Route to Expert Agent
+    │     ├─ .ts → typescript-expert
+    │     ├─ .tsx/.jsx → react-expert
+    │     ├─ .vue → vue-expert
+    │     ├─ .py → python-expert
+    │     ├─ .php → laravel-expert
+    │     ├─ E2E tests → cypress-expert
+    │     └─ Multi-file → parallel expert dispatch
+    │
+    ├─→ Step 5: Generate Tests
+    │     ├─ Create test file in correct location
+    │     ├─ Follow detected conventions
+    │     ├─ Include: happy path, edge cases, error handling
+    │     └─ Add proper mocking for dependencies
+    │
+    └─→ Step 6: Integration
+          ├─ Auto-create TodoWrite for generated tests
+          ├─ Suggest: run tests to verify
+          └─ Link to /saveplan for tracking
+```
+
+## Execution Steps
+
+### Step 1: Analyze Target
+
+```bash
+# Check if target exists
+test -f "$TARGET" && echo "FILE" || test -d "$TARGET" && echo "DIRECTORY"
+
+# For function-specific: parse the file
+# /testgen src/auth.ts:validateToken → extract validateToken signature
+```
+
+**Extract function signature:**
+```bash
+# Use ast-grep if available
+command -v ast-grep >/dev/null 2>&1 && ast-grep -p "function $FUNCTION_NAME" "$FILE"
+
+# Fallback to ripgrep
+rg "(?:function|const|def|public|private)\s+$FUNCTION_NAME" "$FILE" -A 10
+```
+
+**Check for existing tests:**
+```bash
+# Find related test files
+fd -e test.ts -e spec.ts -e test.js -e spec.js | rg "$BASENAME"
+
+# Python
+fd "test_*.py" | rg "$BASENAME"
+```
+
+### Step 2: Detect Framework
+
+**JavaScript/TypeScript:**
+```bash
+# Check package.json devDependencies
+cat package.json 2>/dev/null | jq -r '.devDependencies | keys[]' | grep -E 'jest|vitest|mocha|cypress|playwright|@testing-library'
+```
+
+**Python:**
+```bash
+# Check pyproject.toml or requirements
+grep -E "pytest|unittest|nose" pyproject.toml setup.py requirements*.txt 2>/dev/null
+```
+
+**PHP:**
+```bash
+# Check composer.json
+cat composer.json 2>/dev/null | jq -r '.["require-dev"] | keys[]' | grep -E 'phpunit|pest|codeception'
+```
+
+**Detect test patterns:**
+```bash
+# Find existing test files to match conventions
+fd -e test.ts -e spec.ts -e test.tsx -e spec.tsx | head -3
+fd "test_*.py" tests/ | head -3
+```
+
+### Step 3: Load Project Standards
+
+**Check for conventions:**
+```bash
+# Claude Code conventions
+cat AGENTS.md 2>/dev/null | head -50
+cat CLAUDE.md 2>/dev/null | head -50
+
+# Test config files
+cat jest.config.* vitest.config.* pytest.ini pyproject.toml 2>/dev/null | head -30
+```
+
+**Determine test location convention:**
+```
+# JavaScript conventions (detect which is used)
+src/utils/helper.ts → src/utils/__tests__/helper.test.ts  # __tests__ folder
+                    → src/utils/helper.test.ts            # co-located
+                    → tests/utils/helper.test.ts          # separate tests/
+
+# Python conventions
+app/utils/helper.py → tests/test_helper.py               # tests/ folder
+                    → tests/utils/test_helper.py         # mirror structure
+                    → app/utils/test_helper.py           # co-located
+
+# PHP conventions
+app/Services/UserService.php → tests/Unit/Services/UserServiceTest.php
+                             → tests/Feature/UserServiceTest.php
+```
+
+### Step 4: Route to Expert Agent
+
+| File Pattern | Primary Expert | Secondary |
+|--------------|----------------|-----------|
+| `*.ts` | typescript-expert | - |
+| `*.tsx`, `*.jsx` | react-expert | typescript-expert |
+| `*.vue` | vue-expert | typescript-expert |
+| `*.py` | python-expert | - |
+| `*.php` | laravel-expert | - |
+| `*.cy.ts`, `cypress/*` | cypress-expert | - |
+| `*.spec.ts` (Playwright) | - | typescript-expert |
+| `*.sh`, `*.bash` | bash-expert | - |
+
+**Invoke via Task tool:**
+```
+Task tool with subagent_type: "[detected]-expert"
+Prompt includes:
+  - Source file content
+  - Function signatures to test
+  - Detected framework and conventions
+  - Requested test type and focus
+  - Project conventions from AGENTS.md
+```
+
+### Step 5: Generate Tests
+
+The expert produces tests following this structure:
+
+**Include test categories based on --focus:**
+
+| Focus | What to Generate |
+|-------|------------------|
+| `happy` | Normal input, expected output |
+| `edge` | Boundary values, empty inputs, nulls |
+| `error` | Invalid inputs, exceptions, error handling |
+| `all` | All of the above (default) |
+
+**Depth levels:**
+
+| Depth | Coverage |
+|-------|----------|
+| `quick` | Happy path only, 1-2 tests per function |
+| `normal` | Happy + common edge cases (default) |
+| `thorough` | Comprehensive: all paths, mocking, async |
+
+### Step 6: Integration
+
+**Auto-create TodoWrite:**
+```
+TodoWrite:
+  - content: "Run generated tests for src/auth.ts"
+    status: "pending"
+    activeForm: "Running generated tests for auth.ts"
+```
+
+**Suggest next steps:**
+```
+Tests generated: src/auth.test.ts
+
+Next steps:
+1. Run tests: npm test src/auth.test.ts
+2. Review and refine edge cases
+3. Use /saveplan to track test coverage goals
+```
+
+---
+
+## Expert Routing Details
+
+### TypeScript/JavaScript → typescript-expert
+
+Generates tests with:
+- Proper type imports
+- Generic type handling
+- Async/await patterns
+- Mock typing
+
+### React/JSX → react-expert
+
+Generates tests with:
+- React Testing Library patterns
+- Component rendering tests
+- Hook testing (renderHook)
+- Event simulation
+- Accessibility queries (getByRole)
+
+### Vue → vue-expert
+
+Generates tests with:
+- Vue Test Utils patterns
+- Composition API testing
+- Pinia store mocking
+- Component mounting
+
+### Python → python-expert
+
+Generates tests with:
+- pytest fixtures
+- Parametrized tests
+- Mock/patch patterns
+- Async test handling
+- Type hint verification
+
+### PHP/Laravel → laravel-expert
+
+Generates tests with:
+- PHPUnit/Pest patterns
+- Database transactions
+- Factory usage
+- HTTP testing
+- Mocking facades
+
+### E2E → cypress-expert
+
+Generates tests with:
+- Page object patterns
+- Custom commands
+- Network stubbing
+- Visual testing
+- CI configuration
+
+---
+
+## Framework-Specific Output
+
+### Jest/Vitest (TypeScript)
+
+```typescript
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { validateToken, TokenError } from '../auth';
+
+describe('validateToken', () => {
+  beforeEach(() => {
+    vi.clearAllMocks();
+  });
+
+  describe('happy path', () => {
+    it('should return true for valid JWT token', () => {
+      const token = 'eyJhbGciOiJIUzI1NiIs...';
+      expect(validateToken(token)).toBe(true);
+    });
+
+    it('should decode payload correctly', () => {
+      const token = createTestToken({ userId: 123 });
+      const result = validateToken(token);
+      expect(result.payload.userId).toBe(123);
+    });
+  });
+
+  describe('edge cases', () => {
+    it('should handle empty string', () => {
+      expect(validateToken('')).toBe(false);
+    });
+
+    it('should handle malformed token', () => {
+      expect(validateToken('not.a.token')).toBe(false);
+    });
+
+    it('should handle expired token', () => {
+      const expiredToken = createTestToken({ exp: Date.now() - 1000 });
+      expect(validateToken(expiredToken)).toBe(false);
+    });
+  });
+
+  describe('error handling', () => {
+    it('should throw TokenError for null input', () => {
+      expect(() => validateToken(null)).toThrow(TokenError);
+    });
+
+    it('should throw with descriptive message', () => {
+      expect(() => validateToken(null)).toThrow('Token cannot be null');
+    });
+  });
+});
+```
+
+### React Testing Library
+
+```typescript
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { LoginForm } from '../LoginForm';
+
+describe('LoginForm', () => {
+  const mockOnSubmit = vi.fn();
+
+  beforeEach(() => {
+    mockOnSubmit.mockClear();
+  });
+
+  it('renders email and password fields', () => {
+    render(<LoginForm onSubmit={mockOnSubmit} />);
+
+    expect(screen.getByRole('textbox', { name: /email/i })).toBeInTheDocument();
+    expect(screen.getByLabelText(/password/i)).toBeInTheDocument();
+  });
+
+  it('submits form with credentials', async () => {
+    const user = userEvent.setup();
+    render(<LoginForm onSubmit={mockOnSubmit} />);
+
+    await user.type(screen.getByRole('textbox', { name: /email/i }), 'test@example.com');
+    await user.type(screen.getByLabelText(/password/i), 'password123');
+    await user.click(screen.getByRole('button', { name: /submit/i }));
+
+    expect(mockOnSubmit).toHaveBeenCalledWith({
+      email: 'test@example.com',
+      password: 'password123',
+    });
+  });
+
+  it('shows validation error for invalid email', async () => {
+    const user = userEvent.setup();
+    render(<LoginForm onSubmit={mockOnSubmit} />);
+
+    await user.type(screen.getByRole('textbox', { name: /email/i }), 'invalid');
+    await user.click(screen.getByRole('button', { name: /submit/i }));
+
+    expect(await screen.findByText(/invalid email/i)).toBeInTheDocument();
+    expect(mockOnSubmit).not.toHaveBeenCalled();
+  });
+
+  it('disables submit button while loading', () => {
+    render(<LoginForm onSubmit={mockOnSubmit} isLoading />);
+
+    expect(screen.getByRole('button', { name: /submit/i })).toBeDisabled();
+  });
+});
+```
+
+### pytest (Python)
+
+```python
+import pytest
+from unittest.mock import Mock, patch, AsyncMock
+from app.auth import validate_token, TokenError
+
+class TestValidateToken:
+    """Tests for validate_token function."""
+
+    def test_valid_token_returns_true(self):
+        """Should return True for valid JWT token."""
+        token = "eyJhbGciOiJIUzI1NiIs..."
+        assert validate_token(token) is True
+
+    def test_decodes_payload_correctly(self, valid_token):
+        """Should decode payload with correct user ID."""
+        result = validate_token(valid_token)
+        assert result.payload["userId"] == 123
+
+    @pytest.mark.parametrize("invalid_input", [
+        "",
+        "not.a.token",
+        "a.b",
+        None,
+    ])
+    def test_rejects_invalid_tokens(self, invalid_input):
+        """Should return False for invalid token formats."""
+        assert validate_token(invalid_input) is False
+
+    def test_rejects_expired_token(self, expired_token):
+        """Should return False for expired tokens."""
+        assert validate_token(expired_token) is False
+
+    def test_raises_token_error_for_null(self):
+        """Should raise TokenError with descriptive message."""
+        with pytest.raises(TokenError, match="Token cannot be null"):
+            validate_token(None)
+
+    @pytest.fixture
+    def valid_token(self):
+        """Create a valid test token."""
+        return create_test_token({"userId": 123})
+
+    @pytest.fixture
+    def expired_token(self):
+        """Create an expired test token."""
+        return create_test_token({"exp": time.time() - 1000})
+
+
+class TestValidateTokenAsync:
+    """Tests for async token validation."""
+
+    @pytest.mark.asyncio
+    async def test_async_validation(self):
+        """Should validate token asynchronously."""
+        token = create_test_token({"userId": 456})
+        result = await validate_token_async(token)
+        assert result.valid is True
+
+    @pytest.mark.asyncio
+    async def test_handles_network_timeout(self):
+        """Should handle network timeout gracefully."""
+        with patch("app.auth.fetch_public_key", new_callable=AsyncMock) as mock:
+            mock.side_effect = TimeoutError()
+
+            with pytest.raises(TokenError, match="Validation timeout"):
+                await validate_token_async("token")
+```
+
+### PHPUnit (PHP)
+
+```php
+<?php
+
+namespace Tests\Unit\Services;
+
+use PHPUnit\Framework\TestCase;
+use App\Services\AuthService;
+use App\Exceptions\TokenException;
+use Mockery;
+
+class AuthServiceTest extends TestCase
+{
+    private AuthService $service;
+
+    protected function setUp(): void
+    {
+        parent::setUp();
+        $this->service = new AuthService();
+    }
+
+    protected function tearDown(): void
+    {
+        Mockery::close();
+        parent::tearDown();
+    }
+
+    /** @test */
+    public function it_validates_correct_token(): void
+    {
+        $token = $this->createValidToken(['user_id' => 123]);
+
+        $result = $this->service->validateToken($token);
+
+        $this->assertTrue($result);
+    }
+
+    /** @test */
+    public function it_rejects_expired_token(): void
+    {
+        $token = $this->createExpiredToken();
+
+        $result = $this->service->validateToken($token);
+
+        $this->assertFalse($result);
+    }
+
+    /** @test */
+    public function it_throws_for_null_token(): void
+    {
+        $this->expectException(TokenException::class);
+        $this->expectExceptionMessage('Token cannot be null');
+
+        $this->service->validateToken(null);
+    }
+
+    /**
+     * @test
+     * @dataProvider invalidTokenProvider
+     */
+    public function it_rejects_invalid_tokens(string $invalidToken): void
+    {
+        $result = $this->service->validateToken($invalidToken);
+
+        $this->assertFalse($result);
+    }
+
+    public static function invalidTokenProvider(): array
+    {
+        return [
+            'empty string' => [''],
+            'malformed' => ['not.a.token'],
+            'missing parts' => ['a.b'],
+        ];
+    }
+}
+```
+
+### Pest (PHP)
+
+```php
+<?php
+
+use App\Services\AuthService;
+use App\Exceptions\TokenException;
+
+describe('AuthService', function () {
+    beforeEach(function () {
+        $this->service = new AuthService();
+    });
+
+    describe('validateToken', function () {
+        it('validates correct token', function () {
+            $token = createValidToken(['user_id' => 123]);
+
+            expect($this->service->validateToken($token))->toBeTrue();
+        });
+
+        it('rejects expired token', function () {
+            $token = createExpiredToken();
+
+            expect($this->service->validateToken($token))->toBeFalse();
+        });
+
+        it('throws for null token', function () {
+            $this->service->validateToken(null);
+        })->throws(TokenException::class, 'Token cannot be null');
+
+        it('rejects invalid tokens', function (string $invalidToken) {
+            expect($this->service->validateToken($invalidToken))->toBeFalse();
+        })->with([
+            'empty string' => '',
+            'malformed' => 'not.a.token',
+            'missing parts' => 'a.b',
+        ]);
+    });
+});
+```
+
+### Cypress (E2E)
+
+```typescript
+describe('Login Flow', () => {
+  beforeEach(() => {
+    cy.visit('/login');
+  });
+
+  it('should login with valid credentials', () => {
+    cy.get('[data-cy=email]').type('user@example.com');
+    cy.get('[data-cy=password]').type('password123');
+    cy.get('[data-cy=submit]').click();
+
+    cy.url().should('include', '/dashboard');
+    cy.get('[data-cy=welcome]').should('contain', 'Welcome');
+  });
+
+  it('should show error with invalid credentials', () => {
+    cy.intercept('POST', '/api/login', {
+      statusCode: 401,
+      body: { error: 'Invalid credentials' },
+    }).as('loginRequest');
+
+    cy.get('[data-cy=email]').type('user@example.com');
+    cy.get('[data-cy=password]').type('wrong');
+    cy.get('[data-cy=submit]').click();
+
+    cy.wait('@loginRequest');
+    cy.get('[data-cy=error]').should('be.visible');
+    cy.url().should('include', '/login');
+  });
+
+  it('should persist session after reload', () => {
+    cy.login('user@example.com', 'password123');
+    cy.visit('/dashboard');
+    cy.reload();
+
+    cy.get('[data-cy=welcome]').should('be.visible');
+  });
+});
+```
+
+### Cypress (Component)
+
+```typescript
+import LoginForm from './LoginForm.vue';
+
+describe('LoginForm Component', () => {
+  it('renders login form', () => {
+    cy.mount(LoginForm);
+
+    cy.get('[data-cy=email]').should('exist');
+    cy.get('[data-cy=password]').should('exist');
+    cy.get('[data-cy=submit]').should('contain', 'Login');
+  });
+
+  it('emits submit event with credentials', () => {
+    const onSubmitSpy = cy.spy().as('submitSpy');
+    cy.mount(LoginForm, { props: { onSubmit: onSubmitSpy } });
+
+    cy.get('[data-cy=email]').type('user@example.com');
+    cy.get('[data-cy=password]').type('password123');
+    cy.get('[data-cy=submit]').click();
+
+    cy.get('@submitSpy').should('have.been.calledWith', {
+      email: 'user@example.com',
+      password: 'password123',
+    });
+  });
+
+  it('validates email format', () => {
+    cy.mount(LoginForm);
+
+    cy.get('[data-cy=email]').type('invalid-email');
+    cy.get('[data-cy=submit]').click();
+
+    cy.get('[data-cy=email-error]').should('contain', 'Invalid email');
+  });
+});
+```
+
+---
+
+## Usage Examples
+
+```bash
+# Generate tests for a file
+/testgen src/utils/auth.ts
+
+# Generate tests for specific function
+/testgen src/utils/auth.ts:validateToken
+
+# Generate tests for directory
+/testgen src/services/
+
+# Specify test type
+/testgen src/api/users.ts --type integration
+
+# Override framework detection
+/testgen src/helpers.js --framework jest
+
+# Focus on edge cases only
+/testgen src/parser.ts --focus edge
+
+# Quick generation (happy path only)
+/testgen src/utils.ts --depth quick
+
+# Thorough generation (all cases + mocking)
+/testgen src/complex-service.ts --depth thorough
+
+# Generate test stubs only (no implementation)
+/testgen src/new-feature.ts --stubs
+
+# Generate E2E tests
+/testgen src/pages/Login.tsx --type e2e
+
+# Generate component tests
+/testgen src/components/Button.vue --type component
+```
+
+---
+
+## Focus Modes
+
+| Mode | What's Generated | Use When |
+|------|------------------|----------|
+| `--focus happy` | Normal inputs, expected outputs | Quick smoke tests |
+| `--focus edge` | Boundaries, empty, null, limits | Hardening existing code |
+| `--focus error` | Invalid inputs, exceptions | Error handling coverage |
+| `--focus all` | Everything (default) | New code, full coverage |
+
+---
+
+## Depth Modes
+
+| Mode | Coverage | Output Size |
+|------|----------|-------------|
+| `--depth quick` | Happy path, 1-2 tests/function | Minimal |
+| `--depth normal` | Happy + common edges (default) | Moderate |
+| `--depth thorough` | All paths, mocking, async, types | Comprehensive |
+
+---
+
+## Smart Features
+
+### Dependency Detection
+Automatically identifies and mocks:
+- External API calls (fetch, axios, httpx)
+- Database operations (queries, transactions)
+- File system operations
+- Environment variables
+- Third-party services
+
+### Test Location Intelligence
+Detects project convention:
+```bash
+# Scans existing tests to match pattern
+fd -e test.ts -e spec.ts | head -5
+
+# Matches: __tests__/, co-located, or tests/
+```
+
+### Import Style Matching
+Matches existing test imports:
+```typescript
+// Detects: vitest vs jest vs mocha
+// Detects: @testing-library vs enzyme
+// Detects: expect() style vs assert
+```
+
+---
+
+## CLI Tool Integration
+
+| Tool | Purpose | Fallback |
+|------|---------|----------|
+| `jq` | Parse package.json | Read tool |
+| `rg` | Find existing tests | Grep tool |
+| `ast-grep` | Parse function signatures | ripgrep patterns |
+| `fd` | Find test files | Glob tool |
+
+**Graceful degradation:**
+```bash
+command -v jq >/dev/null 2>&1 && cat package.json | jq '.devDependencies' || cat package.json
+```
+
+---
+
+## Integration
+
+| Command | Relationship |
+|---------|--------------|
+| `/review` | Review generated tests before committing |
+| `/explain` | Understand complex code before testing |
+| `/saveplan` | Track test coverage goals |
+| `/testgen` | This command |
+
+---
+
+## Notes
+
+- Generated tests are starting points - refine as needed
+- Review mocks for accuracy and completeness
+- Expert routing improves framework-specific patterns
+- Use `--stubs` when you prefer to write test logic yourself
+- Always run generated tests to verify they pass
+- Consider `/review` on generated tests before committing

+ 8 - 11
docs/DASH.md

@@ -9,7 +9,7 @@
 |----------|-------|-------|
 |----------|-------|-------|
 | 🤖 **Agents** | 21 | 7,552 |
 | 🤖 **Agents** | 21 | 7,552 |
 | ⚡ **Skills** | 18 | 2,725 |
 | ⚡ **Skills** | 18 | 2,725 |
-| 🔧 **Commands** | 12 | 3,276 |
+| 🔧 **Commands** | 9 | 3,276 |
 | 📏 **Rules** | 1 | 113 |
 | 📏 **Rules** | 1 | 113 |
 | 🧩 **Templates** | 2 | — |
 | 🧩 **Templates** | 2 | — |
 
 
@@ -80,18 +80,15 @@
 
 
 | Command | Purpose |
 | Command | Purpose |
 |---------|---------|
 |---------|---------|
-| 🔧 `/agent-genesis` | Generate expert agent prompts |
+| 🔧 `/sync` | Session bootstrap with project context |
+| 🔧 `/plan` | Unified planning: create plans, save/load state, show status |
+| 🔧 `/review` | Code review staged changes |
+| 🔧 `/testgen` | Generate tests with expert routing |
 | 🔧 `/explain` | Deep code/concept explanation |
 | 🔧 `/explain` | Deep code/concept explanation |
-| 🔧 `/g-slave` | Dispatch Gemini for large codebases |
-| 🔧 `/init-tools` | Quick project permissions setup |
-| 🔧 `/plan` | Create persistent project plans |
-| 🔧 `/saveplan` | Save plan state |
-| 🔧 `/loadplan` | Restore plan from saved state |
-| 🔧 `/showplan` | Show plan progress |
+| 🔧 `/spawn` | Generate expert agents |
+| 🔧 `/delegate` | Delegate to external LLMs (Gemini, OpenAI) |
 | 🔧 `/pulse` | Claude Code ecosystem news digest |
 | 🔧 `/pulse` | Claude Code ecosystem news digest |
-| 🔧 `/review` | Code review staged changes |
-| 🔧 `/sync` | Session bootstrap with project context |
-| 🔧 `/test` | Generate tests |
+| 🔧 `/setperms` | Set tool permissions |
 
 
 ---
 ---