code-reuse-enforcement

Enforce discovery of existing constants, enums, and utilities before writing code.

19|2|Updated Dec 1, 2025
One-click install
npx skills add https://github.com/ai-debugger-inc/aidb --skill code-reuse-enforcement
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-reuse-enforcement
Source: https://github.com/ai-debugger-inc/aidb/tree/main/.claude/skills/code-reuse-enforcement
Command: npx skills add https://github.com/ai-debugger-inc/aidb --skill code-reuse-enforcement

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This CRITICAL guardrail ensures developers discover existing constants, enums, and utilities before writing new code, preventing magic strings, duplication, and drift.

Core Features & Use Cases

  • Discovery-First Workflow: Check constants, enums, and utilities before coding.
  • Avoid Magic Strings & Numbers: Replace literals with shared values from constants.
  • Consistent Refactoring: Centralize changes to avoid drift and duplication.

Quick Start

Before writing new code with literals, check the discovery catalog and existing patterns; use the provided references to guide your implementation.

Frequently Asked Questions about code-reuse-enforcement

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent magic strings and code duplication in my codebase?

Magic strings and duplication occur when developers hardcode values instead of using existing constants, enums, or utilities. This Skill enforces discovery-first workflow: check your codebase's constants catalog before writing literals, then substitute shared resources. This centralizes changes, prevents drift, and ensures consistency across modules.

What's the best way to enforce use of constants and enums across a development team?

Enforce reuse by requiring developers to discover existing constants, enums, and utilities before coding. This Skill integrates discovery guidance into your workflow, blocks commits with hardcoded values, and guides feature work and refactors to use shared resources instead of duplicating literals.

How do I set up a discovery-first workflow for constants and utilities?

A discovery-first workflow checks available constants, enums, and utilities before writing new code. This Skill applies this pattern across all development tasks—feature work, refactors, new modules—guiding developers to substitute literals with existing shared resources and preventing duplicate definitions.

Can this approach detect and block hardcoded values in commits?

Yes. This Skill detects hardcoded values and violations of constant/enum usage, then blocks commits when violations are found. It satisfies functional requirements to identify magic strings and enforce substitution with constants or utilities before code is committed.

Why should I centralize constants and utilities instead of allowing inline literals?

Centralized constants and utilities reduce maintenance burden and prevent drift. When a value changes, you update one source instead of hunting through the codebase. This Skill prevents duplication by enforcing discovery before writing, ensuring all developers reference the same shared resources.

Does this work across all modules and file types in a repository?

Yes. This Skill applies discovery-first guidance and hardcoded-value detection across all development tasks in the repository, ensuring consistent enforcement of constant and enum reuse regardless of module or file type.