agentleFS
CassetteTapeCrackleCassetteTapeCrackle/claude-starters/skills/clean-code-ts/SKILL.md

clean-code-ts

Skill1 starsChanged 3 months agoMITView on GitHub

Use when writing or reviewing TypeScript — deeper idioms (eliminate any, discriminated unions, narrowing, exhaustiveness, schema-derived types, async correctness).

The file

Files
SKILL.md

Clean-code TypeScript (depth)

On top of the base rules (strict tsconfig, ESLint+Prettier, Vitest).

Types

  • No any. Use unknown at boundaries and narrow. Prefer type aliases + discriminated unions for state over booleans/optionals.
  • Model impossible states out of existence (a union, not many independent flags). Exhaustiveness-check unions with a never default in switch.
  • Derive types from runtime schemas (zod/TypeBox) at IO boundaries — one source of truth, not parallel interface + validator.

Correctness

  • strictNullChecks on; handle null/undefined explicitly, no ! non-null assertions outside tests.
  • await every promise or handle it; no floating promises. Promise.all for independent async, not sequential awaits.
  • Readonly by default (readonly, as const); immutable data flow.

Style

  • Named exports over default (grep + refactor friendliness). Small modules; pure functions; early returns.
  • Narrow function signatures — take exactly what's used, not the whole object.

Smells

  • any or as SomeType casts → narrow or fix the type at the source.
  • Booleans multiplying into impossible combinations → discriminated union.
  • A validator and an interface that can drift → derive the type from the schema.

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.