Code review

From vinnie357/claude-skills · View interactive version

Code review is an AI agent skill from the GitHub repository vinnie357/claude-skills. Guide for conducting code reviews. Use when reviewing pull requests, auditing code quality, identifying security issues, or providing code feedback.

How to use this skill

Skill file

Code Review Best Practices

This skill activates when reviewing code for quality, correctness, security, and maintainability.

Anti-fabrication

This skill follows core:anti-fabrication, but has little to verify against an external

source: the checklist and etiquette content is house convention (Google's review guide,

cited in sources.md, for the checklist's shape), and "Language-Specific

Considerations" is broad, stable idiom rather than versioned API claims. Don't assert a

language-specific rule this skill doesn't cover without checking that language's own

style skill first.

Code Review Checklist

1. Correctness and Functionality

Does the code do what it's supposed to do?

Questions to ask:

2. Security

Is the code secure?

Worked BAD/GOOD examples (SQL injection, XSS, hardcoded secrets, mass assignment): references/checklist-examples.md.

3. Performance

Is the code efficient?

Worked BAD/GOOD examples (N+1 queries, loading full datasets, list vs set lookups): references/checklist-examples.md.

4. Code Quality and Maintainability

Is the code readable and maintainable?

Worked BAD/GOOD examples (unclear names, multi-responsibility functions, magic numbers): references/checklist-examples.md.

5. Error Handling

Are errors handled properly?

Worked BAD/GOOD examples (swallowed errors, generic error messages, bang functions that crash): references/checklist-examples.md.

6. Testing

Is the code properly tested?

Worked BAD/GOOD examples (unclear test names, over-broad tests, non-deterministic sleeps): references/checklist-examples.md.

7. Documentation

Is the code documented?

8. Dependencies

Are dependencies handled properly?

9. Restraint and Scope

Does every new symbol earn its place in the diff?

For each NEW symbol introduced by the diff (function, class, config, dependency), check it against the restraint ladder before approving:

Flag speculative abstractions (interfaces with one implementation, config for values that never change, factories for one product) and unrequested features as findings, not nits. See /core:restraint.

Review Process

Before Reviewing

  1. Understand the context
  1. Get execution evidence

During Review

  1. Start with the big picture
  1. Review for correctness
  1. Check security and performance
  1. Review code quality

Providing Feedback

Agent reviewers report findings per /extras-claude-code:claude-output-styles assets/review-findings-format.md.

Be constructive and specific:

# BAD: Vague criticism
"This function is bad."

# GOOD: Specific, actionable feedback
"This function has three responsibilities: validation, database update, and email sending. Consider splitting it into separate functions for better testability and maintainability:

def update_user(user, attrs) do

with {:ok, changeset} <- validate_user_update(user, attrs),

{:ok, user} <- save_user(changeset),

:ok <- send_update_notification(user) do

{:ok, user}

end

end


# BAD: Demanding
"You must change this."

# GOOD: Collaborative
"What do you think about extracting this into a separate function? It would make the code easier to test."

# BAD: Nitpicking without context
"Use single quotes instead of double quotes."

# GOOD: Explain reasoning
"Our style guide prefers single quotes for consistency (see CONTRIBUTING.md section 3.2)."

Use labels to categorize feedback:

Example (SQL-injection-shaped BAD/GOOD code for a [blocking] label: references/checklist-examples.md):

[blocking] This creates a SQL injection vulnerability. Use parameterized queries.

[suggestion] Consider extracting this logic into a separate function for reusability.

[question] Why are we using a map here instead of a struct?

[nit] Extra blank line here.

After Review

  1. Respond to author's questions
  2. Re-review after changes
  3. Approve when satisfied
  4. Celebrate good code

Key Principles

<!-- vale Flavored.Superlatives = NO -->

<!-- vale Flavored.Superlatives = YES -->

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.