deduplicate-code
Skill4 starsChanged 3 months agoApache-2.0View on GitHub
Enforces repository-wide duplicate-code discipline, with zero unsuppressed findings by default and candidate-attribution differential causality for ticket/spec verification.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architecture-remediationSkill
- attentionSkill
- classify-docSkill
- codebase-designSkill
- codebase-memory-mcpSkill
- codegraphSkill
- coding-standardsSkill
- contract-ledgerSkill
- conventional-commitsSkill
- database-migrationsSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- format-codeSkill
- github-issue-dependenciesSkill
- graphifySkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- implement-ticketSkill
- improve-codebase-architectureSkill
- project-delivery-managementSkill
- project-trackingSkill
- prototypeSkill
- repowiseSkill
- researchSkill
- resolving-merge-conflictsSkill
- review-architectureSkill
- review-specSkill
- setup-matt-pocock-skillsSkill
- spec-contractSkill
- spec-merge-cleanupSkill
- tddSkill
- teachSkill
- to-adr-docSkill
- to-docSkill
- to-specsSkill
- to-ticketsSkill
- triageSkill
- verify-architectureSkill
- verify-codeSkill
- verify-spec-closureSkill
- verify-specSkill
- verify-ticket-closureSkill
- verify-ticket-decompositionSkill
- wayfinderSkill
- wiki-lintSkill
- wiki-syncSkill
- wiki-synthesizeSkill
- writing-great-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 8 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Before executing this skill, read .agents/skills/deduplicate-code/PROCEDURE.md in full.
- Distinctive: line 19
All retained whole-repository scanner scope, finding classification, consolidation, suppression-merit, migration/test-surface, …
- Very specific: line 26
When delegated by $implement-ticket, ticket-differential receives:
- Very specific: line 43
Run whole-repository candidate scans in the current exact worktree as before.
- Very specific: line 69
When delegated by $verify-spec, the fixed Spec baseline remains immutable lineage and contract history.
- Very specific: line 102
Before applying the retained spec-differential four-state classification, disposition a scanner relation as upstream-inherited when all of …
- Distinctive: line 106
no candidate-attributable scanner configuration or suppression-policy change caused its visibility.
- Very specific: line 130
When delegated by $implement-ticket, this skill has zero authority to modify protected workflow/control-plane or semantic-authority paths.
- Distinctive: line 134
Before classifying or repairing ticket-attributable findings, require:
- Very specific: line 141
Run it again after every deduplication repair batch and before returning control to $implement-ticket.
- Distinctive: line 144
If a candidate-introduced or candidate-expanded duplicate relation can be resolved only by changing a protected path:
- Distinctive: line 147
leave the protected path untouched.
- Distinctive: line 148
do not add a suppression there.
- Distinctive: line 149
do not weaken scanner configuration.
- Very specific: line 156
If the candidate already contains a protected-path mutation, stop immediately.
- Distinctive: line 191
All standalone/default behavior not explicitly overridden here remains unchanged from the retained procedure.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Code Duplication Checks
Authoritative procedure composition
Before executing this skill, read .agents/skills/deduplicate-code/PROCEDURE.md in full.
That file preserves the complete established duplicate-code procedure. This SKILL.md is
the authoritative entrypoint and owns the differential-causality and control-plane
corrections below; on conflict, this file wins.
All retained whole-repository scanner scope, finding classification, consolidation, suppression-merit, migration/test-surface, forbidden-silencing, rerun, and evidence rules remain normative except where this entrypoint explicitly replaces historical-baseline causality.
Ticket-differential uses the Execution Anchor
When delegated by $implement-ticket, ticket-differential receives:
TICKET_BASELINE
immutable historical ticket lineage only
EXECUTION_ANCHOR
exact fetched shared-branch commit admitted before this implementation attempt
candidate
exact working candidate relative to EXECUTION_ANCHORFor ticket-differential, EXECUTION_ANCHOR is the comparison base.
TICKET_BASELINE is not the scanner/differential baseline and must never be used to create
the isolated comparison worktree for the current attempt.
Run whole-repository candidate scans in the current exact worktree as before. Establish
comparison evidence against an isolated read-only EXECUTION_ANCHOR worktree/ref.
A reusable ticket-differential comparison scan is valid only while all of these are unchanged:
- exact
EXECUTION_ANCHOR; - scanner executable/toolchain versions;
- Execution-Anchor Arid/JSCPD configuration and suppression-policy files;
- scan scope/configuration semantics used for the differential comparison.
Interpret the retained four causality states against EXECUTION_ANCHOR:
candidate-introduced
candidate-expanded
baseline-identical
unresolvedHere baseline-identical means identical to the Execution Anchor. Legitimate
shared-branch/prerequisite/workflow changes between historical Ticket baseline and Execution
Anchor are inherited upstream state and cannot become ticket-attributable duplicate debt.
Spec-differential uses the verify-spec attribution manifest
When delegated by $verify-spec, the fixed Spec baseline remains immutable lineage and
contract history. It is not, by itself, the technical-gate causality boundary for a
long-lived Spec branch that has also absorbed upstream/default-branch work.
$verify-spec must first build the current machine attribution manifest with:
python .agents/skills/verify-spec/scripts/verify_spec_attribution.py build \
--repo . \
--default-ref origin/main \
--candidate-ref HEAD \
--output <verify-spec-attribution.json>Require exact:
VERIFY-SPEC ATTRIBUTION: VALIDThe manifest distinguishes:
candidate_attributable_paths
branch-side paths whose exact candidate blob is not current default-branch state
inherited_default_equivalent_paths
branch-side paths whose exact candidate blob equals current default-branch stateWhole-repository Arid/JSCPD scanner scope is unchanged. The attribution manifest changes repair/blocking causality only.
Before applying the retained spec-differential four-state classification, disposition a
scanner relation as upstream-inherited when all of these hold:
- none of the relation's occurrence paths is in
candidate_attributable_paths; - no candidate-attributable scanner configuration or suppression-policy change caused its visibility; and
- the scanner completed normally.
upstream-inherited findings are reported as inherited repository state and do not enter
the $verify-spec repair loop or block Spec PASS. They are not silently called
baseline-identical; retain their actual upstream/default-branch causality.
Any relation touching at least one candidate_attributable_paths entry remains subject to
the retained Spec-baseline correlation and may become candidate-introduced,
candidate-expanded, baseline-identical, or unresolved as appropriate. Operational
scanner/source-processing errors remain blocking regardless of path attribution.
A path that diverges from current default branch is candidate-attributable even when it is a workflow/control-plane path. This rule therefore cannot be used to hide Spec-owned or branch-owned workflow divergence merely because the path is broadly classified as workflow code.
The fixed Spec baseline is still supplied to spec-differential for historical correlation
of the remaining candidate-attributable relations. It must never be used to turn an exact
current default-branch-equivalent path into Spec-attributable duplicate debt.
Protected control-plane boundary
When delegated by $implement-ticket, this skill has zero authority to modify protected
workflow/control-plane or semantic-authority paths. A duplicate finding does not grant such
authority, even when consolidation would otherwise be the preferred repository-wide repair.
Before classifying or repairing ticket-attributable findings, require:
python -m scripts.workflow_candidate_guard check \
--anchor <execution-anchor>Run it again after every deduplication repair batch and before returning control to
$implement-ticket.
If a candidate-introduced or candidate-expanded duplicate relation can be resolved only by changing a protected path:
- leave the protected path untouched;
- do not add a suppression there;
- do not weaken scanner configuration;
- report the relation as blocked by the workflow/control-plane ownership boundary;
- return control to
$implement-ticketfor upstream routing.
The protected path set is owned by scripts.workflow_candidate_guard; this skill must not
redefine, narrow, bypass, or locally override it.
If the candidate already contains a protected-path mutation, stop immediately. The parent
$implement-ticket may use its narrow restoration command to restore those paths exactly to
the Execution Anchor; $deduplicate-code itself does not perform that recovery.
Terminal evidence for ticket-differential
In addition to the retained differential evidence, report:
Ticket baseline: <immutable historical sha>
Execution Anchor: <exact comparison sha>
Differential comparison base: Execution Anchor
Protected control-plane candidate paths: 0A ticket-differential PASS is invalid if the comparison worktree was created from
TICKET_BASELINE, if the supplied Execution Anchor is missing/mismatched, or if any
protected control-plane candidate path remains.
Terminal evidence for spec-differential
In addition to the retained Spec differential evidence, report:
Spec baseline: <immutable historical sha>
Default branch head: <exact attribution-manifest sha>
Candidate head: <exact attribution-manifest sha>
Candidate-attributable paths: <n>
Inherited default-equivalent paths: <n>
Upstream-inherited duplicate findings: <n>A spec-differential PASS is invalid if the attribution manifest does not bind the exact
candidate HEAD or current fetched default-branch head, or if an unresolved relation remains.
All standalone/default behavior not explicitly overridden here remains unchanged from the retained procedure.
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
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.

