Skip to content
Back to skills

Ts Strict

ASecurity

Enable TypeScript strict mode and fix the resulting type errors safely

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentstypescriptgoapi

Works with

  • api

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill ts-strict --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ts Strict?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ts Strict
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-ts-strict/badge)](https://www.skillsdirectory.com/skills/black141312-ts-strict)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ts-strict
description: Enable TypeScript strict mode and fix the resulting type errors safely
category: languages
---

# Ts Strict

Use this when turning on `strict` (or its sub-flags) in a TypeScript project that compiled loosely, and you need to clear the error wave without papering over real bugs.

1. Enable flags incrementally in `tsconfig.json`: start with `strictNullChecks`, then `noImplicitAny`, then `strictFunctionTypes`, rather than flipping `strict: true` blind.
2. Run `tsc --noEmit` and triage by file/error code; fix the highest-frequency code (often `TS2532` undefined / `TS7006` implicit any) first.
3. For null/undefined errors, narrow with guards (`if (x == null) return`), optional chaining `?.`, or nullish coalescing `??` — not `!` non-null assertions by default.
4. Replace implicit `any` with real types or `unknown` plus a narrowing check; type function params and exported signatures explicitly.
5. Fix unsafe index access (`noUncheckedIndexedAccess`) by handling the `undefined` case from `arr[i]` and `map[key]`.
6. Re-run `tsc --noEmit` until clean, then commit each flag separately so regressions are bisectable.

## Rules
- Prefer `unknown` over `any` when a type is genuinely open — it forces a check at the use site.
- Use `!` and `as` casts sparingly; each one is a place the compiler can no longer protect you — leave a comment justifying it.
- Don't add `// @ts-ignore`/`// @ts-expect-error` to bulk-clear errors; reserve them for known upstream typing bugs and prefer `@ts-expect-error` so they self-remove when fixed.
- Keep `tsconfig` changes and code fixes in lockstep; turning on a flag without fixing its errors breaks the build for everyone.
- Don't loosen library types you don't own — wrap them in a typed adapter instead.
- Tighten at the edges first (public APIs, I/O boundaries); internal inference often follows for free.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.