review-duplication
google-gemini/gemini-cli
コードレビューの際には、このスキルを活用して、コードベース内に機能の重複や「車輪の再発明」、あるいは既存のプロジェクトのベストプラクティスや共有ユーティリティの再利用が不十分でないかを、先を見越して調査してください。
...すべて拡張しますレビューの重複
概要
このスキルは、コードレビュー中にコードベースを調査し、重複したロジック、再実装されたユーティリティ、および確立されたパターンの再利用機会の逸失を特定するための体系的なワークフローを提供します。このワークフローを実行することで、新しいコードが既存のプロジェクトアーキテクチャにシームレスに統合されることを保証します。
ワークフロー:重複の調査
コードレビューを行う際は、レビューを完了する前に以下の手順を実行してください:
1. コアロジックの抽出
新しいコードを分析し、導入される中核となるアルゴリズム、ユーティリティ関数、汎用データ構造、または UI コンポーネントを特定します。特定のビジネスロジックにとどまらず、その根底にある仕組みを見極めます。
2. 既存の配置場所を推測し、依存関係を追跡する
もしこの種のコードがプロジェクト内にすでに存在していた場合、どこに配置されるかを検討します。曖昧さを解消するために、リポジトリのルートからの絶対パスを明記してください。
- ユーティリティ:
packages/core/src/utils/、packages/cli/src/utils/ - UIコンポーネント:
packages/cli/src/ui/components/、packages/cli/src/ui/ - サービス:
packages/core/src/services/、packages/cli/src/services/ - 設定:
packages/core/src/config/、packages/cli/src/config/ - コアロジック:機能がReact UI固有のものではない場合は、
packages/core/を指定してください。
サードパーティ依存関係の追跡:PR でユーティリティライブラリ(例:lodash.merge、date-fns)の新しいインポートが導入される場合、プロジェクトが現在そのライブラリをどのように、どこで使用しているかを追跡してください。既存のラッパーや共有ユーティリティが存在する可能性が高いです。
パッケージファイルの確認:複雑なアルゴリズムの独自実装を提案する前に、package.jsonを確認し、この機能を提供する標準ライブラリ(lodashやuuid など)がすでにインストールされていないか確認してください。
3. コードベースの調査(サブエージェントへの委任)
コードベースの調査という重労働は、専門のサブエージェントに委任してください。これらのエージェントは、セッション履歴を肥大化させることなく、詳細な検索や意味的マッピングを実行するように最適化されています。
包括的なレビューを確実に行うためには、ステップ1で発見した「手がかり」をサブエージェントに提供し、極めて具体的な目標を策定することが必須です。
- コードベース調査エージェント:
codebase_investigatorを主要な調査エージェントとして使用します。委任する際は、コードベースに関する具体的かつ調査的な質問を盛り込んだ目的を策定し、以下の検索ベクトルを明示的に含めてください:- 構造的類似性:既存のコードが同じ基盤となるAPIを使用しているかどうかを尋ねます(例:「類似の目的で、既存のコードに
Intl.DateTimeFormatやsetTimeoutを使用しているものはありますか?」)。 - 命名規則:類似した命名パターンを持つ既存のシンボルがあるかどうかを尋ねます(例:「
*Format*や*Debounce*のような命名パターンを持つ既存のシンボルはありますか?」)。 - コメントとドキュメント:プルリクエストのコメントやJSDocに含まれるキーワードが、他の場所で同様の挙動を記述するために使用されていないかを確認する。
- アーキテクチャへの適合性:この種のロジックが現在どこに一元化されているかを確認します(例:「日付フォーマット処理のロジックは、どこに一元化されていますか?」)。
- リファクタリングの指針:最も重要な点として、サブエージェントに対し、見つかった既存のロジックを活用するために、新しいコードをどのようにリファクタリングできるかを説明するよう求めます。
- 構造的類似性:既存のコードが同じ基盤となるAPIを使用しているかどうかを尋ねます(例:「類似の目的で、既存のコードに
- ジェネラリスト・エージェント:詳細でターン数の多い比較には
ジェネラリストを使用します。例:「PR内のMyNewComponentの実装をレビューし、packages/ui/src内のすべてのコンポーネントと意味的に比較してください。拡張したり、代わりに使用したりできる既存のコンポーネントはありますか?」 - 単純な検索にはファストパスを維持する:極めて単純で曖昧さのないチェック(例:「
package.jsonにlodashが含まれているか?」)については、時間を節約するために直接検索を実行します。結論が定まらない「調査」については、デフォルトで委任を行います。
4. ベストプラクティスの評価
新しいコードがプロジェクトの確立された規約に準拠しているか確認する。
- エラー処理:プロジェクトの標準的なエラークラスやロギングメカニズムを使用していますか?
- 状態管理:確立されたストアやコンテキストをバイパスしていないか?
- スタイル:テーマ変数を使用せず、色や余白をハードコーディングしていないか? プルリクエストで新しいパターンが導入されている場合は、文書化された標準と比較し、代わりに既存のプロジェクトパターンを使用すべきだったかどうかを明確に確認してください。
5. 建設的なフィードバックを作成する
PRが既存の機能を重複させている、あるいはベストプラクティスを無視していることが判明した場合は:
- 明確なレビューコメントを記載してください。
- 参照元を特定する:再利用すべき絶対パスまたはプロジェクト相対パス、および具体的なシンボル(関数、コンポーネント、クラス)を明示的に記載してください。
- 実装の指針:タスクの要件を満たすために既存のコードをどのように組み込むかを示す、簡潔なコードスニペットまたは明確な説明を提供してください。
- 価値の説明:既存のコードを再利用することがなぜ有益なのかを簡潔に説明してください(例:保守性、一貫性、組み込みのエッジケース処理など)。
コメント例:
「このプルリクエストでは、新しい
formatDateユーティリティが導入されているようです。src/utils/dateHelpers.tsには、すでに堅牢でテスト済みのformatDate関数が存在します。次のようにインポートすることで、ご自身の実装を置き換えることができます:
import{ formatDate }from '../utils/dateHelpers';// その後、ここで使用します: constdisplayDate =formatDate(userDate,'MMM Do, YYYY');これを再利用することで、日付のフォーマットがアプリケーションの他の部分と一貫性を保ち、タイムゾーンの変換も正しく処理されるようになります。」
このリポジトリのその他の内容
effortgoogle-gemini/gemini-cli指定された課題に対処するために必要な実装工数を推定します。2026-07-07106.2kqualitygoogle-gemini/gemini-cliGitHubの課題がスパムか、空か、追加情報が必要か、あるいは処理を続行しても問題ないかを評価します。2026-07-07 106.2k spec-generatorgoogle-gemini/gemini-cli開発者ワーカーの指針となる、構造化された Workable Spec JSON を生成します。2026-07-07106.2kantigravity-supportgoogle-gemini/gemini-cliユーザーがAntigravity CLIのインストール、設定、または移行に関する質問をしたり、助けを求めたり、手順をリクエストしたりした際に使用します。 このスキルは、Antigravity CLIの公式ドキュメントから取得した、最新の詳細情報、要件、およびコマンドを提供します。2026-06-09106.2kagent-tuigoogle-gemini/gemini-cliメインエージェント:このスキルを直接使用しないでください。 TUI をテストする必要がある場合は、`tui_tester` サブエージェントを呼び出してください。テスト、自動化、および検査のために、ターミナル UI (TUI) アプリケーションをプログラムで操作します。使用場面:CLI/TUI とのやり取りの自動化、ターミナルアプリの回帰テスト、または対話型動作の検証。 また、ユーザーが「agent-tui とは何ですか」、「agent-tui は何をしますか」、「agent-tui のデモをしてください」、「agent-tui を見せてください」、「agent-tui はどのように動作しますか」と尋ねた場合、または実際の動作を確認したい場合にも使用してください。2026-05-18106.2ktui-testergoogle-gemini/gemini-cli ターミナル自動化を使用して Gemini CLI の動作と視覚的出力をテストするための専門家のガイダンス。2026-05-18106.2kReview Duplication
Overview
This skill provides a structured workflow for investigating a codebase during a code review to identify duplicated logic, reinvented utilities, and missed opportunities to reuse established patterns. By executing this workflow, you ensure that new code integrates seamlessly with the existing project architecture.
Workflow: Investigating for Duplication
When reviewing code, perform the following steps before finalizing your review:
1. Extract Core Logic
Analyze the new code to identify the core algorithms, utility functions, generic data structures, or UI components being introduced. Look beyond the specific business logic to see the underlying mechanics.
2. Hypothesize Existing Locations & Trace Dependencies
Think about where this type of code would live if it already existed in the project. Provide absolute paths from the repo root to disambiguate.
- Utilities:
packages/core/src/utils/,packages/cli/src/utils/ - UI Components:
packages/cli/src/ui/components/,packages/cli/src/ui/ - Services:
packages/core/src/services/,packages/cli/src/services/ - Configuration:
packages/core/src/config/,packages/cli/src/config/ - Core Logic: Call out
packages/core/if functionality does not appear React UI specific.
Trace Third-Party Dependencies: If the PR introduces a new import for a utility library (e.g., lodash.merge, date-fns), trace how and where the project currently uses that library. There is likely an existing wrapper or shared utility.
Check Package Files: Before flagging a custom implementation of a complex algorithm, check package.json to see if a standard library (like lodash or uuid) is already installed that provides this functionality.
3. Investigate the Codebase (Sub-Agent Delegation)
Delegate the heavy lifting of codebase investigation to specialized sub-agents. They are optimized to perform deep searches and semantic mapping without bloating your session history.
To ensure a comprehensive review, you MUST formulate highly specific objectives for the sub-agents, providing them with the "scents" you discovered in Step 1.
- Codebase Investigator: Use the
codebase_investigatoras your primary researcher. When delegating, formulate an objective that asks specific, investigative questions about the codebase, explicitly including these search vectors:- Structural Similarity: Ask if existing code uses the same underlying APIs (e.g., "Does any existing code use
Intl.DateTimeFormatorsetTimeoutfor similar purposes?"). - Naming Conventions: Ask if there are existing symbols with similar naming patterns (e.g., "Are there existing symbols with naming patterns like
*Format*or*Debounce*?"). - Comments & Documentation: Ask if keywords from the PR's comments or JSDoc exist in describing similar behavior elsewhere.
- Architectural Fit: Ask where this type of logic is currently centralized (e.g., "Where is centralized date formatting logic located?").
- Refactoring Guidance: Crucially, ask the sub-agent to explain how the new code could be refactored to use any existing logic it finds.
- Structural Similarity: Ask if existing code uses the same underlying APIs (e.g., "Does any existing code use
- Generalist Agent: Use the
generalistfor detailed, turn-intensive comparisons. For example: "Review the implementation ofMyNewComponentin the PR and compare it semantically against all components inpackages/ui/src. Are there any existing components that could be extended or used instead?" - Retain Fast Path for Simple Searches: For extremely simple, unambiguous checks (e.g., "Does
package.jsonincludelodash?"), perform a direct search to save time. Default to delegation for any open-ended "investigations."
4. Evaluate Best Practices
Check if the new code aligns with the project's established conventions.
- Error Handling: Does it use the project's standard error classes or logging mechanisms?
- State Management: Does it bypass established stores or contexts?
- Styling: Does it hardcode colors or spacing instead of using theme variables? If the PR introduces a new pattern, compare it against the documented standards and explicitly confirm if an existing project pattern should have been used instead.
5. Formulate Constructive Feedback
If you discover that the PR duplicates existing functionality or ignores a best practice:
- Provide a clear review comment.
- Identify the Source: Explicitly mention the absolute or project-relative file path and the specific symbol (function, component, class) that should be reused.
- Implementation Guidance: Provide a brief code snippet or a clear explanation showing how to integrate the existing code to fulfill the task's requirements.
- Explain the Value: Briefly explain why reusing the existing code is beneficial (e.g., maintainability, consistency, built-in edge case handling).
Example comment:
"It looks like this PR introduces a new
formatDateutility. We already have a robust, testedformatDatefunction insrc/utils/dateHelpers.ts.You can replace your implementation by importing it like this:
import { formatDate } from '../utils/dateHelpers';// Then use it here: const displayDate = formatDate(userDate, 'MMM Do, YYYY');Reusing this ensures that the date formatting remains consistent with the rest of the application and handles timezone conversions correctly."
More from this repository
effortgoogle-gemini/gemini-cliEstimates the implementation effort required to address the given issue.
2026-07-07106.2kqualitygoogle-gemini/gemini-cliEvaluates whether a GitHub issue is spam, empty, needs more information, or is OK to proceed.
2026-07-07106.2kspec-generatorgoogle-gemini/gemini-cliGenerates a structured Workable Spec JSON to guide a Developer Worker.
2026-07-07106.2kantigravity-supportgoogle-gemini/gemini-cliUse when the user asks questions, seeks help, or requests instructions related to installing, setting up, or migrating to Antigravity CLI. This skill provides the latest up to date details, requirements, and commands sourced from the official Antigravity CLI documentation.
2026-06-09106.2kagent-tuigoogle-gemini/gemini-cliMain Agents: Do NOT use this skill directly. If you need to test the TUI, invoke the `tui_tester` subagent. Drive terminal UI (TUI) applications programmatically for testing, automation, and inspection. Use when: automating CLI/TUI interactions, regression testing terminal apps, or verifying interactive behavior. Also use when: user asks "what is agent-tui", "what does agent-tui do", "demo agent-tui", "show me agent-tui", "how does agent-tui work", or wants to see it in action.
2026-05-18106.2ktui-testergoogle-gemini/gemini-cliExpert guidance for testing Gemini CLI behavior and visual output using terminal automation.
2026-05-18106.2kreview-duplicationをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/google-gemini/gemini-cli/tree/main/.gemini/skills/review-duplication # Copy the skill folder to .claude/skills/ or .codex/skills/
コピー





家
