code-hardcode-audit

Detect hardcoded values, magic numbers, duplicate constants, and leaked secrets in codebases.

62|10|Updated Dec 4, 2025
One-click install
npx skills add https://github.com/terrylica/cc-skills --skill code-hardcode-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-hardcode-audit
Source: https://github.com/terrylica/cc-skills/tree/main/plugins/itp/skills/code-hardcode-audit
Command: npx skills add https://github.com/terrylica/cc-skills --skill code-hardcode-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Hardcoded values, magic numbers, and duplicate code blocks introduce maintenance debt, bugs, and security risks. This skill automates the detection of these issues, ensuring cleaner, more maintainable, and secure codebases.

Core Features & Use Cases

  • Multi-Tool Audit: Orchestrates Ruff (Python magic numbers), Semgrep (URLs, ports, credentials), and jscpd (duplicate code) for comprehensive detection.
  • Actionable Findings: Provides detailed reports in JSON or text format, including suggested fixes and severity levels.
  • Customizable Rules: Allows for rule tuning and exclusion patterns to minimize false positives and focus on critical issues.
  • Use Case: Before a major release or during a refactoring sprint, run this skill to automatically identify and prioritize hardcoded values and code duplication, significantly improving code quality and reducing future bugs.

Quick Start

Run a full hardcode audit on the 'src/' directory. Output the findings in both text and JSON formats.

Frequently Asked Questions about code-hardcode-audit

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

FAQPage Schema
How do I detect hardcoded values and magic numbers in my codebase?

Hardcoded values and magic numbers are detected by orchestrating multiple specialized tools—Ruff for Python magic numbers, Semgrep for credentials and configuration strings, and jscpd for duplicate code blocks. This skill runs these tools across your repository and outputs findings in JSON or text format, identifying lines and severity to prioritize fixes.

Can I audit Python and multi-language repositories for security issues and code duplication?

Yes. This skill applies to both Python-specific and multi-language codebases, using Ruff, Semgrep, jscpd, and gitleaks to detect magic numbers, leaked secrets, URLs, ports, and duplicate code patterns across diverse project types in a single audit run.

What's the best way to identify duplicate constants and prevent DRY violations before release?

Run a comprehensive hardcode audit on your source directories before a major release or refactoring sprint. The skill detects duplicate code blocks, hardcoded values, and magic numbers, then outputs actionable findings with severity levels and suggested fixes to reduce maintenance debt and bugs.

How do I integrate hardcode detection into my CI pipeline?

The skill outputs findings in JSON format designed for CI integration. You can configure rule tuning and exclusion patterns to minimize false positives, then feed the JSON results directly into your pipeline's reporting or gating logic.

Does this tool detect leaked secrets and credential patterns in code?

Yes. Semgrep and gitleaks components identify credentials, API keys, URLs, and port configurations embedded in your codebase. Findings are flagged with severity levels to help you prioritize remediation of the most critical security risks.

Can I customize detection rules to reduce false positives?

Yes. The skill supports rule tuning and exclusion patterns so you can focus audits on critical issues relevant to your project. This minimizes noise and lets you adapt detection to your codebase's conventions and standards.