/engineering:typescript-effectivefrom engineering
Guides production TypeScript: strict tsconfig flags, eliminating any, Zod boundary validation, JS migration, build performance, and anti-patterns.
Ships in engineering. 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.
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
references/typescript-mastery.md for type-system depth and references/typescript-design-patterns.md for GoF patterns.| Category | Artifact | Format | Example |
|---|---|---|---|
| Correctness | Strict tsconfig + Zod boundary register | Markdown doc covering strictness flags applied and Zod schemas at module boundaries | docs/ts/strict-config-register.md |
references/ directory for deep detail after reading the core workflow below.Production-grade TypeScript beyond the type system. Every rule here lifts real code quality, not just appeases the compiler.
Prerequisite: Load references/typescript-mastery.md for type-system depth. Use this skill for day-to-day production idioms.
Skill-specific references:
references/tsconfig-production.mdreferences/effective-ts-items.mdreferences/clean-code-ts.mdreferences/error-handling-result.mdreferences/zod-boundaries.mdreferences/migration-js-to-ts.mdreferences/build-performance.mdreferences/testing-vitest.mdreferences/anti-patterns.mdstrict: true plus noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride.any. Use unknown at boundaries and narrow.as unless there is no better option; never as unknown as T.union types over enum unless integer values and bidirectional lookup are needed.switch and assertNever.Error subclasses.null/undefined intentionally — don't mix.readonly on inputs by default.{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"useUnknownInCatchVariables": true
}
}
strict alone is not enough. noUncheckedIndexedAccess catches real bugs (arr[i] is T | undefined). exactOptionalPropertyTypes distinguishes { x?: number } from { x?: number | undefined }. See references/tsconfig-production.md.
Prefer types that narrow your values:
// BAD - primitive obsession
function sendEmail(to: string, subject: string, body: string) { ... }
// GOOD - branded types
type Email = string & { readonly __brand: "Email" };
type Subject = string & { readonly __brand: "Subject" };
function parseEmail(raw: string): Email | null { ... }
Discriminated unions + exhaustive match:
type Event =
| { kind: "login"; userId: string }
| { kind: "logout"; userId: string; at: Date }
| { kind: "purchase"; userId: string; amount: number };
function handle(e: Event): string {
switch (e.kind) {
case "login": return `login ${e.userId}`;
case "logout": return `logout ${e.userId}`;
case "purchase": return `bought ${e.amount}`;
default: return assertNever(e);
}
}
function assertNever(x: never): never { throw new Error(`unhandled: ${JSON.stringify(x)}`); }
Narrow unknown before use — never silently trust it.
See references/effective-ts-items.md for the full catalogue (~40 items).
isActive(user) not check(user); loadUser(id) not get(id).readonly, as const, Readonly<T>, spread instead of mutate.See references/clean-code-ts.md.
Throwing is fine inside a module; at boundaries (API handlers, workers, UI event handlers), return typed results:
type Ok<T> = { ok: true; value: T };
type Err<E> = { ok: false; error: E };
type Result<T, E> = Ok<T> | Err<E>;
const ok = <T>(value: T): Ok<T> => ({ ok: true, value });
const err = <E>(error: E): Err<E> => ({ ok: false, error });
async function loadUser(id: string): Promise<Result<User, "not_found" | "db_down">> {
try {
const user = await db.user.findUnique({ where: { id } });
return user ? ok(user) : err("not_found");
} catch {
return err("db_down");
}
}
Libraries: neverthrow, ts-results, or hand-roll as above. Pick one per project. See references/error-handling-result.md.
Every external input parsed with Zod, every internal type inferred from the schema.
import { z } from "zod";
const UserCreate = z.object({
email: z.string().email(),
age: z.number().int().min(0).max(150),
role: z.enum(["admin", "member", "viewer"]),
}).strict();
type UserCreate = z.infer<typeof UserCreate>;
app.post("/users", (req, res) => {
const parsed = UserCreate.safeParse(req.body);
if (!parsed.success) return res.status(400).json({ errors: parsed.error.flatten() });
// parsed.data is fully typed
});
Sources of truth: Zod schema → inferred type. Never define the type separately. See references/zod-boundaries.md.
Gradual, not big-bang. See references/migration-js-to-ts.md for the playbook. Summary:
allowJs: true, checkJs: true — TS checks JS files..js → .ts file by file, fix errors.noImplicitAny, then strict, then stricter flags one at a time.isolatedModules lets bundlers type-check per-file.transpile-only in dev (ts-node with swc/esbuild, tsup).skipLibCheck: true) — trust dep types.See references/build-performance.md.
expectTypeOf (vitest) or tsd for library APIs.fast-check for pure logic.See references/testing-vitest.md.
any — signals "I give up on types." Fix, don't paper over.as T (type assertion) — silently lies to the compiler.as unknown as T — the double lie. Always wrong.! non-null assertion — use narrowing or a type guard.Function type — use (...args: never[]) => unknown or specific signatures.Object / {} type — use Record<string, unknown> or a specific shape.enum for small string sets — use union of string literals.namespace — use ES modules.catch (e) {} — log or re-throw.delete obj.key on typed objects — use spread to build a new object.See references/anti-patterns.md.
tsc --noEmit
eslint . --max-warnings=0
vitest run --coverage --coverage.thresholds.lines=80
references/typescript-mastery.md — deep type system when you need it.references/typescript-design-patterns.md — GoF patterns in TS.typescript-full-stack — shared types FE↔BE, Zod everywhere.react-development / nextjs-app-router — framework-specific.| Condition | Action |
|---|---|
| Value crosses a runtime trust boundary | Parse it with a runtime schema |
| Type complexity obscures meaning | Use a named type or simpler API |
| Migration is incremental | Tighten checks by boundary |
Read and search are required. Editing, dependency updates, builds, and tests require authorisation.
Fallback: without execution, provide exact type-check, lint, and test commands. Do not claim runtime safety from static types alone.
| Artefact | Required? | Purpose |
|---|---|---|
| TypeScript target, compiler configuration, API contracts, and code scope | yes | Preserve sound types and compatibility |
references/anti-patterns.md (opens in a new tab)references/build-performance.md (opens in a new tab)references/clean-code-ts.md (opens in a new tab)references/effective-ts-items.md (opens in a new tab)references/error-handling-result.md (opens in a new tab)references/migration-js-to-ts.md (opens in a new tab)references/testing-vitest.md (opens in a new tab)references/tsconfig-production.md (opens in a new tab)references/typescript-design-patterns.md (opens in a new tab)references/typescript-design-patterns/references/skill-deep-dive.md (opens in a new tab)references/typescript-mastery.md (opens in a new tab)references/typescript-mastery/references/generics-and-type-level.md (opens in a new tab)references/typescript-mastery/references/practical-typescript.md (opens in a new tab)references/zod-boundaries.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub peterbamuhigire/chwezi-dev-engine --plugin engineering169 skills in this plugin
/accounting-engineUse when designing or implementing double-entry accounting policy and an embedded ledger engine for invoices, payments, stock, balanced postings, mapped accounts, idempotency, reversals, period locks, audit trails, and financial statements./accounting-finance-controllerUse when coordinating accounting and finance implementation reviews, doctrine routing, control evidence, remediation priorities, and release decisions across a software system./advanced-testing-strategyUse when designing or reviewing test strategy for production systems, APIs, mobile apps, SaaS platforms, ERP workflows, and AI-enabled systems. Covers unit, integration, contract, end-to-end, regression, release-gate, and risk-based testing decisions.Other plugins' skills for the same job