[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73BWMH2G1CASFFGWAF8DJ4G":3,"skill-same:01M73BWMH2G1CASFFGWAF8DJ4G":71},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":17,"linkOnly":18,"markdownContent":19,"markdownBody":20,"frontMatter":21,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":12,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":36,"install":37,"resources":50},"01M73BWMH2G1CASFFGWAF8DJ4G","pair-programming",null,"ngdletrung\u002FJKAI-Zenith","ngdletrung","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F88302940?v=4","01M73BJVV5QJ87R3MC4BXJMWDN","01M73BJVWAAM03TM18QHKRDAMH",0,"MIT","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FCORE\u002Fpair-programming\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nid: pair-programming\nname_vn: Pair Programming\nversion: 1.0.0\nauthor: Zenith Legacy\ndomain: UNKNOWN\nintent_pairs: []\naliases_vn: []\nschema: {}\npriority: NORMAL\nrelated_skills: []\n\n---\n\n# Pair Programming (pair-programming)\n\n## 🌟 TỔNG QUAN\n---\nname: Pair Programming\ndescription: 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.\n---\n\n# Pair Programming\n\nCollaborative AI pair programming with intelligent role management, real-time quality monitoring, and comprehensive development workflows.\n\n## What This Skill Does\n\nThis 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.\n\n**Key Capabilities:**\n- **Multiple Modes**: Driver, Navigator, Switch, TDD, Review, Mentor, Debug\n- **Real-Time Verification**: Automatic quality scoring with rollback on failures\n- **Role Management**: Seamless switching between driver$navigator roles\n- **Testing Integration**: Auto-generate tests, track coverage, continuous testing\n- **Code Review**: Security scanning, performance analysis, best practice enforcement\n- **Session Persistence**: Auto-save, recovery, export, and sharing\n\n## Prerequisites\n\n**Required:**\n- Claude Flow CLI installed (`npm install -g claude-flow@alpha`)\n- Git repository (optional but recommended)\n\n**Recommended:**\n- Testing framework (Jest, pytest, etc.)\n- Linter configured (ESLint, pylint, etc.)\n- Code formatter (Prettier, Black, etc.)\n\n## Quick Start\n\n### Basic Session\n```bash\n# Start simple pair programming\nclaude-flow pair --start\n```\n\n### TDD Session\n```bash\n# Test-driven development\nclaude-flow pair --start \\\n  --mode tdd \\\n  --test-first \\\n  --coverage 90\n```\n\n---\n\n## Complete Guide\n\n### Session Control Commands\n\n#### Starting Sessions\n```bash\n# Basic start\nclaude-flow pair --start\n\n# Expert refactoring session\nclaude-flow pair --start \\\n  --agent senior-dev \\\n  --focus refactor \\\n  --verify \\\n  --threshold 0.98\n\n# Debugging session\nclaude-flow pair --start \\\n  --agent debugger-expert \\\n  --focus debug \\\n  --review\n\n# Learning session\nclaude-flow pair --start \\\n  --mode mentor \\\n  --pace slow \\\n  --examples\n```\n\n#### Session Management\n```bash\n# Check status\nclaude-flow pair --status\n\n# View history\nclaude-flow pair --history\n\n# Pause session\n$pause [--reason \u003Creason>]\n\n# Resume session\n$resume\n\n# End session\nclaude-flow pair --end [--save] [--report]\n```\n\n### Available Modes\n\n#### Driver Mode\nYou write code while AI provides guidance.\n\n```bash\nclaude-flow pair --start --mode driver\n```\n\n**Your Responsibilities:**\n- Write actual code\n- Implement solutions\n- Make immediate decisions\n- Handle syntax and structure\n\n**AI Navigator:**\n- Strategic guidance\n- Spot potential issues\n- Suggest improvements\n- Real-time review\n- Track overall direction\n\n**Best For:**\n- Learning new patterns\n- Implementing familiar features\n- Quick iterations\n- Hands-on debugging\n\n**Commands:**\n```\n$suggest     - Get implementation suggestions\n$review      - Request code review\n$explain     - Ask for explanations\n$optimize    - Request optimization ideas\n$patterns    - Get pattern recommendations\n```\n\n#### Navigator Mode\nAI writes code while you provide direction.\n\n```bash\nclaude-flow pair --start --mode navigator\n```\n\n**Your Responsibilities:**\n- Provide high-level direction\n- Review generated code\n- Make architectural decisions\n- Ensure business requirements\n\n**AI Driver:**\n- Write implementation code\n- Handle syntax details\n- Implement your guidance\n- Manage boilerplate\n- Execute refactoring\n\n**Best For:**\n- Rapid prototyping\n- Boilerplate generation\n- Learning from AI patterns\n- Exploring solutions\n\n**Commands:**\n```\n$implement   - Direct implementation\n$refactor    - Request refactoring\n$test        - Generate tests\n$document    - Add documentation\n$alternate   - See alternative approaches\n```\n\n#### Switch Mode\nAutomatically alternates roles at intervals.\n\n```bash\n# Default 10-minute intervals\nclaude-flow pair --start --mode switch\n\n# 5-minute intervals (rapid)\nclaude-flow pair --start --mode switch --interval 5m\n\n# 15-minute intervals (deep focus)\nclaude-flow pair --start --mode switch --interval 15m\n```\n\n**Handoff Process:**\n1. 30-second warning before switch\n2. Current driver completes thought\n3. Context summary generated\n4. Roles swap smoothly\n5. New driver continues\n\n**Best For:**\n- Balanced collaboration\n- Knowledge sharing\n- Complex features\n- Extended sessions\n\n#### Specialized Modes\n\n**TDD Mode** - Test-Driven Development:\n```bash\nclaude-flow pair --start \\\n  --mode tdd \\\n  --test-first \\\n  --coverage 100\n```\nWorkflow: Write failing test → Implement → Refactor → Repeat\n\n**Review Mode** - Continuous code review:\n```bash\nclaude-flow pair --start \\\n  --mode review \\\n  --strict \\\n  --security\n```\nFeatures: Real-time feedback, security scanning, performance analysis\n\n**Mentor Mode** - Learning-focused:\n```bash\nclaude-flow pair --start \\\n  --mode mentor \\\n  --explain-all \\\n  --pace slow\n```\nFeatures: Detailed explanations, step-by-step guidance, pattern teaching\n\n**Debug Mode** - Problem-solving:\n```bash\nclaude-flow pair --start \\\n  --mode debug \\\n  --verbose \\\n  --trace\n```\nFeatures: Issue identification, root cause analysis, fix suggestions\n\n### In-Session Commands\n\n#### Code Commands\n```\n$explain [--level basic|detailed|expert]\n  Explain the current code or selection\n\n$suggest [--type refactor|optimize|security|style]\n  Get improvement suggestions\n\n$implement \u003Cdescription>\n  Request implementation (navigator mode)\n\n$refactor [--pattern \u003Cpattern>] [--scope function|file|module]\n  Refactor selected code\n\n$optimize [--target speed|memory|both]\n  Optimize code for performance\n\n$document [--format jsdoc|markdown|inline]\n  Add documentation to code\n\n$comment [--verbose]\n  Add inline comments\n\n$pattern \u003Cpattern-name> [--example]\n  Apply a design pattern\n```\n\n#### Testing Commands\n```\n$test [--watch] [--coverage] [--only \u003Cpattern>]\n  Run test suite\n\n$test-gen [--type unit|integration|e2e]\n  Generate tests for current code\n\n$coverage [--report html|json|terminal]\n  Check test coverage\n\n$mock \u003Ctarget> [--realistic]\n  Generate mock data or functions\n\n$test-watch [--on-save]\n  Enable test watching\n\n$snapshot [--update]\n  Create test snapshots\n```\n\n#### Review Commands\n```\n$review [--scope current|file|changes] [--strict]\n  Perform code review\n\n$security [--deep] [--fix]\n  Security analysis\n\n$perf [--profile] [--suggestions]\n  Performance analysis\n\n$quality [--detailed]\n  Check code quality metrics\n\n$lint [--fix] [--config \u003Cconfig>]\n  Run linters\n\n$complexity [--threshold \u003Cvalue>]\n  Analyze code complexity\n```\n\n#### Navigation Commands\n```\n$goto \u003Cfile>[:line[:column]]\n  Navigate to file or location\n\n$find \u003Cpattern> [--regex] [--case-sensitive]\n  Search in project\n\n$recent [--limit \u003Cn>]\n  Show recent files\n\n$bookmark [add|list|goto|remove] [\u003Cname>]\n  Manage bookmarks\n\n$history [--limit \u003Cn>] [--filter \u003Cpattern>]\n  Show command history\n\n$tree [--depth \u003Cn>] [--filter \u003Cpattern>]\n  Show project structure\n```\n\n#### Git Commands\n```\n$diff [--staged] [--file \u003Cfile>]\n  Show git diff\n\n$commit [--message \u003Cmsg>] [--amend]\n  Commit with verification\n\n$branch [create|switch|delete|list] [\u003Cname>]\n  Branch operations\n\n$stash [save|pop|list|apply] [\u003Cmessage>]\n  Stash operations\n\n$log [--oneline] [--limit \u003Cn>]\n  View git log\n\n$blame [\u003Cfile>]\n  Show git blame\n```\n\n#### AI Partner Commands\n```\n$agent [switch|info|config] [\u003Cagent-name>]\n  Manage AI agent\n\n$teach \u003Cpreference>\n  Teach the AI your preferences\n\n$feedback [positive|negative] \u003Cmessage>\n  Provide feedback to AI\n\n$personality [professional|friendly|concise|verbose]\n  Adjust AI personality\n\n$expertise [add|remove|list] [\u003Cdomain>]\n  Set AI expertise focus\n```\n\n#### Metrics Commands\n```\n$metrics [--period today|session|week|all]\n  Show session metrics\n\n$score [--breakdown]\n  Show quality scores\n\n$productivity [--chart]\n  Show productivity metrics\n\n$leaderboard [--personal|team]\n  Show improvement leaderboard\n```\n\n#### Role & Mode Commands\n```\n$switch [--immediate]\n  Switch driver$navigator roles\n\n$mode \u003Ctype>\n  Change mode (driver|navigator|switch|tdd|review|mentor|debug)\n\n$role\n  Show current role\n\n$handoff\n  Prepare role handoff\n```\n\n### Command Shortcuts\n\n| Alias | Full Command |\n|-------|-------------|\n| `$s` | `$suggest` |\n| `$e` | `$explain` |\n| `$t` | `$test` |\n| `$r` | `$review` |\n| `$c` | `$commit` |\n| `$g` | `$goto` |\n| `$f` | `$find` |\n| `$h` | `$help` |\n| `$sw` | `$switch` |\n| `$st` | `$status` |\n\n### Configuration\n\n#### Basic Configuration\nCreate `.claude-flow$pair-config.json`:\n\n```json\n{\n  \"pair\": {\n    \"enabled\": true,\n    \"defaultMode\": \"switch\",\n    \"defaultAgent\": \"auto\",\n    \"autoStart\": false,\n    \"theme\": \"professional\"\n  }\n}\n```\n\n#### Complete Configuration\n\n```json\n{\n  \"pair\": {\n    \"general\": {\n      \"enabled\": true,\n      \"defaultMode\": \"switch\",\n      \"defaultAgent\": \"senior-dev\",\n      \"language\": \"javascript\",\n      \"timezone\": \"UTC\"\n    },\n\n    \"modes\": {\n      \"driver\": {\n        \"enabled\": true,\n        \"suggestions\": true,\n        \"realTimeReview\": true,\n        \"autoComplete\": false\n      },\n      \"navigator\": {\n        \"enabled\": true,\n        \"codeGeneration\": true,\n        \"explanations\": true,\n        \"alternatives\": true\n      },\n      \"switch\": {\n        \"enabled\": true,\n        \"interval\": \"10m\",\n        \"warning\": \"30s\",\n        \"autoSwitch\": true,\n        \"pauseOnIdle\": true\n      }\n    },\n\n    \"verification\": {\n      \"enabled\": true,\n      \"threshold\": 0.95,\n      \"autoRollback\": true,\n      \"preCommitCheck\": true,\n      \"continuousMonitoring\": true,\n      \"blockOnFailure\": true\n    },\n\n    \"testing\": {\n      \"enabled\": true,\n      \"autoRun\": true,\n      \"framework\": \"jest\",\n      \"onSave\": true,\n      \"coverage\": {\n        \"enabled\": true,\n        \"minimum\": 80,\n        \"enforce\": true,\n        \"reportFormat\": \"html\"\n      }\n    },\n\n    \"review\": {\n      \"enabled\": true,\n      \"continuous\": true,\n      \"preCommit\": true,\n      \"security\": true,\n      \"performance\": true,\n      \"style\": true,\n      \"complexity\": {\n        \"maxComplexity\": 10,\n        \"maxDepth\": 4,\n        \"maxLines\": 100\n      }\n    },\n\n    \"git\": {\n      \"enabled\": true,\n      \"autoCommit\": false,\n      \"commitTemplate\": \"feat: {message}\",\n      \"signCommits\": false,\n      \"pushOnEnd\": false,\n      \"branchProtection\": true\n    },\n\n    \"session\": {\n      \"autoSave\": true,\n      \"saveInterval\": \"5m\",\n      \"maxDuration\": \"4h\",\n      \"idleTimeout\": \"15m\",\n      \"breakReminder\": \"45m\",\n      \"metricsInterval\": \"1m\"\n    },\n\n    \"ai\": {\n      \"model\": \"advanced\",\n      \"temperature\": 0.7,\n      \"maxTokens\": 4000,\n      \"personality\": \"professional\",\n      \"expertise\": [\"backend\", \"testing\", \"security\"],\n      \"learningEnabled\": true\n    }\n  }\n}\n```\n\n#### Built-in Agents\n\n```json\n{\n  \"agents\": {\n    \"senior-dev\": {\n      \"expertise\": [\"architecture\", \"patterns\", \"optimization\"],\n      \"style\": \"thorough\",\n      \"reviewLevel\": \"strict\"\n    },\n    \"tdd-specialist\": {\n      \"expertise\": [\"testing\", \"mocks\", \"coverage\"],\n      \"style\": \"test-first\",\n      \"reviewLevel\": \"comprehensive\"\n    },\n    \"debugger-expert\": {\n      \"expertise\": [\"debugging\", \"profiling\", \"tracing\"],\n      \"style\": \"analytical\",\n      \"reviewLevel\": \"focused\"\n    },\n    \"junior-dev\": {\n      \"expertise\": [\"learning\", \"basics\", \"documentation\"],\n      \"style\": \"questioning\",\n      \"reviewLevel\": \"educational\"\n    }\n  }\n}\n```\n\n#### CLI Configuration\n```bash\n# Set configuration\nclaude-flow pair config set defaultMode switch\nclaude-flow pair config set verification.threshold 0.98\n\n# Get configuration\nclaude-flow pair config get\nclaude-flow pair config get defaultMode\n\n# Export\u002FImport\nclaude-flow pair config export > config.json\nclaude-flow pair config import config.json\n\n# Reset\nclaude-flow pair config reset\n```\n\n#### Profile Management\n\nCreate reusable profiles:\n\n```bash\n# Create profile\nclaude-flow pair profile create refactoring \\\n  --mode driver \\\n  --verify true \\\n  --threshold 0.98 \\\n  --focus refactor\n\n# Use profile\nclaude-flow pair --start --profile refactoring\n\n# List profiles\nclaude-flow pair profile list\n```\n\nProfile configuration:\n```json\n{\n  \"profiles\": {\n    \"refactoring\": {\n      \"mode\": \"driver\",\n      \"verification\": {\n        \"enabled\": true,\n        \"threshold\": 0.98\n      },\n      \"focus\": \"refactor\"\n    },\n    \"debugging\": {\n      \"mode\": \"navigator\",\n      \"agent\": \"debugger-expert\",\n      \"trace\": true,\n      \"verbose\": true\n    },\n    \"learning\": {\n      \"mode\": \"mentor\",\n      \"pace\": \"slow\",\n      \"explanations\": \"detailed\",\n      \"examples\": true\n    }\n  }\n}\n```\n\n### Real-World Examples\n\n#### Example 1: Feature Implementation\n\nImplementing user authentication with JWT tokens:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode switch \\\n  --agent senior-dev \\\n  --focus implement \\\n  --verify \\\n  --test\n```\n\n**Session Flow:**\n```\n👥 Starting pair programming for authentication feature...\n\n[DRIVER: You - 10 minutes]\n$explain JWT authentication flow\n> AI explains JWT concepts and best practices\n\n$suggest implementation approach\n> AI suggests using middleware pattern with refresh tokens\n\n# You write the basic auth middleware structure\n\n[SWITCH TO NAVIGATOR]\n\n[NAVIGATOR: AI - 10 minutes]\n$implement JWT token generation with refresh tokens\n> AI generates secure token implementation\n\n$test-gen\n> AI creates comprehensive test suite\n\n[SWITCH TO DRIVER]\n\n[DRIVER: You - 10 minutes]\n# You refine the implementation\n$review --security\n> AI performs security review, suggests improvements\n\n$commit --message \"feat: JWT authentication with refresh tokens\"\n✅ Truth Score: 0.98 - Committed successfully\n```\n\n#### Example 2: Bug Fixing\n\nDebugging a memory leak in Node.js:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode navigator \\\n  --agent debugger-expert \\\n  --focus debug \\\n  --trace\n```\n\n**Session Flow:**\n```\n👥 Starting debugging session...\n\n$status\n> Analyzing application for memory issues...\n\n$perf --profile\n> Memory usage growing: 150MB → 450MB over 10 minutes\n\n$find \"new EventEmitter\" --regex\n> Found 3 instances of EventEmitter creation\n\n$inspect eventEmitters --deep\n> Discovering listeners not being removed\n\n$suggest fix for memory leak\n> AI suggests: \"Add removeListener in cleanup functions\"\n\n$implement cleanup functions for all event emitters\n> AI generates proper cleanup code\n\n$test\n> Memory stable at 150MB ✅\n\n$commit --message \"fix: memory leak in event emitters\"\n```\n\n#### Example 3: TDD Session\n\nBuilding shopping cart with test-driven development:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode tdd \\\n  --agent tdd-specialist \\\n  --test-first\n```\n\n**Session Flow:**\n```\n👥 TDD Session: Shopping Cart Feature\n\n[RED PHASE]\n$test-gen \"add item to cart\"\n> AI writes failing test:\n  ✗ should add item to cart\n  ✗ should update quantity for existing item\n  ✗ should calculate total price\n\n[GREEN PHASE]\n$implement minimal cart functionality\n> You write just enough code to pass tests\n\n$test\n> Tests passing: 3\u002F3 ✅\n\n[REFACTOR PHASE]\n$refactor --pattern repository\n> AI refactors to repository pattern\n\n$test\n> Tests still passing: 3\u002F3 ✅\n\n[NEXT CYCLE]\n$test-gen \"remove item from cart\"\n> AI writes new failing tests...\n```\n\n#### Example 4: Code Refactoring\n\nModernizing legacy code:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode driver \\\n  --focus refactor \\\n  --verify \\\n  --threshold 0.98\n```\n\n**Session Flow:**\n```\n👥 Refactoring Session: Modernizing UserService\n\n$analyze UserService.js\n> AI identifies:\n  - Callback hell (5 levels deep)\n  - No error handling\n  - Tight coupling\n  - No tests\n\n$suggest refactoring plan\n> AI suggests:\n  1. Convert callbacks to async$await\n  2. Add error boundaries\n  3. Extract dependencies\n  4. Add unit tests\n\n$test-gen --before-refactor\n> AI generates tests for current behavior\n\n$refactor callbacks to async$await\n# You refactor with AI guidance\n\n$test\n> All tests passing ✅\n\n$review --compare\n> AI shows before$after comparison\n> Code complexity: 35 → 12\n> Truth score: 0.99 ✅\n\n$commit --message \"refactor: modernize UserService with async$await\"\n```\n\n#### Example 5: Performance Optimization\n\nOptimizing slow React application:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode switch \\\n  --agent performance-expert \\\n  --focus optimize \\\n  --profile\n```\n\n**Session Flow:**\n```\n👥 Performance Optimization Session\n\n$perf --profile\n> React DevTools Profiler Results:\n  - ProductList: 450ms render\n  - CartSummary: 200ms render\n  - Unnecessary re-renders: 15\n\n$suggest optimizations for ProductList\n> AI suggests:\n  1. Add React.memo\n  2. Use useMemo for expensive calculations\n  3. Implement virtualization for long lists\n\n$implement React.memo and useMemo\n# You implement with AI guidance\n\n$perf --profile\n> ProductList: 45ms render (90% improvement!) ✅\n\n$implement virtualization with react-window\n> AI implements virtual scrolling\n\n$perf --profile\n> ProductList: 12ms render (97% improvement!) ✅\n> FPS: 60 stable ✅\n\n$commit --message \"perf: optimize ProductList with memoization and virtualization\"\n```\n\n#### Example 6: API Development\n\nBuilding RESTful API with Express:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode navigator \\\n  --agent backend-expert \\\n  --focus implement \\\n  --test\n```\n\n**Session Flow:**\n```\n👥 API Development Session\n\n$design REST API for blog platform\n> AI designs endpoints:\n  POST   $api$posts\n  GET    $api$posts\n  GET    $api$posts\u002F:id\n  PUT    $api$posts\u002F:id\n  DELETE $api$posts\u002F:id\n\n$implement CRUD endpoints with validation\n> AI implements with Express + Joi validation\n\n$test-gen --integration\n> AI generates integration tests\n\n$security --api\n> AI adds:\n  - Rate limiting\n  - Input sanitization\n  - JWT authentication\n  - CORS configuration\n\n$document --openapi\n> AI generates OpenAPI documentation\n\n$test --integration\n> All endpoints tested: 15\u002F15 ✅\n```\n\n### Session Templates\n\n#### Quick Start Templates\n\n```bash\n# Refactoring template\nclaude-flow pair --template refactor\n# Focus: Code improvement\n# Verification: High (0.98)\n# Testing: After each change\n# Review: Continuous\n\n# Feature template\nclaude-flow pair --template feature\n# Focus: Implementation\n# Verification: Standard (0.95)\n# Testing: On completion\n# Review: Pre-commit\n\n# Debug template\nclaude-flow pair --template debug\n# Focus: Problem solving\n# Verification: Moderate (0.90)\n# Testing: Regression tests\n# Review: Root cause\n\n# Learning template\nclaude-flow pair --template learn\n# Mode: Mentor\n# Pace: Slow\n# Explanations: Detailed\n# Examples: Many\n```\n\n### Session Management\n\n#### Session Status\n\n```bash\nclaude-flow pair --status\n```\n\n**Output:**\n```\n👥 Pair Programming Session\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\nSession ID: pair_1755021234567\nDuration: 45 minutes\nStatus: Active\n\nPartner: senior-dev\nCurrent Role: DRIVER (you)\nMode: Switch (10m intervals)\nNext Switch: in 3 minutes\n\n📊 Metrics:\n├── Truth Score: 0.982 ✅\n├── Lines Changed: 234\n├── Files Modified: 5\n├── Tests Added: 12\n├── Coverage: 87% ↑3%\n└── Commits: 3\n\n🎯 Focus: Implementation\n📝 Current File: src$auth$login.js\n```\n\n#### Session History\n\n```bash\nclaude-flow pair --history\n```\n\n**Output:**\n```\n📚 Session History\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n1. 2024-01-15 14:30 - 16:45 (2h 15m)\n   Partner: expert-coder\n   Focus: Refactoring\n   Truth Score: 0.975\n   Changes: +340 -125 lines\n\n2. 2024-01-14 10:00 - 11:30 (1h 30m)\n   Partner: tdd-specialist\n   Focus: Testing\n   Truth Score: 0.991\n   Tests Added: 24\n\n3. 2024-01-13 15:00 - 17:00 (2h)\n   Partner: debugger-expert\n   Focus: Bug Fixing\n   Truth Score: 0.968\n   Issues Fixed: 5\n```\n\n#### Session Persistence\n\n```bash\n# Save session\nclaude-flow pair --save [--name \u003Cname>]\n\n# Load session\nclaude-flow pair --load \u003Csession-id>\n\n# Export session\nclaude-flow pair --export \u003Csession-id> [--format json|md]\n\n# Generate report\nclaude-flow pair --report \u003Csession-id>\n```\n\n#### Background Sessions\n\n```bash\n# Start in background\nclaude-flow pair --start --background\n\n# Monitor background session\nclaude-flow pair --monitor\n\n# Attach to background session\nclaude-flow pair --attach \u003Csession-id>\n\n# End background session\nclaude-flow pair --end \u003Csession-id>\n```\n\n### Advanced Features\n\n#### Custom Commands\n\nDefine in configuration:\n\n```json\n{\n  \"customCommands\": {\n    \"tdd\": \"$test-gen && $test --watch\",\n    \"full-review\": \"$lint --fix && $test && $review --strict\",\n    \"quick-fix\": \"$suggest --type fix && $implement && $test\"\n  }\n}\n```\n\nUse custom commands:\n```\n$custom tdd\n$custom full-review\n```\n\n#### Command Chaining\n\n```\n$test && $commit && $push\n$lint --fix && $test && $review --strict\n```\n\n#### Session Recording\n\n```bash\n# Start with recording\nclaude-flow pair --start --record\n\n# Replay session\nclaude-flow pair --replay \u003Csession-id>\n\n# Session analytics\nclaude-flow pair --analytics \u003Csession-id>\n```\n\n#### Integration Options\n\n**With Git:**\n```bash\nclaude-flow pair --start --git --auto-commit\n```\n\n**With CI\u002FCD:**\n```bash\nclaude-flow pair --start --ci --non-interactive\n```\n\n**With IDE:**\n```bash\nclaude-flow pair --start --ide vscode\n```\n\n### Best Practices\n\n#### Session Practices\n1. **Clear Goals** - Define session objectives upfront\n2. **Appropriate Mode** - Choose based on task type\n3. **Enable Verification** - For critical code paths\n4. **Regular Testing** - Maintain quality continuously\n5. **Session Notes** - Document important decisions\n6. **Regular Breaks** - Take breaks every 45-60 minutes\n\n#### Code Practices\n1. **Test Early** - Run tests after each change\n2. **Verify Before Commit** - Check truth scores\n3. **Review Security** - Always for sensitive code\n4. **Profile Performance** - Use `$perf` for optimization\n5. **Save Sessions** - For complex work\n6. **Learn from AI** - Ask questions frequently\n\n#### Mode Selection\n- **Driver Mode**: When learning, controlling implementation\n- **Navigator Mode**: For rapid prototyping, generation\n- **Switch Mode**: Long sessions, balanced collaboration\n- **TDD Mode**: Building with tests\n- **Review Mode**: Quality focus\n- **Mentor Mode**: Learning priority\n- **Debug Mode**: Fixing issues\n\n### Troubleshooting\n\n#### Session Won't Start\n- Check agent availability\n- Verify configuration file syntax\n- Ensure clean workspace\n- Review log files\n\n#### Session Disconnected\n- Use `--recover` to restore\n- Check network connection\n- Verify background processes\n- Review auto-save files\n\n#### Poor Performance\n- Reduce verification threshold\n- Disable continuous testing\n- Check system resources\n- Use lighter AI model\n\n#### Configuration Issues\n- Validate JSON syntax\n- Check file permissions\n- Review priority order (CLI > env > project > user > global)\n- Run `claude-flow pair config validate`\n\n### Quality Metrics\n\n#### Truth Score Thresholds\n```\nError:   \u003C 0.90 ❌\nWarning: 0.90 - 0.95 ⚠️\nGood:    0.95 - 0.98 ✅\nExcellent: > 0.98 🌟\n```\n\n#### Coverage Thresholds\n```\nError:   \u003C 70% ❌\nWarning: 70% - 80% ⚠️\nGood:    80% - 90% ✅\nExcellent: > 90% 🌟\n```\n\n#### Complexity Thresholds\n```\nError:   > 15 ❌\nWarning: 10 - 15 ⚠️\nGood:    5 - 10 ✅\nExcellent: \u003C 5 🌟\n```\n\n### Environment Variables\n\nOverride configuration via environment:\n\n```bash\nexport CLAUDE_PAIR_MODE=driver\nexport CLAUDE_PAIR_VERIFY=true\nexport CLAUDE_PAIR_THRESHOLD=0.98\nexport CLAUDE_PAIR_AGENT=senior-dev\nexport CLAUDE_PAIR_AUTO_TEST=true\n```\n\n### Command History\n\nNavigate history:\n- `↑\u002F↓` - Navigate through command history\n- `Ctrl+R` - Search command history\n- `!!` - Repeat last command\n- `!\u003Cn>` - Run command n from history\n\n### Keyboard Shortcuts (Configurable)\n\nDefault shortcuts:\n```json\n{\n  \"shortcuts\": {\n    \"switch\": \"ctrl+shift+s\",\n    \"suggest\": \"ctrl+space\",\n    \"review\": \"ctrl+r\",\n    \"test\": \"ctrl+t\"\n  }\n}\n```\n\n### Related Commands\n\n- `claude-flow pair --help` - Show help\n- `claude-flow pair config` - Manage configuration\n- `claude-flow pair profile` - Manage profiles\n- `claude-flow pair templates` - List templates\n- `claude-flow pair agents` - List available agents\n\n\n## 🛠️ PHÁC ĐỒ VẬN HÀNH (OPERATIONAL PROTOCOL)\n### 🔍 Phase 1: Investigation (Thẩm định)\n- Xác minh tham số đầu vào dựa trên Schema.\n- Kiểm tra bối cảnh hệ thống liên quan.\n\n### 🚀 Phase 2: Action (Thực thi)\n- Triệu hồi logic thực thi trong `logic.py`.\n- Trả về kết quả và chắt lọc kinh nghiệm.\n\n---\n## ⚠️ SAI LẦM THƯỜNG GẶP (COMMON PITFALLS)\n- Chưa ghi nhận.\n\n---\n*TRUNG THÀNH - CHÍNH XÁC - TỐI THƯỢNG* 💎🦾\n","# Pair Programming (pair-programming)\n\n## 🌟 TỔNG QUAN\n---\nname: Pair Programming\ndescription: 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.\n---\n\n# Pair Programming\n\nCollaborative AI pair programming with intelligent role management, real-time quality monitoring, and comprehensive development workflows.\n\n## What This Skill Does\n\nThis 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.\n\n**Key Capabilities:**\n- **Multiple Modes**: Driver, Navigator, Switch, TDD, Review, Mentor, Debug\n- **Real-Time Verification**: Automatic quality scoring with rollback on failures\n- **Role Management**: Seamless switching between driver$navigator roles\n- **Testing Integration**: Auto-generate tests, track coverage, continuous testing\n- **Code Review**: Security scanning, performance analysis, best practice enforcement\n- **Session Persistence**: Auto-save, recovery, export, and sharing\n\n## Prerequisites\n\n**Required:**\n- Claude Flow CLI installed (`npm install -g claude-flow@alpha`)\n- Git repository (optional but recommended)\n\n**Recommended:**\n- Testing framework (Jest, pytest, etc.)\n- Linter configured (ESLint, pylint, etc.)\n- Code formatter (Prettier, Black, etc.)\n\n## Quick Start\n\n### Basic Session\n```bash\n# Start simple pair programming\nclaude-flow pair --start\n```\n\n### TDD Session\n```bash\n# Test-driven development\nclaude-flow pair --start \\\n  --mode tdd \\\n  --test-first \\\n  --coverage 90\n```\n\n---\n\n## Complete Guide\n\n### Session Control Commands\n\n#### Starting Sessions\n```bash\n# Basic start\nclaude-flow pair --start\n\n# Expert refactoring session\nclaude-flow pair --start \\\n  --agent senior-dev \\\n  --focus refactor \\\n  --verify \\\n  --threshold 0.98\n\n# Debugging session\nclaude-flow pair --start \\\n  --agent debugger-expert \\\n  --focus debug \\\n  --review\n\n# Learning session\nclaude-flow pair --start \\\n  --mode mentor \\\n  --pace slow \\\n  --examples\n```\n\n#### Session Management\n```bash\n# Check status\nclaude-flow pair --status\n\n# View history\nclaude-flow pair --history\n\n# Pause session\n$pause [--reason \u003Creason>]\n\n# Resume session\n$resume\n\n# End session\nclaude-flow pair --end [--save] [--report]\n```\n\n### Available Modes\n\n#### Driver Mode\nYou write code while AI provides guidance.\n\n```bash\nclaude-flow pair --start --mode driver\n```\n\n**Your Responsibilities:**\n- Write actual code\n- Implement solutions\n- Make immediate decisions\n- Handle syntax and structure\n\n**AI Navigator:**\n- Strategic guidance\n- Spot potential issues\n- Suggest improvements\n- Real-time review\n- Track overall direction\n\n**Best For:**\n- Learning new patterns\n- Implementing familiar features\n- Quick iterations\n- Hands-on debugging\n\n**Commands:**\n```\n$suggest     - Get implementation suggestions\n$review      - Request code review\n$explain     - Ask for explanations\n$optimize    - Request optimization ideas\n$patterns    - Get pattern recommendations\n```\n\n#### Navigator Mode\nAI writes code while you provide direction.\n\n```bash\nclaude-flow pair --start --mode navigator\n```\n\n**Your Responsibilities:**\n- Provide high-level direction\n- Review generated code\n- Make architectural decisions\n- Ensure business requirements\n\n**AI Driver:**\n- Write implementation code\n- Handle syntax details\n- Implement your guidance\n- Manage boilerplate\n- Execute refactoring\n\n**Best For:**\n- Rapid prototyping\n- Boilerplate generation\n- Learning from AI patterns\n- Exploring solutions\n\n**Commands:**\n```\n$implement   - Direct implementation\n$refactor    - Request refactoring\n$test        - Generate tests\n$document    - Add documentation\n$alternate   - See alternative approaches\n```\n\n#### Switch Mode\nAutomatically alternates roles at intervals.\n\n```bash\n# Default 10-minute intervals\nclaude-flow pair --start --mode switch\n\n# 5-minute intervals (rapid)\nclaude-flow pair --start --mode switch --interval 5m\n\n# 15-minute intervals (deep focus)\nclaude-flow pair --start --mode switch --interval 15m\n```\n\n**Handoff Process:**\n1. 30-second warning before switch\n2. Current driver completes thought\n3. Context summary generated\n4. Roles swap smoothly\n5. New driver continues\n\n**Best For:**\n- Balanced collaboration\n- Knowledge sharing\n- Complex features\n- Extended sessions\n\n#### Specialized Modes\n\n**TDD Mode** - Test-Driven Development:\n```bash\nclaude-flow pair --start \\\n  --mode tdd \\\n  --test-first \\\n  --coverage 100\n```\nWorkflow: Write failing test → Implement → Refactor → Repeat\n\n**Review Mode** - Continuous code review:\n```bash\nclaude-flow pair --start \\\n  --mode review \\\n  --strict \\\n  --security\n```\nFeatures: Real-time feedback, security scanning, performance analysis\n\n**Mentor Mode** - Learning-focused:\n```bash\nclaude-flow pair --start \\\n  --mode mentor \\\n  --explain-all \\\n  --pace slow\n```\nFeatures: Detailed explanations, step-by-step guidance, pattern teaching\n\n**Debug Mode** - Problem-solving:\n```bash\nclaude-flow pair --start \\\n  --mode debug \\\n  --verbose \\\n  --trace\n```\nFeatures: Issue identification, root cause analysis, fix suggestions\n\n### In-Session Commands\n\n#### Code Commands\n```\n$explain [--level basic|detailed|expert]\n  Explain the current code or selection\n\n$suggest [--type refactor|optimize|security|style]\n  Get improvement suggestions\n\n$implement \u003Cdescription>\n  Request implementation (navigator mode)\n\n$refactor [--pattern \u003Cpattern>] [--scope function|file|module]\n  Refactor selected code\n\n$optimize [--target speed|memory|both]\n  Optimize code for performance\n\n$document [--format jsdoc|markdown|inline]\n  Add documentation to code\n\n$comment [--verbose]\n  Add inline comments\n\n$pattern \u003Cpattern-name> [--example]\n  Apply a design pattern\n```\n\n#### Testing Commands\n```\n$test [--watch] [--coverage] [--only \u003Cpattern>]\n  Run test suite\n\n$test-gen [--type unit|integration|e2e]\n  Generate tests for current code\n\n$coverage [--report html|json|terminal]\n  Check test coverage\n\n$mock \u003Ctarget> [--realistic]\n  Generate mock data or functions\n\n$test-watch [--on-save]\n  Enable test watching\n\n$snapshot [--update]\n  Create test snapshots\n```\n\n#### Review Commands\n```\n$review [--scope current|file|changes] [--strict]\n  Perform code review\n\n$security [--deep] [--fix]\n  Security analysis\n\n$perf [--profile] [--suggestions]\n  Performance analysis\n\n$quality [--detailed]\n  Check code quality metrics\n\n$lint [--fix] [--config \u003Cconfig>]\n  Run linters\n\n$complexity [--threshold \u003Cvalue>]\n  Analyze code complexity\n```\n\n#### Navigation Commands\n```\n$goto \u003Cfile>[:line[:column]]\n  Navigate to file or location\n\n$find \u003Cpattern> [--regex] [--case-sensitive]\n  Search in project\n\n$recent [--limit \u003Cn>]\n  Show recent files\n\n$bookmark [add|list|goto|remove] [\u003Cname>]\n  Manage bookmarks\n\n$history [--limit \u003Cn>] [--filter \u003Cpattern>]\n  Show command history\n\n$tree [--depth \u003Cn>] [--filter \u003Cpattern>]\n  Show project structure\n```\n\n#### Git Commands\n```\n$diff [--staged] [--file \u003Cfile>]\n  Show git diff\n\n$commit [--message \u003Cmsg>] [--amend]\n  Commit with verification\n\n$branch [create|switch|delete|list] [\u003Cname>]\n  Branch operations\n\n$stash [save|pop|list|apply] [\u003Cmessage>]\n  Stash operations\n\n$log [--oneline] [--limit \u003Cn>]\n  View git log\n\n$blame [\u003Cfile>]\n  Show git blame\n```\n\n#### AI Partner Commands\n```\n$agent [switch|info|config] [\u003Cagent-name>]\n  Manage AI agent\n\n$teach \u003Cpreference>\n  Teach the AI your preferences\n\n$feedback [positive|negative] \u003Cmessage>\n  Provide feedback to AI\n\n$personality [professional|friendly|concise|verbose]\n  Adjust AI personality\n\n$expertise [add|remove|list] [\u003Cdomain>]\n  Set AI expertise focus\n```\n\n#### Metrics Commands\n```\n$metrics [--period today|session|week|all]\n  Show session metrics\n\n$score [--breakdown]\n  Show quality scores\n\n$productivity [--chart]\n  Show productivity metrics\n\n$leaderboard [--personal|team]\n  Show improvement leaderboard\n```\n\n#### Role & Mode Commands\n```\n$switch [--immediate]\n  Switch driver$navigator roles\n\n$mode \u003Ctype>\n  Change mode (driver|navigator|switch|tdd|review|mentor|debug)\n\n$role\n  Show current role\n\n$handoff\n  Prepare role handoff\n```\n\n### Command Shortcuts\n\n| Alias | Full Command |\n|-------|-------------|\n| `$s` | `$suggest` |\n| `$e` | `$explain` |\n| `$t` | `$test` |\n| `$r` | `$review` |\n| `$c` | `$commit` |\n| `$g` | `$goto` |\n| `$f` | `$find` |\n| `$h` | `$help` |\n| `$sw` | `$switch` |\n| `$st` | `$status` |\n\n### Configuration\n\n#### Basic Configuration\nCreate `.claude-flow$pair-config.json`:\n\n```json\n{\n  \"pair\": {\n    \"enabled\": true,\n    \"defaultMode\": \"switch\",\n    \"defaultAgent\": \"auto\",\n    \"autoStart\": false,\n    \"theme\": \"professional\"\n  }\n}\n```\n\n#### Complete Configuration\n\n```json\n{\n  \"pair\": {\n    \"general\": {\n      \"enabled\": true,\n      \"defaultMode\": \"switch\",\n      \"defaultAgent\": \"senior-dev\",\n      \"language\": \"javascript\",\n      \"timezone\": \"UTC\"\n    },\n\n    \"modes\": {\n      \"driver\": {\n        \"enabled\": true,\n        \"suggestions\": true,\n        \"realTimeReview\": true,\n        \"autoComplete\": false\n      },\n      \"navigator\": {\n        \"enabled\": true,\n        \"codeGeneration\": true,\n        \"explanations\": true,\n        \"alternatives\": true\n      },\n      \"switch\": {\n        \"enabled\": true,\n        \"interval\": \"10m\",\n        \"warning\": \"30s\",\n        \"autoSwitch\": true,\n        \"pauseOnIdle\": true\n      }\n    },\n\n    \"verification\": {\n      \"enabled\": true,\n      \"threshold\": 0.95,\n      \"autoRollback\": true,\n      \"preCommitCheck\": true,\n      \"continuousMonitoring\": true,\n      \"blockOnFailure\": true\n    },\n\n    \"testing\": {\n      \"enabled\": true,\n      \"autoRun\": true,\n      \"framework\": \"jest\",\n      \"onSave\": true,\n      \"coverage\": {\n        \"enabled\": true,\n        \"minimum\": 80,\n        \"enforce\": true,\n        \"reportFormat\": \"html\"\n      }\n    },\n\n    \"review\": {\n      \"enabled\": true,\n      \"continuous\": true,\n      \"preCommit\": true,\n      \"security\": true,\n      \"performance\": true,\n      \"style\": true,\n      \"complexity\": {\n        \"maxComplexity\": 10,\n        \"maxDepth\": 4,\n        \"maxLines\": 100\n      }\n    },\n\n    \"git\": {\n      \"enabled\": true,\n      \"autoCommit\": false,\n      \"commitTemplate\": \"feat: {message}\",\n      \"signCommits\": false,\n      \"pushOnEnd\": false,\n      \"branchProtection\": true\n    },\n\n    \"session\": {\n      \"autoSave\": true,\n      \"saveInterval\": \"5m\",\n      \"maxDuration\": \"4h\",\n      \"idleTimeout\": \"15m\",\n      \"breakReminder\": \"45m\",\n      \"metricsInterval\": \"1m\"\n    },\n\n    \"ai\": {\n      \"model\": \"advanced\",\n      \"temperature\": 0.7,\n      \"maxTokens\": 4000,\n      \"personality\": \"professional\",\n      \"expertise\": [\"backend\", \"testing\", \"security\"],\n      \"learningEnabled\": true\n    }\n  }\n}\n```\n\n#### Built-in Agents\n\n```json\n{\n  \"agents\": {\n    \"senior-dev\": {\n      \"expertise\": [\"architecture\", \"patterns\", \"optimization\"],\n      \"style\": \"thorough\",\n      \"reviewLevel\": \"strict\"\n    },\n    \"tdd-specialist\": {\n      \"expertise\": [\"testing\", \"mocks\", \"coverage\"],\n      \"style\": \"test-first\",\n      \"reviewLevel\": \"comprehensive\"\n    },\n    \"debugger-expert\": {\n      \"expertise\": [\"debugging\", \"profiling\", \"tracing\"],\n      \"style\": \"analytical\",\n      \"reviewLevel\": \"focused\"\n    },\n    \"junior-dev\": {\n      \"expertise\": [\"learning\", \"basics\", \"documentation\"],\n      \"style\": \"questioning\",\n      \"reviewLevel\": \"educational\"\n    }\n  }\n}\n```\n\n#### CLI Configuration\n```bash\n# Set configuration\nclaude-flow pair config set defaultMode switch\nclaude-flow pair config set verification.threshold 0.98\n\n# Get configuration\nclaude-flow pair config get\nclaude-flow pair config get defaultMode\n\n# Export\u002FImport\nclaude-flow pair config export > config.json\nclaude-flow pair config import config.json\n\n# Reset\nclaude-flow pair config reset\n```\n\n#### Profile Management\n\nCreate reusable profiles:\n\n```bash\n# Create profile\nclaude-flow pair profile create refactoring \\\n  --mode driver \\\n  --verify true \\\n  --threshold 0.98 \\\n  --focus refactor\n\n# Use profile\nclaude-flow pair --start --profile refactoring\n\n# List profiles\nclaude-flow pair profile list\n```\n\nProfile configuration:\n```json\n{\n  \"profiles\": {\n    \"refactoring\": {\n      \"mode\": \"driver\",\n      \"verification\": {\n        \"enabled\": true,\n        \"threshold\": 0.98\n      },\n      \"focus\": \"refactor\"\n    },\n    \"debugging\": {\n      \"mode\": \"navigator\",\n      \"agent\": \"debugger-expert\",\n      \"trace\": true,\n      \"verbose\": true\n    },\n    \"learning\": {\n      \"mode\": \"mentor\",\n      \"pace\": \"slow\",\n      \"explanations\": \"detailed\",\n      \"examples\": true\n    }\n  }\n}\n```\n\n### Real-World Examples\n\n#### Example 1: Feature Implementation\n\nImplementing user authentication with JWT tokens:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode switch \\\n  --agent senior-dev \\\n  --focus implement \\\n  --verify \\\n  --test\n```\n\n**Session Flow:**\n```\n👥 Starting pair programming for authentication feature...\n\n[DRIVER: You - 10 minutes]\n$explain JWT authentication flow\n> AI explains JWT concepts and best practices\n\n$suggest implementation approach\n> AI suggests using middleware pattern with refresh tokens\n\n# You write the basic auth middleware structure\n\n[SWITCH TO NAVIGATOR]\n\n[NAVIGATOR: AI - 10 minutes]\n$implement JWT token generation with refresh tokens\n> AI generates secure token implementation\n\n$test-gen\n> AI creates comprehensive test suite\n\n[SWITCH TO DRIVER]\n\n[DRIVER: You - 10 minutes]\n# You refine the implementation\n$review --security\n> AI performs security review, suggests improvements\n\n$commit --message \"feat: JWT authentication with refresh tokens\"\n✅ Truth Score: 0.98 - Committed successfully\n```\n\n#### Example 2: Bug Fixing\n\nDebugging a memory leak in Node.js:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode navigator \\\n  --agent debugger-expert \\\n  --focus debug \\\n  --trace\n```\n\n**Session Flow:**\n```\n👥 Starting debugging session...\n\n$status\n> Analyzing application for memory issues...\n\n$perf --profile\n> Memory usage growing: 150MB → 450MB over 10 minutes\n\n$find \"new EventEmitter\" --regex\n> Found 3 instances of EventEmitter creation\n\n$inspect eventEmitters --deep\n> Discovering listeners not being removed\n\n$suggest fix for memory leak\n> AI suggests: \"Add removeListener in cleanup functions\"\n\n$implement cleanup functions for all event emitters\n> AI generates proper cleanup code\n\n$test\n> Memory stable at 150MB ✅\n\n$commit --message \"fix: memory leak in event emitters\"\n```\n\n#### Example 3: TDD Session\n\nBuilding shopping cart with test-driven development:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode tdd \\\n  --agent tdd-specialist \\\n  --test-first\n```\n\n**Session Flow:**\n```\n👥 TDD Session: Shopping Cart Feature\n\n[RED PHASE]\n$test-gen \"add item to cart\"\n> AI writes failing test:\n  ✗ should add item to cart\n  ✗ should update quantity for existing item\n  ✗ should calculate total price\n\n[GREEN PHASE]\n$implement minimal cart functionality\n> You write just enough code to pass tests\n\n$test\n> Tests passing: 3\u002F3 ✅\n\n[REFACTOR PHASE]\n$refactor --pattern repository\n> AI refactors to repository pattern\n\n$test\n> Tests still passing: 3\u002F3 ✅\n\n[NEXT CYCLE]\n$test-gen \"remove item from cart\"\n> AI writes new failing tests...\n```\n\n#### Example 4: Code Refactoring\n\nModernizing legacy code:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode driver \\\n  --focus refactor \\\n  --verify \\\n  --threshold 0.98\n```\n\n**Session Flow:**\n```\n👥 Refactoring Session: Modernizing UserService\n\n$analyze UserService.js\n> AI identifies:\n  - Callback hell (5 levels deep)\n  - No error handling\n  - Tight coupling\n  - No tests\n\n$suggest refactoring plan\n> AI suggests:\n  1. Convert callbacks to async$await\n  2. Add error boundaries\n  3. Extract dependencies\n  4. Add unit tests\n\n$test-gen --before-refactor\n> AI generates tests for current behavior\n\n$refactor callbacks to async$await\n# You refactor with AI guidance\n\n$test\n> All tests passing ✅\n\n$review --compare\n> AI shows before$after comparison\n> Code complexity: 35 → 12\n> Truth score: 0.99 ✅\n\n$commit --message \"refactor: modernize UserService with async$await\"\n```\n\n#### Example 5: Performance Optimization\n\nOptimizing slow React application:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode switch \\\n  --agent performance-expert \\\n  --focus optimize \\\n  --profile\n```\n\n**Session Flow:**\n```\n👥 Performance Optimization Session\n\n$perf --profile\n> React DevTools Profiler Results:\n  - ProductList: 450ms render\n  - CartSummary: 200ms render\n  - Unnecessary re-renders: 15\n\n$suggest optimizations for ProductList\n> AI suggests:\n  1. Add React.memo\n  2. Use useMemo for expensive calculations\n  3. Implement virtualization for long lists\n\n$implement React.memo and useMemo\n# You implement with AI guidance\n\n$perf --profile\n> ProductList: 45ms render (90% improvement!) ✅\n\n$implement virtualization with react-window\n> AI implements virtual scrolling\n\n$perf --profile\n> ProductList: 12ms render (97% improvement!) ✅\n> FPS: 60 stable ✅\n\n$commit --message \"perf: optimize ProductList with memoization and virtualization\"\n```\n\n#### Example 6: API Development\n\nBuilding RESTful API with Express:\n\n```bash\n# Session setup\nclaude-flow pair --start \\\n  --mode navigator \\\n  --agent backend-expert \\\n  --focus implement \\\n  --test\n```\n\n**Session Flow:**\n```\n👥 API Development Session\n\n$design REST API for blog platform\n> AI designs endpoints:\n  POST   $api$posts\n  GET    $api$posts\n  GET    $api$posts\u002F:id\n  PUT    $api$posts\u002F:id\n  DELETE $api$posts\u002F:id\n\n$implement CRUD endpoints with validation\n> AI implements with Express + Joi validation\n\n$test-gen --integration\n> AI generates integration tests\n\n$security --api\n> AI adds:\n  - Rate limiting\n  - Input sanitization\n  - JWT authentication\n  - CORS configuration\n\n$document --openapi\n> AI generates OpenAPI documentation\n\n$test --integration\n> All endpoints tested: 15\u002F15 ✅\n```\n\n### Session Templates\n\n#### Quick Start Templates\n\n```bash\n# Refactoring template\nclaude-flow pair --template refactor\n# Focus: Code improvement\n# Verification: High (0.98)\n# Testing: After each change\n# Review: Continuous\n\n# Feature template\nclaude-flow pair --template feature\n# Focus: Implementation\n# Verification: Standard (0.95)\n# Testing: On completion\n# Review: Pre-commit\n\n# Debug template\nclaude-flow pair --template debug\n# Focus: Problem solving\n# Verification: Moderate (0.90)\n# Testing: Regression tests\n# Review: Root cause\n\n# Learning template\nclaude-flow pair --template learn\n# Mode: Mentor\n# Pace: Slow\n# Explanations: Detailed\n# Examples: Many\n```\n\n### Session Management\n\n#### Session Status\n\n```bash\nclaude-flow pair --status\n```\n\n**Output:**\n```\n👥 Pair Programming Session\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\nSession ID: pair_1755021234567\nDuration: 45 minutes\nStatus: Active\n\nPartner: senior-dev\nCurrent Role: DRIVER (you)\nMode: Switch (10m intervals)\nNext Switch: in 3 minutes\n\n📊 Metrics:\n├── Truth Score: 0.982 ✅\n├── Lines Changed: 234\n├── Files Modified: 5\n├── Tests Added: 12\n├── Coverage: 87% ↑3%\n└── Commits: 3\n\n🎯 Focus: Implementation\n📝 Current File: src$auth$login.js\n```\n\n#### Session History\n\n```bash\nclaude-flow pair --history\n```\n\n**Output:**\n```\n📚 Session History\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n1. 2024-01-15 14:30 - 16:45 (2h 15m)\n   Partner: expert-coder\n   Focus: Refactoring\n   Truth Score: 0.975\n   Changes: +340 -125 lines\n\n2. 2024-01-14 10:00 - 11:30 (1h 30m)\n   Partner: tdd-specialist\n   Focus: Testing\n   Truth Score: 0.991\n   Tests Added: 24\n\n3. 2024-01-13 15:00 - 17:00 (2h)\n   Partner: debugger-expert\n   Focus: Bug Fixing\n   Truth Score: 0.968\n   Issues Fixed: 5\n```\n\n#### Session Persistence\n\n```bash\n# Save session\nclaude-flow pair --save [--name \u003Cname>]\n\n# Load session\nclaude-flow pair --load \u003Csession-id>\n\n# Export session\nclaude-flow pair --export \u003Csession-id> [--format json|md]\n\n# Generate report\nclaude-flow pair --report \u003Csession-id>\n```\n\n#### Background Sessions\n\n```bash\n# Start in background\nclaude-flow pair --start --background\n\n# Monitor background session\nclaude-flow pair --monitor\n\n# Attach to background session\nclaude-flow pair --attach \u003Csession-id>\n\n# End background session\nclaude-flow pair --end \u003Csession-id>\n```\n\n### Advanced Features\n\n#### Custom Commands\n\nDefine in configuration:\n\n```json\n{\n  \"customCommands\": {\n    \"tdd\": \"$test-gen && $test --watch\",\n    \"full-review\": \"$lint --fix && $test && $review --strict\",\n    \"quick-fix\": \"$suggest --type fix && $implement && $test\"\n  }\n}\n```\n\nUse custom commands:\n```\n$custom tdd\n$custom full-review\n```\n\n#### Command Chaining\n\n```\n$test && $commit && $push\n$lint --fix && $test && $review --strict\n```\n\n#### Session Recording\n\n```bash\n# Start with recording\nclaude-flow pair --start --record\n\n# Replay session\nclaude-flow pair --replay \u003Csession-id>\n\n# Session analytics\nclaude-flow pair --analytics \u003Csession-id>\n```\n\n#### Integration Options\n\n**With Git:**\n```bash\nclaude-flow pair --start --git --auto-commit\n```\n\n**With CI\u002FCD:**\n```bash\nclaude-flow pair --start --ci --non-interactive\n```\n\n**With IDE:**\n```bash\nclaude-flow pair --start --ide vscode\n```\n\n### Best Practices\n\n#### Session Practices\n1. **Clear Goals** - Define session objectives upfront\n2. **Appropriate Mode** - Choose based on task type\n3. **Enable Verification** - For critical code paths\n4. **Regular Testing** - Maintain quality continuously\n5. **Session Notes** - Document important decisions\n6. **Regular Breaks** - Take breaks every 45-60 minutes\n\n#### Code Practices\n1. **Test Early** - Run tests after each change\n2. **Verify Before Commit** - Check truth scores\n3. **Review Security** - Always for sensitive code\n4. **Profile Performance** - Use `$perf` for optimization\n5. **Save Sessions** - For complex work\n6. **Learn from AI** - Ask questions frequently\n\n#### Mode Selection\n- **Driver Mode**: When learning, controlling implementation\n- **Navigator Mode**: For rapid prototyping, generation\n- **Switch Mode**: Long sessions, balanced collaboration\n- **TDD Mode**: Building with tests\n- **Review Mode**: Quality focus\n- **Mentor Mode**: Learning priority\n- **Debug Mode**: Fixing issues\n\n### Troubleshooting\n\n#### Session Won't Start\n- Check agent availability\n- Verify configuration file syntax\n- Ensure clean workspace\n- Review log files\n\n#### Session Disconnected\n- Use `--recover` to restore\n- Check network connection\n- Verify background processes\n- Review auto-save files\n\n#### Poor Performance\n- Reduce verification threshold\n- Disable continuous testing\n- Check system resources\n- Use lighter AI model\n\n#### Configuration Issues\n- Validate JSON syntax\n- Check file permissions\n- Review priority order (CLI > env > project > user > global)\n- Run `claude-flow pair config validate`\n\n### Quality Metrics\n\n#### Truth Score Thresholds\n```\nError:   \u003C 0.90 ❌\nWarning: 0.90 - 0.95 ⚠️\nGood:    0.95 - 0.98 ✅\nExcellent: > 0.98 🌟\n```\n\n#### Coverage Thresholds\n```\nError:   \u003C 70% ❌\nWarning: 70% - 80% ⚠️\nGood:    80% - 90% ✅\nExcellent: > 90% 🌟\n```\n\n#### Complexity Thresholds\n```\nError:   > 15 ❌\nWarning: 10 - 15 ⚠️\nGood:    5 - 10 ✅\nExcellent: \u003C 5 🌟\n```\n\n### Environment Variables\n\nOverride configuration via environment:\n\n```bash\nexport CLAUDE_PAIR_MODE=driver\nexport CLAUDE_PAIR_VERIFY=true\nexport CLAUDE_PAIR_THRESHOLD=0.98\nexport CLAUDE_PAIR_AGENT=senior-dev\nexport CLAUDE_PAIR_AUTO_TEST=true\n```\n\n### Command History\n\nNavigate history:\n- `↑\u002F↓` - Navigate through command history\n- `Ctrl+R` - Search command history\n- `!!` - Repeat last command\n- `!\u003Cn>` - Run command n from history\n\n### Keyboard Shortcuts (Configurable)\n\nDefault shortcuts:\n```json\n{\n  \"shortcuts\": {\n    \"switch\": \"ctrl+shift+s\",\n    \"suggest\": \"ctrl+space\",\n    \"review\": \"ctrl+r\",\n    \"test\": \"ctrl+t\"\n  }\n}\n```\n\n### Related Commands\n\n- `claude-flow pair --help` - Show help\n- `claude-flow pair config` - Manage configuration\n- `claude-flow pair profile` - Manage profiles\n- `claude-flow pair templates` - List templates\n- `claude-flow pair agents` - List available agents\n\n\n## 🛠️ PHÁC ĐỒ VẬN HÀNH (OPERATIONAL PROTOCOL)\n### 🔍 Phase 1: Investigation (Thẩm định)\n- Xác minh tham số đầu vào dựa trên Schema.\n- Kiểm tra bối cảnh hệ thống liên quan.\n\n### 🚀 Phase 2: Action (Thực thi)\n- Triệu hồi logic thực thi trong `logic.py`.\n- Trả về kết quả và chắt lọc kinh nghiệm.\n\n---\n## ⚠️ SAI LẦM THƯỜNG GẶP (COMMON PITFALLS)\n- Chưa ghi nhận.\n\n---\n*TRUNG THÀNH - CHÍNH XÁC - TỐI THƯỢNG* 💎🦾\n",{"id":5,"author":22,"domain":23,"schema":24,"name_vn":25,"version":26,"priority":27,"aliases_vn":28,"intent_pairs":29,"related_skills":30},"Zenith Legacy","UNKNOWN",{},"Pair Programming","1.0.0","NORMAL",[],[],[],"main","571327a911ec45873180fd5628525b6d4504ed79","intelligence\u002Fskills\u002FCORE\u002Fpair-programming","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith","https:\u002F\u002Fgithub.com\u002Fngdletrung","2026-11-08 11:23:33",{"source":7,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add ngdletrung\u002FJKAI-Zenith --skill pair-programming",{"tool":43,"command":44},"bunx","bunx skills add ngdletrung\u002FJKAI-Zenith --skill pair-programming",{"tool":46,"command":47},"pnpm","pnpm dlx skills add ngdletrung\u002FJKAI-Zenith --skill pair-programming","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FCORE\u002Fpair-programming\u002FSKILL.md",true,[51,57,63,67],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"__init__.py","SCRIPT","脚本",65,"https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FCORE\u002Fpair-programming\u002F__init__.py",{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"dossier.md","REFERENCE","参考文档",2224,"https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FCORE\u002Fpair-programming\u002Fdossier.md",{"path":64,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":65,"sourceHtmlUrl":66},"logic.py",398,"https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FCORE\u002Fpair-programming\u002Flogic.py",{"path":68,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":69,"sourceHtmlUrl":70},"manifest.json",917,"https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FCORE\u002Fpair-programming\u002Fmanifest.json",[72,79,85,92,98,104],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":17},"01M73C2NC1W5P3A0V3GQAJ0SJB","standard_plugin","Hướng dẫn kích hoạt và vận hành cho kỹ năng standard_plugin.","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002Ftemplates\u002Fstandard_plugin\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":17},"01M73C2KAN3Q7D5XEBKB3KZW1B","_STANDARD","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002F_STANDARD\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":17},"01M73C2HV7KDJQTA6ACCR10HZB","test_dynamic_audit","Thao tác kiểm toán động","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FTEST\u002Ftest_dynamic_audit\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":17},"01M73C2FRG0JHZ6W155V1KCHRP","security-audit","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FSECURITY\u002Fsecurity-audit\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":17},"01M73C2EMWYHFTAR9RSZ41TBGP","security-and-hardening","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FSECURITY\u002Fsecurity-and-hardening\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":17},"01M73C2CV0BQ59NAEWXKBQ370Z","performance-optimization","https:\u002F\u002Fgithub.com\u002Fngdletrung\u002FJKAI-Zenith\u002Fblob\u002Fmain\u002Fintelligence\u002Fskills\u002FSECURITY\u002Fperformance-optimization\u002FSKILL.md",[],[]]