npx skills add https://github.com/ruvnet/ruflo --skill 'Pair Programming'通过智能角色管理、实时质量监控和全面的开发工作流程,实现协作式 AI 结对编程。
此技能提供专业的 AI 辅助结对编程能力,支持多种协作模式、持续验证和集成测试。它管理驾驶员/领航员角色,执行实时代码审查,跟踪质量指标,并通过真实度分数验证确保高标准。
核心能力:
必需:
npm install -g claude-flow@alpha)推荐:
# 启动简单的结对编程
claude-flow pair --start
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 测试驱动开发
claude-flow pair --start \
--mode tdd \
--test-first \
--coverage 90
# 基础启动
claude-flow pair --start
# 专家重构会话
claude-flow pair --start \
--agent senior-dev \
--focus refactor \
--verify \
--threshold 0.98
# 调试会话
claude-flow pair --start \
--agent debugger-expert \
--focus debug \
--review
# 学习会话
claude-flow pair --start \
--mode mentor \
--pace slow \
--examples
# 检查状态
claude-flow pair --status
# 查看历史
claude-flow pair --history
# 暂停会话
$pause [--reason <reason>]
# 恢复会话
$resume
# 结束会话
claude-flow pair --end [--save] [--report]
您编写代码,AI 提供指导。
claude-flow pair --start --mode driver
您的职责:
AI 领航员:
最适合:
命令:
$suggest - 获取实现建议
$review - 请求代码审查
$explain - 请求解释
$optimize - 请求优化思路
$patterns - 获取模式推荐
AI 编写代码,您提供方向。
claude-flow pair --start --mode navigator
您的职责:
AI 驾驶员:
最适合:
命令:
$implement - 指导实现
$refactor - 请求重构
$test - 生成测试
$document - 添加文档
$alternate - 查看替代方案
按时间间隔自动切换角色。
# 默认 10 分钟间隔
claude-flow pair --start --mode switch
# 5 分钟间隔(快速)
claude-flow pair --start --mode switch --interval 5m
# 15 分钟间隔(深度专注)
claude-flow pair --start --mode switch --interval 15m
交接流程:
最适合:
TDD 模式 - 测试驱动开发:
claude-flow pair --start \
--mode tdd \
--test-first \
--coverage 100
工作流程:编写失败测试 → 实现 → 重构 → 重复
审查模式 - 持续代码审查:
claude-flow pair --start \
--mode review \
--strict \
--security
功能:实时反馈、安全扫描、性能分析
导师模式 - 学习导向:
claude-flow pair --start \
--mode mentor \
--explain-all \
--pace slow
功能:详细解释、逐步指导、模式教学
调试模式 - 问题解决:
claude-flow pair --start \
--mode debug \
--verbose \
--trace
功能:问题识别、根本原因分析、修复建议
$explain [--level basic|detailed|expert]
解释当前代码或选中部分
$suggest [--type refactor|optimize|security|style]
获取改进建议
$implement <description>
请求实现(领航员模式)
$refactor [--pattern <pattern>] [--scope function|file|module]
重构选中代码
$optimize [--target speed|memory|both]
优化代码性能
$document [--format jsdoc|markdown|inline]
为代码添加文档
$comment [--verbose]
添加内联注释
$pattern <pattern-name> [--example]
应用设计模式
$test [--watch] [--coverage] [--only <pattern>]
运行测试套件
$test-gen [--type unit|integration|e2e]
为当前代码生成测试
$coverage [--report html|json|terminal]
检查测试覆盖率
$mock <target> [--realistic]
生成模拟数据或函数
$test-watch [--on-save]
启用测试监视
$snapshot [--update]
创建测试快照
$review [--scope current|file|changes] [--strict]
执行代码审查
$security [--deep] [--fix]
安全分析
$perf [--profile] [--suggestions]
性能分析
$quality [--detailed]
检查代码质量指标
$lint [--fix] [--config <config>]
运行代码检查器
$complexity [--threshold <value>]
分析代码复杂度
$goto <file>[:line[:column]]
导航到文件或位置
$find <pattern> [--regex] [--case-sensitive]
在项目中搜索
$recent [--limit <n>]
显示最近文件
$bookmark [add|list|goto|remove] [<name>]
管理书签
$history [--limit <n>] [--filter <pattern>]
显示命令历史
$tree [--depth <n>] [--filter <pattern>]
显示项目结构
$diff [--staged] [--file <file>]
显示 git diff
$commit [--message <msg>] [--amend]
提交并验证
$branch [create|switch|delete|list] [<name>]
分支操作
$stash [save|pop|list|apply] [<message>]
储藏操作
$log [--oneline] [--limit <n>]
查看 git 日志
$blame [<file>]
显示 git blame
$agent [switch|info|config] [<agent-name>]
管理 AI 代理
$teach <preference>
教导 AI 您的偏好
$feedback [positive|negative] <message>
向 AI 提供反馈
$personality [professional|friendly|concise|verbose]
调整 AI 个性
$expertise [add|remove|list] [<domain>]
设置 AI 专业领域焦点
$metrics [--period today|session|week|all]
显示会话指标
$score [--breakdown]
显示质量分数
$productivity [--chart]
显示生产力指标
$leaderboard [--personal|team]
显示改进排行榜
$switch [--immediate]
切换驾驶员/领航员角色
$mode <type>
更改模式 (driver|navigator|switch|tdd|review|mentor|debug)
$role
显示当前角色
$handoff
准备角色交接
| 别名 | 完整命令 |
|---|---|
$s | $suggest |
$e | $explain |
$t | $test |
$r | $review |
$c | $commit |
$g | $goto |
$f | $find |
$h | $help |
$sw | $switch |
$st | $status |
创建 .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"
}
}
}
# 设置配置
claude-flow pair config set defaultMode switch
claude-flow pair config set verification.threshold 0.98
# 获取配置
claude-flow pair config get
claude-flow pair config get defaultMode
# 导出/导入
claude-flow pair config export > config.json
claude-flow pair config import config.json
# 重置
claude-flow pair config reset
创建可重用的配置文件:
# 创建配置文件
claude-flow pair profile create refactoring \
--mode driver \
--verify true \
--threshold 0.98 \
--focus refactor
# 使用配置文件
claude-flow pair --start --profile refactoring
# 列出配置文件
claude-flow pair profile list
配置文件配置:
{
"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
}
}
}
使用 JWT 令牌实现用户认证:
# 会话设置
claude-flow pair --start \
--mode switch \
--agent senior-dev \
--focus implement \
--verify \
--test
会话流程:
👥 为认证功能启动结对编程...
[驾驶员: 您 - 10 分钟]
$explain JWT 认证流程
> AI 解释 JWT 概念和最佳实践
$suggest 实现方法
> AI 建议使用带有刷新令牌的中间件模式
# 您编写基础认证中间件结构
[切换到领航员]
[领航员: AI - 10 分钟]
$implement 带有刷新令牌的 JWT 令牌生成
> AI 生成安全的令牌实现
$test-gen
> AI 创建全面的测试套件
[切换到驾驶员]
[驾驶员: 您 - 10 分钟]
# 您完善实现
$review --security
> AI 执行安全审查,提出改进建议
$commit --message "feat: JWT authentication with refresh tokens"
✅ 真实度分数: 0.98 - 成功提交
调试 Node.js 中的内存泄漏:
# 会话设置
claude-flow pair --start \
--mode navigator \
--agent debugger-expert \
--focus debug \
--trace
会话流程:
👥 启动调试会话...
$status
> 分析应用程序内存问题...
$perf --profile
> 内存使用增长: 150MB → 450MB 超过 10 分钟
$find "new EventEmitter" --regex
> 发现 3 个 EventEmitter 创建实例
$inspect eventEmitters --deep
> 发现监听器未被移除
$suggest 内存泄漏修复方案
> AI 建议:"在清理函数中添加 removeListener"
$implement 为所有事件发射器添加清理函数
> AI 生成正确的清理代码
$test
> 内存稳定在 150MB ✅
$commit --message "fix: memory leak in event emitters"
使用测试驱动开发构建购物车:
# 会话设置
claude-flow pair --start \
--mode tdd \
--agent tdd-specialist \
--test-first
会话流程:
👥 TDD 会话: 购物车功能
[红色阶段]
$test-gen "add item to cart"
> AI 编写失败测试:
✗ should add item to cart
✗ should update quantity for existing item
✗ should calculate total price
[绿色阶段]
$implement 最小化购物车功能
> 您编写刚好能通过测试的代码
$test
> 测试通过: 3/3 ✅
[重构阶段]
$refactor --pattern repository
> AI 重构为仓库模式
$test
> 测试仍然通过: 3/3 ✅
[下一个周期]
$test-gen "remove item from cart"
> AI 编写新的失败测试...
现代化遗留代码:
# 会话设置
claude-flow pair --start \
--mode driver \
--focus refactor \
--verify \
--threshold 0.98
会话流程:
👥 重构会话: 现代化 UserService
$analyze UserService.js
> AI 识别:
- 回调地狱(5 层深度)
- 无错误处理
- 紧耦合
- 无测试
$suggest 重构计划
> AI 建议:
1. 将回调转换为 async/await
2. 添加错误边界
3. 提取依赖项
4. 添加单元测试
$test-gen --before-refactor
> AI 为当前行为生成测试
$refactor callbacks to async/await
# 您在 AI 指导下重构
$test
> 所有测试通过 ✅
$review --compare
> AI 显示前后对比
> 代码复杂度: 35 → 12
> 真实度分数: 0.99 ✅
$commit --message "refactor: modernize UserService with async/await"
优化缓慢的 React 应用程序:
# 会话设置
claude-flow pair --start \
--mode switch \
--agent performance-expert \
--focus optimize \
--profile
会话流程:
👥 性能优化会话
$perf --profile
> React DevTools 分析器结果:
- ProductList: 450ms 渲染
- CartSummary: 200ms 渲染
- 不必要的重新渲染: 15
$suggest ProductList 优化建议
> AI 建议:
1. 添加 React.memo
2. 对昂贵计算使用 useMemo
3. 为长列表实现虚拟化
$implement React.memo 和 useMemo
# 您在 AI 指导下实现
$perf --profile
> ProductList: 45ms 渲染(90% 改进!)✅
$implement 使用 react-window 实现虚拟化
> AI 实现虚拟滚动
$perf --profile
> ProductList: 12ms 渲染(97% 改进!)✅
> FPS: 60 稳定 ✅
$commit --message "perf: optimize ProductList with memoization and virtualization"
使用 Express 构建 RESTful API:
# 会话设置
claude-flow pair --start \
--mode navigator \
--agent backend-expert \
--focus implement \
--test
会话流程:
👥 API 开发会话
$design 博客平台的 REST API
> AI 设计端点:
POST /api/posts
GET /api/posts
GET /api/posts/:id
PUT /api/posts/:id
DELETE /api/posts/:id
$implement 带有验证的 CRUD 端点
> AI 使用 Express + Joi 验证实现
$test-gen --integration
> AI 生成集成测试
$security --api
> AI 添加:
- 速率限制
- 输入清理
- JWT 认证
- CORS 配置
$document --openapi
> AI 生成 OpenAPI 文档
$test --integration
> 所有端点测试: 15/15 ✅
# 重构模板
claude-flow pair --template refactor
# 焦点: 代码改进
# 验证: 高 (0.98)
# 测试: 每次更改后
# 审查: 持续
# 功能模板
claude-flow pair --template feature
# 焦点: 实现
# 验证: 标准 (0.95)
# 测试: 完成后
# 审查: 提交前
# 调试模板
claude-flow pair --template debug
# 焦点: 问题解决
# 验证: 中等 (0.90)
# 测试: 回归测试
# 审查: 根本原因
# 学习模板
claude-flow pair --template learn
# 模式: 导师
# 节奏: 慢
# 解释: 详细
# 示例: 多
claude-flow pair --status
输出:
👥 结对编程会话
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
会话 ID: pair_1755021234567
持续时间: 45 分钟
状态: 活跃
伙伴: senior-dev
当前角色: 驾驶员 (您)
模式: 切换 (10m 间隔)
下次切换: 3 分钟后
📊 指标:
├── 真实度分数: 0.982 ✅
├── 更改行数: 234
├── 修改文件: 5
├── 添加测试: 12
├── 覆盖率: 87% ↑3%
└── 提交次数: 3
🎯 焦点: 实现
📝 当前文件: src/auth/login.js
claude-flow pair --history
输出:
📚 会话历史
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. 2024-01-15 14:30 - 16:45 (2h 15m)
伙伴: expert-coder
焦点: 重构
真实度分数: 0.975
更改: +340 -125 行
2. 2024-01-14 10:00 - 11:30 (1h 30m)
伙伴: tdd-specialist
焦点: 测试
真实度分数: 0.991
添加测试: 24
3. 2024-01-13 15:00 - 17:00 (2h)
伙伴: debugger-expert
焦点: 错误修复
真实度分数: 0.968
修复问题: 5
# 保存会话
claude-flow pair --save [--name <name>]
# 加载会话
claude-flow pair --load <session-id>
# 导出会话
claude-flow pair --export <session-id> [--format json|md]
# 生成报告
claude-flow pair --report <session-id>
# 在后台启动
claude-flow pair --start --background
# 监控后台会话
claude-flow pair --monitor
# 附加到后台会话
claude-flow pair --attach <session-id>
# 结束后台会话
claude-flow pair --end <session-id>
在配置中定义:
{
"customCommands": {
"tdd": "$test-gen && $test --watch",
"full-review": "$lint --fix && $test && $review --strict",
"quick-fix": "$suggest --type fix && $implement && $test"
}
}
使用自定义命令:
$custom tdd
$custom full-review
$test && $commit && $push
$lint --fix && $test && $review --strict
# 启动时录制
claude-flow pair --start --record
# 回放会话
claude-flow pair --replay <session-id>
# 会话分析
claude-flow pair --analytics <session-id>
与 Git:
claude-flow pair --start --git --auto-commit
与 CI/CD:
claude-flow pair --start --ci --non-interactive
与 IDE:
claude-flow pair --start --ide vscode
$perf 进行优化--recover 恢复claude-flow pair config validate错误: < 0.90 ❌
警告: 0.90 - 0.95 ⚠️
良好: 0.95 - 0.98 ✅
优秀: > 0.98 🌟
错误: < 70% ❌
警告: 70% - 80% ⚠️
良好: 80% - 90% ✅
优秀: > 90% 🌟
错误: > 15 ❌
警告: 10 - 15 ⚠️
良好: 5 - 10 ✅
优秀: < 5 🌟
通过环境变量覆盖配置:
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
导航历史:
↑/↓ - 在命令历史中导航Ctrl+R - 搜索命令历史!! - 重复上一个命令!<n> - 运行历史中的第 n 个命令默认快捷键:
{
"shortcuts": {
"switch": "ctrl+shift+s",
"suggest": "ctrl+space",
"review": "ctrl+r",
"test": "ctrl+t"
}
}
claude-flow pair --help - 显示帮助claude-flow pair config - 管理配置claude-flow pair profile - 管理配置文件claude-flow pair templates - 列出模板claude-flow pair agents - 列出可用代理每周安装
–
仓库
GitHub 星标
24.0K
首次出现
–
安全审计
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 |
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 agentsWeekly Installs
–
Repository
GitHub Stars
24.0K
First Seen
–
Security Audits
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
109,600 周安装
$c |
$commit |
$g | $goto |
$f | $find |
$h | $help |
$sw | $switch |
$st | $status |