Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.
Python aianthropicautomationclaude-codeclaude-skillscloudflaredevtoolsproductivityreactskillstailwindvite
Add session management slash commands for automated workflow
Jez1f19b24abc96
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 89670189..d65b5397 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Added - Session Management Slash Commands ✅++**Date**: 2025-11-07++**New Commands**: `/wrap-session`, `/resume-session` (located in `~/.claude/commands/`)++#### Session Management Automation+- **Commands Created**: 2 slash commands for automated session workflow+- **Token Savings**: 3-5 minutes per session cycle (wrap + resume)+- **Files Created**: 2 command files (~250 lines total)+- **Updated**: project-session-management skill to reference commands++**What These Commands Provide**:+- ✅ **`/wrap-session`**: Automates end-of-session workflow+ - Uses Task agent to analyze session state+ - Auto-updates SESSION.md with progress+ - Detects and updates relevant docs (CHANGELOG.md, ARCHITECTURE.md, etc.)+ - Creates structured git checkpoint commit+ - Outputs formatted handoff summary+ - Optional git push to remote+ - **Saves 2-3 minutes** per wrap-up (10-15 manual steps → 1 command)++- ✅ **`/resume-session`**: Automates start-of-session context loading+ - Uses Explore agent to load session context+ - Reads SESSION.md + IMPLEMENTATION_PHASES.md + recent git history+ - Displays formatted session summary (phase, progress, Next Action)+ - Stage-aware (shows verification checklist if in Verification stage)+ - Optionally opens "Next Action" file+ - Asks permission to continue or adjust direction+ - **Saves 1-2 minutes** per resume (5-8 manual reads → 1 command)++**Key Features**:+- Leverages Claude Code's built-in Task and Explore agents+- Comprehensive error handling (missing files, git failures, etc.)+- Smart doc detection (only updates relevant docs)+- Structured git checkpoint format (auto-follows template)+- Stage-aware context loading (Implementation/Verification/Debugging)++**Integration**:+- Commands reference project-session-management skill+- Skill references commands as "Option A: Automated (Recommended)"+- Manual workflow still available as "Option B: Manual"++**Distribution**:+- Commands installed to `~/.claude/commands/` (user's home directory)+- Available immediately after installation+- Work across all projects++**Production Tested**: Successfully tested on claude-skills project++---+### Added - TanStack Skills ✅**Date**: 2025-11-07diff --git a/README.md b/README.mdindex d04d3473..6787ef0c 100644--- a/README.md+++ b/README.md@@ -452,6 +452,12 @@ Session handoff protocol for managing context across sessions. Prevents 3 docume**Triggers**: `session management`, `session handoff`, `context management`+**Includes 2 Slash Commands**:+- `/wrap-session` - Automate end-of-session workflow (update SESSION.md, git checkpoint, handoff summary)+- `/resume-session` - Automate start-of-session context loading (load docs, show summary, continue from "Next Action")++**Time Savings**: 3-5 minutes per session cycle (automated vs manual workflow)+---### GitHub Automationdiff --git a/commands/README.md b/commands/README.mdnew file mode 100644index 00000000..0ef424fe--- /dev/null+++ b/commands/README.md@@ -0,0 +1,90 @@+# Session Management Commands++Two slash commands for automating session workflow with Claude Code.++## Installation++Copy commands to your `.claude/commands/` directory:++```bash+# From the claude-skills repo+cp commands/wrap-session.md ~/.claude/commands/+cp commands/resume-session.md ~/.claude/commands/+```++Commands are immediately available in Claude Code after copying.++## Commands++### `/wrap-session`++**Purpose**: Automate end-of-session workflow++**Usage**: Type `/wrap-session` in Claude Code++**What it does**:+1. Uses Task agent to analyze current session state+2. Updates SESSION.md with progress+3. Detects and updates relevant docs (CHANGELOG.md, ARCHITECTURE.md, etc.)+4. Creates structured git checkpoint commit+5. Outputs formatted handoff summary+6. Optionally pushes to remote++**Time savings**: 2-3 minutes per wrap-up (10-15 manual steps → 1 command)++---++### `/resume-session`++**Purpose**: Automate start-of-session context loading++**Usage**: Type `/resume-session` in Claude Code++**What it does**:+1. Uses Explore agent to load session context (SESSION.md + planning docs)+2. Shows recent git history (last 5 commits)+3. Displays formatted session summary (phase, progress, Next Action)+4. Shows verification criteria if in "Verification" stage+5. Optionally opens "Next Action" file+6. Asks permission to continue or adjust direction++**Time savings**: 1-2 minutes per resume (5-8 manual reads → 1 command)++---++## Requirements++- `SESSION.md` file in project root (created by `project-session-management` skill)+- `IMPLEMENTATION_PHASES.md` in project (optional, created by `project-planning` skill)+- Git repository initialized++## Integration++These commands work with the `project-session-management` skill:+- See: `~/.claude/skills/project-session-management/SKILL.md`+- Commands use Claude Code's built-in Task and Explore agents+- Manual workflow still available if preferred++## Features++**`/wrap-session`**:+- ✅ Auto-updates SESSION.md+- ✅ Smart doc detection+- ✅ Structured git checkpoint format+- ✅ Comprehensive error handling++**`/resume-session`**:+- ✅ Multi-file context loading+- ✅ Stage-aware (shows verification checklist when needed)+- ✅ Detects uncommitted changes+- ✅ Optional "Next Action" file opening++## Total Time Savings++**3-5 minutes per session cycle** (wrap + resume)++---++**Version**: 1.0.0+**Last Updated**: 2025-11-07+**Author**: Jeremy Dawes | Jezwebdiff --git a/commands/resume-session.md b/commands/resume-session.mdnew file mode 100644index 00000000..2ffb435e--- /dev/null+++ b/commands/resume-session.md@@ -0,0 +1,277 @@+# Resume Session++Quickly resume work by loading context from SESSION.md, showing current state, and continuing from "Next Action".++---++## Your Task++Follow these steps to load session context and resume work efficiently.++### 1. Load Session Context (Use Explore Agent)++Use the Task tool with subagent_type="Explore" and description "Load session context for resuming work" to gather:+- Find and read SESSION.md+- Find and read IMPLEMENTATION_PHASES.md (focus on current phase section)+- Extract current phase number and name+- Extract current stage (Implementation/Verification/Debugging)+- Extract last checkpoint hash and date+- Extract "Next Action" (file + line + what to do)+- Extract known issues+- Extract progress (completed and pending tasks)+- Get list of planning docs mentioned in SESSION.md+- Run `git log --oneline -5` for recent commits+- Run `git status` for uncommitted changes++**If SESSION.md doesn't exist:**+- Output: "❌ No SESSION.md found. Is this a new project?"+- Suggest: "Run project-planning skill to set up session management."+- Stop here++**If IMPLEMENTATION_PHASES.md doesn't exist:**+- Output: "⚠️ Warning: No IMPLEMENTATION_PHASES.md found."+- Output: "Continuing with SESSION.md only. Some context may be limited."+- Continue anyway++### 2. Check for Uncommitted Changes++If `git status` shows uncommitted changes:+- Output warning:+ ```+ ⚠️ WARNING: Uncommitted changes detected!++ Uncommitted files:+ [list files from git status]++ These changes weren't checkpointed. Continue anyway? (y/n)+ ```++**If user says no:**+- Output: "Stopping. Run /wrap-session to checkpoint changes first."+- Stop here++**If user says yes:**+- Output: "⚠️ Proceeding with uncommitted changes. Remember to checkpoint later."+- Continue++### 3. Show Recent Git History++Output formatted git history:++```+📜 Recent Commits (last 5):++[hash] [commit message line 1]+[hash] [commit message line 1]+[hash] [commit message line 1]+[hash] [commit message line 1]+[hash] [commit message line 1]++Current checkpoint: [hash from SESSION.md] ([date])+```++### 4. Display Session Summary++Output formatted summary:++```+═══════════════════════════════════════════════+ WELCOME BACK TO [PROJECT NAME]+═══════════════════════════════════════════════++📋 Current Phase: Phase [N] - [Phase Name] ([Status emoji])+📍 Current Stage: [Implementation/Verification/Debugging]+💾 Last Checkpoint: [hash] ([date])++───────────────────────────────────────────────+PROGRESS THIS PHASE:+───────────────────────────────────────────────++✅ [completed task]+✅ [completed task]+✅ [completed task]+🔄 [current pending task] ← CURRENT+⏸️ [future pending task]+⏸️ [future pending task]++───────────────────────────────────────────────+KNOWN ISSUES:+───────────────────────────────────────────────++• [issue 1]+• [issue 2]+[or "None" if no issues]++───────────────────────────────────────────────+NEXT ACTION:+───────────────────────────────────────────────++[Concrete next action from SESSION.md]+File: [file path]+Line: [line number] (if applicable)+Task: [specific action to take]++───────────────────────────────────────────────+PLANNING DOCS AVAILABLE:+───────────────────────────────────────────────++✅ SESSION.md (loaded)+✅ IMPLEMENTATION_PHASES.md (current phase loaded)+• [other docs from SESSION.md] (available)++═══════════════════════════════════════════════+```++### 5. Stage-Specific Context++**If current stage is "Verification":**+- Read current phase verification criteria from IMPLEMENTATION_PHASES.md+- Output:+ ```+ ───────────────────────────────────────────────+ VERIFICATION CHECKLIST (Current Phase):+ ───────────────────────────────────────────────++ [ ] [verification item 1]+ [ ] [verification item 2]+ [ ] [verification item 3]++ Check these items before marking phase complete.+ ───────────────────────────────────────────────+ ```++**If current stage is "Debugging":**+- Emphasize known issues+- Output:+ ```+ 🐛 Currently debugging. Focus on resolving known issues above.+ ```++**If current stage is "Implementation":**+- No special output (normal flow)++### 6. Load Additional Planning Docs (Optional)++Check if SESSION.md references other planning docs (ARCHITECTURE.md, API_ENDPOINTS.md, DATABASE_SCHEMA.md, etc.)++If any are referenced, ask:+```+Additional planning docs available:+• ARCHITECTURE.md+• API_ENDPOINTS.md+• [others...]++Would you like me to load any of these? (Enter doc names or 'none'):+```++**If user specifies docs:**+- Read the specified docs+- Output: "✅ Loaded [doc list]"++**If user says "none":**+- Output: "Continuing with loaded context only."++### 7. Offer to Open "Next Action" File++Extract file path from "Next Action".++Ask user:+```+Next Action file: [file path]++Would you like me to open this file? (y/n)+```++**If yes:**+- Use Read tool to open the file+- If line number specified, focus on that area (offset/limit)+- Output: "✅ Opened [file] at line [line]"++**If no:**+- Output: "File not opened. You can request it when ready."++### 8. Offer to Proceed with Next Action++Ask user:+```+Ready to proceed with Next Action?++Next Action: [action description]++Options:+1. Yes - proceed with this action+2. No - I'll tell you what to do instead+3. Context only - just keep loaded context, don't execute yet++Your choice (1/2/3):+```++**If choice 1 (Yes):**+- Output: "Proceeding with: [Next Action]"+- Begin executing the Next Action+- Use appropriate tools (Edit, Write, Bash, etc.)++**If choice 2 (No):**+- Output: "What would you like to do instead?"+- Wait for user to specify new direction+- Update SESSION.md "Next Action" if user provides new task++**If choice 3 (Context only):**+- Output: "Context loaded. Ready when you are."+- Wait for user instructions++### 9. Final Confirmation++Output:+```+✨ Session resumed successfully!++Current context loaded:+• Phase [N] progress+• Next Action ready+• [X] planning docs loaded++Ready to continue work.+```++---++## Error Handling++**SESSION.md doesn't exist:**+- Output: "❌ No SESSION.md found. Is this a new project?"+- Suggest: "Run project-planning skill or create SESSION.md manually."+- Stop++**IMPLEMENTATION_PHASES.md missing:**+- Warning only, continue with SESSION.md+- Output: "⚠️ IMPLEMENTATION_PHASES.md not found. Limited context available."++**Next Action is vague or missing:**+- Output: "⚠️ Next Action is unclear or missing in SESSION.md."+- Output: "Please update SESSION.md with specific: [file] + [line] + [action]"+- Offer to help: "Would you like me to help you define the Next Action? (y/n)"++**File from Next Action doesn't exist:**+- Output: "⚠️ File [path] from Next Action not found."+- Ask: "Has it been moved or renamed? Should I search for it? (y/n)"++**Git commands fail:**+- Output: "⚠️ Git history unavailable. Continuing without it."+- Show SESSION.md context only++**Phase number mismatch:**+- If SESSION.md phase doesn't match IMPLEMENTATION_PHASES.md:+- Output: "⚠️ Phase mismatch detected between SESSION.md and IMPLEMENTATION_PHASES.md"+- Output: "Using SESSION.md as source of truth."++---++## Success Criteria++✅ User has full context of where they left off+✅ Current phase progress is crystal clear+✅ Next Action is specific and ready to execute+✅ User can immediately continue work or adjust direction+✅ All relevant planning docs are accessible+✅ Recent git history provides continuitydiff --git a/commands/wrap-session.md b/commands/wrap-session.mdnew file mode 100644index 00000000..1d8604ae--- /dev/null+++ b/commands/wrap-session.md@@ -0,0 +1,241 @@+# Wrap Session++Automate end-of-session workflow: update SESSION.md, create git checkpoint, and prepare for context clear.++---++## Your Task++Follow these steps to wrap up the current session and prepare for a clean handoff.++### 1. Analyze Current State (Use Task Agent)++Use the Task tool with description "Analyze session state for wrap-up" to gather:+- Read SESSION.md completely+- Run `git status` to see uncommitted changes+- Run `git log -1 --oneline` to see last commit+- Run `git diff --stat` to see what changed+- Extract current phase number, name, and status+- Extract current stage (Implementation/Verification/Debugging)+- Extract "Next Action"+- Extract "Known Issues"++If SESSION.md doesn't exist:+- Stop and output: "❌ No SESSION.md found. Run project-planning skill first to set up session management."+- Do not proceed further++### 2. Update SESSION.md++**Update the following sections:**++**a) Current Stage**+- If tasks completed and ready for verification: Change to "Verification"+- If verification done and ready for next phase: Keep as current+- If debugging: Keep as "Debugging"++**b) Progress Section**+- Mark any completed tasks with `[x]`+- Add new tasks discovered during session+- Reorder if priorities changed++**c) Known Issues**+- Add any new issues discovered this session+- Remove resolved issues+- Update issue descriptions if changed++**d) Next Action**+- Update to be concrete and specific:+ - Must include: file path + line number (if applicable) + specific action+ - Example: "Implement PATCH /api/tasks/:id in src/routes/tasks.ts:47, handle validation and ownership check"+ - NOT vague like: "Continue working on API..."++**e) Last Checkpoint**+- Update date to today (YYYY-MM-DD format)+- Checkpoint hash will be updated after git commit (step 4)++**f) If Phase Complete**+- Change phase status from 🔄 to ✅+- Add "Completed" date+- Add "Summary" with 2-3 line accomplishment description+- Collapse phase section to 2-3 lines+- Move to next phase:+ - Change next phase from ⏸️ to 🔄+ - Expand next phase with initial task list+ - Set new "Next Action"++### 3. Check for Doc Updates++**Analyze what changed** this session using git diff output.++**Ask user about updating these docs** (only if relevant changes detected):++**If phase completed:**+- "Phase [N] complete! Should I add entry to CHANGELOG.md? (y/n)"++**If architecture changed** (new patterns, major refactoring):+- "Architecture changes detected. Update ARCHITECTURE.md? (y/n)"++**If API endpoints added/modified:**+- "API changes detected. Update API_ENDPOINTS.md? (y/n)"++**If database schema changed:**+- "Schema changes detected. Update DATABASE_SCHEMA.md? (y/n)"++**If README needs updates** (new features, changed usage):+- "User-facing changes detected. Update README.md? (y/n)"++**For each "yes":**+- Read the relevant doc+- Update with session changes+- Confirm update was made++**Note:** Don't ask about docs that don't exist or aren't relevant to changes.++### 4. Create Git Checkpoint++**a) Stage all changes:**+```bash+git add .+```++**b) Check if there are changes to commit:**+```bash+git status --short+```++If no changes:+- Output: "ℹ️ No changes to commit. SESSION.md updated, no checkpoint created."+- Skip to step 5++**c) Determine checkpoint status:**+- If phase complete: Status = "Complete"+- If significant progress: Status = "In Progress"+- If blocked/paused: Status = "Paused"+- Otherwise: Status = "In Progress"++**d) Get phase info from SESSION.md:**+- Phase number+- Phase name+- What was accomplished this session (from progress updates)+- Files that changed (from git status)++**e) Create structured commit message:**++```bash+git commit -m "$(cat <<'EOF'+checkpoint: Phase [N] [Status] - [Brief Description]++Phase: [N] - [Phase Name]+Status: [Complete/In Progress/Paused]+Session: [1-2 sentence summary of what was accomplished]++Files Changed:+- path/to/file.ts ([what changed])+- path/to/file2.ts ([what changed])+[... list all significant files]++Next: [Concrete next action from SESSION.md]++🤖 Generated with [Claude Code](https://claude.com/claude-code)++Co-Authored-By: Claude <[email protected]>+EOF+)"+```++**f) Get commit hash:**+```bash+git log -1 --format="%h"+```++**g) Update SESSION.md "Last Checkpoint" with new hash**++### 5. Output Handoff Summary++Display a formatted summary:++```+═══════════════════════════════════════════════+ SESSION WRAP-UP COMPLETE+═══════════════════════════════════════════════++📋 Phase: [N] - [Phase Name] ([Status emoji])+📍 Stage: [Implementation/Verification/Debugging]++✅ Completed This Session:+ • [accomplishment 1]+ • [accomplishment 2]+ • [accomplishment 3]++🎯 Next Action:+ [Concrete next action from SESSION.md]++💾 Checkpoint: [hash] ([date])++📄 Docs Updated:+ • SESSION.md+ • [CHANGELOG.md] (if updated)+ • [other docs] (if updated)++═══════════════════════════════════════════════+```++### 6. Ask About Git Push++Ask user: "Push checkpoint to remote? (y/n)"++**If yes:**+```bash+git push+```++**If push succeeds:**+- Output: "✅ Pushed to remote successfully"++**If push fails:**+- Output: "❌ Push failed. Run `git push` manually when ready."++### 7. Final Message++Output:+```+✨ Session wrapped successfully!++Ready to clear context or continue working.++To resume: Run `/resume-session` in your next session.+```++---++## Error Handling++**SESSION.md doesn't exist:**+- Stop immediately+- Output: "❌ No SESSION.md found. Create it first with project-planning skill."++**No IMPLEMENTATION_PHASES.md:**+- Warning: "⚠️ No IMPLEMENTATION_PHASES.md found. Continuing with SESSION.md only."+- Proceed without phase verification++**Git commit fails:**+- Output error message+- Output: "Fix git issue and try again, or commit manually."++**Git push fails:**+- Output: "⚠️ Push failed. You can run `git push` manually later."+- Continue (not critical)++**Docs update fails:**+- Output: "⚠️ Failed to update [doc]. You can update it manually."+- Continue with other updates++---++## Success Criteria++✅ SESSION.md updated with current progress+✅ Git checkpoint created with structured message+✅ Relevant docs updated (if needed)+✅ Clear "Next Action" for resuming+✅ User knows exactly what to do nextdiff --git a/skills/project-session-management/SKILL.md b/skills/project-session-management/SKILL.mdindex 4d81e2cd..a1ab66ef 100644--- a/skills/project-session-management/SKILL.md+++ b/skills/project-session-management/SKILL.md@@ -67,18 +67,64 @@ Phase 3: Tasks API (estimated 4 hours)### Before Ending Any Session+**Option A: Automated (Recommended)**+- Run `/wrap-session` command to automate the entire wrap-up process++**Option B: Manual**1. ✅ **Update SESSION.md** with current phase progress2. ✅ **Create git checkpoint commit** (see format below)3. ✅ **Update "Next Action"** to be concrete (file + line + what to do)### When Resuming+**Option A: Automated (Recommended)**+- Run `/resume-session` command to load context and continue from "Next Action"++**Option B: Manual**1. ✅ **Read SESSION.md** to understand current state2. ✅ **Check "Next Action"** for concrete starting point3. ✅ **Continue from that point**---+## 🤖 Automation Commands++Two slash commands are available to automate session management:++### `/wrap-session`+**Use when**: Ending a work session (context getting full or natural stopping point)++**What it does**:+1. Uses Task agent to analyze current session state+2. Updates SESSION.md with progress+3. Detects and updates relevant docs (CHANGELOG.md, ARCHITECTURE.md, etc.)+4. Creates structured git checkpoint commit+5. Outputs handoff summary+6. Optionally pushes to remote++**Example**: User types `/wrap-session` → Claude automates entire wrap-up process++**Token savings**: ~2-3 minutes saved per wrap-up (10-15 manual steps → 1 command)++### `/resume-session`+**Use when**: Starting a new session after context clear++**What it does**:+1. Uses Explore agent to load session context (SESSION.md + planning docs)+2. Shows recent git history (last 5 commits)+3. Displays formatted session summary (phase, progress, Next Action)+4. Shows verification criteria if in "Verification" stage+5. Optionally opens "Next Action" file+6. Asks permission to continue or adjust direction++**Example**: User types `/resume-session` → Claude loads all context and resumes work++**Token savings**: ~1-2 minutes saved per resume (5-8 manual reads → 1 command)++**Note**: These commands use Claude Code's built-in Task and Explore agents for efficient automation. Manual workflow steps are still available below if you prefer direct control.++---+## SESSION.md Structure### Purpose