code-deduplication

Enforce check-before-write policies using a markdown-based capability index.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/AdigunQ/ralph-smart --skill code-deduplication-adigunq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-deduplication
Source: https://github.com/AdigunQ/ralph-smart/tree/main/knowledges/bootstrap_skills/code-deduplication
Command: npx skills add https://github.com/AdigunQ/ralph-smart --skill code-deduplication-adigunq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents the creation of redundant code by ensuring developers check for existing functionality before writing new code, thereby reducing bloat and improving maintainability.

Core Features & Use Cases

  • Capability Index: Maintains a searchable index (CODE_INDEX.md) of existing functions and their purposes.
  • Check-Before-Write Enforcement: Guides developers to search the index and codebase for similar functionality before implementing new code.
  • Code Audit: Provides a process for periodically auditing the codebase for duplication patterns.
  • Use Case: A developer needs to add a date formatting function. Instead of writing a new one, they check CODE_INDEX.md, find an existing formatDate() function, and use or extend it, ensuring consistency.

Quick Start

Use the code-deduplication skill to update the code index by running the update-code-index command.

Frequently Asked Questions about code-deduplication

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent semantic code duplication when generating new functions?

You can prevent code duplication by maintaining a searchable capability index of existing functions, enforcing a check-before-write policy that guides AI agents to search for existing patterns before generating new code.

How does a capability index help identify redundant code patterns?

A capability index identifies redundant code by maintaining a centralized markdown file documenting existing functions and purposes, enabling agents to discover and reuse current implementations instead of generating overlapping logic.

What is the best way to audit a codebase for duplicate functions?

The best way to audit for duplicate functions is to perform periodic codebase reviews cross-referencing against a maintained capability index, utilizing optional vector databases for enhanced semantic searchability to detect overlapping patterns.

Can I use a markdown-based code index with vector databases for refactoring?

Yes, you can integrate a markdown-based code index with optional vector databases for refactoring. This combination enhances semantic searchability across the codebase, helping locate existing functionality before writing new code.

Why should developers check for existing functionality before writing new code?

Developers should check for existing functionality before writing new code to prevent redundant code creation, reduce codebase bloat, and significantly improve long-term maintainability and developer productivity.

When do I need to update the code index during a development workflow?

You need to update the code index during development whenever new functions are added or existing ones are modified, ensuring the capability index accurately reflects the current codebase for future check-before-write searches.