# Strict Typescript

> Configures and applies strict TypeScript safety (tsconfig flags, ts-reset, narrowing, exhaustive checks). Use this skill when tightening compiler options, eliminating unsafe patterns, or reviewing type-safety gaps. Do not use when/for runtime Zod validation at boundaries (use validation-boundary) or general design review (use design-principles).

- Skill: `jagreehal/strict-typescript` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add jagreehal/strict-typescript`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jagreehal/strict-typescript/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jagreehal (https://skillmd.com/u/jagreehal)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/jagreehal/strict-typescript

---


# Strict TypeScript

## Critical rules

- `strict: true` is the floor. Also enable `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`, `verbatimModuleSyntax`, `erasableSyntaxOnly`, and related unused/fallthrough flags.
- Ban `any` / `as` / non-null assertions in source. Narrow with guards, discriminated unions, or Zod.
- Install `@total-typescript/ts-reset` so `JSON.parse` is `unknown`.
- Prefer `satisfies` and `as const` over loose object typing; avoid barrels and erasable-syntax violations (`enum`, param properties).
- Enforce with `@typescript-eslint/strict-type-checked` at `'error'`.
- Before editing tsconfig or patterns, read [references/tsconfig.md](references/tsconfig.md) and [references/type-patterns.md](references/type-patterns.md).

## Workflow

1. Audit `tsconfig.json` against the required flags in [references/tsconfig.md](references/tsconfig.md).
2. Add `reset.d.ts` importing `@total-typescript/ts-reset`.
3. Enable strict ESLint type-checked rules — see [references/eslint-and-build.md](references/eslint-and-build.md).
4. Replace `as`/`any` with guards, unions, or Zod; brand confusable IDs.
5. Prefer direct imports over barrels; profile with `tsc --extendedDiagnostics` if compile is slow.
6. Confirm `tsc --noEmit` and ESLint pass clean.

## Resources

- [references/tsconfig.md](references/tsconfig.md) — required flags and explanations. Read when configuring.
- [references/type-patterns.md](references/type-patterns.md) — narrowing, ts-reset, type-fest, branded types. Read when fixing unsafe code.
- [references/eslint-and-build.md](references/eslint-and-build.md) — ESLint, barrels, build tools, rationalizations. Read when enforcing in CI.

## Validation

- [ ] Supplementary strict flags all enabled
- [ ] `ts-reset` installed via `reset.d.ts`
- [ ] No `any`/`as` in source (fixtures aside); narrowing is typed
- [ ] `satisfies` / `as const` for literal configs
- [ ] Strict type-checked ESLint rules are `'error'`
- [ ] No hot-path barrel files; `tsc --noEmit` clean

## Constraints

- Prototypes may trade safety for speed; runtime input parsing belongs in `validation-boundary`.
- Related: `pattern-enforcement`, `validation-boundary`, `fn-args-deps`, `result-types`.

