
ts-best-practices
TypeScript type safety guidelines for writing maximally type-safe code. Apply these patterns when writing or reviewing any TypeScript: discriminated unions, type narrowing, type guards, exhaustiveness checks, avoiding as casts, preferring unknown over any, and making impossible states unrepresentable. Use this skill whenever writing TypeScript code, reviewing TypeScript for type safety issues, or when the user mentions type safety, type narrowing, discriminated unions, or asks to make types stricter/more explicit.
- Installs
- 285
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/poteto/noodle --skill ts-best-practices- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads ts-best-practices automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Type Safety
This project's TypeScript policy. Apply when writing or reviewing TypeScript.
| Rule | Summary |
|---|---|
No as casts | Every as is a potential runtime crash. Validate at boundaries, then cast only if earned. Prefer Zod/Valibot over manual validation. |
unknown over any | any disables type checking for everything it touches. External data is always unknown. |
| Discriminated unions | Model variants with a shared literal discriminant. No optional-field bags. |
| Narrowing hierarchy | Prefer: discriminated union switch > in operator > typeof/instanceof > type guard > as |
| Type guards | Must actually verify the claim. Name them isX or hasX. Prefer discriminant narrowing when possible. |
| Exhaustiveness checks | Always add default: never arm to switches over discriminated unions. Use an absurd() helper to reduce boilerplate. |
satisfies over as | When verifying a value matches a type without widening, use satisfies to preserve literal types. |
| Impossible states | If a bug requires asking "can this combination happen?" the type is too loose. Tighten it. |
Read references/patterns.md for code examples of each rule.
FAQ
What does the ts-best-practices skill do?
TypeScript type safety guidelines for writing maximally type-safe code. Apply these patterns when writing or reviewing any TypeScript: discriminated unions, type narrowing, type guards, exhaustiveness checks, avoiding as casts, preferring unknown over any, and making impossible states unrepresentable. Use this skill whenever writing TypeScript code, reviewing TypeScript for type safety issues, or when the user mentions type safety, type narrowing, discriminated unions, or asks to make types stricter/more explicit.
How do I install ts-best-practices?
Run npx skills add https://github.com/poteto/noodle --skill ts-best-practices in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ts-best-practices/ (personal) or .claude/skills/ts-best-practices/ (project).
Which AI agents can use ts-best-practices?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is ts-best-practices safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains ts-best-practices?
It is published by poteto in poteto/noodle. It has 285 recorded installs.
More from poteto/noodle
adversarial-review
poteto/noodle
Adversarial code review using cross-model approach. Spawns reviewers on the opposing model (Claude uses Codex, Codex uses Claude) to challenge work from distinct critical lenses. Produces a synthesized verdict with findings and lead judgment. Triggers: "adversarial review".
unslop
poteto/noodle
Remove AI writing patterns from prose. Use for docs, READMEs, blog posts, any non-code text that should sound human. Triggers: "unslop", "humanize", "make this sound human", "clean up this writing", "edit for voice", "de-AI this text".
debugging
poteto/noodle
Systematic root-cause debugging methodology. Use for any technical problem — errors, failures, unexpected behavior, or when stuck. Triggers: "debug", "fix this", "what's wrong", "investigate".
quality
poteto/noodle
Post-cook quality gate. Reviews completed cook work for correctness, scope discipline, and principle compliance. Emits stagemessage events with findings. Triggers after execute stages, on '/quality', 'review this', 'check the work', 'assess quality'.
commit
poteto/noodle
Create conventional commit messages. Use when the user says "commit this", "save changes", "git commit", asks to commit code, write a commit message, or format git history. Follows conventional commits specification.
todo
poteto/noodle
Add, complete, or view items in the brain/todos.md backlog. Use when the user says "todo", "add a todo", "mark done", "what's on the backlog", "show todos", "list tasks", "check off", or wants to manage their task list.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.