flpbalada/fb-skills

typescript-best-practices

Improve TypeScript safety, readability, and maintainability.

First seen May 4, 2026

Installation

$ npx skills add flpbalada/fb-skills --skill typescript-best-practices

Summary

  • Improve TypeScript safety, readability, and maintainability.
  • Use when reviewing TypeScript code, choosing typing strategy, configuring strictness, handling async errors, replacing any with unknown, narrowing external data, modeling state with unions, placing runtime validation, or organizing types.
  • For complex reusable type utilities use typescript-advanced-types; for interface vs type decisions use typescript-interface-vs-type.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from flpbalada/fb-skills · top by installs.

npx skills add flpbalada/fb-skills

Browse all from flpbalada/fb-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 7
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,305 B
  • docs SUMMARY.md 465 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 15 installs

SKILL.md

TypeScript Best Practices

Goal

Make code safer and easier to change. Use TypeScript to model real constraints without adding noise.

Rules

  • Prefer unknown over any.
  • Let inference work for local values.
  • Add explicit types at boundaries: exports, API input/output, public functions.
  • Enable strict compiler options when project allows.
  • Use discriminated unions for state variants.
  • Narrow unknown data before use.
  • Prefer interface for object shapes.
  • Prefer type for unions and utility types.
  • Avoid type assertions unless crossing a known boundary.
  • Keep runtime validation near external input.

Common Fixes

  • Replace any with unknown plus guards.
  • Replace boolean state pairs with a discriminated union.
  • Replace broad string with a union when valid values are finite.
  • Infer types from schemas instead of duplicating them.
  • Move reusable complex types to named aliases.

Avoid

  • Non-null assertions used to silence real uncertainty.
  • Large anonymous object types repeated in many places.
  • as chains.
  • Deep conditional types for app-level code.
  • Types that are stricter than runtime validation.

References

Output

  • Type safety issue.
  • Simpler type model.
  • Boundary validation plan.
  • Compiler or lint check when relevant.