// AI-assisted pair programming with multiple modes (driver/navigator/switch), real-time verification, quality monitoring, and comprehensive testing. Supports TDD, debugging, refactoring, and learning sessions. Features automatic role switching, continuous code review, security scanning, and performance optimization with truth-score verification.
| name | Pair Programming |
| description | AI-assisted pair programming with multiple modes (driver/navigator/switch), real-time verification, quality monitoring, and comprehensive testing. Supports TDD, debugging, refactoring, and learning sessions. Features automatic role switching, continuous code review, security scanning, and performance optimization with truth-score verification. |
Collaborative AI pair programming with intelligent role management, real-time quality monitoring, and comprehensive development workflows.
This skill provides professional pair programming capabilities with AI assistance, supporting multiple collaboration modes, continuous verification, and integrated testing. It manages driver/navigator roles, performs real-time code review, tracks quality metrics, and ensures high standards through truth-score verification.
Key Capabilities:
Required:
npm install -g claude-flow@alpha)Recommended:
# Start simple pair programming
claude-flow pair --start
# Test-driven development
claude-flow pair --start \
--mode tdd \
--test-first \
--coverage 90
# Basic start
claude-flow pair --start
# Expert refactoring session
claude-flow pair --start \
--agent senior-dev \
--focus refactor \
--verify \
--threshold 0.98
# Debugging session
claude-flow pair --start \
--agent debugger-expert \
--focus debug \
--review
# Learning session
claude-flow pair --start \
--mode mentor \
--pace slow \
--examples
# Check status
claude-flow pair --status
# View history
claude-flow pair --history
# Pause session
/pause [--reason <reason>]
# Resume session
/resume
# End session
claude-flow pair --end [--save] [--report]
You write code while AI provides guidance.
claude-flow pair --start --mode driver
Your Responsibilities:
AI Navigator:
Best For:
Commands:
/suggest - Get implementation suggestions
/review - Request code review
/explain - Ask for explanations
/optimize - Request optimization ideas
/patterns - Get pattern recommendations
AI writes code while you provide direction.
claude-flow pair --start --mode navigator
Your Responsibilities:
AI Driver:
Best For:
Commands:
/implement - Direct implementation
/refactor - Request refactoring
/test - Generate tests
/document - Add documentation
/alternate - See alternative approaches
Automatically alternates roles at intervals.
# Default 10-minute intervals
claude-flow pair --start --mode switch
# 5-minute intervals (rapid)
claude-flow pair --start --mode switch --interval 5m
# 15-minute intervals (deep focus)
claude-flow pair --start --mode switch --interval 15m
Handoff Process:
Best For:
TDD Mode - Test-Driven Development:
claude-flow pair --start \
--mode tdd \
--test-first \
--coverage 100
Workflow: Write failing test โ Implement โ Refactor โ Repeat
Review Mode - Continuous code review:
claude-flow pair --start \
--mode review \
--strict \
--security
Features: Real-time feedback, security scanning, performance analysis
Mentor Mode - Learning-focused:
claude-flow pair --start \
--mode mentor \
--explain-all \
--pace slow
Features: Detailed explanations, step-by-step guidance, pattern teaching
Debug Mode - Problem-solving:
claude-flow pair --start \
--mode debug \
--verbose \
--trace
Features: Issue identification, root cause analysis, fix suggestions
/explain [--level basic|detailed|expert]
Explain the current code or selection
/suggest [--type refactor|optimize|security|style]
Get improvement suggestions
/implement <description>
Request implementation (navigator mode)
/refactor [--pattern <pattern>] [--scope function|file|module]
Refactor selected code
/optimize [--target speed|memory|both]
Optimize code for performance
/document [--format jsdoc|markdown|inline]
Add documentation to code
/comment [--verbose]
Add inline comments
/pattern <pattern-name> [--example]
Apply a design pattern
/test [--watch] [--coverage] [--only <pattern>]
Run test suite
/test-gen [--type unit|integration|e2e]
Generate tests for current code
/coverage [--report html|json|terminal]
Check test coverage
/mock <target> [--realistic]
Generate mock data or functions
/test-watch [--on-save]
Enable test watching
/snapshot [--update]
Create test snapshots
/review [--scope current|file|changes] [--strict]
Perform code review
/security [--deep] [--fix]
Security analysis
/perf [--profile] [--suggestions]
Performance analysis
/quality [--detailed]
Check code quality metrics
/lint [--fix] [--config <config>]
Run linters
/complexity [--threshold <value>]
Analyze code complexity
/goto <file>[:line[:column]]
Navigate to file or location
/find <pattern> [--regex] [--case-sensitive]
Search in project
/recent [--limit <n>]
Show recent files
/bookmark [add|list|goto|remove] [<name>]
Manage bookmarks
/history [--limit <n>] [--filter <pattern>]
Show command history
/tree [--depth <n>] [--filter <pattern>]
Show project structure
/diff [--staged] [--file <file>]
Show git diff
/commit [--message <msg>] [--amend]
Commit with verification
/branch [create|switch|delete|list] [<name>]
Branch operations
/stash [save|pop|list|apply] [<message>]
Stash operations
/log [--oneline] [--limit <n>]
View git log
/blame [<file>]
Show git blame
/agent [switch|info|config] [<agent-name>]
Manage AI agent
/teach <preference>
Teach the AI your preferences
/feedback [positive|negative] <message>
Provide feedback to AI
/personality [professional|friendly|concise|verbose]
Adjust AI personality
/expertise [add|remove|list] [<domain>]
Set AI expertise focus
/metrics [--period today|session|week|all]
Show session metrics
/score [--breakdown]
Show quality scores
/productivity [--chart]
Show productivity metrics
/leaderboard [--personal|team]
Show improvement leaderboard
/switch [--immediate]
Switch driver/navigator roles
/mode <type>
Change mode (driver|navigator|switch|tdd|review|mentor|debug)
/role
Show current role
/handoff
Prepare role handoff
| Alias | Full Command |
|---|---|
/s | /suggest |
/e | /explain |
/t | /test |
/r | /review |
/c | /commit |
/g | /goto |
/f | /find |
/h | /help |
/sw | /switch |
/st | /status |
Create .claude-flow/pair-config.json:
{
"pair": {
"enabled": true,
"defaultMode": "switch",
"defaultAgent": "auto",
"autoStart": false,
"theme": "professional"
}
}
{
"pair": {
"general": {
"enabled": true,
"defaultMode": "switch",
"defaultAgent": "senior-dev",
"language": "javascript",
"timezone": "UTC"
},
"modes": {
"driver": {
"enabled": true,
"suggestions": true,
"realTimeReview": true,
"autoComplete": false
},
"navigator": {
"enabled": true,
"codeGeneration": true,
"explanations": true,
"alternatives": true
},
"switch": {
"enabled": true,
"interval": "10m",
"warning": "30s",
"autoSwitch": true,
"pauseOnIdle": true
}
},
"verification": {
"enabled": true,
"threshold": 0.95,
"autoRollback": true,
"preCommitCheck": true,
"continuousMonitoring": true,
"blockOnFailure": true
},
"testing": {
"enabled": true,
"autoRun": true,
"framework": "jest",
"onSave": true,
"coverage": {
"enabled": true,
"minimum": 80,
"enforce": true,
"reportFormat": "html"
}
},
"review": {
"enabled": true,
"continuous": true,
"preCommit": true,
"security": true,
"performance": true,
"style": true,
"complexity": {
"maxComplexity": 10,
"maxDepth": 4,
"maxLines": 100
}
},
"git": {
"enabled": true,
"autoCommit": false,
"commitTemplate": "feat: {message}",
"signCommits": false,
"pushOnEnd": false,
"branchProtection": true
},
"session": {
"autoSave": true,
"saveInterval": "5m",
"maxDuration": "4h",
"idleTimeout": "15m",
"breakReminder": "45m",
"metricsInterval": "1m"
},
"ai": {
"model": "advanced",
"temperature": 0.7,
"maxTokens": 4000,
"personality": "professional",
"expertise": ["backend", "testing", "security"],
"learningEnabled": true
}
}
}
{
"agents": {
"senior-dev": {
"expertise": ["architecture", "patterns", "optimization"],
"style": "thorough",
"reviewLevel": "strict"
},
"tdd-specialist": {
"expertise": ["testing", "mocks", "coverage"],
"style": "test-first",
"reviewLevel": "comprehensive"
},
"debugger-expert": {
"expertise": ["debugging", "profiling", "tracing"],
"style": "analytical",
"reviewLevel": "focused"
},
"junior-dev": {
"expertise": ["learning", "basics", "documentation"],
"style": "questioning",
"reviewLevel": "educational"
}
}
}
# Set configuration
claude-flow pair config set defaultMode switch
claude-flow pair config set verification.threshold 0.98
# Get configuration
claude-flow pair config get
claude-flow pair config get defaultMode
# Export/Import
claude-flow pair config export > config.json
claude-flow pair config import config.json
# Reset
claude-flow pair config reset
Create reusable profiles:
# Create profile
claude-flow pair profile create refactoring \
--mode driver \
--verify true \
--threshold 0.98 \
--focus refactor
# Use profile
claude-flow pair --start --profile refactoring
# List profiles
claude-flow pair profile list
Profile configuration:
{
"profiles": {
"refactoring": {
"mode": "driver",
"verification": {
"enabled": true,
"threshold": 0.98
},
"focus": "refactor"
},
"debugging": {
"mode": "navigator",
"agent": "debugger-expert",
"trace": true,
"verbose": true
},
"learning": {
"mode": "mentor",
"pace": "slow",
"explanations": "detailed",
"examples": true
}
}
}
Implementing user authentication with JWT tokens:
# Session setup
claude-flow pair --start \
--mode switch \
--agent senior-dev \
--focus implement \
--verify \
--test
Session Flow:
๐ฅ Starting pair programming for authentication feature...
[DRIVER: You - 10 minutes]
/explain JWT authentication flow
> AI explains JWT concepts and best practices
/suggest implementation approach
> AI suggests using middleware pattern with refresh tokens
# You write the basic auth middleware structure
[SWITCH TO NAVIGATOR]
[NAVIGATOR: AI - 10 minutes]
/implement JWT token generation with refresh tokens
> AI generates secure token implementation
/test-gen
> AI creates comprehensive test suite
[SWITCH TO DRIVER]
[DRIVER: You - 10 minutes]
# You refine the implementation
/review --security
> AI performs security review, suggests improvements
/commit --message "feat: JWT authentication with refresh tokens"
โ
Truth Score: 0.98 - Committed successfully
Debugging a memory leak in Node.js:
# Session setup
claude-flow pair --start \
--mode navigator \
--agent debugger-expert \
--focus debug \
--trace
Session Flow:
๐ฅ Starting debugging session...
/status
> Analyzing application for memory issues...
/perf --profile
> Memory usage growing: 150MB โ 450MB over 10 minutes
/find "new EventEmitter" --regex
> Found 3 instances of EventEmitter creation
/inspect eventEmitters --deep
> Discovering listeners not being removed
/suggest fix for memory leak
> AI suggests: "Add removeListener in cleanup functions"
/implement cleanup functions for all event emitters
> AI generates proper cleanup code
/test
> Memory stable at 150MB โ
/commit --message "fix: memory leak in event emitters"
Building shopping cart with test-driven development:
# Session setup
claude-flow pair --start \
--mode tdd \
--agent tdd-specialist \
--test-first
Session Flow:
๐ฅ TDD Session: Shopping Cart Feature
[RED PHASE]
/test-gen "add item to cart"
> AI writes failing test:
โ should add item to cart
โ should update quantity for existing item
โ should calculate total price
[GREEN PHASE]
/implement minimal cart functionality
> You write just enough code to pass tests
/test
> Tests passing: 3/3 โ
[REFACTOR PHASE]
/refactor --pattern repository
> AI refactors to repository pattern
/test
> Tests still passing: 3/3 โ
[NEXT CYCLE]
/test-gen "remove item from cart"
> AI writes new failing tests...
Modernizing legacy code:
# Session setup
claude-flow pair --start \
--mode driver \
--focus refactor \
--verify \
--threshold 0.98
Session Flow:
๐ฅ Refactoring Session: Modernizing UserService
/analyze UserService.js
> AI identifies:
- Callback hell (5 levels deep)
- No error handling
- Tight coupling
- No tests
/suggest refactoring plan
> AI suggests:
1. Convert callbacks to async/await
2. Add error boundaries
3. Extract dependencies
4. Add unit tests
/test-gen --before-refactor
> AI generates tests for current behavior
/refactor callbacks to async/await
# You refactor with AI guidance
/test
> All tests passing โ
/review --compare
> AI shows before/after comparison
> Code complexity: 35 โ 12
> Truth score: 0.99 โ
/commit --message "refactor: modernize UserService with async/await"
Optimizing slow React application:
# Session setup
claude-flow pair --start \
--mode switch \
--agent performance-expert \
--focus optimize \
--profile
Session Flow:
๐ฅ Performance Optimization Session
/perf --profile
> React DevTools Profiler Results:
- ProductList: 450ms render
- CartSummary: 200ms render
- Unnecessary re-renders: 15
/suggest optimizations for ProductList
> AI suggests:
1. Add React.memo
2. Use useMemo for expensive calculations
3. Implement virtualization for long lists
/implement React.memo and useMemo
# You implement with AI guidance
/perf --profile
> ProductList: 45ms render (90% improvement!) โ
/implement virtualization with react-window
> AI implements virtual scrolling
/perf --profile
> ProductList: 12ms render (97% improvement!) โ
> FPS: 60 stable โ
/commit --message "perf: optimize ProductList with memoization and virtualization"
Building RESTful API with Express:
# Session setup
claude-flow pair --start \
--mode navigator \
--agent backend-expert \
--focus implement \
--test
Session Flow:
๐ฅ API Development Session
/design REST API for blog platform
> AI designs endpoints:
POST /api/posts
GET /api/posts
GET /api/posts/:id
PUT /api/posts/:id
DELETE /api/posts/:id
/implement CRUD endpoints with validation
> AI implements with Express + Joi validation
/test-gen --integration
> AI generates integration tests
/security --api
> AI adds:
- Rate limiting
- Input sanitization
- JWT authentication
- CORS configuration
/document --openapi
> AI generates OpenAPI documentation
/test --integration
> All endpoints tested: 15/15 โ
# Refactoring template
claude-flow pair --template refactor
# Focus: Code improvement
# Verification: High (0.98)
# Testing: After each change
# Review: Continuous
# Feature template
claude-flow pair --template feature
# Focus: Implementation
# Verification: Standard (0.95)
# Testing: On completion
# Review: Pre-commit
# Debug template
claude-flow pair --template debug
# Focus: Problem solving
# Verification: Moderate (0.90)
# Testing: Regression tests
# Review: Root cause
# Learning template
claude-flow pair --template learn
# Mode: Mentor
# Pace: Slow
# Explanations: Detailed
# Examples: Many
claude-flow pair --status
Output:
๐ฅ Pair Programming Session
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Session ID: pair_1755021234567
Duration: 45 minutes
Status: Active
Partner: senior-dev
Current Role: DRIVER (you)
Mode: Switch (10m intervals)
Next Switch: in 3 minutes
๐ Metrics:
โโโ Truth Score: 0.982 โ
โโโ Lines Changed: 234
โโโ Files Modified: 5
โโโ Tests Added: 12
โโโ Coverage: 87% โ3%
โโโ Commits: 3
๐ฏ Focus: Implementation
๐ Current File: src/auth/login.js
claude-flow pair --history
Output:
๐ Session History
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. 2024-01-15 14:30 - 16:45 (2h 15m)
Partner: expert-coder
Focus: Refactoring
Truth Score: 0.975
Changes: +340 -125 lines
2. 2024-01-14 10:00 - 11:30 (1h 30m)
Partner: tdd-specialist
Focus: Testing
Truth Score: 0.991
Tests Added: 24
3. 2024-01-13 15:00 - 17:00 (2h)
Partner: debugger-expert
Focus: Bug Fixing
Truth Score: 0.968
Issues Fixed: 5
# Save session
claude-flow pair --save [--name <name>]
# Load session
claude-flow pair --load <session-id>
# Export session
claude-flow pair --export <session-id> [--format json|md]
# Generate report
claude-flow pair --report <session-id>
# Start in background
claude-flow pair --start --background
# Monitor background session
claude-flow pair --monitor
# Attach to background session
claude-flow pair --attach <session-id>
# End background session
claude-flow pair --end <session-id>
Define in configuration:
{
"customCommands": {
"tdd": "/test-gen && /test --watch",
"full-review": "/lint --fix && /test && /review --strict",
"quick-fix": "/suggest --type fix && /implement && /test"
}
}
Use custom commands:
/custom tdd
/custom full-review
/test && /commit && /push
/lint --fix && /test && /review --strict
# Start with recording
claude-flow pair --start --record
# Replay session
claude-flow pair --replay <session-id>
# Session analytics
claude-flow pair --analytics <session-id>
With Git:
claude-flow pair --start --git --auto-commit
With CI/CD:
claude-flow pair --start --ci --non-interactive
With IDE:
claude-flow pair --start --ide vscode
/perf for optimization--recover to restoreclaude-flow pair config validateError: < 0.90 โ
Warning: 0.90 - 0.95 โ ๏ธ
Good: 0.95 - 0.98 โ
Excellent: > 0.98 ๐
Error: < 70% โ
Warning: 70% - 80% โ ๏ธ
Good: 80% - 90% โ
Excellent: > 90% ๐
Error: > 15 โ
Warning: 10 - 15 โ ๏ธ
Good: 5 - 10 โ
Excellent: < 5 ๐
Override configuration via environment:
export CLAUDE_PAIR_MODE=driver
export CLAUDE_PAIR_VERIFY=true
export CLAUDE_PAIR_THRESHOLD=0.98
export CLAUDE_PAIR_AGENT=senior-dev
export CLAUDE_PAIR_AUTO_TEST=true
Navigate history:
โ/โ - Navigate through command historyCtrl+R - Search command history!! - Repeat last command!<n> - Run command n from historyDefault shortcuts:
{
"shortcuts": {
"switch": "ctrl+shift+s",
"suggest": "ctrl+space",
"review": "ctrl+r",
"test": "ctrl+t"
}
}
claude-flow pair --help - Show helpclaude-flow pair config - Manage configurationclaude-flow pair profile - Manage profilesclaude-flow pair templates - List templatesclaude-flow pair agents - List available agents