Cursor Skill

auto-type-checking

Run TypeScript type checking after file edits and immediately flag type errors before moving on. Uses Cursor hooks for automatic enforcement.

LLM Mart · 0 points · 23 views 1 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download spencerpauly-awesome-cursor-skills-resources_auto-type-checking-99cd265.zip · 1 KB
Part of spencerpauly/awesome-cursor-skills — 65 skills

Install

skills CLI npx skills add https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/auto-type-checking
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install spencerpauly-awesome-cursor-skills@llmmart
Git git clone https://github.com/spencerpauly/awesome-cursor-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole spencerpauly/awesome-cursor-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

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:

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:

{
  "hooks": [
    {
      "event": "afterFileEdit",
      "script": "check-types.sh",
      "pattern": "**/*.{ts,tsx}"
    }
  ]
}

Create .cursor/hooks/check-types.sh:

#!/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
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
Files (awesome-cursor-skills)
  • SKILL.md 1.9 KB
    ---
    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
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related