code-reuse-enforcement

code-reuse-enforcement is a skill for Claude Code, Codex from ai-debugger-inc/aidb. It costs 41 tokens per session (1,038 once invoked), scanned A, original, Apache-2.0.

A code-review guardrail for AIDB that requires developers to look for existing constants, enums, and utilities before adding new ones. It is designed to prevent duplicated code and hard-coded values, sometimes called magic strings or magic numbers.

In plain words
What is it for?
Use it before writing code that introduces paths, URLs, timeouts, environment variables, statuses, or utility functions, especially across the AIDB codebase.
Why use it?
It keeps shared values in one place and reduces inconsistent behavior. Reusing existing helpers also makes later maintenance easier.

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/ai-debugger-inc/aidb/code-reuse-enforcement
Any agent
npx skills add ai-debugger-inc/aidb --skill code-reuse-enforcement
Clone the repo
git clone --depth 1 https://github.com/ai-debugger-inc/aidb

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 code-reuse-enforcement

README.md
[![agentmods](https://agentmods.dev/badge/skills/ai-debugger-inc/aidb/code-reuse-enforcement.svg)](https://agentmods.dev/skills/ai-debugger-inc/aidb/code-reuse-enforcement)
Your own site
<a href="https://agentmods.dev/skills/ai-debugger-inc/aidb/code-reuse-enforcement"><img src="https://agentmods.dev/badge/skills/ai-debugger-inc/aidb/code-reuse-enforcement.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,038 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.00041 $0.01038
Opus 5 $0.00020 $0.00519
Sonnet 5 $0.00008 $0.00208
Haiku 4.5 $0.00004 $0.00104

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

Security

Grade A, and why

code-reuse-enforcement 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.

.claude/skills/code-reuse-enforcement/SKILL.md · 168 lines

How it starts

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

Code Reuse Enforcement

CRITICAL GUARDRAIL: Discover existing code BEFORE writing new code.

Why This Matters

  • Magic strings scatter across 50 files instead of 1 constant
  • Duplicate utilities create maintenance nightmares
  • Inconsistent values break features silently

The Discovery-First Workflow

BEFORE writing ANY code with literals or utilities:

  1. Check Constants - URLs, paths, timeouts, limits, env var names
  2. Check Enums - States, statuses, types, actions
  3. Check Utilities - Path ops, env reading, file ops, validation

Quick Reference: discovery-catalog.md


Common Violations

Magic Strings

# ❌ BAD
url = "https://ai-debugger.com/support"
log_dir = ".aidb/log"
debug = os.getenv("AIDB_LOG_LEVEL", "INFO")

# ✅ GOOD
from aidb_common.constants import AIDB_BASE_URL
from aidb_common.path import get_aidb_log_dir
from aidb_logging.utils import get_log_level

url = f"{AIDB_BASE_URL}/support"
log_dir = get_aidb_log_dir()
log_level = get_log_level(default="INFO")

Magic Numbers

# ❌ BAD
await asyncio.sleep(0.1)
timeout = 5.0

# ✅ GOOD
from aidb.common.constants import EVENT_POLL_TIMEOUT_S, CONNECTION_TIMEOUT_S

await asyncio.sleep(EVENT_POLL_TIMEOUT_S)
timeout = CONNECTION_TIMEOUT_S

Reimplementing Utilities

# ❌ BAD
def get_bool_env(name: str, default: bool) -> bool:
    value = os.getenv(name)
    return value.lower() in ("true", "1", "yes") if value else default

# ✅ GOOD
from aidb_common.env import read_bool
result = read_bool("AIDB_TRACE", default=False)

String States

# ❌ BAD
if session_state == "running":
    pass

# ✅ GOOD
from aidb_mcp.core.constants import SessionState
if session_state == SessionState.RUNNING:
    pass

Read the full file on GitHub · 168 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 168 lines · 41 tokens per session scan A 2a3aae19c0fe

Subscribe to this mod's changes

code-reuse-enforcement is a skill published in the GitHub repository ai-debugger-inc/aidb (21 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 41 tokens to every session and 1,038 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-30.

Related

Other skills, from other repositories

docs-writer

Write, update, and review Mintlify MDX documentation for Bifrost features. Explores the full codebase (UI, Go backend, config schema), validates config.json examples, places screenshot placeholders, and presents outlines for approval before writing. Invoked with /docs-writer , /docs-writer update , or /docs-writer…

maximhq/bifrost · 83 tokens

e2e-test

Skill "e2e-test" from maximhq/bifrost, covering playwright e2e testing, usage, workflow overview, auto-update workflow (sync mode) and step 0: detect what changed.

maximhq/bifrost · 0 tokens

investigate-issue

Investigate a GitHub issue by fetching details, analyzing the codebase, researching documentation, and presenting an actionable implementation plan with test guidance. Use when asked to investigate, analyze, triage, or plan work for a GitHub issue. Invoked with /investigate-issue or /investigate-issue (prompts for ID).

maximhq/bifrost · 78 tokens

api-validator

Scan Bifrost HTTP controllers/handlers/integrations and validate OpenAPI API coverage, route methods/paths, parameters, request/response docs, and auth/security information. Use when asked to audit missing or incorrect APIs, compare controllers against docs/openapi, validate auth information, or fix API documentation…

maximhq/bifrost · 78 tokens

changelog-writer

Write changelogs for Bifrost releases. Reads git history, bumps module versions following the core→framework→plugins→transport hierarchy, writes transports/changelog.md (enterprise-style) and per-module changelog.md files, and updates version files. Invoked with /changelog-writer or /changelog-writer .

maximhq/bifrost · 73 tokens

resolve-pr-comments-stack

Resolve unresolved PR review comments across an entire Graphite (gt) stack of many PRs, bottom-up, in one working directory. Use when asked to "go through this stack and resolve comments", "clean up review comments across the whole stack", or given a list/range of PR numbers that form (or partially form) a gt stack.…

maximhq/bifrost · 99 tokens