Skip to content

feat(skills): add prevent-recurrence to turn recurring mistakes into failing checks - #259

Merged
paveg merged 2 commits into
mainfrom
feat/prevent-recurrence
Oct 20, 2026
Merged

paveg merged 2 commits into
mainfrom
feat/prevent-recurrence

Conversation

@paveg

@paveg paveg commented Oct 20, 2026

Copy link
Copy Markdown
Owner

概要

pstack の correct を手元向けに直し、prevent-recurrence スキルとして追加します。繰り返している誤りを種類ごとに洗い出し、その種類を型・lint/CI・テストなど強制できる最も高い段で防ぎます。新しいチェックについては、過去の実際の誤りで赤くなることを確かめるところまでを手順にします。

#255〜#257 で、レビュアーが指摘に encodable タグを付けるようにしました。このスキルは、溜まったタグをはじめとする記録を、実際のチェックに変える側です。

変更内容

  • home/dot_claude/skills/prevent-recurrence/SKILL.md(新規): 明示的に呼んだときだけ動く(disable-model-invocation: true)
    • 材料: git の履歴、PR のレビューコメント、PR 本文の「Encodable findings」節、メモリの feedback 記録、回避策を説明する注意書き
    • 種類として扱うのは 2 回以上起きたものだけ。1 回きりのものは理由を付けて報告に残す
    • 強制の段は、既存の encodable の尺度(architecture > type > lint > test > hook > rule)をそのまま使う。選んだ段より上を使えない理由を 1 行ずつ書く
    • 新しいチェックは、誤りが起きたコミットで赤、現在のツリーで緑になる出力を付ける
  • workflow.md: ユーザーに直されたときに、同じパターンがすでにメモリにあれば /prevent-recurrence を提案する、と既存の 1 行に足した。明示呼び出し専用のスキルは、呼ばれるまで読み込まれないため

pstack から取り込まなかったもの: ルールと強制手段の対応表(手で同期する一覧になるため)と、行ごとの期限付き例外。

検証

このリポジトリで、同じ課題(「繰り返している誤りを見つけて、再発を防いで」)を、スキルなしとスキルありの 2 回、別エージェント(sonnet、使い捨ての worktree)に実行させました。

スキルなし(Red) スキルあり(Green)
作ったもの ルールファイル 3 つと CLAUDE.md の書き換え テスト 1 本と CI チェック 1 本
効くかの証拠 書式チェックだけ 誤りが起きたコミット(8754c10、53ff735)で赤、HEAD で緑
1 回きりの誤り 種類として数えた 理由を付けて除外した
メモリで承認が要るとされた変更 許可なく適用した 適用せずに一覧にした

赤と緑の結果は、エージェントの報告だけでなく、私の手でも再現しました。Green が作った 2 つのチェックは、別の PR で出します。

just fmt-check は exit 0 です。

🤖 Generated with Claude Code

…failing checks

Adapted from pstack's `correct`: gather occurrences from git history, PR review
comments, the PR bodies' Encodable findings, agent memory, and workaround
notes; keep only classes seen at least twice; fix each at the highest level on
the existing encodable scale; and prove every new check fails on a real past
occurrence. The rule-to-enforcer table and the per-line expiry exceptions are
left out.

Red/green on this repo, same task, sonnet, isolated worktree:
- without the skill: three rule files and a CLAUDE.md edit, no check, nothing
  shown failing, single occurrences counted, and a memory-gated change applied
- with it: a profile-render test and a .chezmoiremove check, each red on the
  commits where the mistake happened (8754c10, 53ff735) and green on HEAD

workflow.md's correction bullet now suggests the skill when memory already
holds the same pattern, since an explicit-only skill is not visible otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3a7a3b2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paveg
paveg merged commit e59ab4b into main Oct 20, 2026
12 checks passed
@paveg
paveg deleted the feat/prevent-recurrence branch October 20, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant