Agent skill
code-review
Provides structured code review guidelines for TypeScript projects. Use when reviewing pull requests, analyzing code quality, or suggesting improvements.
Install this agent skill to your Project
npx add-skill https://github.com/mastra-ai/mastra/tree/main/examples/unified-workspace/skills/code-review
SKILL.md
Code Review Guidelines
Overview
This skill provides structured guidelines for reviewing TypeScript code. Apply these standards when reviewing pull requests, analyzing code quality, or suggesting improvements.
Keywords: code review, pull request, PR review, TypeScript, code quality, best practices, refactoring
Review Checklist
1. Code Correctness
Before approving, verify:
- Logic is correct and handles edge cases
- Error handling is appropriate
- No obvious bugs or race conditions
- Tests cover the changes adequately
2. Code Quality
Check for:
- Clear, descriptive variable and function names
- Functions do one thing well (single responsibility)
- No excessive nesting (max 3 levels)
- DRY - no unnecessary duplication
- YAGNI - no speculative features
3. TypeScript Specific
Ensure:
- Proper type annotations (avoid
any) - Interfaces/types defined for complex objects
- Generics used appropriately
- Null/undefined handled safely
-
strictmode compatible
4. Performance
Look for:
- Unnecessary re-renders (React)
- Missing memoization for expensive operations
- Inefficient loops or data structures
- Memory leaks (event listeners, subscriptions)
Review Comments
Comment Format
Use this format for review comments:
[severity]: brief description
Why: explanation of the issue
Suggestion: how to fix it (with code if helpful)
Severity levels:
[critical]- Must fix before merge[suggestion]- Recommended improvement[nit]- Minor style preference[question]- Need clarification
Example Comments
Good comment:
[suggestion]: Consider extracting this validation logic
Why: This 15-line validation block is hard to test in isolation
Suggestion: Move to a `validateUserInput(data)` function
Bad comment:
This is wrong, fix it.
Common Issues
Anti-patterns to Flag
- God functions - Functions over 50 lines doing multiple things
- Prop drilling - Passing props through 3+ component levels
- Magic numbers - Unexplained literal values
- Catch-all error handling -
catch(e) { console.log(e) } - Implicit any - Missing type annotations on function parameters
Security Concerns
Always flag:
- SQL/NoSQL injection vulnerabilities
- XSS opportunities (unsanitized user input in DOM)
- Hardcoded secrets or API keys
- Insecure randomness for security contexts
- Missing input validation on API endpoints
Approval Guidelines
Approve When
- All critical issues resolved
- Tests pass
- Code meets team standards
- No security concerns
Request Changes When
- Critical bugs found
- Security vulnerabilities present
- Missing required tests
- Significant performance issues
Leave Comments When
- Minor improvements possible
- Design alternatives worth discussing
- Documentation could be clearer
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
performance-review
Performance-focused code review for identifying bottlenecks and optimization opportunities
security-review
Security-focused code review checklist for identifying vulnerabilities
code-standards
Code quality standards and style guide for reviewing pull requests
smoke-test
Create a Mastra project using create-mastra and smoke test the studio in Chrome
ralph-plan
Interactive planning assistant that helps create focused, well-structured ralph-loop commands through collaborative conversation
e2e-tests-studio
REQUIRED when modifying any file in packages/playground-ui or packages/playground. Triggers on: React component creation/modification/refactoring, UI changes, new playground features, bug fixes affecting studio UI. Generates Playwright E2E tests that validate PRODUCT BEHAVIOR, not just UI states.
Didn't find tool you were looking for?