#What it does
The /type-strict skill incrementally improves your TypeScript type safety. Instead of flipping strict: true and drowning in 500 errors, it works file-by-file and rule-by-rule -- fixing the easiest wins first, then progressively tightening until your codebase reaches full strictness.
#How to use
bash
/type-strictRun at the project root for a full audit, or target a specific file or directory.
bash
/type-strict src/api/#What it fixes
anytypes -- Replacesanywith proper types inferred from usage, orunknownwith type guards when the type genuinely varies- Missing return types -- Adds explicit return type annotations to exported functions
- Implicit
anyparameters -- Annotates callback parameters and function arguments - Non-null assertions -- Replaces
value!with proper null checks or optional chaining - Type assertions -- Converts unsafe
as Typecasts to type guards or discriminated unions - Loose comparisons -- Flags
==vs===and truthy checks that hide type issues
#Workflow
- Audit -- Scans the codebase and counts type safety violations by category
- Prioritize -- Ranks fixes by impact (API boundaries first, internal helpers last)
- Fix -- Applies safe, automated fixes for straightforward cases
- Flag -- Lists complex cases that need manual review with suggested approaches
- Configure -- Recommends
tsconfig.jsonstrictness flags to enable next
#Example
bash
> /type-strict
## TypeScript Strictness Audit
Current strictness: 62% (14 of 23 strict flags enabled)
### Quick wins (auto-fixable)
- 23 uses of `any` replaceable with concrete types
- 18 exported functions missing return types
- 7 non-null assertions replaceable with optional chaining
### Needs review
- 4 generic `any` in API response handlers (suggest Zod schemas)
- 2 type assertions in test utilities (suggest type guards)
### Recommended next tsconfig flags
1. `noUncheckedIndexedAccess` -- catches undefined array/object access
2. `exactOptionalPropertyTypes` -- distinguishes missing vs undefined
Apply auto-fixes? (23 files affected)