typescript-best-practices

A set of guidelines for writing and reviewing TypeScript and Node.js code. TypeScript adds checks to JavaScript, while Node.js runs JavaScript outside a web browser.

In plain words
What is it for?
Use it when building or reviewing TypeScript services, APIs, and Node.js projects, including type definitions, requests, cancellation, and tests.
Why use it?
It helps catch type mistakes and handle asynchronous operations and errors consistently.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/taoidle/plan-cascade/typescript
Any agent
npx skills add Taoidle/plan-cascade --skill typescript
Clone the repo
git clone --depth 1 https://github.com/Taoidle/plan-cascade

Made for: Claude Code, Codex.

Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 566 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00034 $0.00566
Opus 5 $0.00017 $0.00283
Sonnet 5 $0.00007 $0.00113
Haiku 4.5 $0.00003 $0.00057

Measured 2d ago against content hash 0a823606f706, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

typescript-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

builtin-skills/typescript/SKILL.md · 98 lines

What it actually says

TypeScript Best Practices

Code Style

Rule Guideline
Formatter Prettier
Linter ESLint + @typescript-eslint
Strict mode strict: true in tsconfig

Type Safety

Rule Guideline
Avoid any Use unknown + narrowing
Type guards Custom predicates
Discriminated unions For variants
type Result<T> = { success: true; data: T } | { success: false; error: Error };

function isUser(v: unknown): v is User {
  return typeof v === 'object' && v !== null && 'id' in v;
}

Error Handling

class ApiError extends Error {
  constructor(message: string, public status: number) {
    super(message);
    this.name = 'ApiError';
  }
}

async function fetchUser(id: string): Promise<User> {
  const res = await fetch(`/api/users/${id}`);
  if (!res.ok) throw new ApiError('Failed', res.status);
  return res.json();
}

Project Structure

src/{index.ts, types/, services/, utils/}
tests/
package.json, tsconfig.json

Async Patterns

Pattern Usage
Promise.all Parallel operations
AbortController Cancellation
const [user, settings] = await Promise.all([fetchUser(id), fetchSettings(id)]);

Anti-Patterns

Avoid Use Instead
as assertions Type guards
! non-null ?. and ??
any unknown + narrowing
// Bad: data as User, user!.name
// Good:
if (isUser(data)) { /* data is User */ }
const name = user?.name ?? 'Unknown';

Testing (Vitest)

describe('Service', () => {
  it('should create', async () => {
    const mock = { save: vi.fn().mockResolvedValue({ id: '1' }) };
    const result = await new Service(mock).create({ name: 'Test' });
    expect(result.id).toBe('1');
  });
});
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 98 lines · 34 tokens per session scan A 0a823606f706

Subscribe to this mod's changes

typescript-best-practices is a skill published in the GitHub repository Taoidle/plan-cascade (131 stars, last pushed 5mo ago), licensed MIT. It adds 34 tokens to every session and 566 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

release

Cut a versioned release of the DOS kernel — bump the version, draft release notes, commit, tag, push to master, and create a GitHub release. The tag push triggers the gated PyPI publish pipeline (publish.yml); the skill surfaces the run and its approval gate.

anthony-chaudhary/dos-kernel · 59 tokens

stable-release

Promote an already-shipped rolling release (vX.Y.Z) of the DOS kernel to a named stable channel — gated on a green kernel suite + a green third-party CI run on the candidate + a clean truth syscall + a soak window. Writes an evidence file and adds a stable/ git tag on the same commit. Does NOT bump versions or build…

anthony-chaudhary/dos-kernel · 81 tokens

dos-goal-fleet

Launch multiple goal-scoped workers in waves, each with a witness-gated stop condition and dos arbitrate file-tree safety. Use when an operator asks to run several independent goals in parallel and fold only verified ships.

anthony-chaudhary/dos-kernel · 51 tokens

dos-dispatch-loop

Run recurring dos-dispatch cycles, switching to dos-replan when the backlog drains and stopping on the kernel's loop verdict. Use for unattended dispatch->replan->dispatch work across disjoint lanes.

anthony-chaudhary/dos-kernel · 49 tokens

dos-goal-gate

Ground a keep-working goal in evidence the worker did not author by wiring dos hook stop to refuse false done claims. Use for one self-stopping agent or loop worker; use dos-witness-claim for fold barriers.

anthony-chaudhary/dos-kernel · 54 tokens

dos-witness-claim

Route subagent claims through independent read-back before another agent relies on them. Use at parallel, pipeline, or synthesis barriers where shipped phases, files, rows, messages, or other effects must be witnessed.

anthony-chaudhary/dos-kernel · 47 tokens