review-duplication

tarafından google-gemini

Kod incelemeleri sırasında, kod tabanında yinelenen işlevsellik, yeniden icat edilmiş tekerlekler veya mevcut yapıların yeniden kullanılmaması durumlarını proaktif olarak araştırmak için bu beceriyi kullanın.

npx skills add https://github.com/google-gemini/gemini-cli --skill review-duplication

Review 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_investigator as 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.DateTimeFormat or setTimeout for 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.
  • Generalist Agent: Use the generalist for detailed, turn-intensive comparisons. For example: "Review the implementation of MyNewComponent in the PR and compare it semantically against all components in packages/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.json include lodash?"), 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 formatDate utility. We already have a robust, tested formatDate function in src/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."

google-gemini tarafından daha fazla skill

agent-tui
google-gemini
Main Agents: Do NOT use this skill directly. If you need to test the TUI, invoke the `tui_tester` subagent. Drive terminal UI (TUI) applications…
gemini-api-cli
google-gemini
Gemini API CLI aracını kullanma kılavuzu. Gemini API ile komut satırı üzerinden etkileşim kurmanız, aracıları yönetmeniz veya medya (görseller, …) oluşturmanız gerektiğinde kullanın.
behavioral-evals
google-gemini
Davranışsal değerlendirmeler oluşturma, çalıştırma, düzeltme ve teşvik etme rehberi. Ajan karar mantığını doğrularken, hataları ayıklarken, prompt hatalarını ayıklarken kullanın…
gemini-live-api-dev
google-gemini
Gerçek zamanlı çift yönlü akış, WebSockets üzerinden Gemini ile ses, video ve metin konuşmaları için. Ses giriş/çıkışı (16 kHz PCM), video kareleri, metin ve kesinti yönetimi için ses etkinliği algılamalı otomatik transkripsiyonları destekler. Yerel ses özelliklerini içerir: duygusal diyalog, proaktif ses ve düşünme modu; senkron ve asenkron araç kullanımı için fonksiyon çağrısı; ve Google Search grounding. Oturum yönetimi, bağlam sıkıştırma, devam ettirme ve...
gemini-omni-flash-api
google-gemini
Üretken video düzenleme, metinden videoya, görsel referanslı video oluşturma ve ilk kareden videoya geçiş animasyonları için bu beceriyi kullanın…
gemini-api-dev
google-gemini
Google'ın Gemini modelleriyle uygulamalar geliştirin; çok modlu içerik, fonksiyon çağırma ve yapılandırılmış çıktıları Python, JavaScript, Go ve Java'da destekler. 1M token bağlamıyla mevcut Gemini 3 modellerine (Pro, Flash, Pro Image) erişin; eski Gemini 2.x ve 1.5 modelleri kullanımdan kaldırılmıştır. Metin oluşturma, görüntü/ses/video anlama, fonksiyon çağırma, yapılandırılmış JSON çıktısı, kod yürütme, bağlam önbelleğe alma ve gömme işlemlerini destekler. Resmi SDK'lar mevcuttur: google-genai (Python),...
gemini-interactions-api
google-gemini
Gemini modelleri ve ajanları için sunucu tarafı durumu, akış ve araç orkestrasyonu ile birleşik arayüz. Birden çok güncel modeli (gemini-3-flash-preview, gemini-3-pro-preview, gemini-2.5-flash/pro) ve Deep Research ajanını destekler; kullanımdan kaldırılan model kimliklerini otomatik olarak güncel alternatiflerle değiştirir. previous_interaction_id aracılığıyla konuşma geçmişini sunucuya aktararak manuel geçmiş yönetimi olmadan durum bilgisi olan çok turlu etkileşimler sağlar. Dahili araç orkestrasyonu dahil...
deliver
google-gemini
Özet brifingin kısaltılmış bir sürümünü bir Google Chat veya Slack gelen webhook'una gönderir, böylece günlük çalıştırma kendini teslim eder — webhook yoksa sessizce atlar…