Borrowing it
Nothing to install: this file belongs to dancing-bear-show/dancing-bear. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/dancing-bear-show/dancing-bear/main/.claude/skills/optimize-code-reuse/SKILL.mdgit clone --depth 1 https://github.com/dancing-bear-show/dancing-bearWrote 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.
[](https://agentmods.dev/skills/dancing-bear-show/dancing-bear/optimize-code-reuse)<a href="https://agentmods.dev/skills/dancing-bear-show/dancing-bear/optimize-code-reuse"><img src="https://agentmods.dev/badge/skills/dancing-bear-show/dancing-bear/optimize-code-reuse/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.
<a href="https://agentmods.dev/skills/dancing-bear-show/dancing-bear/optimize-code-reuse"><img src="https://agentmods.dev/badge/skills/dancing-bear-show/dancing-bear/optimize-code-reuse.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00042 | $0.00860 |
| Opus 5.5 | $0.00017 | $0.00344 |
| Sonnet 5.5 | $0.00008 | $0.00172 |
| Haiku 4.5 | $0.00004 | $0.00086 |
Grade A, and why
optimize-code-reuse 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Optimize Code — Code Reuse Pass
Delegates to workflows/code/optimize-code.yaml with skip_checks=complexity,coverage,security,arch,
running only the reuse scan dimension. Findings are applied and rechecked automatically.
When to Use
- After implementing a feature to consolidate similar code
- When you notice the same function exists in multiple places
- Pre-PR deduplication check
- User says "reduce duplication", "extract helpers", or "consolidate code"
How to Run
Bootstrap source_root, test_path and domain_slug from context:
source_root: thesrc/<domain>/directory of the files you just wrote or changedtest_path: the correspondingtests/<domain>_tests/directorydomain_slug:source_rootwith/replaced by-(e.g.src-mail); keeps each domain's workspace separatepr_number: optional — if you have an open PR, pass it to scope file detection to that PR's diff
IMPORTANT: Use the /workflow skill — do NOT call ./bin/workflow run --execute directly. It only writes dispatch files and exits (status=pending). The /workflow skill is what actually spawns agents, waits for results, and handles human gates.
Skill(skill="workflow", args="--workflow workflows/code/optimize-code.yaml --params source_root=src/<domain>/ --params test_path=tests/<domain>_tests/ --params domain_slug=src-<domain> --params skip_checks=complexity,coverage,security,arch")
With a PR number:
Skill(skill="workflow", args="--workflow workflows/code/optimize-code.yaml --params pr_number=314 --params source_root=src/<domain>/ --params test_path=tests/<domain>_tests/ --params domain_slug=src-<domain> --params skip_checks=complexity,coverage,security,arch")
What Runs
Focuses on the reuse scan dimension — other dimensions can be added via skip_checks. The workflow runs the full correction and recheck cycle:
- pre-check-auth — verify GitHub and qlty connections
- scan-changed-files — identify .py files changed vs main (or PR diff)
- mps-scan-reuse — shared utility reuse, bare string literals, domain duplicate detection
- mps-collate-findings — collate reuse findings into unified report
- apply-corrections — fix all critical + auto-fixable minor reuse findings
- recheck-lint —
bin/ruff-resolve.sh check+ tests to confirm fixes - human-gate — present reuse summary, ask to commit/open PR
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.
- yesterday First seen · 64 lines · 42 tokens per session scan A d9ccdf6b2c5b
optimize-code-reuse is a skill published in the GitHub repository dancing-bear-show/dancing-bear (7 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 860 once invoked, about $0.0002 per session on Opus 5.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-11-07.
optimize-code-reuse compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| optimize-code-reusedancing-bear-show/dancing-bear | Skill | 7 | yesterday | MIT | A | 42 | Claude Code |
| gogolafkfreund/nixos_config | Skill | 32 | yesterday | GPL-3.0 | A | 125 | Claude Code, Codex |
| google-workspace-authbobmatnyc/claude-mpm | Skill | 158 | 2mo ago | none | A | 22 | Claude Code |
| find-simplificationsQwenLM/qwen-code | Skill | 29k | today | Apache-2.0 | C | 103 | Claude Code, Codex |
| swarm-pr-reviewZaxbyHub/opencode-swarm | Skill | 518 | today | MIT | A | 91 | Claude Code |
| code-reviewjrswab/axe | Skill | 909 | 17d ago | Apache-2.0 | A | 0 | Claude Code, Codex |
| agent-debug-ciNVIDIA/elements | Skill | 115 | yesterday | Apache-2.0 | A | 80 | Claude Code, Codex |