
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.
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.
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:
| Stage | Hook | What happens |
|---|---|---|
| Before each write | PreToolUse on Write/Edit/NotebookEdit | The 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 edit | PostToolUse on Write/Edit | A fast syntax/type check runs on that one file. Errors go back to Claude. |
| End of each turn | Stop | Whole-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
| Language | Blocked |
|---|---|
| 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.
| Language | After 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) |
| Python | pyright <file> → fallback python3 compile check | — |
| Rust | — | cargo check (needs Cargo.toml) |
| Go | gofmt -e | go vet ./... (needs go.mod) |
| C / C++ | clang-check -p (only with compile_commands.json) | — |
| Zig | zig 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) |
| PHP | php -l | — |
| Ruby | ruby -c | — |
| Elixir | parse with Code.string_to_quoted! | — |
| Swift | — | swift build (needs Package.swift) |
| Dart | dart analyze <file> | — |
| Lua | luac -p | — |
| Bash / Shell | shellcheck -S warning → fallback bash -n | — |
| Terraform | — | terraform validate in changed, initialized directories |
| R | parse(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:
| Language | Server | Install |
|---|---|---|
| Zig | zls | brew install zls |
| Elixir | elixir-ls | brew install elixir-ls |
| Dart | dart language-server | brew install dart-sdk |
| Bash / Shell | bash-language-server | npm i -g bash-language-server |
| Terraform | terraform-ls | brew install hashicorp/tap/terraform-ls |
| R | languageserver | R -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
| Command | What 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:doctor | Audit installed language servers and compilers. |
Example prompts
- "Fix the type errors in
src/billing.tswithout usinganyor@ts-ignore." - "/hatchlock:optimize the
/ordersendpoint, it's doing one query per line item." - "/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
| Tool | Install | What you get |
|---|---|---|
| Claude Code | claude plugin marketplace add tahmidbintaslim/HatchLock, then claude plugin install hatchlock@hatchlock-marketplace | Everything |
| GitHub Copilot CLI | copilot plugin marketplace add tahmidbintaslim/HatchLock, then copilot plugin install hatchlock@hatchlock-marketplace | Everything |
| Cursor | Cursor Marketplace (pending), or add hatchlock-mcp | Blocking before writes, skills, rules |
| Grok Build | grok plugin marketplace add tahmidbintaslim/HatchLock | Blocking before writes, skills |
| Devin (Windsurf) | devin plugins install tahmidbintaslim/HatchLock | Everything |
| JetBrains Junie | /extensions marketplace add https://github.com/tahmidbintaslim/HatchLock | Everything |
| Google Antigravity | Build with ./scripts/build-antigravity.sh, then agy plugin install dist/antigravity/hatchlock | Blocking before writes, end-of-turn check, skills |
| ChatGPT / Codex | OpenAI plugin directory (skills only) | Skills as guidance |
| Any MCP client (VS Code, Claude Desktop, Cline, Zed, Kiro and others) | hatchlock-mcp | Checks 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
- ⭐ Star the repository
- ☕ Buy Me a Coffee
- 🌐 Tahmid Bin Taslim Rafi
MIT License.
hatchlock-mcpnpm install hatchlock-mcp