Skip to content
Development
Command

/context

Show current development context (PRD, branch, progress)

From plugin
claude-plugin-prd-workflow
1327 skills17 agents27 commands

Command definition

context.md
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=""
fi

Step 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
fi

Step 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/^- \[ \] //')
fi

Step 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
@yassinello
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.

Stars on GitHub

Momentum

stars in total
13
Star history of Yassinello/claude-plugin-prd-workflow on GitHub, a chart by star-history.com

Other commands on claude-plugin-prd-workflow.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command