Comprehensive checklist for conducting thorough code reviews covering functionality, security, performance, and maintainability
Add this skill
npx mdskills install sickn33/code-review-checklistComprehensive, actionable checklist with excellent examples for systematic code reviews
1---2name: code-review-checklist3description: "Comprehensive checklist for conducting thorough code reviews covering functionality, security, performance, and maintainability"4---56# Code Review Checklist78## Overview910Provide a systematic checklist for conducting thorough code reviews. This skill helps reviewers ensure code quality, catch bugs, identify security issues, and maintain consistency across the codebase.1112## When to Use This Skill1314- Use when reviewing pull requests15- Use when conducting code audits16- Use when establishing code review standards for a team17- Use when training new developers on code review practices18- Use when you want to ensure nothing is missed in reviews19- Use when creating code review documentation2021## How It Works2223### Step 1: Understand the Context2425Before reviewing code, I'll help you understand:26- What problem does this code solve?27- What are the requirements?28- What files were changed and why?29- Are there related issues or tickets?30- What's the testing strategy?3132### Step 2: Review Functionality3334Check if the code works correctly:35- Does it solve the stated problem?36- Are edge cases handled?37- Is error handling appropriate?38- Are there any logical errors?39- Does it match the requirements?4041### Step 3: Review Code Quality4243Assess code maintainability:44- Is the code readable and clear?45- Are names descriptive?46- Is it properly structured?47- Are functions/methods focused?48- Is there unnecessary complexity?4950### Step 4: Review Security5152Check for security issues:53- Are inputs validated?54- Is sensitive data protected?55- Are there SQL injection risks?56- Is authentication/authorization correct?57- Are dependencies secure?5859### Step 5: Review Performance6061Look for performance issues:62- Are there unnecessary loops?63- Is database access optimized?64- Are there memory leaks?65- Is caching used appropriately?66- Are there N+1 query problems?6768### Step 6: Review Tests6970Verify test coverage:71- Are there tests for new code?72- Do tests cover edge cases?73- Are tests meaningful?74- Do all tests pass?75- Is test coverage adequate?7677## Examples7879### Example 1: Functionality Review Checklist8081```markdown82## Functionality Review8384### Requirements85- [ ] Code solves the stated problem86- [ ] All acceptance criteria are met87- [ ] Edge cases are handled88- [ ] Error cases are handled89- [ ] User input is validated9091### Logic92- [ ] No logical errors or bugs93- [ ] Conditions are correct (no off-by-one errors)94- [ ] Loops terminate correctly95- [ ] Recursion has proper base cases96- [ ] State management is correct9798### Error Handling99- [ ] Errors are caught appropriately100- [ ] Error messages are clear and helpful101- [ ] Errors don't expose sensitive information102- [ ] Failed operations are rolled back103- [ ] Logging is appropriate104105### Example Issues to Catch:106107**❌ Bad - Missing validation:**108\`\`\`javascript109function createUser(email, password) {110 // No validation!111 return db.users.create({ email, password });112}113\`\`\`114115**✅ Good - Proper validation:**116\`\`\`javascript117function createUser(email, password) {118 if (!email || !isValidEmail(email)) {119 throw new Error('Invalid email address');120 }121 if (!password || password.length < 8) {122 throw new Error('Password must be at least 8 characters');123 }124 return db.users.create({ email, password });125}126\`\`\`127```128129### Example 2: Security Review Checklist130131```markdown132## Security Review133134### Input Validation135- [ ] All user inputs are validated136- [ ] SQL injection is prevented (use parameterized queries)137- [ ] XSS is prevented (escape output)138- [ ] CSRF protection is in place139- [ ] File uploads are validated (type, size, content)140141### Authentication & Authorization142- [ ] Authentication is required where needed143- [ ] Authorization checks are present144- [ ] Passwords are hashed (never stored plain text)145- [ ] Sessions are managed securely146- [ ] Tokens expire appropriately147148### Data Protection149- [ ] Sensitive data is encrypted150- [ ] API keys are not hardcoded151- [ ] Environment variables are used for secrets152- [ ] Personal data follows privacy regulations153- [ ] Database credentials are secure154155### Dependencies156- [ ] No known vulnerable dependencies157- [ ] Dependencies are up to date158- [ ] Unnecessary dependencies are removed159- [ ] Dependency versions are pinned160161### Example Issues to Catch:162163**❌ Bad - SQL injection risk:**164\`\`\`javascript165const query = \`SELECT * FROM users WHERE email = '\${email}'\`;166db.query(query);167\`\`\`168169**✅ Good - Parameterized query:**170\`\`\`javascript171const query = 'SELECT * FROM users WHERE email = $1';172db.query(query, [email]);173\`\`\`174175**❌ Bad - Hardcoded secret:**176\`\`\`javascript177const API_KEY = 'sk_live_abc123xyz';178\`\`\`179180**✅ Good - Environment variable:**181\`\`\`javascript182const API_KEY = process.env.API_KEY;183if (!API_KEY) {184 throw new Error('API_KEY environment variable is required');185}186\`\`\`187```188189### Example 3: Code Quality Review Checklist190191```markdown192## Code Quality Review193194### Readability195- [ ] Code is easy to understand196- [ ] Variable names are descriptive197- [ ] Function names explain what they do198- [ ] Complex logic has comments199- [ ] Magic numbers are replaced with constants200201### Structure202- [ ] Functions are small and focused203- [ ] Code follows DRY principle (Don't Repeat Yourself)204- [ ] Proper separation of concerns205- [ ] Consistent code style206- [ ] No dead code or commented-out code207208### Maintainability209- [ ] Code is modular and reusable210- [ ] Dependencies are minimal211- [ ] Changes are backwards compatible212- [ ] Breaking changes are documented213- [ ] Technical debt is noted214215### Example Issues to Catch:216217**❌ Bad - Unclear naming:**218\`\`\`javascript219function calc(a, b, c) {220 return a * b + c;221}222\`\`\`223224**✅ Good - Descriptive naming:**225\`\`\`javascript226function calculateTotalPrice(quantity, unitPrice, tax) {227 return quantity * unitPrice + tax;228}229\`\`\`230231**❌ Bad - Function doing too much:**232\`\`\`javascript233function processOrder(order) {234 // Validate order235 if (!order.items) throw new Error('No items');236237 // Calculate total238 let total = 0;239 for (let item of order.items) {240 total += item.price * item.quantity;241 }242243 // Apply discount244 if (order.coupon) {245 total *= 0.9;246 }247248 // Process payment249 const payment = stripe.charge(total);250251 // Send email252 sendEmail(order.email, 'Order confirmed');253254 // Update inventory255 updateInventory(order.items);256257 return { orderId: order.id, total };258}259\`\`\`260261**✅ Good - Separated concerns:**262\`\`\`javascript263function processOrder(order) {264 validateOrder(order);265 const total = calculateOrderTotal(order);266 const payment = processPayment(total);267 sendOrderConfirmation(order.email);268 updateInventory(order.items);269270 return { orderId: order.id, total };271}272\`\`\`273```274275## Best Practices276277### ✅ Do This278279- **Review Small Changes** - Smaller PRs are easier to review thoroughly280- **Check Tests First** - Verify tests pass and cover new code281- **Run the Code** - Test it locally when possible282- **Ask Questions** - Don't assume, ask for clarification283- **Be Constructive** - Suggest improvements, don't just criticize284- **Focus on Important Issues** - Don't nitpick minor style issues285- **Use Automated Tools** - Linters, formatters, security scanners286- **Review Documentation** - Check if docs are updated287- **Consider Performance** - Think about scale and efficiency288- **Check for Regressions** - Ensure existing functionality still works289290### ❌ Don't Do This291292- **Don't Approve Without Reading** - Actually review the code293- **Don't Be Vague** - Provide specific feedback with examples294- **Don't Ignore Security** - Security issues are critical295- **Don't Skip Tests** - Untested code will cause problems296- **Don't Be Rude** - Be respectful and professional297- **Don't Rubber Stamp** - Every review should add value298- **Don't Review When Tired** - You'll miss important issues299- **Don't Forget Context** - Understand the bigger picture300301## Complete Review Checklist302303### Pre-Review304- [ ] Read the PR description and linked issues305- [ ] Understand what problem is being solved306- [ ] Check if tests pass in CI/CD307- [ ] Pull the branch and run it locally308309### Functionality310- [ ] Code solves the stated problem311- [ ] Edge cases are handled312- [ ] Error handling is appropriate313- [ ] User input is validated314- [ ] No logical errors315316### Security317- [ ] No SQL injection vulnerabilities318- [ ] No XSS vulnerabilities319- [ ] Authentication/authorization is correct320- [ ] Sensitive data is protected321- [ ] No hardcoded secrets322323### Performance324- [ ] No unnecessary database queries325- [ ] No N+1 query problems326- [ ] Efficient algorithms used327- [ ] No memory leaks328- [ ] Caching used appropriately329330### Code Quality331- [ ] Code is readable and clear332- [ ] Names are descriptive333- [ ] Functions are focused and small334- [ ] No code duplication335- [ ] Follows project conventions336337### Tests338- [ ] New code has tests339- [ ] Tests cover edge cases340- [ ] Tests are meaningful341- [ ] All tests pass342- [ ] Test coverage is adequate343344### Documentation345- [ ] Code comments explain why, not what346- [ ] API documentation is updated347- [ ] README is updated if needed348- [ ] Breaking changes are documented349- [ ] Migration guide provided if needed350351### Git352- [ ] Commit messages are clear353- [ ] No merge conflicts354- [ ] Branch is up to date with main355- [ ] No unnecessary files committed356- [ ] .gitignore is properly configured357358## Common Pitfalls359360### Problem: Missing Edge Cases361**Symptoms:** Code works for happy path but fails on edge cases362**Solution:** Ask "What if...?" questions363- What if the input is null?364- What if the array is empty?365- What if the user is not authenticated?366- What if the network request fails?367368### Problem: Security Vulnerabilities369**Symptoms:** Code exposes security risks370**Solution:** Use security checklist371- Run security scanners (npm audit, Snyk)372- Check OWASP Top 10373- Validate all inputs374- Use parameterized queries375- Never trust user input376377### Problem: Poor Test Coverage378**Symptoms:** New code has no tests or inadequate tests379**Solution:** Require tests for all new code380- Unit tests for functions381- Integration tests for features382- Edge case tests383- Error case tests384385### Problem: Unclear Code386**Symptoms:** Reviewer can't understand what code does387**Solution:** Request improvements388- Better variable names389- Explanatory comments390- Smaller functions391- Clear structure392393## Review Comment Templates394395### Requesting Changes396```markdown397**Issue:** [Describe the problem]398399**Current code:**400\`\`\`javascript401// Show problematic code402\`\`\`403404**Suggested fix:**405\`\`\`javascript406// Show improved code407\`\`\`408409**Why:** [Explain why this is better]410```411412### Asking Questions413```markdown414**Question:** [Your question]415416**Context:** [Why you're asking]417418**Suggestion:** [If you have one]419```420421### Praising Good Code422```markdown423**Nice!** [What you liked]424425This is great because [explain why]426```427428## Related Skills429430- `@requesting-code-review` - Prepare code for review431- `@receiving-code-review` - Handle review feedback432- `@systematic-debugging` - Debug issues found in review433- `@test-driven-development` - Ensure code has tests434435## Additional Resources436437- [Google Code Review Guidelines](https://google.github.io/eng-practices/review/)438- [OWASP Top 10](https://owasp.org/www-project-top-ten/)439- [Code Review Best Practices](https://github.com/thoughtbot/guides/tree/main/code-review)440- [How to Review Code](https://www.kevinlondon.com/2015/05/05/code-review-best-practices.html)441442---443444**Pro Tip:** Use a checklist template for every review to ensure consistency and thoroughness. Customize it for your team's specific needs!445
Full transparency — inspect the skill content before installing.