$npx -y skills add anthropics/knowledge-work-plugins --skill code-reviewReview code changes for security, performance, and correctness. Trigger with a PR URL or diff, "review this before I merge", "is this code safe?", or when checking a change for N+1 queries, injection risks, missing edge cases, or error handling gaps.
| 1 | # /code-review |
| 2 | |
| 3 | > If you see unfamiliar placeholders or need to check which tools are connected, see [CONNECTORS.md](../../CONNECTORS.md). |
| 4 | |
| 5 | Review code changes with a structured lens on security, performance, correctness, and maintainability. |
| 6 | |
| 7 | ## Usage |
| 8 | |
| 9 | ``` |
| 10 | /code-review <PR URL or file path> |
| 11 | ``` |
| 12 | |
| 13 | Review the provided code changes: @$1 |
| 14 | |
| 15 | If no specific file or URL is provided, ask what to review. |
| 16 | |
| 17 | ## How It Works |
| 18 | |
| 19 | ``` |
| 20 | ┌─────────────────────────────────────────────────────────────────┐ |
| 21 | │ CODE REVIEW │ |
| 22 | ├─────────────────────────────────────────────────────────────────┤ |
| 23 | │ STANDALONE (always works) │ |
| 24 | │ ✓ Paste a diff, PR URL, or point to files │ |
| 25 | │ ✓ Security audit (OWASP top 10, injection, auth) │ |
| 26 | │ ✓ Performance review (N+1, memory leaks, complexity) │ |
| 27 | │ ✓ Correctness (edge cases, error handling, race conditions) │ |
| 28 | │ ✓ Style (naming, structure, readability) │ |
| 29 | │ ✓ Actionable suggestions with code examples │ |
| 30 | ├─────────────────────────────────────────────────────────────────┤ |
| 31 | │ SUPERCHARGED (when you connect your tools) │ |
| 32 | │ + Source control: Pull PR diff automatically │ |
| 33 | │ + Project tracker: Link findings to tickets │ |
| 34 | │ + Knowledge base: Check against team coding standards │ |
| 35 | └─────────────────────────────────────────────────────────────────┘ |
| 36 | ``` |
| 37 | |
| 38 | ## Review Dimensions |
| 39 | |
| 40 | ### Security |
| 41 | - SQL injection, XSS, CSRF |
| 42 | - Authentication and authorization flaws |
| 43 | - Secrets or credentials in code |
| 44 | - Insecure deserialization |
| 45 | - Path traversal |
| 46 | - SSRF |
| 47 | |
| 48 | ### Performance |
| 49 | - N+1 queries |
| 50 | - Unnecessary memory allocations |
| 51 | - Algorithmic complexity (O(n²) in hot paths) |
| 52 | - Missing database indexes |
| 53 | - Unbounded queries or loops |
| 54 | - Resource leaks |
| 55 | |
| 56 | ### Correctness |
| 57 | - Edge cases (empty input, null, overflow) |
| 58 | - Race conditions and concurrency issues |
| 59 | - Error handling and propagation |
| 60 | - Off-by-one errors |
| 61 | - Type safety |
| 62 | |
| 63 | ### Maintainability |
| 64 | - Naming clarity |
| 65 | - Single responsibility |
| 66 | - Duplication |
| 67 | - Test coverage |
| 68 | - Documentation for non-obvious logic |
| 69 | |
| 70 | ## Output |
| 71 | |
| 72 | ```markdown |
| 73 | ## Code Review: [PR title or file] |
| 74 | |
| 75 | ### Summary |
| 76 | [1-2 sentence overview of the changes and overall quality] |
| 77 | |
| 78 | ### Critical Issues |
| 79 | | # | File | Line | Issue | Severity | |
| 80 | |---|------|------|-------|----------| |
| 81 | | 1 | [file] | [line] | [description] | 🔴 Critical | |
| 82 | |
| 83 | ### Suggestions |
| 84 | | # | File | Line | Suggestion | Category | |
| 85 | |---|------|------|------------|----------| |
| 86 | | 1 | [file] | [line] | [description] | Performance | |
| 87 | |
| 88 | ### What Looks Good |
| 89 | - [Positive observations] |
| 90 | |
| 91 | ### Verdict |
| 92 | [Approve / Request Changes / Needs Discussion] |
| 93 | ``` |
| 94 | |
| 95 | ## If Connectors Available |
| 96 | |
| 97 | If **~~source control** is connected: |
| 98 | - Pull the PR diff automatically from the URL |
| 99 | - Check CI status and test results |
| 100 | |
| 101 | If **~~project tracker** is connected: |
| 102 | - Link findings to related tickets |
| 103 | - Verify the PR addresses the stated requirements |
| 104 | |
| 105 | If **~~knowledge base** is connected: |
| 106 | - Check changes against team coding standards and style guides |
| 107 | |
| 108 | ## Tips |
| 109 | |
| 110 | 1. **Provide context** — "This is a hot path" or "This handles PII" helps me focus. |
| 111 | 2. **Specify concerns** — "Focus on security" narrows the review. |
| 112 | 3. **Include tests** — I'll check test coverage and quality too. |