detectar-duplicacao

detectar-duplicacao is a command for Claude Code from luanpdd/kit-mcp. It costs 49 tokens per session (2,179 once invoked), scanned A, original, MIT.

A code-analysis command that finds repeated code patterns and groups similar code across a codebase. It can compare both matching text and similar meaning.

In plain words
What is it for?
Use it to find, rank, and plan extractions for repeated code, including candidates for shared methods or classes.
Why use it?
Duplication makes one change require edits in many places and increases the chance that copies drift apart.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Good fit Use it to find, rank, and plan extractions for repeated code, including candidates for shared methods or classes.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/luanpdd/kit-mcp/detectar-duplicacao
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.

Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp

Made for: Claude Code.

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 detectar-duplicacao

README.md
[![agentmods](https://agentmods.dev/badge/commands/luanpdd/kit-mcp/detectar-duplicacao/github.svg)](https://agentmods.dev/commands/luanpdd/kit-mcp/detectar-duplicacao)
Your own site
<a href="https://agentmods.dev/commands/luanpdd/kit-mcp/detectar-duplicacao"><img src="https://agentmods.dev/badge/commands/luanpdd/kit-mcp/detectar-duplicacao/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for detectar-duplicacao

Your own site · 80×15
<a href="https://agentmods.dev/commands/luanpdd/kit-mcp/detectar-duplicacao"><img src="https://agentmods.dev/badge/commands/luanpdd/kit-mcp/detectar-duplicacao.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,179 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00049 $0.02179
Opus 5 $0.00024 $0.01090
Sonnet 5 $0.00010 $0.00436
Haiku 4.5 $0.00005 $0.00218

Measured 6d ago against content hash 069c00548ff9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

detectar-duplicacao 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 6d 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.

kit/commands/detectar-duplicacao.md · 198 lines

How it starts

The opening of the file, as written. The whole thing — 198 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Invoca o agente shotgun-surgery-detector que aplica a skill legacy-shotgun-surgery. Output: clusters priorizados por (size × frequency × extract feasibility).

Cria/Atualiza:

  • .planning/SHOTGUN-SURGERY.md — clusters detectados, top 10 priorizados, sugestões extract

Após: o user tem lista acionável de candidates a extract method/class para reduzir change points. PR sequence canônica: extract first → modify second.

Exemplos:

/detectar-duplicacao src/                                              # both modes, defaults
/detectar-duplicacao . --mode=syntactic                                # só Feathers original (sem custo IA)
/detectar-duplicacao src/ --threshold 0.90                              # mais conservador
/detectar-duplicacao src/ --min-cluster-size 5                         # só clusters grandes
/detectar-duplicacao src/ --provider=pgvector                          # forçar self-hosted

Pré-requisitos:

  • jscpd disponível para sintática (npm install -g jscpd se não)
  • OPENAI_API_KEY OR pgvector setup para semântica (auto-detect)
  • Node.js 20+ no path para chamadas embeddings

Quando este comando é o caminho:

  • Você sente "estou mudando isso em N lugares" — use detector pra confirmar/quantificar
  • Refactor proposto inclui extract method/class — detector confirma 3+ ocorrências
  • Code review onde reviewer suspeita de DRY violations
  • Pré-requisito para /legacy refactor quando shotgun é a real causa raiz

1. Parsear argumentos

ROOT_DIR=$(echo "$ARGUMENTS" | awk '{print $1}')
THRESHOLD=$(echo "$ARGUMENTS" | grep -oE -- '--threshold [0-9.]+' | awk '{print $2}')
MIN_CLUSTER=$(echo "$ARGUMENTS" | grep -oE -- '--min-cluster-size [0-9]+' | awk '{print $2}')
MIN_BLOCK=$(echo "$ARGUMENTS" | grep -oE -- '--min-block-lines [0-9]+' | awk '{print $2}')
MODE=$(echo "$ARGUMENTS" | grep -oE -- '--mode[= ][^ ]+' | sed 's/--mode[= ]//')
PROVIDER=$(echo "$ARGUMENTS" | grep -oE -- '--provider[= ][^ ]+' | sed 's/--provider[= ]//')
OUTPUT_PATH=$(echo "$ARGUMENTS" | grep -oE -- '--output [^ ]+' | awk '{print $2}')

[ -z "$ROOT_DIR" ]     && ROOT_DIR="."
[ -z "$THRESHOLD" ]    && THRESHOLD="0.85"
[ -z "$MIN_CLUSTER" ]  && MIN_CLUSTER=3
[ -z "$MIN_BLOCK" ]    && MIN_BLOCK=10
[ -z "$MODE" ]         && MODE="both"
[ -z "$PROVIDER" ]     && PROVIDER="auto"
[ -z "$OUTPUT_PATH" ]  && OUTPUT_PATH=".planning/SHOTGUN-SURGERY.md"

if [ ! -d "$ROOT_DIR" ]; then
  echo "ERROR: root_dir não encontrado: $ROOT_DIR"
  exit 1
fi

mkdir -p "$(dirname "$OUTPUT_PATH")"

Read the full file on GitHub · 198 lines

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. 6d ago First seen · 198 lines · 49 tokens per session scan A 069c00548ff9

Subscribe to this mod's changes

detectar-duplicacao is a command published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed 2d ago), licensed MIT. It adds 49 tokens to every session and 2,179 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-09-03.