flpbalada/fb-skills/typescript-best-practices
Claude Code and agent skill by flpbalada/fb-skills
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install flpbalada/fb-skills/typescript-best-practicesSKILL.md
The same SKILL.md was published earlier as flpbalada/fb-skills/typescript-best-practices.
TypeScript Best Practices
Goal
Make code safer and easier to change. Use TypeScript to model real constraints without adding noise.
Rules
- Prefer
unknownoverany. - 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
interfacefor object shapes. - Prefer
typefor unions and utility types. - Avoid type assertions unless crossing a known boundary.
- Keep runtime validation near external input.
Common Fixes
- Replace
anywithunknownplus guards. - Replace boolean state pairs with a discriminated union.
- Replace broad
stringwith 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.
aschains.- Deep conditional types for app-level code.
- Types that are stricter than runtime validation.
References
context/code-patterns.md: type system, functions, async patterns, and guard clauses.context/organization.md: file naming, barrel files, and project configuration.context/testing-performance.md: DI, type guards, null handling, and performance.- W3Schools TypeScript Best Practices
- TypeScript Handbook
- TypeScript Performance Wiki
Output
- Type safety issue.
- Simpler type model.
- Boundary validation plan.
- Compiler or lint check when relevant.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/typescript-best-practices/SKILL.md
Popularity
- Repository stars
- 8
- Repository forks
- 1
- 7-day trend score
- 16
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/flpbalada/fb-skills/typescript-best-practices)