agentleFS
mindroom-aimindroom-ai/mindroom/.claude/skills/duplication-audit/SKILL.md

duplication-audit

Skill319 starsChanged 58 days agoApache-2.0View on GitHub

Find duplicated functionality across the codebase and propose minimal, safe generalizations.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 15 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep it simple and avoid adding features.

    line 11
  2. Distinctive:

    Read project-specific instructions (AGENTS.md or similar) and follow them.

    line 15
  3. Distinctive:

    Ask a brief clarification if the request is ambiguous (for example: report only vs refactor).

    line 16
  4. Distinctive:

    Look for cross-module patterns: same steps, different files.

    line 35
  5. Distinctive:

    Use fast search tools to find repeated keywords and patterns.

    line 38
  6. Distinctive:

    Check for repeated parsing, IO, validation, or response formatting.

    line 39
  7. Distinctive:

    Avoid over-engineering. If only two call sites exist, keep the helper small.

    line 47
  8. Distinctive:

    Prefer pure functions. Keep IO at the edges.

    line 48
  9. Distinctive:

    If the user asked you to implement changes:

    line 66
  10. Distinctive:

    Keep the public API stable unless explicitly requested.

    line 68
  11. Distinctive:

    Add small comments only when the logic is non-obvious.

    line 69
  12. Very specific:

    Run pytest to verify nothing broke.

    line 71
  13. Distinctive:

    Start with a short summary of the top 1-3 duplications.

    line 75
  14. Distinctive:

    Do not add new features or change behavior beyond deduplication.

    line 82
  15. Distinctive:

    Avoid deep refactors without explicit request.

    line 83
  16. Distinctive:

    If a duplication is better left alone (e.g., clarity, single usage), say so.

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Duplication audit and generalization prompt

You are a coding agent working inside a repository. Your job is to find duplicated functionality (not just identical code) and propose a minimal, safe generalization. Keep it simple and avoid adding features.

First steps

  • Read project-specific instructions (AGENTS.md or similar) and follow them.
  • Ask a brief clarification if the request is ambiguous (for example: report only vs refactor).

Objective

Identify and consolidate duplicated functionality across the codebase. Duplication includes:

  • Multiple functions that parse or validate the same data in slightly different ways
  • Repeated config parsing or data model manipulation
  • Similar external service calls across different modules
  • Near-identical error handling or logging patterns
  • Repeated setup/teardown logic
  • Similar data transforms that can become a shared helper

The goal is to propose a general, reusable abstraction that reduces duplication while preserving behavior. Keep changes minimal and easy to review.

Search strategy

  1. Map the hot paths
  • Scan entry points (CLI, main loops, API handlers) to see what they do repeatedly.
  • Look for cross-module patterns: same steps, different files.
  1. Find duplicate operations
  • Use fast search tools to find repeated keywords and patterns.
  • Check for repeated parsing, IO, validation, or response formatting.
  1. Validate duplication is real
  • Confirm the functional intent matches (not just similar code).
  • Note any subtle differences that must be preserved.
  1. Propose a minimal generalization
  • Suggest a shared helper, utility, or wrapper.
  • Avoid over-engineering. If only two call sites exist, keep the helper small.
  • Prefer pure functions. Keep IO at the edges.

Deliverables

Provide a concise report with:

  1. Findings
  • List duplicated behaviors with file references and a short description of the shared functionality.
  • Explain why these are functionally the same (or nearly the same).
  1. Proposed generalizations
  • For each duplication, propose a shared helper and where it should live.
  • Outline any behavior differences that need to be parameterized.
  1. Impact and risk
  • Note any behavior risks, test needs, or migration steps.

If the user asked you to implement changes:

  • Make only the minimal edits needed to dedupe behavior.
  • Keep the public API stable unless explicitly requested.
  • Add small comments only when the logic is non-obvious.
  • Summarize what changed and why.
  • Run pytest to verify nothing broke.

Output format

  • Start with a short summary of the top 1-3 duplications.
  • Then provide a list of findings, ordered by impact.
  • Include a small proposed refactor plan (step-by-step, no more than 5 steps).
  • End with any questions or assumptions.

Guardrails

  • Do not add new features or change behavior beyond deduplication.
  • Avoid deep refactors without explicit request.
  • Preserve existing style conventions and import rules.
  • If a duplication is better left alone (e.g., clarity, single usage), say so.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.