Agent skill
clean-typescript
Write clean, efficient TypeScript code that follows common best practices
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/clean-typescript
SKILL.md
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
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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?