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).
In this repository9 other files it gives its agents.
- agent-orchestrationSkill
- clean-code-audioSkill
- clean-code-bashSkill
- clean-code-coreSkill
- clean-code-cppSkill
- clean-code-cSkill
- clean-code-goSkill
- clean-code-pythonSkill
- clean-code-rustSkill
The file
Files
Clean-code TypeScript (depth)
On top of the base rules (strict tsconfig, ESLint+Prettier, Vitest).
Types
- No
any. Useunknownat boundaries and narrow. Prefertypealiases + discriminated unions for state over booleans/optionals. - Model impossible states out of existence (a union, not many independent flags). Exhaustiveness-check unions with a
neverdefault inswitch. - Derive types from runtime schemas (zod/TypeBox) at IO boundaries — one source of truth, not parallel
interface+ validator.
Correctness
strictNullCheckson; handlenull/undefinedexplicitly, no!non-null assertions outside tests.awaitevery promise or handle it; no floating promises.Promise.allfor 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
anyoras SomeTypecasts → narrow or fix the type at the source.- Booleans multiplying into impossible combinations → discriminated union.
- A validator and an
interfacethat can drift → derive the type from the schema.
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
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.

