Claude-skill-registry clean-typescript
Write clean, efficient TypeScript code that follows common best practices
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/clean-typescript" ~/.claude/skills/majiayu000-claude-skill-registry-clean-typescript && rm -rf "$T"
manifest:
skills/data/clean-typescript/SKILL.mdsource content
Clean 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
and unsafe type assertionsany - Use
instead ofunknown
when necessaryany - Let TypeScript infer types when inference is clear and stable
Types & Interfaces
- PREFER
aliases for most use casestype - Use
primarily for public, extendable object shapesinterface - 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
andnull
explicitlyundefined - 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
objectsas const - 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