llm-artifacts-detection について
llm-artifacts-detectionは、LLMコーディングエージェントが生みがちな品質上の問題を探すコードレビュー用スキルです。テスト、デッドコード、抽象化、スタイルを調べ、ファイル位置に基づく根拠付きの指摘を求めます。
主な機能
- 01テスト品質と重複の確認
- 02未使用コードと整理箇所の検出
- 03過剰な抽象化や設定の指摘
- 04冗長または不要な記述の特定
- 05ファイルと行番号に基づく指摘
活用シーン
- 01AIエージェント生成コードのレビュー
- 02反復生成後のコード整理
- 03コードベースの保守性問題の特定
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ existential-birds/ beagle --skill llm-artifacts-detectionインストール後、Claude Code で/llm-artifacts-detectionを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
references/abstraction-criteria.mddead-code-criteria.mdstyle-criteria.mdtests-criteria.md詳細
LLM 生成コードの問題パターン検出
LLM コーディングエージェントが持ち込み、コード品質を低下させる一般的なパターンを検出して報告します。
検出カテゴリ
| カテゴリ | 参照先 | 主な問題 |
|---|---|---|
| テスト | references/tests-criteria.md | DRY 原則への違反、ライブラリのテスト、モックの境界 |
| デッドコード | references/dead-code-criteria.md | 未使用コード、TODO/FIXME、後方互換性のための不要なコード |
| 抽象化 | references/abstraction-criteria.md | 過剰な抽象化、コピー&ペーストによる乖離、過剰な設定項目 |
| スタイル | references/style-criteria.md | 明白なコメント、過剰な防御的コード、不要な型 |
エージェント向けプロンプト
検出に特化したエージェントを起動するには、以下のプロンプトを使用します。
テストエージェント
Analyze the test files for LLM-introduced test quality issues:
1. **DRY Violations**: Look for setup/teardown code repeated across multiple test functions instead of using fixtures or shared helpers. Flag patterns like:
- Identical object creation in multiple tests
- Repeated mock configurations
- Copy-pasted database setup
2. **Library Testing**: Identify tests that validate standard library or framework behavior rather than application code. Signs:
- No imports from the application codebase
- Testing built-in functions or third-party library methods
- Assertions about stdlib behavior
3. **Mock Boundaries**: Flag mocking that's too deep or too shallow:
- Too deep: Mocking internal implementation details, private methods
- Too shallow: Mocking at the wrong layer, missing integration points
- Wrong level: Unit test mocks in integration tests or vice versa
For each issue found, report: [FILE:LINE] ISSUE_TITLE
デッドコードエージェント
Scan the codebase for dead code and cleanup opportunities:
1. **Unused Code**: Find functions, classes, and variables with no references:
- Functions never called
- Classes never instantiated
- Module-level variables never read
- Unreachable code after returns
2. **TODO/FIXME Comments**: Flag all TODO, FIXME, HACK, XXX comments that indicate incomplete work
3. **Backwards Compat Cruft**: Look for patterns suggesting removed features:
- Variables renamed with _unused, _old, _deprecated suffixes
- Re-exports only for backwards compatibility
- Comments like "# removed", "# legacy", "# deprecated"
- Empty functions/classes kept "for compatibility"
4. **Orphaned Tests**: Tests for code that no longer exists:
- Test files with no corresponding source
- Test functions testing deleted features
For each issue found, report: [FILE:LINE] ISSUE_TITLE
抽象化エージェント
Review the codebase for over-engineering introduced by LLM agents:
1. **Over-Abstraction**: Identify unnecessary abstraction layers:
- Wrapper classes that just delegate to one method
- Interfaces/protocols with only one implementation
- Abstract base classes with single concrete class
- Factory functions that always return the same type
2. **Copy-Paste Drift**: Find 3+ similar code blocks that should be parameterized:
- Nearly identical functions with minor variations
- Repeated patterns that could be a single function with parameters
- Similar class methods across multiple classes
3. **Over-Configuration**: Flag configuration for non-configurable things:
- Feature flags that are never toggled
- Environment variables always set to one value
- Config options with no production variation
- Overly generic code for single use case
For each issue found, report: [FILE:LINE] ISSUE_TITLE
スタイルエージェント
Check for verbose LLM-style patterns that reduce code clarity:
1. **Obvious Comments**: Comments that restate what the code clearly does:
- "# increment counter" above counter += 1
- "# return the result" above return result
- Docstrings that repeat the function name
2. **Over-Documentation**: Excessive documentation on trivial code:
- Full docstrings on simple getters/setters
- Parameter descriptions for obvious args
- Return value docs for self-evident returns
3. **Defensive Overkill**: Unnecessary defensive programming:
- try/except around code that cannot fail
- Null checks on values that can't be null
- Type checks after type hints guarantee the type
- Validation of already-validated inputs
4. **Unnecessary Type Hints**: Type hints that add no value:
- Type hints on obvious literal assignments
- Redundant hints on variables immediately clear from context
- Over-annotated internal/local variables
For each issue found, report: [FILE:LINE] ISSUE_TITLE
ゲート(報告)
指摘が推測ではなく証拠に基づくものになるよう、以下の順に実行します。これは review-verification-protocol スキルの反作話ゲートを検出側に適用したものです。すべての [FILE:LINE] は、このターンで新たに読み込んだバッファからそのまま引用する必要があり、ブランチ名、ディレクトリ、記憶から推測してはいけません。
- 位置の確認 — 開いたバッファ、
read_file、または同等の方法でFILEとLINEを設定します。古い検索スニペットだけに頼ってはいけません。合格条件:LINEがFILEの範囲内にあり、説明する問題がその行または隣接する行に表示されていること。 - タイトル —
ISSUE_TITLEには、修正案ではなく、欠陥を平易な言葉で(短い一文程度に)記述します。合格条件:FILEをLINEの位置で開いた人が、タイトルが当てはまる理由を確認できること。 - 重複排除 — 最終出力の前に、同じ
FILE:LINEと根本原因を共有する行を統合します。合格条件: その位置における個別の欠陥ごとに、[FILE:LINE] ISSUE_TITLEが最大 1 件であること。
使用方法
- AI 生成コードをレビューするときに、このスキルを読み込みます。
- エージェントがサブエージェントに対応している場合は、検出カテゴリごとに 1 つずつ並列で割り当てます。 対応していない場合は、カテゴリを順番に自分で確認し、同じ形式の
[FILE:LINE] ISSUE_TITLE指摘を作成します。 - 詳細な基準や例については、参照ファイルを使用します。
- 上記の**ゲート(報告)**を適用してから、指摘を
[FILE:LINE] ISSUE_TITLEの形式で出力します。
適用する場面
- AI コーディングエージェントが書いたコードのクリーンアップ
- 生成後のコードレビュー
- AI による反復生成で増えたコードの肥大化の抑制
- 保守性を損なうパターンの特定
コメント
Markdown 対応