ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 ccdwyer

red-squiggle

Claude が直前に編集したファイルを型チェックと lint にかけ、エラーを同じツール結果へ入れる Claude Code モッドです。問題を起こしたステップでモデルが壊れた型を確認できます。

翻訳済み

この mod について

Red Squiggle hook は、成功した Edit または Write のたびに実行され、直前に編集されたファイルの型チェックと lint を行います。エラーは同じツール結果に入るため、モデルは数ターン後にテストが失敗してからではなく、問題を起こした時点でエラーを確認できます。

対応するチェッカー:

  • プロジェクトにある TypeScript(--noEmit --incremental を、そのファイルを含む設定に対して実行し、extends と references を追跡し、--listFiles でファイルがプログラム内にあるか判定)。
  • プロジェクトにある eslint(設定ファイルがある場合だけ実行し、--format json --quiet でエラーだけを報告)。
  • Python ファイルには ruff check --no-fix。

「新しい」エラーだけを報告します。各チェッカーはベースラインを保持してエラーを 1 件ずつ数え、プロジェクトまたはファイルを初めて見たときはベースラインを取得します。表示するのは今回の編集で新しく入ったエラーと、今回の編集で新たに壊れた別ファイルのエラーだけです。出力は引用コンテキストとしてツール結果の後ろに追加され、最大 20 行で、命令ではなくデータとして示されます。ステータスラインにはファイルがクリーンかエラー数が表示されます。チェッカーがない、クラッシュする、タイムアウトする場合(デフォルト 30 秒)は fail-open となり、元の結果を維持します。同じプロジェクトでは一度に 1 つの tsc だけを動かし、プロジェクト探索は repo ルートで止め、何もインストールせず npx に切り替えません。

/config で tsc、eslint、ruff、timeoutSeconds を切り替えられます。インストールは ccdwyer/claude-mods marketplace を追加して red-squiggle を入れます。すべてのチェックはローカルで行われ、ネットワークデータもテレメトリーも送信しません。ライセンスは MIT です。

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add ccdwyer/red-squiggle
claude plugin install red-squiggle
原文 / README

Red Squiggle

Red Squiggle demo

A Claude Code mod that type-checks and lints the file Claude just edited and puts any errors into that same tool result. The model sees broken types on the step that caused them, not three turns later when a test run fails.

Red Squiggle runs after each successful Edit or Write. It skips edits that errored and edits staged for review.

| File | Checker | Notes | |---|---|---| | .ts .tsx .js .jsx .mts .cts .mjs .cjs | the project's own TypeScript (node_modules/typescript/bin/tsc) | Runs --noEmit --incremental on the config whose program contains the file. It reads include, exclude, files, allowJs and checkJs through extends (relative, package and array forms) with real glob matching, and recursively follows references. A file that no glob takes, but that may be in a program through an import, is checked against the nearest config, and --listFiles decides. A build-info file goes under node_modules/.cache/red-squiggle/. | | same | the project's own node_modules/.bin/eslint | Only when an eslint config exists. Runs from that config's folder with --format json --quiet, so it reports errors only. | | .py | ruff check --no-fix | Uses .venv/bin/ruff, then venv/bin/ruff, then ruff on PATH. JSON output. |

  • Only new errors. Red Squiggle keeps a baseline of what each checker reported, counted per error, so a second identical error still shows. The first time it sees a project or file in a session, it takes the baseline just before the edit. If that fails, the first run after the edit becomes the baseline and nothing is reported as new. The model sees errors this edit introduced in the file, plus errors it newly broke in other files (tsc). Errors that were already there are counted, not repeated. Every error in a newly created file counts as new.
  • The output reaches the model as quoted context after the tool result, capped at 20 lines and marked as data, not instructions.
  • The status line shows ✓ file clean, ✗ N errors in file, or how many errors are new in other files. "Clean" means the file was proven to be in the program tsc checked (--listFiles). A file outside every program, or a run cut off before it proves the file was checked, reports nothing rather than "clean". Paths are compared through their real spelling (/tmp vs /private/tmp).
  • Fail-open. If a checker is missing, crashes or times out (default 30 s), or if anything else after the write throws, the edit's result comes back untouched.
  • Only one tsc runs per project at a time. Edits that arrive during a run share a single follow-up run.
  • Project lookups stop at the repository root (.git). It never installs anything or falls back to npx.

Settings

/config lists tsc, eslint and ruff toggles and timeoutSeconds.

Install

/plugin marketplace add ccdwyer/claude-mods
/plugin install red-squiggle@ccdwyer-mods
/reload-plugins

Develop

claude plugin validate .
claude plugin test .

What it hooks

Events this mod hooks, as claude plugin validate reads the module:

  • tool.call

Engine calls it makes: $.fs.exists, $.fs.read (via eslintPlan, readJson), $.fs.stat (via canonical), $.process.run (via run), $.state.get, $.state.set, $.ui.status (via annotate).

A tool.call hook sits in the middle of every tool call: it can see the call, refuse it, or add context to its result. This mod uses that only for the behaviour described above.

Privacy

It runs entirely on your machine. It sends nothing over the network. It runs your project's own tsc, eslint and ruff.

The mod collects no analytics or telemetry, and its author receives no data from it.

Full policy: PRIVACY.md.

License

MIT

関連作品