Code Review Workflows
Forge can help you maintain high code quality through AI-assisted code reviews, identifying issues in readability, performance, security, and maintainability.Basic Code Review
Request a comprehensive review of any file or component:- Code structure and organization
- Potential bugs or edge cases
- Performance optimizations
- Security vulnerabilities
- Best practices and conventions
Structured Review Workflow
Receive analysis
Forge will analyze the code and provide categorized feedback with specific line references (e.g.,
src/auth/login.ts:67).Prioritize changes
Review the suggestions and decide which to implement. Ask Forge to clarify or elaborate on any feedback.
Review Categories
Security Review
Focus on security vulnerabilities and best practices:- Input validation and sanitization
- Authentication and authorization issues
- SQL injection or XSS vulnerabilities
- Exposed secrets or credentials
- Insecure cryptographic practices
Performance Review
Identify performance bottlenecks and optimization opportunities:- Algorithm complexity
- Unnecessary loops or operations
- Memory usage patterns
- Database query efficiency
- Caching opportunities
Maintainability Review
Ensure code is maintainable and follows best practices:- Code organization and structure
- Naming conventions
- Documentation completeness
- Error handling patterns
- Test coverage
Real-World Review Scenarios
Scenario 1: Pre-commit Review
Before committing changes, get a quick review:Scenario 2: Pull Request Review
Use Forge to review a branch before creating a pull request:- Compare the branch against main
- Identify potential issues across all modified files
- Suggest improvements to documentation and tests
- Help you create a comprehensive PR description
Scenario 3: Legacy Code Review
When working with existing code:- Identify outdated patterns
- Suggest modern alternatives
- Highlight security concerns from older code
- Propose incremental refactoring strategies
Review Checklists
General Code Review
- Code follows project conventions and style guide
- Functions and variables have clear, descriptive names
- Complex logic includes explanatory comments
- Error handling is comprehensive and appropriate
- No hardcoded values; uses configuration
- Code is DRY (Don’t Repeat Yourself)
Security-Focused Review
- All user inputs are validated and sanitized
- Authentication and authorization are properly implemented
- Sensitive data is encrypted at rest and in transit
- No secrets or credentials in code
- Rate limiting and DOS protection in place
- Dependencies are up-to-date and vulnerability-free
Performance-Focused Review
- Algorithms use appropriate complexity (O(n) vs O(n²))
- Database queries are optimized with proper indexes
- Caching is used where appropriate
- Large datasets are paginated or streamed
- Memory is managed efficiently (no leaks)
- Unnecessary operations are eliminated
Integration with Development Workflow
Review During Development
Get real-time feedback while coding:Review Before Merging
Ensure quality before merging to main:Advanced Review Techniques
Comparative Reviews
Compare different implementation approaches:Architectural Reviews
Review system design and architecture:- Service boundaries and responsibilities
- Communication patterns
- Data flow and consistency
- Scalability considerations
Convention Compliance
Ensure code follows project-specific conventions:Review Output Examples
Example: Security Issue Found
Example: Performance Improvement
Best Practices for Code Reviews
- Review early and often: Don’t wait until code is “perfect”
- Be specific in requests: Focus reviews on particular concerns when needed
- Learn from feedback: Understand why changes are suggested
- Iterate on feedback: Ask follow-up questions for clarity
- Automate where possible: Use
forge.yamlcustom rules for consistent standards - Document decisions: When you disagree with a suggestion, document why
Common Review Commands
| Task | Example Prompt |
|---|---|
| General review | Review src/components/Dashboard.tsx |
| Security focus | Check this API for security issues |
| Performance focus | How can I optimize this function? |
| Before commit | Review my uncommitted changes |
| Architecture | Review the structure of the auth module |
Next Steps
- Learn about Refactoring with Forge
- Explore Testing strategies
- Review Best Practices for development workflows