About clean-typescript
A TypeScript guidance skill for developers who want types to improve correctness and readability. It favors explicit, composable types, safe null handling, and clear error states over unnecessary complexity.
Key features
- 01Prefer readable explicit types
- 02Avoid `any` and unsafe assertions
- 03Use unions or `as const` over enums
- 04Handle nullability with guards
- 05Represent errors explicitly
Use cases
- 01Reviewing TypeScript type definitions
- 02Designing clear public function APIs
- 03Reducing unsafe null and error handling
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ academind/ ai-config --skill clean-typescriptAfter installing, type/clean-typescriptin Claude Code to confirm it loaded.
Details
From the project READMEClean TypeScript
We use TypeScript as a correctness and clarity tool, not as ceremony. Types should reduce bugs and cognitive load.
Type Philosophy
- PREFER explicit, readable types over clever or overly generic ones
- AVOID
anyand unsafe type assertions - Use
unknowninstead ofanywhen necessary - Let TypeScript infer types when inference is clear and stable
Types & Interfaces
- PREFER
typealiases for most use cases - Use
interfaceprimarily for public, extendable object shapes - Keep types small, composable, and well-named
Functions & APIs
- PREFER explicit return types for public functions
- Avoid function overloads unless they meaningfully improve the API
- Keep function signatures simple and predictable
Nullability & Safety
- Handle
nullandundefinedexplicitly - DO NOT rely on non-null assertions (
!) except as a last resort - Prefer narrowing via control flow and guards
Enums & Constants
- AVOID
enum - PREFER union types or
as constobjects - Keep runtime output predictable and minimal
Error Handling
- Type errors and error states explicitly
- Prefer result objects or typed errors over throwing where appropriate
- Do not hide failure modes behind broad types
General Principles
- Types should explain intent
- If a type is hard to understand, it’s probably wrong
- Favor maintainability over theoretical completeness
Comments
Markdown supported