code-review
Code Review Methodology
Run a systematic pre-PR review for template-ts codebases. Identify critical risks first, then report major and minor issues with concrete fixes.
Review Process
- Identify scope — Determine exactly what to review.
- Scan changes — Analyze against template-ts review categories.
- Verify uncertain patterns — Use external lookup only when uncertainty remains.
- Categorize findings — Classify as Critical, Major, or Minor.
- Generate report — Produce an actionable review summary.
- Run automated checks — Run repository-standard quality gates.
Step 1: Identify Scope
Determine scope in this order:
- Use explicit user scope first. Review the exact files, PR, commits, or branch comparison provided by the user.
- Infer recent commits by default when scope is missing. Use
git log -5 --onelineandgit diff HEAD~5..HEAD --statwhen no scope was given and repository context is available. - Ask one precise scope question only when needed. Ask only when repository state is unavailable or multiple plausible scopes exist and inference would be unreliable.
Step 2: Apply Template-ts Review Categories
Use the full category checklist and examples in references/review-pattern-catalog.md.
Apply these category groups:
- TRPC patterns
- TanStack Router and Query patterns
- Code deduplication (DRY)
- Code quality and style conventions
- Security
- Performance
- Testing
- Effect patterns (when Effect code is in scope)
Load related skills when deeper specialization is required:
trpc-patternstanstack-frontendeffect-tsscan-effect-solutions(for deep Effect audits)
Step 3: Verify Uncertain Patterns
Use lookup tools only when local codebase evidence is insufficient.
Use Exa to validate uncertain real-world usage patterns for external libraries or evolving APIs.
Use Context7 to confirm official documentation details (exact API names, version-specific behavior, deprecations).
Skip both when the repository already contains a clear canonical pattern.
Step 4: Apply Test Expectations Proportionally
Require tests for behavior changes.
Treat these as behavior changes:
- New or changed business logic
- API contract changes
- Query/loader behavior changes
- Security or authorization logic changes
- User-visible component behavior changes
Treat these as low-risk changes where new tests are optional:
- Documentation-only updates
- Comment-only updates
- Mechanical refactors with no logic change (for example rename-only, formatting-only, import reordering)
State test rationale explicitly in the final review summary.
Step 5: Run Automated Checks
Run bun run check when the repository uses the standard template-ts quality-gate script.
Run the repository-equivalent command set when a different convention is used (for example separate lint, typecheck, and test commands).
Capture command outcomes in the final report.
Severity Classification
CRITICAL (must fix before merge)
- Security vulnerabilities
- SQL injection or hardcoded secrets
- Missing authentication on protected endpoints
- Breaking changes to public APIs
MAJOR (should fix)
- Wrong TRPC v11 patterns (
.useQueryinstead of.queryOptions) - N+1 database queries
- Missing prefetch causing slow page loads
- Manual types instead of
RouterInputs/RouterOutputs - Code duplication violating DRY
MINOR (consider fixing)
- Style inconsistencies
- Missing documentation
- Non-critical refactoring opportunities
Report Template
# Code Review Report
**Scope:** [What was reviewed]
**Date:** [Current date]
---
## CRITICAL ISSUES
[List with file:line, description, fix]
---
## MAJOR ISSUES
[List with file:line, description, fix]
---
## MINOR ISSUES
[List with file:line, brief description]
---
## TEST EXPECTATIONS
- Behavior-changing code paths covered: [Yes/No + details]
- Low-risk changes with test exemption: [Yes/No + rationale]
---
## AUTOMATED CHECKS
- Commands run: [List]
- Result: [Pass/Fail]
---
## POSITIVE OBSERVATIONS
- [Good patterns found]
---
## SUMMARY
**Assessment:** [APPROVE / NEEDS_WORK / REJECT]
**Next steps:** [Specific actions]
## Quick Stats
- Files reviewed: [N]
- Issues: Critical: [N], Major: [N], Minor: [N]
Assessment Criteria
APPROVE
- No critical issues
- Core TRPC and TanStack patterns are correct
- Repository quality-gate checks pass
NEEDS_WORK
- Major pattern violations exist
- Required tests are missing for behavior changes
- Performance issues impact reliability or UX
REJECT
- Security vulnerabilities exist
- Breaking changes are introduced without migration path
- Fundamental design flaws make the change unsafe to merge
Related Skills
trpc-patterns— TRPC router patterns, procedures, error handlingtanstack-frontend— Router, Query, Form patternseffect-ts— Effect services, layers, ManagedRuntime, error handlingscan-effect-solutions— Deep Effect compliance scanproduction-troubleshooting— Performance investigation
More from blogic-cz/agent-tools
git-workflow
Automates the full PR lifecycle — create or update a pull request, then aggressively monitor CI checks and review feedback in a continuous loop, fixing failures and addressing comments until the PR is fully green. Also covers push, branch creation, and branch sync workflows.
60update-packages
This skill should be used when upgrading dependencies, bumping packages, resolving outdated dependencies, or performing dependency updates. It guides safe Bun-based package upgrades with breaking-change handling, runtime pin alignment, and grouped version coordination.
40testing-patterns
This skill should be used when implementing or reviewing testing workflows in template-ts projects, especially for testing, Vitest, Playwright, integration test, and mocking scenarios.
36tdd
This skill should be used when a task explicitly asks for TDD, test-first development, or the Red-Green-Refactor cycle. It guides incremental implementation with concrete Red-Green-Refactor examples, including Effect service patterns with mock layers.
31debugging-with-opensrc
Load this skill when debugging behavior in external libraries by reading local OpenSrc mirrors (Effect, TanStack, TRPC, Drizzle, Better Auth, Sentry, Pino), or when docs conflict with runtime behavior and source-level verification is required.
29agent-tools
LOAD THIS SKILL when: using CLI wrapper tools (gh-tool, observability-tool, db-tool, k8s-tool, az-tool, logs-tool, session-tool), working with observability, databases, GitHub PRs, Kubernetes, Azure DevOps, or application logs. Contains tool overview, usage patterns, and project-specific aliases.
28