Back to skills
SKILL.md
Pair Programming
ASecurityAI-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.
- 82,861 stars
- 0 votes
- 0 copies
- 5 views
- Added September 2, 2026
Works with
Security analysis
92/100- Installs packages at runtime which could introduce malicious dependencies
npx -y skills add ruvnet/ruflo --skill pair-programming --agent claude-codeAre you the author of Pair Programming?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ruvnet-pair-programming-ruflo)---
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.
---
# Pair Programming
Collaborative AI pair programming with intelligent role management, real-time quality monitoring, and comprehensive development workflows.
## What This Skill Does
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:**
- **Multiple Modes**: Driver, Navigator, Switch, TDD, Review, Mentor, Debug
- **Real-Time Verification**: Automatic quality scoring with rollback on failures
- **Role Management**: Seamless switching between driver$navigator roles
- **Testing Integration**: Auto-generate tests, track coverage, continuous testing
- **Code Review**: Security scanning, performance analysis, best practice enforcement
- **Session Persistence**: Auto-save, recovery, export, and sharing
## How Claude Code Uses This
The CLI holds the session state; Claude Code reads it. There is no REPL to type into.
1. At the start of every turn run `ruflo pair status --json`. If `active` is `false`, this skill is dormant.
2. Follow `mode` and `aiRole`. As **driver** you write the code and the human reviews. As **navigator** you review and suggest and never edit unless asked. `tdd`, `review`, `mentor` and `debug` refine that behaviour as described below.
3. When `switchDue` is `true`, run `ruflo pair switch`, announce the swap, and continue in the new role.
4. Change mode mid-session with `ruflo pair mode <mode>`. The human can run the same commands from their shell.
State lives in `.claude-flow/sessions/pair/current.json`. `ruflo pair end` archives it to `history.jsonl` next to it.
## Prerequisites
**Required:**
- Ruflo CLI installed (`npm install -g ruflo`), which provides the `ruflo pair` command
- Git repository (optional but recommended)
**Recommended:**
- Testing framework (Jest, pytest, etc.)
- Linter configured (ESLint, pylint, etc.)
- Code formatter (Prettier, Black, etc.)
## Quick Start
### Basic Session
```bash
# Start simple pair programming
ruflo pair start
```
### TDD Session
```bash
# Test-driven development
ruflo pair start \
--mode tdd \
--test-first \
--coverage 90
```
---
## Complete Guide
### Session Control Commands
#### Starting Sessions
```bash
# Basic start
ruflo pair start
# Expert refactoring session
ruflo pair start \
--agent senior-dev \
--focus refactor \
--verify \
--threshold 0.98
# Debugging session
ruflo pair start \
--agent debugger-expert \
--focus debug \
--review
# Learning session
ruflo pair start \
--mode mentor \
--pace slow \
--examples
```
#### Session Management
```bash
# Check status
ruflo pair status
# View history
ruflo pair history
# Pause session
$pause [--reason <reason>]
# Resume session
$resume
# End session
ruflo pair end [--save] [--report]
```
### Available Modes
#### Driver Mode
You write code while AI provides guidance.
```bash
ruflo pair start --mode driver
```
**Your Responsibilities:**
- Write actual code
- Implement solutions
- Make immediate decisions
- Handle syntax and structure
**AI Navigator:**
- Strategic guidance
- Spot potential issues
- Suggest improvements
- Real-time review
- Track overall direction
**Best For:**
- Learning new patterns
- Implementing familiar features
- Quick iterations
- Hands-on debugging
**Commands:**
```
$suggest - Get implementation suggestions
$review - Request code review
$explain - Ask for explanations
$optimize - Request optimization ideas
$patterns - Get pattern recommendations
```
#### Navigator Mode
AI writes code while you provide direction.
```bash
ruflo pair start --mode navigator
```
**Your Responsibilities:**
- Provide high-level direction
- Review generated code
- Make architectural decisions
- Ensure business requirements
**AI Driver:**
- Write implementation code
- Handle syntax details
- Implement your guidance
- Manage boilerplate
- Execute refactoring
**Best For:**
- Rapid prototyping
- Boilerplate generation
- Learning from AI patterns
- Exploring solutions
**Commands:**
```
$implement - Direct implementation
$refactor - Request refactoring
$test - Generate tests
$document - Add documentation
$alternate - See alternative approaches
```
#### Switch Mode
Automatically alternates roles at intervals.
```bash
# Default 10-minute intervals
ruflo pair start --mode switch
# 5-minute intervals (rapid)
ruflo pair start --mode switch --interval 5m
# 15-minute intervals (deep focus)
ruflo pair start --mode switch --interval 15m
```
**Handoff Process:**
1. 30-second warning before switch
2. Current driver completes thought
3. Context summary generated
4. Roles swap smoothly
5. New driver continues
**Best For:**
- Balanced collaboration
- Knowledge sharing
- Complex features
- Extended sessions
#### Specialized Modes
**TDD Mode** - Test-Driven Development:
```bash
ruflo pair start \
--mode tdd \
--test-first \
--coverage 100
```
Workflow: Write failing test → Implement → Refactor → Repeat
**Review Mode** - Continuous code review:
```bash
ruflo pair start \
--mode review \
--strict \
--security
```
Features: Real-time feedback, security scanning, performance analysis
**Mentor Mode** - Learning-focused:
```bash
ruflo pair start \
--mode mentor \
--explain-all \
--pace slow
```
Features: Detailed explanations, step-by-step guidance, pattern teaching
**Debug Mode** - Problem-solving:
```bash
ruflo pair start \
--mode debug \
--verbose \
--trace
```
Features: Issue identification, root cause analysis, fix suggestions
### In-Session Commands
#### Code Commands
```
$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
```
#### Testing Commands
```
$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 Commands
```
$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
```
#### Navigation Commands
```
$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
```
#### Git Commands
```
$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
```
#### AI Partner Commands
```
$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 Commands
```
$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
```
#### Role & Mode Commands
```
$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
```
### Command Shortcuts
| Alias | Full Command |
|-------|-------------|
| `$s` | `$suggest` |
| `$e` | `$explain` |
| `$t` | `$test` |
| `$r` | `$review` |
| `$c` | `$commit` |
| `$g` | `$goto` |
| `$f` | `$find` |
| `$h` | `$help` |
| `$sw` | `$switch` |
| `$st` | `$status` |
### Configuration
A session is configured only by the options you pass to `ruflo pair start`. There is no configuration file, no profiles and no environment variables.
| Option | Values | Default |
|--------|--------|---------|
| `--mode`, `-m` (or a bare word: `ruflo pair start tdd`) | `driver`, `navigator`, `switch`, `tdd`, `review`, `mentor`, `debug` | `driver` |
| `--role` | `driver` or `navigator`: the AI's starting role | `navigator` for `navigator` and `review` modes, `driver` otherwise |
| `--interval`, `-i` | Role switch interval, e.g. `90s`, `10m`, `1h` | `10m` in `switch` mode |
| `--json` | Print the session as JSON | off |
```bash
ruflo pair start --mode switch --interval 15m
ruflo pair start --mode review --json
```
`status`, `switch`, `mode`, `end` and `history` accept `--json` too. `ruflo pair mode <mode>` changes the mode of the running session.
The active session is stored in `.claude-flow/sessions/pair/current.json`; `ruflo pair end` appends it to `history.jsonl` in the same directory. Only one session can be active per project.
### Real-World Examples
#### Example 1: Feature Implementation
Implementing user authentication with JWT tokens:
```bash
# Session setup
ruflo 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
```
#### Example 2: Bug Fixing
Debugging a memory leak in Node.js:
```bash
# Session setup
ruflo 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"
```
#### Example 3: TDD Session
Building shopping cart with test-driven development:
```bash
# Session setup
ruflo 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...
```
#### Example 4: Code Refactoring
Modernizing legacy code:
```bash
# Session setup
ruflo 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"
```
#### Example 5: Performance Optimization
Optimizing slow React application:
```bash
# Session setup
ruflo 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"
```
#### Example 6: API Development
Building RESTful API with Express:
```bash
# Session setup
ruflo 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 ✅
```
### Session Templates
#### Quick Start Templates
```bash
# Refactoring template
ruflo pair --template refactor
# Focus: Code improvement
# Verification: High (0.98)
# Testing: After each change
# Review: Continuous
# Feature template
ruflo pair --template feature
# Focus: Implementation
# Verification: Standard (0.95)
# Testing: On completion
# Review: Pre-commit
# Debug template
ruflo pair --template debug
# Focus: Problem solving
# Verification: Moderate (0.90)
# Testing: Regression tests
# Review: Root cause
# Learning template
ruflo pair --template learn
# Mode: Mentor
# Pace: Slow
# Explanations: Detailed
# Examples: Many
```
### Session Management
#### Session Status
```bash
ruflo 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
```
#### Session History
```bash
ruflo 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
```
#### Session Persistence
```bash
# Save session
ruflo pair --save [--name <name>]
# Load session
ruflo pair --load <session-id>
# Export session
ruflo pair --export <session-id> [--format json|md]
# Generate report
ruflo pair --report <session-id>
```
#### Background Sessions
```bash
# Start in background
ruflo pair start --background
# Monitor background session
ruflo pair --monitor
# Attach to background session
ruflo pair --attach <session-id>
# End background session
ruflo pair end <session-id>
```
### Advanced Features
#### Command Chaining
```
$test && $commit && $push
$lint --fix && $test && $review --strict
```
#### Session Recording
```bash
# Start with recording
ruflo pair start --record
# Replay session
ruflo pair --replay <session-id>
# Session analytics
ruflo pair --analytics <session-id>
```
#### Integration Options
**With Git:**
```bash
ruflo pair start --git --auto-commit
```
**With CI/CD:**
```bash
ruflo pair start --ci --non-interactive
```
**With IDE:**
```bash
ruflo pair start --ide vscode
```
### Best Practices
#### Session Practices
1. **Clear Goals** - Define session objectives upfront
2. **Appropriate Mode** - Choose based on task type
3. **Enable Verification** - For critical code paths
4. **Regular Testing** - Maintain quality continuously
5. **Session Notes** - Document important decisions
6. **Regular Breaks** - Take breaks every 45-60 minutes
#### Code Practices
1. **Test Early** - Run tests after each change
2. **Verify Before Commit** - Check truth scores
3. **Review Security** - Always for sensitive code
4. **Profile Performance** - Use `$perf` for optimization
5. **Save Sessions** - For complex work
6. **Learn from AI** - Ask questions frequently
#### Mode Selection
- **Driver Mode**: When learning, controlling implementation
- **Navigator Mode**: For rapid prototyping, generation
- **Switch Mode**: Long sessions, balanced collaboration
- **TDD Mode**: Building with tests
- **Review Mode**: Quality focus
- **Mentor Mode**: Learning priority
- **Debug Mode**: Fixing issues
### Troubleshooting
#### Session Won't Start
- Check agent availability
- Ensure clean workspace
- Review log files
#### Session Disconnected
- Use `--recover` to restore
- Check network connection
- Verify background processes
- Review auto-save files
#### Poor Performance
- Reduce verification threshold
- Disable continuous testing
- Check system resources
- Use lighter AI model
### Quality Metrics
#### Truth Score Thresholds
```
Error: < 0.90 ❌
Warning: 0.90 - 0.95 ⚠️
Good: 0.95 - 0.98 ✅
Excellent: > 0.98 🌟
```
#### Coverage Thresholds
```
Error: < 70% ❌
Warning: 70% - 80% ⚠️
Good: 80% - 90% ✅
Excellent: > 90% 🌟
```
#### Complexity Thresholds
```
Error: > 15 ❌
Warning: 10 - 15 ⚠️
Good: 5 - 10 ✅
Excellent: < 5 🌟
```
### Command History
Navigate history:
- `↑/↓` - Navigate through command history
- `Ctrl+R` - Search command history
- `!!` - Repeat last command
- `!<n>` - Run command n from history
### Keyboard Shortcuts (Configurable)
Default shortcuts:
```json
{
"shortcuts": {
"switch": "ctrl+shift+s",
"suggest": "ctrl+space",
"review": "ctrl+r",
"test": "ctrl+t"
}
}
```
### Related Commands
- `ruflo pair --help` - Show help
- `ruflo pair start` - Start a session (`--mode`, `--role`, `--interval`, `--json`)
- `ruflo pair status` - Show the active session
- `ruflo pair switch` - Swap driver and navigator roles
- `ruflo pair mode <mode>` - Change the mode of the active session
- `ruflo pair end` - End the session and append it to the history
- `ruflo pair history` - List past sessions
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.