Skip to content
Back to skills

Clean Typescript

ASecurity

Write clean, efficient TypeScript code that follows common best practices

  • 754 stars
  • 0 votes
  • 1 copy
  • 13 views
  • Added February 8, 2026
developmenttypescriptapi

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill clean-typescript --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clean Typescript?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clean Typescript
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-clean-typescript/badge)](https://www.skillsdirectory.com/skills/majiayu000-clean-typescript)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clean-typescript
description: Write clean, efficient TypeScript code that follows common best practices
---

# 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** `any` and unsafe type assertions
- Use `unknown` instead of `any` when necessary
- Let TypeScript infer types when inference is clear and stable

## Types & Interfaces

- **PREFER** `type` aliases for most use cases
- Use `interface` primarily 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 `null` and `undefined` explicitly
- **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 const` objects
- 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.