My personal OpenCode global configuration with custom agents and commands for enhanced development workflow.
- Automatic Branch Management: OpenCode automatically creates feature branches for development work
- Enhanced Review System: Multi-agent code review with security, performance, and architecture analysis
- Comprehensive Analysis: Full codebase analysis with documentation generation and issue reporting
- Fact-Checking & Validation: Prevents misinformation by verifying technical claims before making assertions
- Review Agents:
- Security Agent - Deep security vulnerability analysis
- Performance Agent - Performance bottleneck identification
- Codebase Analyzer - Comprehensive project analysis and documentation
- Review Agent - General code review focusing on correctness and maintainability
- Testing Skills (Implementing "Testing with AI" Article):
- Adversarial Testing - Edge case generation that finds scenarios developers miss
- Coverage-Driven Testing - Precision testing targeting specific uncovered lines
- Mock Generation - Jest/Go mocks with deep mockr integration for HTTP-level API mocking
- Integration Testing - Complete test scaffolding with database setup and environment configuration
- Test-Driven Development - Test-first workflow with AI-generated specifications
- Review Skills:
- Security Review - Security-focused analysis with threat modeling
- Review Preparation - Comprehensive review prep and checklist generation
- Enhanced File Review - Multi-agent coordinated file analysis
- Custom Commands:
/start-work- Begin development with automatic branch creation/security-scan- Quick security vulnerability scan/analyze-project- Comprehensive project analysis/verify-environment- Validate installed software and prevent version misinformation/check-file- Review specific files for issues/pr-summary- Generate PR descriptions from branch diff/review-changes- Analyze recent git changes
-
Clone this repository to your OpenCode config directory:
git clone https://github.com/ridakaddir/opencode.config.git ~/.config/opencode -
Copy the example configuration:
cp opencode.example.json opencode.json
-
Set your Context7 API key:
export CONTEXT7_API_KEY="your-api-key-here"
Or add it to your shell profile for persistence:
echo 'export CONTEXT7_API_KEY="your-api-key-here"' >> ~/.zshrc
-
Install dependencies:
npm install
CONTEXT7_API_KEY: Your Context7 API key for enhanced documentation access
- Read-only code review agent
- Focuses on logic errors, security issues, and architectural violations
- Temperature: 0.1 for consistency
- Permissions: Read-only with limited git commands allowed
Begin development work with automatic branch creation and management.
Features:
- Automatically detects if you're on main/master branch
- Suggests appropriate branch names based on work type
- Provides clear opt-out options for working on current branch
- Handles dirty working tree scenarios
Usage:
/start-work
# Follow the prompts to describe your work
# Example: "user authentication" → feature/20260322-user-authenticationBranch Types:
feature/- New functionality, testing, developmentfix/- Bug fixes and patchesreview/- Code review and analysis workpoc/- Proof of concept and experimentsdocs/- Documentation updatesrefactor/- Code restructuring
Opt-out Options:
- Type "current" to continue on current branch
- Type "main" to work directly on main (not recommended)
- Use
--no-branchflag to skip branch creation
Quick security vulnerability scan with immediate feedback.
Features:
- Scans for hardcoded secrets and credentials
- Detects common XSS and SQL injection patterns
- Checks for insecure dependencies
- Reviews environment configuration
- Provides quick remediation guidance
Usage:
/security-scan
/security-scan src/auth/Comprehensive project analysis with documentation generation.
Features:
- Complete architecture analysis
- Quality assessment with detailed findings
- Documentation generation (ARCHITECTURE.md, SETUP.md, etc.)
- Prioritized improvement roadmap
- Integration with security and performance agents
Analysis Depths:
- Quick (5-10 min) - Overview and critical issues
- Standard (20-30 min) - Complete analysis with documentation
- Deep (45-60 min) - Exhaustive review with refactoring roadmap
Review a specific file for issues and improvements.
Example:
/check-file src/components/UserAuth.tsxGenerate a comprehensive PR description from the current branch diff.
Features:
- Analyzes commits from main branch
- Creates structured PR description
- Includes testing notes and breaking changes
Analyze recent commits and flag potential issues before opening a PR.
Features:
- Reviews last 15 commits
- Provides diff summary
- Suggests verification steps
Once configured, these agents and commands are available globally in OpenCode:
# Start development work (recommended first step)
/start-work
# Quick security scan
/security-scan
# Comprehensive project analysis
/analyze-project
# Testing Skills (Implementing your testing article)
!skill testing-adversarial "validatePaymentAmount function --security --performance"
!skill testing-coverage "--file src/service.ts --lines 45-52,78-84"
!skill testing-mocks "UserRepository, EmailService --include-mockr"
!skill testing-integration "user authentication flow --include-mockr"
!skill testing-tdd "rate limiter for API endpoints"
# Enhanced file review with multi-agent analysis
!skill review-file-enhanced "src/auth/login.ts"
# Security-focused review with threat modeling
!skill review-security "src/api/users.go --focus authorization"
# Review preparation with automated checklists
!skill review-preparation "current branch --comprehensive"
# Review a specific file
/check-file src/components/UserAuth.tsx
# Generate PR description
/pr-summary
# Review recent changes
/review-changes# 1. Begin development with branch management
/start-work
# → Detects you're on main, suggests: feature/20260322-user-auth
# 2. Continue with development
# OpenCode will automatically use the new branch for all work
# 3. When ready, create PR
/pr-summary# Skip branch creation when needed
/start-work
# → Choose "current" when prompted
# → Or work on existing feature branch# 1. Test-Driven Development - Start with tests
!skill testing-tdd "user authentication with JWT and role permissions"
# → Generates comprehensive test specification before implementation
# 2. Adversarial Testing - Find edge cases developers miss
!skill testing-adversarial "loginUser function --security --performance"
# → Generates 20+ edge cases including injection attempts, race conditions
# 3. Coverage-Driven Testing - Target specific gaps
!skill testing-coverage "--file src/auth.ts --lines 67-89"
# → Generates tests for exact uncovered lines from coverage report
# 4. Mock Generation with Mockr Integration
!skill testing-mocks "AuthService, EmailService --include-mockr"
# → Generates Jest mocks AND mockr HTTP-level configurations
# 5. Complete Integration Testing
!skill testing-integration "authentication flow --include-mockr"
# → Full integration test setup with database and external service mocking# 1. Prepare comprehensive review
!skill review-preparation "feature/user-auth"
# → Generates review checklist and impact analysis
# 2. Security-focused analysis
!skill review-security "src/auth/ --comprehensive"
# → Deep security vulnerability assessment
# 3. Multi-agent file review
!skill review-file-enhanced "src/auth/jwt.ts --all-agents"
# → Security + Performance + Architecture analysis
# 4. Full project analysis
/analyze-project
# → Complete codebase documentation and improvement roadmap
# 5. Quick security scan
/security-scan
# → Rapid vulnerability detection├── agents/
│ └── review.md # Code review agent configuration
├── commands/
│ ├── check-file.md # File review command
│ ├── pr-summary.md # PR description generator
│ ├── review-changes.md # Change analysis command
│ └── start-work.md # Branch management command
├── prompts/
│ └── build-with-auto-branch.txt # Build agent prompt for branch automation
├── opencode.example.json # Configuration template
├── package.json # Dependencies
└── README.md # This file
This configuration includes automatic git branch management:
- Build Agent: Automatically checks branch status before development work
- Smart Detection: Identifies when you're on main/master and suggests branching
- Opt-out Support: Always provides options to continue on current branch
- Consistent Naming: Uses date-based naming for clear organization
feature/YYYYMMDD-description # New features and development
fix/YYYYMMDD-description # Bug fixes
review/YYYYMMDD-description # Code review work
poc/YYYYMMDD-description # Proof of concepts
docs/YYYYMMDD-description # Documentation updates
refactor/YYYYMMDD-description # Code restructuringThe automatic branching is configured through:
- Enhanced
opencode.jsonwith git branch permissions - Custom build agent prompt in
prompts/build-with-auto-branch.txt /start-workcommand for explicit branch management
- Node.js >= 16.0.0
- OpenCode AI
- Context7 API key (optional, for enhanced documentation)
MIT