ai-pair-programming
Complete AI pair programming suite with slash commands, expert agents, and intelligent hooks
Transform your coding workflow with intelligent AI assistance
An advanced Claude Code plugin that brings together slash commands, specialized agents, and intelligent hooks to create a comprehensive AI pair programming experience.
๐ Features
This plugin integrates three powerful Claude Code features:
๐ Slash Commands
Quick access to AI programming assistance:
/pair- Start an interactive pair programming session/review- Get comprehensive code reviews/suggest- Receive intelligent improvement suggestions/fix- Automatically detect and fix bugs/explain- Get detailed code explanations
๐ค Expert Agents
Specialized AI assistants for different aspects of development:
@code-reviewer- Security, quality, and best practices expert@bug-hunter- Bug detection and fixing specialist@architect- Software architecture and design consultant@performance-expert- Performance optimization specialist
๐ Intelligent Hooks
Automatic quality checks throughout your workflow:
- PostToolUse: Suggests code review after significant changes
- PreToolUse: Validates quality before git commits
- SessionEnd: Generates comprehensive session reports
๐ Installation
Quick Install
# Add the marketplace (if not already added)
/plugin marketplace add https://github.com/Dev-GOM/claude-code-marketplace.git
# Install the plugin
/plugin install ai-pair-programming@dev-gom-plugins
# Restart Claude Code
claude -r
Verify Installation
/plugin
You should see "ai-pair-programming" in the enabled plugins list.
๐ Usage
Starting a Pair Programming Session
/pair
This activates AI pair programming mode where Claude:
- Asks clarifying questions before implementing
- Explains reasoning and design decisions
- Suggests alternatives and trade-offs
- Catches potential mistakes early
- Shares knowledge and best practices
Getting a Code Review
# Review recent changes
/review
# Review a specific file
/review src/components/auth.js
The @code-reviewer agent will analyze:
- Security: Authentication, input validation, vulnerabilities
- Code Quality: Readability, naming, organization
- Performance: Algorithm efficiency, optimization opportunities
- Best Practices: Design patterns, error handling, testing
- Potential Bugs: Edge cases, null checks, logic errors
Requesting Improvement Suggestions
# Get suggestions for recent changes
/suggest
# Get suggestions for a specific file
/suggest src/utils/api.js
Provides:
- Refactoring opportunities
- Design improvements
- Performance optimizations
- Code modernization suggestions
- Maintainability enhancements
Fixing Bugs
# Debug with error message
/fix "TypeError: Cannot read property 'length' of undefined"
# Debug a specific file
/fix src/services/payment.js
The @bug-hunter agent will:
- Identify the problem from error messages
- Perform root cause analysis
- Propose multiple fix approaches
- Implement the best solution
- Suggest tests to prevent regression
Getting Code Explanations
# Explain a file
/explain src/hooks/useAuth.ts
# Explain a concept
/explain "how does the authentication flow work"
Provides explanations with:
- Big picture overview
- Component breakdowns
- Execution flow walkthroughs
- Design patterns and best practices
- Concrete examples
Using Expert Agents Directly
You can invoke agents directly in your conversation:
@code-reviewer please review the authentication logic in auth.ts
@bug-hunter there's a memory leak in the WebSocket connection
@architect how should I structure the microservices communication?
@performance-expert the dashboard is loading slowly, can you analyze it?
๐ง How It Works
Intelligent Hook System
The plugin uses hooks to provide proactive assistance:
-
After Writing Code (PostToolUse)
- Tracks file changes
- Suggests review after 5 files or 5 minutes
- Helps maintain consistent quality
-
Before Git Commits (PreToolUse)
- Checks if code has been reviewed
- Warns about unreviewed changes
- Prevents committing problematic code
-
Session End (SessionEnd)
- Generates summary report
- Provides statistics
- Recommends next actions
State Tracking
The plugin maintains state in .state/review-state.json:
{
"fileChanges": 0,
"lastReviewTime": 1634567890000
}
This helps track:
- Number of files changed since last review
- Time of last code review
- Session statistics
Generated Reports
At session end, creates .pair-programming-session.md:
# AI Pair Programming Session Report
**Session End:** 2024-10-16 14:30:00
## Session Statistics
- **Files Modified:** 7
- **Last Code Review:** 2024-10-16 14:15:00
## Recommendations
โ
Code is relatively stable. Good time for a commit!
๐ฏ Workflow Example
Here's a typical workflow using this plugin:
# 1. Start pair programming
/pair
# Claude: "Let's build something great together! What would you like to work on?"
# 2. Implement feature with AI assistance
"Let's add user authentication"
# Claude helps design and implement...
# 3. After 5 files changed, automatic suggestion appears
# ๐ก Tip: You've made significant changes. Consider running /review
# 4. Request code review
/review
# @code-reviewer provides detailed analysis
# 5. Fix any issues found
@bug-hunter please fix the JWT validation issue
# 6. Before committing, validation occurs
git commit -m "Add authentication"
# โ ๏ธ Pre-Commit Check: Run /review to ensure quality
# 7. Final review
/review
# 8. Commit the code
git commit -m "Add authentication"
# 9. End session - automatic report generated
# ๐ฏ Session Complete! Report saved to .pair-programming-session.md
โ๏ธ Configuration
Plugin Configuration
The plugin uses hooks/hooks.json for configuration. Key settings:
{
"configuration": {
"reviewThresholds": {
"fileChangeCount": 5, // Files before suggesting review
"timeIntervalMinutes": 5, // Minutes before suggesting review
"preCommitWarningFiles": 3, // Files to warn before commit
"preCommitWarningMinutes": 10 // Minutes to warn before commit
},
"outputFiles": {
"sessionReport": ".pair-programming-session.md",
"reviewState": ".state/review-state.json"
},
"features": {
"autoReviewSuggestion": true, // Enable auto-review suggestions
"preCommitValidation": true, // Enable pre-commit warnings
"sessionReporting": true // Enable session reports
}
}
}
Environment Variables:
${CLAUDE_PLUGIN_ROOT}: Automatically resolves to plugin root directory- Used in hook commands to ensure correct script paths
Customizing Agents
Agents are defined as Markdown files with YAML frontmatter in agents/ directory.
Example (agents/code-reviewer.md):
---
name: code-reviewer
description: Your custom description
tools: Read, Grep, Glob
model: sonnet
---
Your custom system prompt goes here...
Agent Properties:
name: Unique identifier (use lowercase and hyphens)description: When to invoke this agenttools: Comma-separated list of allowed toolsmodel: Model to use (sonnet, opus, haiku, or inherit)
Disabling Specific Hooks
Edit hooks/hooks.json to disable hooks:
{
"hooks": {
"PostToolUse": [
{
"enabled": false, // Disable this hook
...
}
]
}
}
Or disable the entire plugin:
/plugin disable ai-pair-programming
๐ Output Files
The plugin generates these files:
.state/review-state.json- Session state tracking.pair-programming-session.md- Session report
Add to .gitignore if desired:
.state/
.pair-programming-session.md
๐ Troubleshooting
Plugin Not Working
-
Check plugin installation:
/plugin -
Verify Node.js is available:
node --version -
Check for errors:
claude --debug
Hooks Not Triggering
- Ensure hooks are enabled in settings
- Check hook event names match
- Verify script permissions (Unix):
chmod +x plugins/ai-pair-programming/scripts/*.js
Agents Not Responding
- Verify agent Markdown files have valid YAML frontmatter
- Check agent names match (use
@agent-nameformat) - Ensure agents directory is properly configured
- Confirm agent files use
.mdextension, not.json
๐ฆ Version
Current Version: 1.1.1
๐ Changelog
v1.1.1 (2025-10-20)
- ๐ Auto Migration: Plugin version-based configuration migration
- ๐ฆ Smart Updates: Preserves user settings while adding new fields
- ๐ท๏ธ Project Scoping: State and output files now use project name to prevent conflicts
- ๐ฏ SessionStart Hook: Auto-creates configuration file on session start
- โก Performance: SessionStart hook exits immediately if config is up-to-date
- ๐ Cross-Platform: Enhanced path handling for Windows/macOS/Linux compatibility
v1.0.0
- Initial release
๐ค Contributing
Feel free to customize this plugin:
- Fork the repository
- Modify agents, commands, or hooks
- Test with
/plugin validate - Share your improvements!
๐ License
Apache License 2.0 - See LICENSE for details
๐ Credits
Created for the Claude Code community to enhance developer productivity through intelligent AI pair programming.
Happy Coding with AI! ๐
For issues or suggestions, please open an issue on GitHub.
๐Quick Installation
/plugin install ai-pair-programming@dev-gom-pluginsRun this command in Claude Code to install the plugin.