agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when writing or hardening TypeScript in strict mode. Covers advanced types, discriminated unions, runtime validation at trust boundaries, generics, and removing `any` from an existing codebase. Trigger on "get rid of all the any types", "turn on strict mode in tsconfig",
Claude Code
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill typescript --agent claude-code
Codex
$ npx skills add nimadorostkar/Claude-Skills-collection --skill typescript -a codex -y
Cursor
$ npx skills add nimadorostkar/Claude-Skills-collection --skill typescript -a cursor -y
Gemini CLI
$ npx skills add nimadorostkar/Claude-Skills-collection --skill typescript -a gemini-cli -y
GitHub Copilot
$ npx skills add nimadorostkar/Claude-Skills-collection --skill typescript -a github-copilot -y
OpenCode
$ npx skills add nimadorostkar/Claude-Skills-collection --skill typescript -a opencode -y
Windsurf
$ npx skills add nimadorostkar/Claude-Skills-collection --skill typescript -a windsurf -y
name: typescript description: Use when writing or hardening TypeScript in strict mode. Covers advanced types, discriminated unions, runtime validation at trust boundaries, generics, and removing `any` from an existing codebase. Trigger on "get rid of all the any types", "turn on strict mode in tsconfig", "type inference is failing on this generic", "validate this api response at runtime". Do not use for React component and hook design — see the react skill. metadata: category: languages version: 1.0.0 tags: [typescript, types, strict, zod, generics]
Use the type system to make invalid states unrepresentable. This skill covers strict-mode TypeScript, the advanced type features worth reaching for, and the discipline of validating untrusted data exactly once — at the boundary.
1. **Set the gate** — Enable `strict`, `noUncheckedIndexedAccess`, and `exactOptionalPropertyTypes`. Everything else follows from the compiler's complaints. 2. **Type the boundaries** — Define schemas for every input that crosses into your program: HTTP payloads, env vars, config files, message queues. 3. **Model the domain** — Replace boolean flags and optional grab-bags with discriminated unions. 4. **Implement inward** — Internal code trusts its types because the boundary already validated them. 5. **Verify** — `tsc --noEmit` and lint with `@typescript-eslint`, `no-explicit-any` set to error.
**Boundary validation with derived types:**
import { z } from "zod";
const Config = z.object({
port: z.coerce.number().int().positive(),
databaseUrl: z.string().url(),
logLevel: z.enum(["debug", "info", "warn", "error"]).default("info"),
});
export type Config = z.infer<typeof Config>;
export function loadConfig(env: NodeJS.ProcessEnv): Config {
const parsed = Config.safeParse({
port: env.PORT,
databaseUrl: env.DATABASE_URL,
logLevel: env.LOG_LEVEL,
});
if (!parsed.success) {
throw new Error(`Invalid configuration:\n${parsed.error.message}`);
}
return parsed.data;
}**Exhaustive discriminated union:**
type Job =
| { status: "queued"; queuedAt: Date }
| { status: "running"; startedAt: Date; workerId: string }
| { status: "failed"; error: string; attempts: number };
function describe(job: Job): string {
switch (job.status) {
case "queued":
return `Queued at ${job.queuedAt.toISOString()}`;
case "running":
return `Running on ${job.workerId}`;
case "failed":
return `Failed after ${job.attempts} attempts: ${job.error}`;
default: {
const unreachable: never = job;
throw new Error(`Unhandled job status: ${JSON.stringify(unreachable)}`);
}
}
}A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory,…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling,…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.