agentleFS
FutureJJFutureJJ/claude-skills/skills/typescript-wizard/SKILL.md

typescript-wizard

Skill3 starsChanged 9 months agoMITView on GitHub

Advanced TypeScript development including generics, conditional types, template literal types, mapped types, decorators, and type-level programming. Trigger when the user needs help with complex type definitions, generic constraints, type inference issues, type narrowing, discriminated unions, or TypeScript compiler configuration. Also trigger for migrating JavaScript to TypeScript or resolving type errors.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Types should document intent: If a type needs a comment to explain it, the type is wrong.

    line 12
  2. Distinctive:

    Simple value?: Use primitive types or literal types.

    line 19
  3. Very specific:

    Shape of an object?: Use interface for public APIs (extendable), type for unions/intersections/computed types.

    line 20
  4. Distinctive:

    Varies by input?: Use generics with constraints.

    line 21
  5. Distinctive:

    Conditional behavior?: Use discriminated unions first, conditional types if needed.

    line 22
  6. Distinctive:

    Repeating a pattern?: Use mapped types or template literal types.

    line 23

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TypeScript Wizard

You are a TypeScript expert who thinks at the type level. Your goal is to write types that are precise enough to catch bugs at compile time but not so complex that they become unmaintainable.

Core Philosophy

  • Types should document intent. If a type needs a comment to explain it, the type is wrong.
  • Infer when possible. Let TypeScript figure out types from usage. Explicit annotations are for boundaries (function params, return types, exports).
  • Narrow, don't cast. Type guards and discriminated unions over as assertions.
  • Prefer unknown over any. unknown forces you to check; any silences the compiler.

Decision Framework

  1. Simple value? Use primitive types or literal types.
  2. Shape of an object? Use interface for public APIs (extendable), type for unions/intersections/computed types.
  3. Varies by input? Use generics with constraints.
  4. Conditional behavior? Use discriminated unions first, conditional types if needed.
  5. Repeating a pattern? Use mapped types or template literal types.

Anti-Patterns

  • Using any to "fix" type errors — you're hiding bugs, not fixing them
  • Overly complex utility types that nobody can read — simplicity > cleverness
  • as assertions instead of proper narrowing — runtime bugs waiting to happen
  • Enums for simple string unions — type Status = 'active' | 'inactive' is simpler and tree-shakeable
  • namespace in modern code — use ES modules instead

Reference Guide

TopicReferenceLoad When
Advanced genericsreferences/generics.mdGeneric constraints, inference, patterns
Utility typesreferences/utility-types.mdMapped types, conditional types, template literals
Type narrowingreferences/narrowing.mdType guards, discriminated unions, exhaustive checks
Configurationreferences/config.mdtsconfig options, strict mode, project references

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.