deduplicate-code

deduplicate-code is a skill for Claude Code, Codex from sponge-b0b/Polaris. It costs 38 tokens per session (446 once invoked), scanned A, original, Apache-2.0.

A code-duplication check that scans for repeated Python blocks and matching token sequences. A token sequence is a run of code elements such as names, operators, and keywords.

In plain words
What is it for?
It is for checking code before refactoring, extracting shared utilities, or adding helper modules. It uses structural and token-based scans to find copied or highly similar code.
Why use it?
It helps reveal existing equivalent logic before someone creates another helper or extracts a utility. It also flags cases where separate components may be trying to own the same business rule.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sponge-b0b/polaris/deduplicate-code
Any agent
npx skills add sponge-b0b/Polaris --skill deduplicate-code
Clone the repo
git clone --depth 1 https://github.com/sponge-b0b/Polaris

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for deduplicate-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/sponge-b0b/polaris/deduplicate-code.svg)](https://agentmods.dev/skills/sponge-b0b/polaris/deduplicate-code)
Your own site
<a href="https://agentmods.dev/skills/sponge-b0b/polaris/deduplicate-code"><img src="https://agentmods.dev/badge/skills/sponge-b0b/polaris/deduplicate-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 446 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00038 $0.00446
Opus 5 $0.00019 $0.00223
Sonnet 5 $0.00008 $0.00089
Haiku 4.5 $0.00004 $0.00045

Measured 4d ago against content hash 58bccdeebbb1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

deduplicate-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/deduplicate-code/SKILL.md · 50 lines

What it actually says

Code Duplication Checks

Objective

Prevent codebase bloat and guard against split-brain logic by identifying existing equivalent code or structural patterns before introducing new helper files or utilities.

Guardrail Constraints

  • Single Source of Truth: Do not create a new helper function, service locator, or wrapper module until existing codebase logic has been explicitly audited and ruled out.
  • Architectural Boundary: Stop immediately if an analysis shows two separate components attempting to claim authoritative ownership over the same business domain or calculation rule.

Execution Steps

Execute these duplication scanning tools over the workspace target paths before mapping out a refactor or utility extraction:

Step 1: Python Native Structural Scan

Run arid to scan recursively for cloned Python blocks:

arid .

Step 2: Token Sequence Scan

Run jscpd across the repository root to catch structural code clones, configuration layer mirroring, or copy-pasted blocks across different layers:

jscpd .

Step 3: Analysis & Consolidation Rule

  • Review the matching lines or token arrays reported by the tooling.
  • If a matching helper sequence already exists in the repository, refactor the active code block to safely inherit or consume the existing canonical interface instead of creating a parallel implementation.

Examples

Example 1: Pre-Refactor Analysis Trigger

User: "I want to extract some utility functions for formatting these metrics before writing the plan." Agent Response: "I am triggering the duplication-checks skill via arid and jscpd to verify if equivalent metrics layout logic already exists in the codebase before we design a new helper module." Agent Execution:

arid .
jscpd .
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 50 lines · 38 tokens per session scan A 58bccdeebbb1

Subscribe to this mod's changes

deduplicate-code is a skill published in the GitHub repository sponge-b0b/Polaris (4 stars, last pushed today), licensed Apache-2.0. It adds 38 tokens to every session and 446 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

nornweave-api

Give AI agents their own email inboxes using the NornWeave API. Use when building email agents, sending/receiving emails programmatically, managing inboxes, retrieving threads, searching messages, or integrating with email providers (Mailgun, SES, SendGrid, Resend). NornWeave provides LLM-ready markdown parsing and…

DataCovey/nornweave · 77 tokens

commit-push

Commit and push the changes made on this chat session to the current branch. Use best practices from Conventional Commits.

DataCovey/nornweave · 27 tokens

commit

Commit the changes made on this chat session to the current branch. Use best practices from Conventional Commits.

DataCovey/nornweave · 23 tokens

hybrid-ralph

Hybrid architecture combining Ralph's PRD format with Planning-with-Files' structured approach. Auto-generates PRDs from task descriptions, manages parallel story execution with dependency resolution, and provides context-filtered agents for efficient multi-story development.

Taoidle/plan-cascade · 52 tokens

mega-plan

Project-level multi-task orchestration system. Manages multiple hybrid:worktree features in parallel with dependency resolution, coordinated PRD generation, and unified merge workflow.

Taoidle/plan-cascade · 35 tokens

planning-with-files

Implements Manus-style file-based planning for complex tasks. Creates taskplan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls. Now with automatic session recovery after /clear and optional Git worktree mode.

Taoidle/plan-cascade · 62 tokens