Skip to content
Development
Command

/context

Show current development context (PRD, branch, progress)

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

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.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
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

Other commands on claude-plugin-prd-workflow.