/eng:typescriptfrom Engineering Skills
Use when writing or reviewing TypeScript — typing code, designing types, configuring tsconfig, typing Next.js routes, or fixing type errors. Enforces strict, inference-first TypeScript 7 — no any or unsafe casts, discriminated unions, satisfies, utility types, erasable syntax only, tsconfig presets chosen by who resolves the imports, TypeScript 6's defaults and removed options, declaration emit and subpath imports for packages, type-aware lint, and typed routes. Zod schemas live in `schemas-and-contracts`; identifier naming in `naming`.
Ships in Engineering Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Strict, inference-first TypeScript. Types are documentation the compiler checks — make illegal states unrepresentable.
Before applying this skill, read the project's root AGENTS.md, the AGENTS.md closest to the files in question, and any doc they link for this skill's topic. Names, values and choices — budgets, tiers, tokens, voice, paths — come from those files, never from this skill.
strict: true, always. Never disable strict or a rule to make something pass.any. Take unknown at boundaries and narrow; reach for a generic before any.as to launder unknown data into a type, no non-null ! to silence the compiler — narrow or fix the type. as const, and as for a narrowing you can prove, are fine.schemas-and-contracts'.satisfies checks a value against a type while keeping its literal type (config objects, lookup maps); a plain annotation widens it.{ status: "ok"; data } | { status: "error"; message }); narrow on the discriminant and check the default is never.as const for literal, read-only data; derive the union from it (type Status = (typeof STATUSES)[number]).Pick, Omit, Partial, Required, Record, ReturnType, Awaited. Compose, don't duplicate.<T extends …>); don't over-generalise.type over interface, which composes, unions and infers; use interface only for declaration merging or implements.value is T predicate, or a filter TypeScript infers one from (.filter((x) => x !== undefined)), narrows where an as would only assert.unknown — catch (error: unknown) and narrow (instanceof Error, a schema parse) before touching one.type UserId = string & { readonly __brand: "UserId" }) — not for everything.NoInfer<T> locks an inference site so a second argument can't widen what the first inferred.type CacheTag = `${Entity}:${string}`).Every file must run by deleting its types — Node runs .ts that way natively, and single-file transpilers (SWC, esbuild) compile each file on its own. Node's TypeScript docs recommend two compiler options for it:
erasableSyntaxOnly: true refuses the features that generate code: enum, a namespace with values, parameter properties (constructor(private name: string)), import =. Use an as const object with a derived union instead of an enum, and an explicit field assigned in the constructor instead of a parameter property.verbatimModuleSyntax: true keeps every import exactly as written, so a type-only import must say so (import type { User }, or import { save, type User }). A tool that strips types per file can then drop it safely.Turning them on in an existing codebase: the first passes as soon as no file uses the four features; the second needs type-only imports marked, which @typescript-eslint/consistent-type-imports fixes automatically.
Who resolves a workspace's imports decides its module settings, so a monorepo keeps one shared preset per kind of consumer, never one setting for every package. A wrong choice builds cleanly and fails at import time.
| Preset | For | Module settings |
|---|---|---|
base | everything; the others extend it | strict, noUncheckedIndexedAccess, isolatedModules, skipLibCheck, a target |
nextjs | a Next.js app | module: "ESNext", moduleResolution: "Bundler", jsx: "preserve", noEmit, the next plugin |
react-library | a package every consumer bundles | module: "ESNext", moduleResolution: "Bundler", jsx: "react-jsx" |
node-library | a package plain Node loads | module: "NodeNext", moduleResolution: "NodeNext" |
TypeScript 6 changed the defaults, and TypeScript 7 removes what 6 deprecated:
types defaults to [] — no @types package is global unless listed. Each preset lists the globals its code uses: ["node"] for node-library and anything reading process, the test runner's for test configs. ["*"] restores the old behaviour at the old cost.rootDir defaults to the tsconfig's folder. A package that emits sets "rootDir": "./src" beside "outDir": "./dist", or its output lands in dist/src/.noUncheckedSideEffectImports is on, so a side-effect import TypeScript can't resolve (import "./globals.css") fails; declare it (declare module "*.css";) rather than turning the check off.strict is on by default — the base still says so, for readers.baseUrl (put its prefix in each paths entry), moduleResolution node/node10 or classic, esModuleInterop or allowSyntheticDefaultImports set to false, target: "es5", downlevelIteration, outFile, module amd/umd/system/none, or alwaysStrict: false. ignoreDeprecations: "6.0" silences them only until TypeScript 7.module Foo {} (write namespace Foo {}), an import asserts { type: "json" } (write with), or a /// <reference no-default-lib="true"/> directive.dist/ emits declarations — declaration, declarationMap (so "go to definition" lands in the source) and isolatedDeclarations, which makes every export state its type so declarations can be emitted file by file. Its exports give each entry a types condition first."imports": { "#/*": "./src/*" } in its package.json, imported as #/utils/date.js — rather than paths, which Node and the package's consumers never see. paths stays for apps.NodeNext requires the .js extension on relative imports (import { x } from "./x.js"). That's the ESM spec, and it's what makes plain tsc output loadable by Node.tsconfig.json extends its preset and adds the path alias ("@/*": ["./src/*"]). Add a second alias only with a reason.noUncheckedIndexedAccess (indexed access yields T | undefined) is in the base; exactOptionalPropertyTypes (?: no longer accepts an explicit undefined) is a project's choice.next typegen && tsc --noEmit, because typed routes and PageProps/LayoutProps come from Next's generated types.strictTypeChecked with parserOptions.projectService: true, so no-floating-promises, no-misused-promises and switch-exhaustiveness-check catch what the compiler doesn't.typescript dependency to the last major it supports, record why in the lint config's docs, and remove the alias once the parser catches up. Lint and the compiler then check with slightly different versions, so the compiler stays the authority.With typedRoutes: true in next.config, Next checks every href against the app's real pages.
Each app declares its own RouteTable type in its routes file and ends the table with } as const satisfies RouteTable. Route is a real union of pages only inside an app, where Next's generated types declare it; in a shared package it is a stub that accepts any string, so a shared RouteTable would check nothing.
import type { Route } from "next";
type RouteTable = {
[key: string]: Route | RouteTable | ((...args: never[]) => string);
};
export const ROUTES = {
home: "/",
events: {
root: "/events",
detail: (eventId: string): `/events/${string}` => `/events/${eventId}`,
},
} as const satisfies RouteTable;
A path with a parameter is a function typed by its template (`/events/${string}`), never a bare Route: Route excludes dynamic routes, so a Link fed a bare Route from a function would stop being checked.
Type a nav item's href as Route, so every navigation link is checked when it compiles.
Never as Route on a literal — the cast accepts a path that no longer exists, while satisfies fails the build. Keep as Route for a path known only at runtime (a returnTo read from the URL, a path the API sends), with a comment saying which.
any, unsafe as, non-null ! to silence errors, and @ts-ignore. Use @ts-expect-error with a reason only when truly unavoidable.enum, namespaces with values and parameter properties — erasableSyntaxOnly refuses them.schemas-and-contracts.naming.code-structure.codebase-audit.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub timonwa/engineering-skills --plugin eng20 skills in this plugin
/agents-mdWrites or updates a project's AGENTS.md and the short AGENTS.md notes in each app and package — what an agent can't work out from the code: commands, structure, conventions that differ from the defaults, workflow, recorded deviations from the house standards and hard constraints, under 200 lines. Use when starting a project, setting up AGENTS.md or CLAUDE.md, or bringing a project's agent instructions up to date./audit-allManually invoked. Runs the house audit suite across the eng, fe and be sets — detects what the repo has, runs every installed audit that applies (codebase, conventions, dependencies, env, security, accessibility, frontend, performance, SEO/AEO/GEO, Storybook, content, API, access control, Firestore, Redis), and rolls their reports into one health report with an overall score and cross-cutting priorities. Each audit still writes its own report./Other plugins' skills for the same job