This skill should be used when the user asks to "review TypeScript code", "typescript code quality", "TypeScript idioms check", "review my TypeScript", "check code quality", or wants feedback on TypeScript patterns, typing strategy, and module organization.
Install
npx skillscat add bromanko/llm-agents/typescript-code-review Install via the SkillsCat registry.
SKILL.md
TypeScript Code Review
Action required: Run /review typescript code to start an interactive code quality review. Do not perform the review manually.
Perform a thorough code quality review of TypeScript code, focusing on type safety, maintainability, and clear architecture.
Scope Determination
First, determine what code to review:
- If the user specifies files/directories: Review those paths
- If no scope specified: Review working changes
- Check for
.jjdirectory first, usejj diffif present - Otherwise use
git diffto identify changed.ts,.tsx,.mts, and.ctsfiles - If no changes, ask the user what to review
- Check for
Review Process
- Read the target files using the Read tool
- Analyze against the checklist below
- Output findings in the standard format
Review Checklist
Type Safety & API Design
- Avoids
anyand unsafe type assertions (as unknown aschains) - Uses
unknownfor untrusted input with explicit narrowing - Function signatures are explicit and stable
- Public APIs use strong domain types instead of primitive-heavy signatures
- Optional fields and nullability handled intentionally (
strictNullChecksmindset) - Generic constraints are meaningful (
<T extends ...>when needed)
Type Narrowing & Control Flow
- Uses type guards, discriminated unions, and exhaustive checks
switch/if branches narrow types correctly- Uses
neverexhaustiveness checks for union handling - Avoids non-null assertions (
!) unless justified with local invariants - Runtime checks align with type-level expectations
Idiomatic TypeScript Patterns
- Uses
type/interfaceconsistently and intentionally - Prefers composition over deep inheritance trees
- Keeps utility types readable (no type-level overengineering)
- Async code uses
async/awaitclearly with proper error boundaries - Side effects separated from pure transformations where feasible
Module Organization
- Public exports are minimal and intentional
- Internal helpers are not leaked from module boundaries
- File/module names reflect responsibilities
- Avoids cyclic imports and tangled dependencies
- Shared types colocated with domain or API boundaries appropriately
Readability & Maintainability
- Functions/classes are focused (single responsibility)
- Complex logic has concise explanatory comments
- Naming is descriptive without excessive verbosity
- No dead code, stale TODOs, or unused imports
- Consistent formatting and linting expectations followed
Error Handling
- Errors include actionable context
- No silent failures (empty
catch, swallowed Promise rejections) - Domain errors represented consistently (custom error types or tagged results)
- Validation occurs near system boundaries (request, file, env, external data)
Output Format
Present findings as:
## Findings
### [SEVERITY] Issue Title
**File:** `path/to/file.ts:LINE`
**Category:** quality
**Issue:** Description of what's wrong and why it matters.
**Suggestion:** How to fix, with code example if helpful.
**Effort:** trivial|small|medium|large
---Use severity indicators:
- HIGH: Bugs, incorrect behavior, serious maintainability risks
- MEDIUM: Weak typing, non-idiomatic patterns, unclear structure
- LOW: Style issues, minor cleanup, optional improvements
Summary
After all findings, provide:
- Total count by severity
- Top 2-3 priority items to address
- Overall code quality assessment (1-2 sentences)