From nuxt-modern-dev
Use when writing or reviewing TypeScript in Vue, Nuxt, Node, or shared TS utilities, fixing type errors, or deciding how to type API responses and composables.
How this skill is triggered — by the user, by Claude, or both
Slash command
/nuxt-modern-dev:typescript-strictThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Baseline:** TypeScript strict mode. Confirm the exact compiler version from the repository lockfile.
Baseline: TypeScript strict mode. Confirm the exact compiler version from the repository lockfile.
| ALWAYS | NEVER |
|---|---|
strict: true in tsconfig | any (use unknown + narrow) |
| Type props, emits, composable returns | Silence errors with @ts-ignore / blanket as any |
Type useFetch / API data | Fake/mock data when the real API fails |
Prefer interface/type for shared shapes | Implicit any parameters |
unknown then narrow, or zod/schema if project already uses itdefineProps<{ ... }>() typedunknown in catch, narrow before use// composable return — named fields, readonly state
export function useCounter(initial = 0) {
const count = ref(initial)
function inc() {
count.value++
}
return { count: readonly(count), inc }
}
// fetch — type the data, handle error state (no mock fallback)
const { data, error, pending } = await useFetch<Item[]>('/api/items')
if (error.value) {
// show error UI — do not invent items
}
// bad
function parse(x: any) {
return x.foo
}
// good
function parse(x: unknown): string {
if (typeof x === 'object' && x && 'foo' in x && typeof (x as { foo: unknown }).foo === 'string') {
return (x as { foo: string }).foo
}
throw new Error('Invalid payload')
}
bun run typecheck
# or
nuxi typecheck
| Excuse | Reality |
|---|---|
| "any is faster" | Breaks refactors; use unknown |
| "I'll fix types later" | Later never; type at the boundary now |
| "Mock data if API fails" | Forbidden — show error state |
any / @ts-ignoretypecheck considered or runnpx claudepluginhub pstuart/pstuart --plugin nuxt-modern-devTypeScript discipline for any JavaScript/TypeScript project (frontend + backend): strict mode, type design, generics, narrowing, error types, module resolution, tsconfig hygiene. Apply when the project has `tsconfig.json` and `typescript` in devDependencies. Stack-agnostic — referenced by every JS/TS framework plugin in the marketplace. Use this skill to: - Write types that catch bugs at compile time, not runtime. - Use generics, conditional types, and discriminated unions correctly. - Avoid `any`, `unknown`, and unsafe casts. - Match the project's tsconfig strictness level. - Type third-party libraries (with @types/* or declaration files). Do NOT use this skill for: - Plain JavaScript projects (no tsconfig.json). - Framework-specific type idioms (React component props, Vue defineProps, Angular signals — those live in framework plugins' own conventions skills). - tRPC/Zod runtime-validation specifics — handled by validation libs at the boundary.
Provides expert knowledge for TypeScript strict mode, type safety, generics, type guards, and avoiding 'any'. References patterns, sharp edges, and validations for creation, diagnosis, and review.
Provides strict TypeScript patterns for type safety, null handling, ESLint configuration, and fixing type errors. Auto-activates on .ts/.tsx files.