feat(claude): 複数プロジェクトの .claude 設定から汎用的な知見を反映する - #64
Merged
Conversation
~/Works/src 配下 113 個の .claude ディレクトリ (node_modules・third_party・ submodule・CTF ベンチマークのノイズを除いた実質 37 個) を精査し、複数プロ ジェクトで独立に観測された汎用パターンのみを chezmoi 側へ反映した。 - permissions.allow に追加: perl, golangci-lint, prek, dprint, actionlint, glab, pkill, nohup, および create-verify skill の運用に必要な `chmod +x .claude/verify.sh` (狭いスコープ限定) - PreToolUse の危険コマンド検知に git clean -f / dropdb / drop database を 追加 (誤検知テスト済み。git branch -D は case-insensitive grep の制約上 git branch -d の誤検知を避けられないため見送り) - debugger agent に根本原因分析の原則を追記 (症状名で犯人を決めない/最初の エラーを主因と即断しない/正常系の終端まで追う/confirmed・hypothesis を 区別する。3 リポジトリで独立に観測された log-investigate 系スキルの共通 パターン) - security-reviewer agent に、AI レビュアー自身を欺くための埋め込み指示 (偽の承認主張・存在しない規約引用など) を検出する観点を追加
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
~/Works/src配下にクローンされている 113 個の.claudeディレクトリ (node_modules・third_party/submodule・CTF ベンチマークのノイズを除いた実質 37 個) を調査し、複数プロジェクトにまたがって独立に観測された汎用パターンのみを chezmoi 管理の Claude Code 設定に反映した。調査は 5 グループ (msageha 個人リポジトリ群 / dope-corp 群 / SakanaAI・EUD-Cloud-Service 群 / SakanaAIBusiness 群 x2) に分けて並列で実施し、各グループには既存の chezmoi 側の permissions.allow・hooks・agents・skills・rules を渡した上で「chezmoi 側に無く汎用的な差分のみ」を抽出させた。プロジェクト固有の API URL・インフラリソース名・社内ライブラリに強く結合した知見は除外している。
変更内容
permissions.allowに追加:perl,golangci-lint,prek,dprint,actionlint,glab,pkill,nohupsettings.local.jsonで個別に許可プロンプトが繰り返し発生していたコマンド (sed/awk の並びに perl、gofmt の並びに golangci-lint、pre-commit の並びに prek/dprint/actionlint、gh の並びに glab、kill/ps/pgrep の並びに pkill/nohup)Bash(chmod +x .claude/verify.sh)を狭いスコープで allow に追加create-verifyskill の手順そのもの (chmod で実行権限を付与) なのに許可されておらず、skill を使うたび毎回プロンプトが発生していたdebuggeragent に根本原因分析の原則を追記log-investigate系スキルで同じパターンが観測されたため採用security-revieweragent に、AI レビュアー自身を欺くための埋め込み指示 (偽の承認主張・存在しない規約引用など、コード内コメントや PR description 経由のプロンプトインジェクション) を検出する観点を追加動作確認
mise run pre-commitが通ったmise run testが通った (42 件全て pass)mise run dry-runで意図した差分のみであることを確認した (secret ファイルを含まない対象に絞ったchezmoi diffで目視確認、secret パターンの混入なし)chezmoi execute-templateでレンダリングした JSON の構文検証、および追加した危険コマンド検知の正規表現をテストケース (新規ブロック対象・既存パターン維持・誤検知しないケース) で個別検証済み補足情報
以下は精査の過程で見つかったが、既存の方針と矛盾する・設計判断を要する・裏付けが 1 リポジトリのみで確信度が低い等の理由で今回は見送った。ユーザー判断が必要な項目として記録する。
chukei-financial-simulationのsafety_gate.pyに同種の保護がある。価値は高いが、Claude Code の permission 評価は deny が allow より常に優先されるため、単純に.env.*パターンを deny に足すと既存の.env.templateallow (プレースホルダのみのテンプレート編集) まで塞いでしまう。安全なパターン設計 (具体的な.envバリアント名の列挙 or PreToolUse hook 側での拡張子除外ロジック) を詰めてから別途対応する方が良いbisectskill の新設 (torchtitan のtorch_bisectを汎用化): 依存リポジトリを bisect して回帰を探すタスクに使える設計だが、1 リポジトリのみでの観測docs-lintagent の新設 (aquarium の doc-source drift 検出、read-only 監査): 同上、1 リポジトリのみplaywrightskill の Golden Rule 「Never waitForTimeout」と文脈が異なるため慎重な書き分けが必要portfolioのjapanese-tech-writing/cognitive-rhythm-writing): 非常に高品質だが書籍原稿執筆に強く最適化されており、ユーザースコープの共通設定として汎用化すべきかは判断が要るcontext: fork+agent: general-purposeの skill frontmatter パターン: 重い生成系 skill を親 context から隔離実行する技法。documentation-writer等への適用は既存 skill の設計変更を伴うため保留