brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
code-reviewUse this skill when the user says 'review this code', 'code review', 'review PR', 'check this implementation', 'is this code good', 'LGTM?', 'feedback on code', or wants a structured code review. Covers: correctness, architecture, clarity, performance, security, and test quality. Produces a structured review with severity levels: MUST, SHOULD, CONSIDER. Wor…
Independent GitHub snapshot · Automated classification · Original documentation governs
Version: 1.1.0 Author: j4flmao License: MIT
Provide systematic, structured code reviews covering correctness, architecture, clarity, performance, security, and tests. Every finding is actionable, prioritized by severity, and anchored to a specific file and line.
Exact user phrases: "review this code", "code review", "review PR", "check this implementation", "is this code good", "LGTM?", "feedback on code".
Before activating, verify:
No file output. This skill produces structured review text.
Answer exactly:
## Code Review: {file/scope}
### [MUST] {short title}
- **File**: `src/path/file.ts:42`
- **Issue**: {what's wrong}
- **Why**: {impact}
- **Fix**: {suggested approach}
### [SHOULD] {short title}
...
### [CONSIDER] {short title}
...
### Positive
- {what's done well}
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output -- why use many token when few do trick. No explanations of what code review is.
This skill is complete when:
100 lines or as many as needed to cover all findings in one pass.
Is the finding a correctness bug (wrong behavior)?
|-- YES --> [MUST] Blocks merge. Can cause production incidents.
|-- NO --> Is it a security vulnerability?
|-- YES --> [MUST] Immediate fix required.
|-- NO --> Is it a performance regression (measurable)?
|-- YES --> Is it likely to affect users in production?
| |-- YES --> [SHOULD] Fix before next release.
| |-- NO --> [CONSIDER] Monitor and fix if needed.
|-- NO --> Is it an architecture or maintainability concern?
|-- YES --> Does it violate established patterns?
| |-- YES --> [SHOULD] Follow project conventions.
| |-- NO --> [CONSIDER] Improvement suggestion.
|-- NO --> Is it a clarity or naming issue?
|-- YES --> Does it block understanding for reviewers?
| |-- YES --> [SHOULD] Rename or clarify.
| |-- NO --> [CONSIDER] Minor improvement.
|-- NO --> Is it a test quality issue?
|-- YES --> Are tests missing for critical paths?
| |-- YES --> [SHOULD] Add critical tests.
| |-- NO --> [CONSIDER] Expand test coverage.
What is the scope of the change?
|-- < 50 lines diff --> Full review (all 6 dimensions).
|-- 50-200 lines --> Full review. Read every line.
|-- 200-400 lines --> Full review. Focus on changed logic files over config/tests.
|-- > 400 lines --> Review critical path diff. Flag: "Diff exceeds 400 lines. Focused on core logic changes."
| |-- Skip: formatting, comments, whitespace-only diffs.
| |-- Flag: large diffs that should be split into multiple PRs.
Is this a new feature or a bug fix?
|-- New feature --> Heavy on architecture + correctness + test quality.
|-- Bug fix --> Heavy on correctness + root cause analysis + regression tests.
|-- Refactor --> Heavy on architecture + performance (verify no regression).
|-- Dependency update --> Heavy on security + compatibility + changelog diff.
Does the code touch a critical path (auth, payments, data layer)?
|-- YES --> Security + correctness = highest priority. MUST findings here are blockers.
|-- NO --> Standard review weighting.
| Aspect | Static Typed (TS, Rust, Java) | Dynamic (Python, JS, Ruby) |
|---|---|---|
| Type errors | Caught at compile time | Runtime risk. MUST review type contracts |
| Null safety | Compiler-enforced (strict mode) | Manual checks required. SHOULD validate all external inputs |
| Refactoring safety | Compiler-guided. SAFE | Manual. RISK of silent breakage |
| Performance optimization | Compiler handles many cases | Runtime profile required. SHOULD review hot paths |
| Testing depth | Integration + types tested | Unit + integration required for coverage |
| Documentation | Types are partial docs | Docstrings required for public APIs |
Pass 1: Scan -- Read diff structure. Identify affected files and changed modules.
Identify critical path files. Note files to skip (generated, config, formatting).
Pass 2: Correctness -- Read each changed file in the context of the full function.
Verify logic, edge cases, error handling, data flow.
Pass 3: Architecture -- Check patterns, layer violations, dependency direction.
Does this code belong where it is placed?
Pass 4: Security + Performance + Clarity -- Combine these in a single pass.
Input validation, auth checks, N+1 queries, naming, magic numbers.
Pass 5: Tests -- Review test coverage, assertions, edge cases.
Do tests validate the change? Are they testing behavior, not implementation?
Pass 6: Positive observations -- Find at least one thing done well per 3 findings.
This is not optional. Code reviews should not be purely negative.
Correctness checklist:
ErrorArchitecture checklist:
Clarity checklist:
users not userList, index not i except in trivial loops)createUser(isAdmin=true) not createUser(true))Performance checklist:
import *):nth-child chains, universal selectors on large lists)Security checklist:
Test checklist:
Flagging formatting, naming, or style preferences as [MUST] when no project convention exists. Style is not correctness. Use [CONSIDER] for style unless it violates an established standard.
Fix: Before reviewing, check if the project has a style guide, linter config, or formatter. If it does, reference it. If not, style is [CONSIDER] at most.
Reviewing a function without understanding how it is called or what data it processes. A function that is correct in isolation may be wrong in context.
Fix: Read calling code and test files before the implementation. Understand the data flow before evaluating the code.
Suggesting abstractions, patterns, or refactors that are disproportionate to the change. A 5-line bug fix should not trigger a [MUST] to "extract a strategy pattern."
Fix: Proportionate feedback. A 10-line change gets 1-2 findings. A 200-line feature gets 5-10 findings. Match the review depth to the change size.
Listing 15 issues and 0 positives. This demoralizes the author and trains them to ignore feedback.
Fix: Every review must include positive observations. Find something the author did well, even if it is "good test coverage" or "clear variable naming."
Raising issues that are technically correct but practically irrelevant: unused import in a test file, white-space inconsistency, variable name preference.
Fix: Ask: "If the author ignores this finding, will the code break or cause maintenance burden?" If no, it is not worth raising. Use [CONSIDER] sparingly for genuinely helpful suggestions, not perfectionism.
Reviewing only production code and ignoring the test file. Tests are the only way to verify correctness; ignoring them means the review is incomplete.
Fix: Never mark a review complete without reviewing the test file. If there are no tests, that is a [MUST] finding.
Multiple approaches can be correct. If the code is correct, performant, and maintainable, do not flag it for not matching your preferred pattern.
Fix: Before raising an architecture finding, ask: "Is the current approach incorrect, or just different from how I would do it?" Only raise if it is genuinely wrong.
Looking at a changed function in isolation without seeing what changed from the previous version. The diff shows intent; the full file shows context. Both are needed.
Fix: Start with the diff to understand what changed. Then read the full file for the changed functions to understand context.
Labeling similar issues with different severity in the same review. This confuses the author and undermines the severity system.
Fix: Be consistent. Define severity before reviewing: "Is this a logic bug? MUST. Is this a naming preference? CONSIDER." Apply uniformly.
Writing long code snippets in review comments instead of pointing to the problem. The reviewer's job is to find issues, not to write the fix.
Fix: Describe the approach in 1-2 sentences. Only include code if the fix is non-obvious. For obvious fixes, just state the problem and suggested approach.
| Approach | Focus | Format | Best For |
|---|---|---|---|
| Code Review (this skill) | All 6 dimensions: correctness, architecture, clarity, performance, security, tests | Structured [MUST]/[SHOULD]/[CONSIDER] | General purpose, pre-merge |
| Security Review | Vulnerability assessment | CWE classification, exploitability scoring | Security-critical code, compliance audits |
| Architecture Review | System design, layer boundaries, coupling | ADR, architecture diagram | Major features, new modules, system design |
| Performance Review | Runtime profiling, bundle analysis, query optimization | Flame graph, bundle report | Performance-critical features, regression investigation |
| Pair Programming | Real-time feedback, shared ownership | Continuous conversation | Complex features, knowledge transfer |
| Automated Linting | Style, formatting, simple correctness | Linter output, CI integration | Every PR (supplementary, not replacement) |
| Formal Verification | Mathematical proof of correctness | Proof artifacts | Safety-critical systems (medical, aerospace) |
This review skill is the broadest, covering all dimensions in a single pass. It is the default starting point for any code review request.
Time budget per line: 30-60 seconds per changed line for critical code, 10-20 seconds for config/tests. Aim for 200-400 lines per hour maximum. Beyond this, review quality drops.
Review fatigue: After 60 minutes of continuous review, finding accuracy drops by 40%. Take breaks. Split large reviews across sessions.
Priority allocation: Spend 60% of review time on correctness + security (highest risk), 25% on architecture + tests, 15% on clarity + performance. This weighting ensures the most impactful issues are caught.
Automated checks that should pass before human review starts:
# Pre-review CI checks
- Lint: passes project linting rules
- Type check: no type errors (strict mode where applicable)
- Test: all existing tests pass
- Format: matches project formatter
- Security scan: no known vulnerabilities in new dependencies
- Bundle size: within threshold (if applicable)
If any automated check fails, the author should fix it before requesting review. Do not waste reviewer time on issues automation can catch.
When a PR exceeds 400 lines:
# GitHub Actions: Automated review gate
name: code-review-gate
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test -- --coverage
- name: Check coverage threshold
run: |
$coverage = (Get-Content coverage/coverage-summary.json | ConvertFrom-Json).total.lines.pct
if ($coverage -lt 80) { throw "Coverage below 80%" }
- name: Check for secrets
run: npx secretlint "**/*"
// .github/CODEOWNERS
# Default reviewer
* @team/engineering
# Critical paths require senior review
src/auth/** @team/security-reviewers
src/payments/** @team/senior-engineers
src/db/migrations/** @team/db-admin
# Documentation
docs/** @team/tech-writers
## Code Review: {file/scope}
### [MUST] {short title}
- **File**: `src/path/file.ts:42`
- **Issue**: {what's wrong}
- **Why**: {impact of the issue}
- **Fix**: {suggested approach}
### [SHOULD] {short title}
...
### [CONSIDER] {short title}
...
### Positive
- {what's done well}
references/code-review-advanced.md -- Code Review Advanced Topicsreferences/code-review-fundamentals.md -- Code Review Fundamentalsreferences/review-checklist.md -- Code Review Checklistreferences/review-workflow.md -- Code Review Workflowreferences/security-review-checklist.md -- Security Review Checklistreferences/security-review-guide.md -- Security Review Guidereferences/code-review-checklist.md -- Comprehensive Code Review Checklistreferences/code-review-workflow-automation.md -- Code Review Workflow and AutomationAfter completing this skill:
Compression footer: code-review/v1.1 | sections: protocol, architecture, workflow, rules, pitfalls, comparisons, performance, ecosystem.