agentleFS
samsam007bsamsam007b/claude-code-standards-kit/skills/typescript-review/SKILL.md

typescript-review

Skill2 starsChanged 8 months agoMITView on GitHub

TypeScript & code quality audit: strict mode, explicit types, no-any, SOLID patterns, Clean Code naming. Sources: Martin Fowler, Google Engineering Practices, Microsoft TypeScript Handbook.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before merging a backend or frontend PR

    line 13

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/typescript-review: TypeScript & Code Quality Audit

When to use

  • Review of a TypeScript file or module
  • Before merging a backend or frontend PR
  • Refactoring a legacy file (any everywhere, missing types)
  • Validation of a new service or helper

Rules (Robert C. Martin + TypeScript strict)

Strict types

  • strict: true in tsconfig (includes noImplicitAny, strictNullChecks, etc.)
  • Zero any: use unknown then narrowing or a justified as Type
  • Zero // @ts-ignore: solve the typing problem
  • Explicit types on public function parameters
  • Explicit return type on complex or public functions

Advanced type patterns

  • Discriminated unions for multiple states (no separate boolean + data)
  • Branded types for IDs (UserId, PropertyId, not a bare string)
  • const assertions for literals (as const)
  • Generics for reusability (no copy-pasting types)
  • satisfies operator for validation without widening

Clean Code (Martin)

  • Functions: max 20 lines, 1 responsibility, max 3 parameters
  • Naming: verb + noun for functions (getUserProfile, validateEmail)
  • Variables: explicit names, never d, tmp, data, res
  • Comments: only on the "why" (never the "what" if the code is clear)
  • File: max 300 lines, beyond that split into sub-modules

SOLID

  • S Single Responsibility: 1 class/file = 1 reason to change
  • O Open/Closed: extension via interfaces, no modification of the core
  • L Liskov: subtypes replaceable without breaking behavior
  • I Interface Segregation: small, specific interfaces
  • D Dependency Inversion: depend on abstractions, not concretions

Forbidden patterns

  • switch on a union type → use discriminated unions + object map
  • Object.keys() without a cast → (Object.keys(obj) as (keyof typeof obj)[])
  • JSON.parse() without Zod validation → always validate external inputs
  • Mutations of shared objects → always return a new object

Output format

## TypeScript Review: [file/module]

### Quality score: [0-100]

### 🔴 Critical violations (any, ts-ignore, unsafe)
### 🟡 Design issues (SOLID, Clean Code)
### 🟢 Suggestions (type optimizations)

### Proposed refactoring
[corrected code with explanation]

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.