Development
Command
/context
Show current development context (PRD, branch, progress)
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/context
Context preview
What this command does when you run it.
Show current development context (PRD, branch, progress)
Command definition
context.mdname: context
description: Show current development context (PRD, branch, progress)
category: PRD Management
Context Command
Display your current development context to quickly resume work after interruptions.
Purpose
Answer the question: **"Where am I and what was I doing?"**
Essential for:
- ๐ Resuming work after meetings/interruptions
- ๐ฏ Remembering which PRD you're on
- ๐ Seeing progress at a glance
- โก Quick status check without digging through files
Usage
# Show current context
/context
# Show context for specific worktree
/context --worktree=worktrees/prd-007/
# Verbose mode (includes recent commits, todos)
/context --verbose
/context -v
Workflow
Step 1: Detect Current Location
# Get current Git branch
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
# Detect if in worktree
if git rev-parse --git-common-dir &>/dev/null; then
GIT_COMMON_DIR=$(git rev-parse --git-common-dir)
if [[ "$GIT_COMMON_DIR" != *".git"* ]] || [[ "$GIT_COMMON_DIR" == *"worktrees"* ]]; then
IN_WORKTREE=true
WORKTREE_PATH=$(pwd)
else
IN_WORKTREE=false
WORKTREE_PATH=""
fi
else
IN_WORKTREE=false
WORKTREE_PATH=""
fiStep 2: Extract PRD Information
**From branch name**:
# Extract PRD ID from branch name (supports various formats)
# Examples: feat/PRD-007-oauth, feature/WTC-PRD-007-oauth, PRD-007-oauth
if [[ "$CURRENT_BRANCH" =~ (PRD-[0-9]+) ]]; then
PRD_ID="${BASH_REMATCH[1]}"
elif [[ "$CURRENT_BRANCH" =~ ([A-Z]+-PRD-[0-9]+) ]]; then
PRD_ID="${BASH_REMATCH[1]}"
else
PRD_ID="unknown"
fi**Find PRD file**:
# Search for PRD file across directories
PRD_FILE=$(find product/prds/ -name "*${PRD_ID}*.md" 2>/dev/null | head -n 1)
if [ -n "$PRD_FILE" ]; then
# Extract metadata from PRD
PRD_TITLE=$(grep -m1 '^#' "$PRD_FILE" | sed 's/^#\+\s*//' | sed "s/${PRD_ID}:\s*//")
PRD_STATUS=$(grep -m1 '^\*\*Status\*\*:' "$PRD_FILE" | sed 's/^\*\*Status\*\*:\s*//' || echo "Unknown")
PRD_PRIORITY=$(grep -m1 '^\*\*Priority\*\*:' "$PRD_FILE" | sed 's/^\*\*Priority\*\*:\s*//' || echo "-")
PRD_ASSIGNEE=$(grep -m1 '^\*\*Assignee\*\*:' "$PRD_FILE" | sed 's/^\*\*Assignee\*\*:\s*//' || echo "-")
# Determine directory/stage
if [[ "$PRD_FILE" == *"01-draft"* ]]; then
PRD_STAGE="Draft"
elif [[ "$PRD_FILE" == *"02-ready"* ]]; then
PRD_STAGE="Ready"
elif [[ "$PRD_FILE" == *"03-in-progress"* ]]; then
PRD_STAGE="In Progress"
elif [[ "$PRD_FILE" == *"04-complete"* ]]; then
PRD_STAGE="Complete"
else
PRD_STAGE="Unknown"
fi
fiStep 3: Calculate Progress Metrics
# Days since branch created
BRANCH_CREATED=$(git log --format=%ct --reverse "$CURRENT_BRANCH" 2>/dev/null | head -n1)
if [ -n "$BRANCH_CREATED" ]; then
CURRENT_TIME=$(date +%s)
DAYS_ELAPSED=$(( (CURRENT_TIME - BRANCH_CREATED) / 86400 ))
else
DAYS_ELAPSED=0
fi
# Count commits on branch (vs main)
COMMIT_COUNT=$(git rev-list --count HEAD ^main 2>/dev/null || echo "0")
# Check for uncommitted changes
if git diff --quiet && git diff --cached --quiet; then
HAS_CHANGES=false
else
HAS_CHANGES=true
fi
# Count files changed
FILES_CHANGED=$(git diff --cached --name-only | wc -l)
UNSTAGED_FILES=$(git diff --name-only | wc -l)
Step 4: Parse Work Plan (If Exists)
# Look for WORK_PLAN.md in PRD directory or worktree
if [ -f "WORK_PLAN.md" ]; then
# Count total tasks
TOTAL_TASKS=$(grep -c '^- \[' WORK_PLAN.md 2>/dev/null || echo "0")
# Count completed tasks
COMPLETED_TASKS=$(grep -c '^- \[x\]' WORK_PLAN.md 2>/dev/null || echo "0")
# Calculate progress percentage
if [ "$TOTAL_TASKS" -gt 0 ]; then
PROGRESS_PERCENT=$(( 100 * COMPLETED_TASKS / TOTAL_TASKS ))
else
PROGRESS_PERCENT=0
fi
# Find next task (first unchecked)
NEXT_TASK=$(grep -m1 '^- \[ \]' WORK_PLAN.md 2>/dev/null | sed 's/^- \[ \] //')
fiStep 5: Display Context
**Standard output**:
๐ **Current Context**
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฟ **Branch**: feat/PRD-007-oauth2-integration
๐ **PRD**: PRD-007 - OAuth2 Integration System
๐ **Stage**: In Progress
๐ **Location**: worktrees/prd-007-oauth2-integration/
โฑ๏ธ **Started**: 2 days ago
๐ค **Assignee**: @yassinello
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ **Progress**: 3/8 tasks (38%)
โโโโโโโโโโ 38%
โ
**Completed**:
- OAuth provider configuration
- Database schema migration
- Basic auth flow implementation
๐ฏ **Next Task**:
- Implement OAuth callback handler
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ป **Git Status**:
- ๐จ Commits: 5 commits ahead of main
- ๐ Staged: 3 files
- โ ๏ธ Unstaged: 2 files
- ๐พ Working directory: Modified
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ **Quick Actions**:
- Continue work: (already in right location)
- View PRD: cat product/prds/03-in-progress/PRD-007-oauth2-integration.md
- View work plan: cat WORK_PLAN.md
- Commit progress: git add . && git commit
- Switch PRD: /switch <other-prd-id>
**Verbose output** (with `--verbose` or `-v`):
๐ **Current Context** (Detailed)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[... same as above ...]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ **Recent Activity**:
Last 3 commits:
- a3f2c1d (2 hours ago) Implement token refresh logic
- 8d4e2a9 (5 hours ago) Add OAuth callback route
- 1c8f3b2 (1 day ago) Set up OAuth provider config
Modified files:
M src/auth/oauth-provider.ts
M src/routes/auth.ts
A src/auth/token-manager.ts
?? src/auth/oauth-callback.ts
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ **Dependencies**:
- โ
PRD-003 (Database schema) - Complete
- ๐จ PRD-005 (Auth system) - In Progress
Step 6: Handle Edge Cases
**Case 1: On main branch**
๐ **Current Context**
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฟ **Branch**: main
๐ **Location**: Main repository (no active PRD)
๐ก **Ready to start work?**
- List available PR
Read more
name: context description: Show current development context (PRD, branch, progress) category: PRD Management
Context Command
Display your current development context to quickly resume work after interruptions.
Purpose
Answer the question: **"Where am I and what was I doing?"**
Essential for:
- ๐ Resuming work after meetings/interruptions
- ๐ฏ Remembering which PRD you're on
- ๐ Seeing progress at a glance
- โก Quick status check without digging through files
Usage
# Show current context /context # Show context for specific worktree /context --worktree=worktrees/prd-007/ # Verbose mode (includes recent commits, todos) /context --verbose /context -v
Workflow
Step 1: Detect Current Location
# Get current Git branch
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
# Detect if in worktree
if git rev-parse --git-common-dir &>/dev/null; then
GIT_COMMON_DIR=$(git rev-parse --git-common-dir)
if [[ "$GIT_COMMON_DIR" != *".git"* ]] || [[ "$GIT_COMMON_DIR" == *"worktrees"* ]]; then
IN_WORKTREE=true
WORKTREE_PATH=$(pwd)
else
IN_WORKTREE=false
WORKTREE_PATH=""
fi
else
IN_WORKTREE=false
WORKTREE_PATH=""
fiStep 2: Extract PRD Information
**From branch name**:
# Extract PRD ID from branch name (supports various formats)
# Examples: feat/PRD-007-oauth, feature/WTC-PRD-007-oauth, PRD-007-oauth
if [[ "$CURRENT_BRANCH" =~ (PRD-[0-9]+) ]]; then
PRD_ID="${BASH_REMATCH[1]}"
elif [[ "$CURRENT_BRANCH" =~ ([A-Z]+-PRD-[0-9]+) ]]; then
PRD_ID="${BASH_REMATCH[1]}"
else
PRD_ID="unknown"
fi**Find PRD file**:
# Search for PRD file across directories
PRD_FILE=$(find product/prds/ -name "*${PRD_ID}*.md" 2>/dev/null | head -n 1)
if [ -n "$PRD_FILE" ]; then
# Extract metadata from PRD
PRD_TITLE=$(grep -m1 '^#' "$PRD_FILE" | sed 's/^#\+\s*//' | sed "s/${PRD_ID}:\s*//")
PRD_STATUS=$(grep -m1 '^\*\*Status\*\*:' "$PRD_FILE" | sed 's/^\*\*Status\*\*:\s*//' || echo "Unknown")
PRD_PRIORITY=$(grep -m1 '^\*\*Priority\*\*:' "$PRD_FILE" | sed 's/^\*\*Priority\*\*:\s*//' || echo "-")
PRD_ASSIGNEE=$(grep -m1 '^\*\*Assignee\*\*:' "$PRD_FILE" | sed 's/^\*\*Assignee\*\*:\s*//' || echo "-")
# Determine directory/stage
if [[ "$PRD_FILE" == *"01-draft"* ]]; then
PRD_STAGE="Draft"
elif [[ "$PRD_FILE" == *"02-ready"* ]]; then
PRD_STAGE="Ready"
elif [[ "$PRD_FILE" == *"03-in-progress"* ]]; then
PRD_STAGE="In Progress"
elif [[ "$PRD_FILE" == *"04-complete"* ]]; then
PRD_STAGE="Complete"
else
PRD_STAGE="Unknown"
fi
fiStep 3: Calculate Progress Metrics
# Days since branch created BRANCH_CREATED=$(git log --format=%ct --reverse "$CURRENT_BRANCH" 2>/dev/null | head -n1) if [ -n "$BRANCH_CREATED" ]; then CURRENT_TIME=$(date +%s) DAYS_ELAPSED=$(( (CURRENT_TIME - BRANCH_CREATED) / 86400 )) else DAYS_ELAPSED=0 fi # Count commits on branch (vs main) COMMIT_COUNT=$(git rev-list --count HEAD ^main 2>/dev/null || echo "0") # Check for uncommitted changes if git diff --quiet && git diff --cached --quiet; then HAS_CHANGES=false else HAS_CHANGES=true fi # Count files changed FILES_CHANGED=$(git diff --cached --name-only | wc -l) UNSTAGED_FILES=$(git diff --name-only | wc -l)
Step 4: Parse Work Plan (If Exists)
# Look for WORK_PLAN.md in PRD directory or worktree
if [ -f "WORK_PLAN.md" ]; then
# Count total tasks
TOTAL_TASKS=$(grep -c '^- \[' WORK_PLAN.md 2>/dev/null || echo "0")
# Count completed tasks
COMPLETED_TASKS=$(grep -c '^- \[x\]' WORK_PLAN.md 2>/dev/null || echo "0")
# Calculate progress percentage
if [ "$TOTAL_TASKS" -gt 0 ]; then
PROGRESS_PERCENT=$(( 100 * COMPLETED_TASKS / TOTAL_TASKS ))
else
PROGRESS_PERCENT=0
fi
# Find next task (first unchecked)
NEXT_TASK=$(grep -m1 '^- \[ \]' WORK_PLAN.md 2>/dev/null | sed 's/^- \[ \] //')
fiStep 5: Display Context
**Standard output**:
๐ **Current Context** โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ฟ **Branch**: feat/PRD-007-oauth2-integration ๐ **PRD**: PRD-007 - OAuth2 Integration System ๐ **Stage**: In Progress ๐ **Location**: worktrees/prd-007-oauth2-integration/ โฑ๏ธ **Started**: 2 days ago ๐ค **Assignee**: @yassinello โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ **Progress**: 3/8 tasks (38%) โโโโโโโโโโ 38% โ **Completed**: - OAuth provider configuration - Database schema migration - Basic auth flow implementation ๐ฏ **Next Task**: - Implement OAuth callback handler โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ป **Git Status**: - ๐จ Commits: 5 commits ahead of main - ๐ Staged: 3 files - โ ๏ธ Unstaged: 2 files - ๐พ Working directory: Modified โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ **Quick Actions**: - Continue work: (already in right location) - View PRD: cat product/prds/03-in-progress/PRD-007-oauth2-integration.md - View work plan: cat WORK_PLAN.md - Commit progress: git add . && git commit - Switch PRD: /switch <other-prd-id>
**Verbose output** (with `--verbose` or `-v`):
๐ **Current Context** (Detailed) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ [... same as above ...] โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ **Recent Activity**: Last 3 commits: - a3f2c1d (2 hours ago) Implement token refresh logic - 8d4e2a9 (5 hours ago) Add OAuth callback route - 1c8f3b2 (1 day ago) Set up OAuth provider config Modified files: M src/auth/oauth-provider.ts M src/routes/auth.ts A src/auth/token-manager.ts ?? src/auth/oauth-callback.ts โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ **Dependencies**: - โ PRD-003 (Database schema) - Complete - ๐จ PRD-005 (Auth system) - In Progress
Step 6: Handle Edge Cases
**Case 1: On main branch**
๐ **Current Context** โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ฟ **Branch**: main ๐ **Location**: Main repository (no active PRD) ๐ก **Ready to start work?** - List available PR
Ships withclaude-plugin-prd-workflow
The complete Claude Code plugin for Product-Driven Development Transform PRDs from ideas to shipped features with AI-powered review, guided implementation, and automated quality gates. Never ship unclear requirements again.
Get the whole plugin
Stats
12
Stars
0
Forks
Quiet
Maintenance
JavaScript
Language
MIT
License
10mo ago
Last commit
10mo ago
Created
Repo: Yassinello/claude-plugin-prd-workflow
Other commands on claude-plugin-prd-workflow.
Command
Command
Command
Command
Command
Command

