typescript-best-practices
Use when reading or editing TypeScript code.
Skill by Cloeille
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/cloeille-typescript-best-practices
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/typescript-best-practices
What's inside
- Skill name
typescript-best-practices- Description
- Use when reading or editing TypeScript code.
- License
- MIT
- Instructions
- 26 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- patterns.md · references/
SKILL.md (first lines)
# TypeScript best practices
Apply the **type-system-discipline** principle skill first.
| Rule | Summary |
|------|---------|
| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. |
| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they can't be mixed up. Validate once at the boundary. |
| Constructive modeling | Build the shape so the illegal value can't be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, not a wish for refinement types. |
| Simplest total type | Keep `T[]` while every operation on it stays total. Strengthen to `NonEmpty<T>` only where the loose type forces `!`, a cast, or a "should never happen" throw. |
| `unknown` over `any` | External data is `unknown`. |
| Schemas before guards | Before hand-writing a property-by-property type guard, use the repository's runtime schema library and infer the type from the schema, such as `z.infer`. |
| No `as` casts | Every `as` is a runtime crash waiting. Cast only after validation. |
| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`/`instanceof` > user-defined type guard > `as`. |
| Type guards | Must verify the claim. A lying guard is worse than `as` because the bug hides behind a name that says it's safe. Name them `isX` or `hasX`. |
| Exhaustiveness | Inline `const _exhaustive: never = x;` in default arms so the compiler errors when a new variant is added. |
| `satisfies` over `as` | Validates the value without widening literal types. |
| Boundary validation | Parse where data crosses in, into a named domain type. `Record<string, unknown>` (however spelled) stops at that parse. Trust types inside. See the **boundary-discipline** principle skill. |
| Schema-derived types | Reach for `Pick`/`Omit`/`Parameters`/`ReturnType`/`Awaited`/`typeof` before declaring a new interface. |
| Object args | Pass objects, not positional, so argument order is self-documenting. Skip on hot paths (per-frame render, tokenizers, parsers). |
| Real tests | Don't mock what you can run. Prefer the framework's real test primitives with leak/disposable checks, and verify UI in a running build. Mock only what you can't run locally. |
| Structured telemetry | Prefer structured logger diagnostics with enough context to debug from an id. No `console.log` in shipped code. |
Examples: `references/patterns.md`.From Cloeille/pstack, MIT.
More from Cloeille/pstack
- 0.635score
reflect
Cloeille
Use when asked to reflect: route learnings into skills.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
no-comments
Cloeille
Use to remove needless code comments via Comment Sicko.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
figure-it-out
Cloeille
Use when no playbook fits: design an auditable one first.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
technical-writing
Cloeille
Use when writing or editing technical docs or READMEs.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
create-verification-skill
Cloeille
Generate a project-local skill that drives the real app.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
show-me-your-work
Cloeille
Use for long-running work that needs a decision trail.
SkillAFreshness: A★ 12Claude Code +9 - 0.628score
deslop
Cloeille
Remove AI-generated code slop from a diff before committing.
SkillAFreshness: A★ 12Claude Code +9 - 0.625score
how
Cloeille
Use to explain how code works, with walkthroughs.
SkillAFreshness: A★ 12Claude Code +9 - 0.625score
swarm
Cloeille
Fan out parallel workers via delegate_task, drain, report.
SkillAFreshness: A★ 12Claude Code +9 - 0.625score
architect
Cloeille
Design types and module structure before writing code.
SkillAFreshness: A★ 12Claude Code +9 - 0.625score
principle-encode-lessons-in-structure
Cloeille
Apply when writing the same instruction twice: encode it.
SkillAFreshness: A★ 12Claude Code +9 - 0.625score
maintain-verification-skill
Cloeille
Use to resync a project's verification skill with its app.
SkillAFreshness: A★ 12Claude Code +9
Signals
- Stars
- 12
- Forks
- 5
- Open issues
- 0
- Last commit (this folder)
- Oct 23, 2026 (6 days ago)
- Last release
- Oct 23, 2026 (6 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Cloeille/pstack
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Cloeille
- 0.635score
reflect
Cloeille
Use when asked to reflect: route learnings into skills.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
show-me-your-work
Cloeille
Use for long-running work that needs a decision trail.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
create-verification-skill
Cloeille
Generate a project-local skill that drives the real app.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
no-comments
Cloeille
Use to remove needless code comments via Comment Sicko.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
figure-it-out
Cloeille
Use when no playbook fits: design an auditable one first.
SkillAFreshness: A★ 12Claude Code +9 - 0.630score
technical-writing
Cloeille
Use when writing or editing technical docs or READMEs.
SkillAFreshness: A★ 12Claude Code +9
Cite this page
typescript-best-practices skill. Agent Mart. https://agentmart.dev/skills/cloeille-typescript-best-practices (last updated 2026-10-24)