skills/typescript-strict/SKILL.md
TypeScript strict typing patterns and best practices. ALWAYS use when the user mentions "any type", "type error", "ts-ignore", "type guard", "unknown type", "zod schema", "type safety", "erreur de type", "typage strict". Provides patterns for avoiding `any`, proper use of `unknown`, type guards, and Zod validation.
npx skillsauth add devattom/.claude typescript-strictInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
NEVER use these - they defeat TypeScript's purpose:
| Type | Why it's bad | What to do instead |
|------|--------------|---------------------|
| any | Disables all type checking | Use proper types or unknown with type guards |
| as any | Type assertion escape hatch | Fix the underlying type issue |
| @ts-ignore | Silences compiler errors | Fix the type error properly |
| @ts-expect-error | Only acceptable with explanation | Prefer fixing the actual issue |
unknownUse unknown ONLY when:
// WRONG - using any
function process(data: any) { return data.value; }
// CORRECT - using unknown with type guard
function process(data: unknown) {
if (isValidData(data)) {
return data.value;
}
throw new Error('Invalid data');
}
// Type guard function
function isValidData(data: unknown): data is { value: string } {
return typeof data === 'object' && data !== null && 'value' in data;
}
neverUse never ONLY for:
function handleStatus(status: 'pending' | 'done' | 'error'): string {
switch (status) {
case 'pending': return 'Waiting...';
case 'done': return 'Complete!';
case 'error': return 'Failed';
default:
const _exhaustive: never = status;
throw new Error(`Unhandled status: ${_exhaustive}`);
}
}
as const// Let inference work - no need to annotate
const count = 0; // inferred as number
const items = ['a', 'b']; // inferred as string[]
// Explicitly type function signatures
function calculateTotal(items: CartItem[]): number {
return items.reduce((sum, item) => sum + item.price, 0);
}
// Use const for literal types
const CONFIG = {
apiUrl: 'https://api.example.com',
timeout: 5000,
} as const;
For external data, use Zod for runtime validation:
import { z } from 'zod';
const UserSchema = z.object({
id: z.string().uuid(),
email: z.string().email(),
name: z.string().min(1),
});
type User = z.infer<typeof UserSchema>;
// Safe parsing with runtime validation
function parseUser(data: unknown): User {
return UserSchema.parse(data);
}
Ensure these are enabled:
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"exactOptionalPropertyTypes": true
}
}
development
Use when you want to audit a project wiki for quality issues — stale version claims, contradictions between pages, orphan pages, broken wiki links, missing cross-references, or misalignment between wiki content and the actual codebase state.
development
Systematic error debugging with analysis, solution discovery, and verification
development
Structured adversarial debate between AI councillors using Agent Teams to evaluate ideas, plans, or decisions. ALWAYS use when the user says "council", "debate this", "evaluate this idea", "challenge my plan", "stress-test", "devil's advocate", "multiple perspectives", "évaluer cette idée", "débattre", "challenger mon plan", "tester cette décision", or when the user wants rigorous multi-perspective analysis of a proposal, architecture decision, or strategic choice. Each councillor (visionary, critic, pragmatist, innovator, ethicist, domain expert) represents a distinct perspective and they challenge each other through cross-examination and peer exchange, producing a nuanced verdict (PROCEED / PROCEED WITH CONDITIONS / RECONSIDER / DO NOT PROCEED). Do NOT use for divergent brainstorming or idea generation — use workflow-brainstorm instead.
testing
Automated CI/CD pipeline fixer - watches CI, fixes errors locally, commits, and loops until green. Use when CI is failing and you want to automatically fix and verify changes.