auto-type-checking — Claude Code skill: type checks after every edit
Runs tsc --noEmit after each TypeScript edit and surfaces type errors right away instead of at build time.
npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a claude-codeWhat auto-type-checking does
The skill checks types after the agent touches a .ts or .tsx file. Manually that means running npx tsc --noEmit 2>&1 | head -30 and fixing what shows up before moving on. The automated route uses a Cursor hook in .cursor/hooks.json on the afterFileEdit event, pointing at check-types.sh with the pattern **/*.{ts,tsx}. That script runs npx tsc --noEmit --pretty 2>&1 | head -20 and ends with exit 0, so errors never block the agent — it just reads the output.
What you get back: missing imports (Cannot find name), type mismatches, a property that does not exist on an interface, a possibly null object, an unsatisfied generic constraint. Each one has a fix — add the import, correct the type or the value, extend the interface.
On a large project tsc can be slow, and the skill itself suggests --incremental or checking only changed files. Path aliases break the check when paths in tsconfig.json are wrong. In a monorepo, run tsc from the package root rather than the workspace root. For a fix-until-clean loop the skill points at pairing it with grinding-until-pass.
What it helps with
- catch a type error right after editing a file
- drop a missing import before the build runs
- fix a type mismatch in a function argument
- add a missing property to an interface
- guard a possibly null value with optional chaining
Example prompts for the agent
- check types after that edit
- run tsc --noEmit and show me the first errors
- type-check only the files I changed
How to install auto-type-checking
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a claude-code2Manually: put the files in place
~/.claude/skills/auto-type-checking/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/auto-type-checking/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a codex2Manually: put the files in place
.agents/skills/auto-type-checking/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a cursor2Manually: put the files in place
.cursor/skills/auto-type-checking/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install spencerpauly/awesome-cursor-skills auto-type-checking2Manually: put the files in place
.github/skills/auto-type-checking/SKILL.md1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a gemini-cli2Platform CLI
gemini skills install https://github.com/spencerpauly/awesome-cursor-skills --path resources/auto-type-checkingManually: put the files in place
.devin/skills/auto-type-checking/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about auto-type-checking
How do I install auto-type-checking in Claude?
Run npx skills add spencerpauly/awesome-cursor-skills --skill auto-type-checking -a claude-code. The skill lands at ~/.claude/skills/auto-type-checking/SKILL.md.
What does auto-type-checking do?
It runs a TypeScript type check after every file edit and reports errors while the agent is still on the task.
Do I need Cursor for the automatic mode?
The afterFileEdit hook is described for Cursor via .cursor/hooks.json. Everywhere else you run npx tsc --noEmit yourself.
Source text
SKILL.md · CC0-1.0
---
name: auto-type-checking
description: Run TypeScript type checking after file edits and immediately flag type errors before moving on. Uses Cursor hooks for automatic enforcement.
user-invocable: true
---
# Auto Type Checking
Catch type errors immediately after every edit instead of discovering them at build time.
## Manual Workflow
After editing a TypeScript file, run:
```bash
npx tsc --noEmit 2>&1 | head -30
```
If errors appear, fix them before moving on.
## Automated with Cursor Hooks
Add to `.cursor/hooks.json` to run automatically after every file edit:
```json
{
"hooks": [
{
"event": "afterFileEdit",
"script": "check-types.sh",
"pattern": "**/*.{ts,tsx}"
}
]
}
```
Create `.cursor/hooks/check-types.sh`:
```bash
#!/bin/bash
# Quick type check — only reports errors, doesn't block
npx tsc --noEmit --pretty 2>&1 | head -20
exit 0 # Don't block the agent even if there are errors
```
```bash
chmod +x .cursor/hooks/check-types.sh
```
## What to Check
When type errors appear:
1. **Missing imports**: `Cannot find name 'X'` → add the import
2. **Type mismatches**: `Type 'string' is not assignable to type 'number'` → fix the type or the value
3. **Missing properties**: `Property 'x' does not exist on type 'Y'` → add the property to the interface or fix the access
4. **Null safety**: `Object is possibly 'null'` → add null check or optional chaining
5. **Generic constraints**: `Type 'X' does not satisfy the constraint 'Y'` → fix the generic parameter
## Tips
- Use `--noEmit` to type-check without producing output files
- For large projects, `tsc` can be slow — consider `--incremental` or running only on changed files
- If using path aliases, ensure `tsconfig.json` paths are configured correctly
- For monorepos, run `tsc` from the package root, not the workspace root
- Pair with `grinding-until-pass` for a full "fix until clean" loop
© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills