π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
π Checkpoint: Edit /workspaces/claude-code-flow/.claude/commands/pair/examples.md
rUv5b26c47cc7ac
diff --git a/.claude/checkpoints/1755028513.json b/.claude/checkpoints/1755028513.jsonnew file mode 100644index 0000000000..77212f3bef--- /dev/null+++ b/.claude/checkpoints/1755028513.json@@ -0,0 +1 @@+{"branch": "checkpoint/pre-edit-20250812-195513", "file": "/workspaces/claude-code-flow/.claude/commands/pair/commands.md", "timestamp": "2025-08-12T19:55:13Z", "type": "pre-edit", "original_branch": "alpha-89"}diff --git a/.claude/checkpoints/1755028514.json b/.claude/checkpoints/1755028514.jsonnew file mode 100644index 0000000000..d44447a7c7--- /dev/null+++ b/.claude/checkpoints/1755028514.json@@ -0,0 +1 @@+{"tag": "checkpoint-20250812-195514", "file": "/workspaces/claude-code-flow/.claude/commands/pair/commands.md", "timestamp": "2025-08-12T19:55:14Z", "type": "post-edit", "branch": "alpha-89", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 8440 ++++++++++++++++++++--- .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1755028421.json | 1 + .claude/checkpoints/1755028422.json | 1 + .claude/commands/pair/commands.md | 546 ++ .claude/commands/truth/{README.md => start.md} | 0 .claude/commands/verify/{README.md => start.md} | 0 claude-flow-wiki | 0 9 files changed, 8090 insertions(+), 906 deletions(-) "}diff --git a/.claude/commands/pair/examples.md b/.claude/commands/pair/examples.mdnew file mode 100644index 0000000000..0a39c2bb76--- /dev/null+++ b/.claude/commands/pair/examples.md@@ -0,0 +1,512 @@+# Pair Programming Examples++Real-world examples and scenarios for pair programming sessions.++## Example 1: Feature Implementation++### Scenario+Implementing a user authentication feature with JWT tokens.++### Session Setup+```bash+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+```++## Example 2: Bug Fixing Session++### Scenario+Debugging a memory leak in a Node.js application.++### Session Setup+```bash+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"+```++## Example 3: Test-Driven Development++### Scenario+Building a shopping cart feature using TDD.++### Session Setup+```bash+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...+```++## Example 4: Code Refactoring++### Scenario+Refactoring legacy code to modern patterns.++### Session Setup+```bash+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"+```++## Example 5: Learning Session++### Scenario+Learning React hooks with AI mentorship.++### Session Setup+```bash+claude-flow pair --start \+ --mode mentor \+ --agent react-expert \+ --pace slow \+ --examples+```++### Session Flow+```+π₯ Learning Session: React Hooks++/learn useState hook+> AI explains with interactive examples++/example custom hook for API calls+> AI shows best practice implementation:+```javascript+function useApi(url) {+ const [data, setData] = useState(null);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState(null);++ useEffect(() => {+ // Implementation explained step by step+ }, [url]);++ return { data, loading, error };+}+```++/implement my own custom hook+# You write with AI guidance++/review --educational+> AI provides detailed feedback with learning points++/quiz react hooks+> AI tests your understanding+> Score: 8/10 - Good progress!+```++## Example 6: Performance Optimization++### Scenario+Optimizing a slow React application.++### Session Setup+```bash+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"+```++## Example 7: API Development++### Scenario+Building a RESTful API with Express.++### Session Setup+```bash+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 β++/deploy --staging+> API deployed to staging environment+```++## Example 8: Database Migration++### Scenario+Migrating from MongoDB to PostgreSQL.++### Session Setup+```bash+claude-flow pair --start \+ --mode switch \+ --agent database-expert \+ --verify \+ --test+```++### Session Flow+```+π₯ Database Migration Session++/analyze MongoDB schema+> AI maps current structure:+ - users collection β users table+ - posts collection β posts table+ - Embedded comments β comments table with FK++/design PostgreSQL schema+> AI creates normalized schema with relations++/implement migration script+# You write migration with AI assistance++/test --migration --sample-data+> Migration successful for 10,000 records β++/implement data access layer+> AI creates repository pattern implementation++/test --integration+> All queries working correctly β++/verify data integrity+> Truth score: 0.995 β+> No data loss detected+```++## Example 9: CI/CD Pipeline++### Scenario+Setting up GitHub Actions CI/CD pipeline.++### Session Setup+```bash+claude-flow pair --start \+ --mode navigator \+ --agent devops-expert \+ --focus implement+```++### Session Flow+```+π₯ CI/CD Pipeline Setup++/implement GitHub Actions workflow+> AI creates .github/workflows/ci.yml:+ - Build on push/PR+ - Run tests+ - Check coverage+ - Deploy to staging++/test --ci --dry-run+> Pipeline simulation successful β++/implement deployment to production+> AI adds:+ - Manual approval step+ - Rollback capability+ - Health checks+ - Notifications++/security --scan-pipeline+> AI adds security scanning:+ - Dependency scanning+ - Container scanning+ - Secret scanning++/commit --message "ci: complete CI/CD pipeline with security scanning"+```++## Example 10: Mobile App Development++### Scenario+Building a React Native mobile feature.++### Session Setup+```bash+claude-flow pair --start \+ --mode switch \+ --agent mobile-expert \+ --language react-native \+ --test+```++### Session Flow+```+π₯ Mobile Development Session++/implement offline-first data sync+> AI implements:+ - Local SQLite storage+ - Queue for pending changes+ - Sync on connection restore+ - Conflict resolution++/test --device ios simulator+> Feature working on iOS β++/test --device android emulator+> Feature working on Android β++/optimize --mobile+> AI optimizes:+ - Reduces bundle size by 30%+ - Implements lazy loading+ - Adds image caching++/review --accessibility+> AI ensures:+ - Screen reader support+ - Proper contrast ratios+ - Touch target sizes++/commit --message "feat: offline-first sync with optimizations"+```++## Common Patterns++### Starting Patterns+```bash+# Quick start for common scenarios+claude-flow pair --template <template>+```++Available templates:+- `feature` - New feature development+- `bugfix` - Bug fixing session+- `refactor` - Code refactoring+- `optimize` - Performance optimization+- `test` - Test writing+- `review` - Code review+- `learn` - Learning session++### Session Commands Flow++#### Typical Feature Development+```+/start β /explain β /design β /implement β /test β /review β /commit β /end+```++#### Typical Bug Fix+```+/start β /reproduce β /debug β /trace β /fix β /test β /verify β /commit β /end+```++#### Typical Refactoring+```+/start β /analyze β /plan β /test-gen β /refactor β /test β /review β /commit β /end+```++## Best Practices from Examples++1. **Always Start with Context** - Use `/explain` or `/analyze`+2. **Test Early and Often** - Run tests after each change+3. **Verify Before Commit** - Check truth scores+4. **Document Decisions** - Use `/note` for important choices+5. **Review Security** - Always run `/security` for sensitive code+6. **Profile Performance** - Use `/perf` for optimization+7. **Save Sessions** - Use `/save` for complex work++## Related Documentation++- [Getting Started](./README.md)+- [Session Management](./session.md)+- [Commands Reference](./commands.md)+- [Configuration](./config.md)\ No newline at end of file