Enforce TypeScript quality standards immediately after writing or modifying .ts/.tsx files. Run type checking and linting on each changed file for instant feedback. Use after creating/editing TypeScript files, or when quality checks, typecheck, lint, or validate are mentioned.
This skill helps maintain TypeScript code quality by running instant checks on each file after it's written or modified.
When activated, this skill ensures TypeScript code meets quality standards by:
pnpm exec tsc --noEmit <file> to ensure zero TypeScript type errorspnpm lint <file> to enforce code style consistencyChecks run on the SPECIFIC FILE that was just written/modified, not the entire project.
Activate this skill:
ZERO TOLERANCE POLICY: No lint errors or type errors are acceptable.
Type Checking - File-scoped typecheck
Linting - File-scoped lint
When this skill is active, follow these steps:
Immediately inform the user that quality checks are running:
🔍 Checking {filename}...
Replace {filename} with the actual file path (e.g., src/utils/auth.ts).
Determine which TypeScript file was just written or modified. This is the file to check.
Execute checks sequentially on the SPECIFIC FILE ONLY:
# Type check the specific file
pnpm exec tsc --noEmit path/to/file.ts
# Lint the specific file
pnpm lint path/to/file.ts
Important:
If all checks pass: Report success clearly:
✓ {filename}: typecheck and lint passed
If any check fails:
✗ {filename}: found N errorsunknown instead of any when the type is truly unknownany without explicit justification in comments@ts-ignore without explanation)@ts-expect-error to suppress valid errorsUser: "Create a new TypeScript component for user authentication"
Actions:
any types🔍 Checking src/components/Auth.tsx...pnpm exec tsc --noEmit src/components/Auth.tsxpnpm lint src/components/Auth.tsx✓ src/components/Auth.tsx: typecheck and lint passedUser: "Update the session processing logic to handle new event types"
Actions:
🔍 Checking packages/session/src/processor.ts...pnpm exec tsc --noEmit packages/session/src/processor.tspnpm lint packages/session/src/processor.ts✓ packages/session/src/processor.ts: typecheck and lint passed✗ packages/session/src/processor.ts: found 2 errors (then show errors)User: Writes a file with type errors
Actions:
🔍 Checking src/utils/helper.ts...pnpm exec tsc --noEmit src/utils/helper.ts✗ src/utils/helper.ts: found 3 errors
src/utils/helper.ts:15:5 - error TS2322: Type 'string' is not assignable to type 'number'.
src/utils/helper.ts:22:10 - error TS2339: Property 'foo' does not exist on type 'User'.
src/utils/helper.ts:35:3 - error TS2345: Argument of type 'null' is not assignable to parameter of type 'string'.
This skill works with pnpm workspace monorepos by checking individual files in their packages.
File-scoped checks work across packages without needing to change directories.
# File-scoped typecheck (fast, targeted)
pnpm exec tsc --noEmit path/to/file.ts
# File-scoped lint
pnpm lint path/to/file.ts
# Both checks in sequence
pnpm exec tsc --noEmit path/to/file.ts && pnpm lint path/to/file.ts
When errors occur:
Always provide actionable information to help fix the errors.
This skill requires projects to have:
The skill uses:
pnpm exec tsc --noEmit <file> for type checkingpnpm lint <file> for linting