Repository avatar
AI Tools
v1.3.0
active

hatchlock

io.github.tahmidbintaslim/hatchlock

Stops AI code from hiding type errors: flags @ts-ignore/as any and runs your local compilers.

Documentation

HatchLock: stop your AI from hiding type errors.

HatchLock

Stop your AI from hiding type errors.

When an AI coding assistant hits a type error, the quick way out is to tell the type checker to look away: @ts-ignore, as any, # type: ignore. The error is still there. You just can't see it.

HatchLock is a free plugin for Claude Code that closes that way out:

  • It blocks the shortcut before it is written. The AI is told to fix the type instead.
  • It checks each edit with your own compilers, so mistakes are caught while the AI is still working.
  • It leaves your existing code alone. Only new shortcuts are stopped.
  • It runs on your machine. No account, no tracking, nothing sent anywhere.

Website · Report a problem · License: MIT Buy Me A Coffee


Install

claude plugin marketplace add tahmidbintaslim/HatchLock
claude plugin install hatchlock@hatchlock-marketplace

Or run from a local clone:

git clone https://github.com/tahmidbintaslim/HatchLock.git
claude --plugin-dir ./HatchLock

Updating

Third-party marketplaces do not auto-update by default:

claude plugin marketplace update hatchlock-marketplace

How it works

HatchLock checks code at three points:

StageHookWhat happens
Before each writePreToolUse on Write/Edit/NotebookEditThe new text is scanned for escape hatches. If one is found, the write is blocked and Claude is told to fix the type instead.
After each editPostToolUse on Write/EditA fast syntax/type check runs on that one file. Errors go back to Claude.
End of each turnStopWhole-project compilers run once for each language with uncommitted changes. Errors make Claude continue and fix them (at most once per turn, never a loop).

Blocked escape hatches

LanguageBlocked
TypeScript / JS / Vue@ts-ignore, @ts-expect-error, @ts-nocheck, eslint-disable, as any, : any, <any>, Record<string, any>
Python (incl. notebooks)# type: ignore, # pyright: ignore
PHP@phpstan-ignore, @psalm-suppress
Rust#[allow(dead_code)], #[allow(unused…)]
Go//nolint

Only new suppressions are blocked: ones already in the code Claude is editing are left alone. .d.ts declaration files are skipped.

Genuinely need one? Put hatchlock-allow: <reason> on the same line (the reason is required):

// @ts-expect-error hatchlock-allow: asserting this call is a type error

What the hooks run

Everything runs locally with tools you already have installed. A missing tool means that check is skipped, never a failure. No network calls, no telemetry, no data leaves your machine.

LanguageAfter each edit (that file)End of turn (project)
TypeScript / JS / Vue—node_modules/.bin/tsc --noEmit --incremental (needs tsconfig.json; build info kept outside the repo)
Pythonpyright <file> → fallback python3 compile check—
Rust—cargo check (needs Cargo.toml)
Gogofmt -ego vet ./... (needs go.mod)
C / C++clang-check -p (only with compile_commands.json)—
Zigzig ast-check—
Java—javac -Xlint:all on changed files, output to a temp dir (skipped for Maven/Gradle projects)
C#—dotnet build --no-restore (needs *.csproj)
PHPphp -l—
Rubyruby -c—
Elixirparse with Code.string_to_quoted!—
Swift—swift build (needs Package.swift)
Dartdart analyze <file>—
Lualuac -p—
Bash / Shellshellcheck -S warning → fallback bash -n—
Terraform—terraform validate in changed, initialized directories
Rparse(file=…)—
Kotlin—— (no check; kotlinc is too slow for a hook)

Requires jq. Without it, every hook exits silently.


Language servers

HatchLock bundles LSP configs only for languages Anthropic does not ship an official LSP plugin for:

LanguageServerInstall
Zigzlsbrew install zls
Elixirelixir-lsbrew install elixir-ls
Dartdart language-serverbrew install dart-sdk
Bash / Shellbash-language-servernpm i -g bash-language-server
Terraformterraform-lsbrew install hashicorp/tap/terraform-ls
RlanguageserverR -e 'install.packages("languageserver")'

For TypeScript, Python, Rust, Go, C/C++, Java, C#, PHP, Ruby, Swift, Kotlin and Lua, install Anthropic's official plugins, for example:

claude plugin install typescript-lsp@claude-plugins-official

Run /hatchlock:doctor to see what is installed and what to add for the languages in your project (/hatchlock:doctor --all lists every language).

Cloud sessions: Claude Code does not start language servers in cloud sessions. The hooks still run.


Skills

CommandWhat it does
tight-diff (auto)Minimal, surgical changes; LSP lookups before changing signatures; no escape hatches; verify before moving on.
/hatchlock:optimize [target]First-principles performance: N+1 queries, accidental O(N²), memory, LLM prompt/prefix-cache layout.
/hatchlock:architect [feature]Data-first design: schemas and state machines first, then a 3-option trade-off matrix.
/hatchlock:clean [file]Inline single-use abstractions, flatten nesting, remove dead code without behaviour changes.
/hatchlock:doctorAudit installed language servers and compilers.

Example prompts

  1. "Fix the type errors in src/billing.ts without using any or @ts-ignore."
  2. "/hatchlock:optimize the /orders endpoint, it's doing one query per line item."
  3. "/hatchlock:clean lib/report_builder.py, then confirm behaviour is unchanged."

Settings

Disabled languages. HatchLock needs no setup. To turn it off for languages you don't want checked, set HATCHLOCK_DISABLED_LANGUAGES to a comma-separated list in the env block of your Claude Code settings (~/.claude/settings.json, or .claude/settings.json for one project):

{ "env": { "HATCHLOCK_DISABLED_LANGUAGES": "go, rust" } }

Names: typescript, python, rust, go, cpp, zig, java, csharp, php, ruby, elixir, swift, kotlin, dart, lua, shell, terraform, r.

A disabled language skips all three checks: the block before writing, the check after each edit, and the end-of-turn project check.

Enterprise

Organizations that set allowManagedHooksOnly in managed settings disable plugin hooks, including HatchLock's. The skills and language servers still work.

Works with

ToolInstallWhat you get
Claude Codeclaude plugin marketplace add tahmidbintaslim/HatchLock, then claude plugin install hatchlock@hatchlock-marketplaceEverything
GitHub Copilot CLIcopilot plugin marketplace add tahmidbintaslim/HatchLock, then copilot plugin install hatchlock@hatchlock-marketplaceEverything
CursorCursor Marketplace (pending), or add hatchlock-mcpBlocking before writes, skills, rules
Grok Buildgrok plugin marketplace add tahmidbintaslim/HatchLockBlocking before writes, skills
Devin (Windsurf)devin plugins install tahmidbintaslim/HatchLockEverything
JetBrains Junie/extensions marketplace add https://github.com/tahmidbintaslim/HatchLockEverything
Google AntigravityBuild with ./scripts/build-antigravity.sh, then agy plugin install dist/antigravity/hatchlockBlocking before writes, end-of-turn check, skills
ChatGPT / CodexOpenAI plugin directory (skills only)Skills as guidance
Any MCP client (VS Code, Claude Desktop, Cline, Zed, Kiro and others)hatchlock-mcpChecks the agent can call, plus the skills

Only Claude Code has been tested end to end. Copilot installs the plugin (verified). The other hosts are built to their published hook formats; please report anything that doesn't work.

The skills follow the open Agent Skills format, so you can also copy skills/ into any tool that reads .agents/skills/.

Current docs: tight-diff tells the agent to check the docs for the library version your project uses before calling an API. For live docs for every language, also add a docs server such as Context7.

Maintainers: listing steps for every store are in docs/LAUNCH.md.

Website

The landing page lives in site/ (Astro). Design notes are in DESIGN.md and PRODUCT.md.

cd site && npm install && npm run dev

Development

./tests/test-suite.sh
claude plugin validate . --strict

Behaviour tests (uses your Claude credentials, about $0.40 for all cases at 3 runs each):

claude plugin eval . --trust-plugin --allow-tools Write Edit --ablation none

Privacy

HatchLock collects and sends no data. See PRIVACY.md.

Support

Report bugs and ask questions in GitHub Issues.

Inspired by

The tight-diff principles are adapted from Andrej Karpathy's January 2026 post on LLM coding pitfalls. HatchLock is an independent project and is not affiliated with or endorsed by Andrej Karpathy, Anthropic or OpenAI.

☕ Support the project

MIT License.

NPM
hatchlock-mcp
Install Command
npm install hatchlock-mcp
Runtime: npx