terrylica/cc-skills/code-hardcode-audit

Claude Code and agent skill by terrylica/cc-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Detect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.

Install

npx vskill@latest install terrylica/cc-skills/code-hardcode-audit

SKILL.md

Code Hardcode Audit

Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

When to Use This Skill

Use this skill when the user mentions:

  • "hardcoded values", "hardcodes", "magic numbers"
  • "constant detection", "find constants"
  • "duplicate constants", "DRY violations"
  • "code audit", "hardcode audit"
  • "PLR2004", "semgrep", "jscpd", "gitleaks", "ast-grep", "SSoT violations"
  • "secret scanning", "leaked secrets", "API keys", "bandit", "trufflehog", "whispers"
  • "passwords in code", "credential leaks", "entropy detection"
  • "config file secrets", "hardcoded credentials"

Quick Start

bash
# Preflight — verify all tools installed and configured
uv run --python 3.14 --script scripts/preflight.py -- .
# Full audit (all 9 tools, preflight + both outputs)
uv run --python 3.14 --script scripts/audit_hardcodes.py -- src/
# Individual tools (all respect .gitignore):
# Python credential detection (passwords, tokens, API keys in variable names)
uv run --python 3.14 --script scripts/run_bandit.py -- src/
# Entropy-based secret detection (catches secrets regex can't)
uv run --python 3.14 --script scripts/run_trufflehog.py -- src/
# Config file secrets (YAML, JSON, Dockerfile, .env, .properties)
uv run --python 3.14 --script scripts/run_whispers.py -- src/
# AST-based hardcode detection (numeric args, URLs, paths, sleep)
uv run --python 3.14 --script scripts/run_ast_grep.py -- src/
# Python magic numbers only (fastest)
uv run --python 3.14 --script scripts/run_ruff_plr.py -- src/
# Pattern-based detection (URLs, ports, paths, sleep, circuit breaker)
uv run --python 3.14 --script scripts/run_semgrep.py -- src/
# Env-var coverage audit (BaseSettings cross-reference)
uv run --python 3.14 --script scripts/audit_env_coverage.py -- src/
# Copy-paste detection
uv run --python 3.14 --script scripts/run_jscpd.py -- src/
# Regex-based secret scanning (API keys, tokens, passwords)
uv run --python 3.14 --script scripts/run_gitleaks.py -- src/

Tool Overview

ToolDetection FocusLanguage SupportSpeed
PreflightTool availability + config validationN/AInstant
BanditHardcoded passwords, tokens in Python (B105-7)PythonFast
TruffleHogEntropy-based secret + API verificationAny (file-based)Medium
WhispersConfig file secrets (YAML, JSON, Docker, .env)Config filesMedium
ast-grepHardcoded literals in args, sleep, URLs, pathsMulti-languageFast
Ruff PLR2004Magic value comparisonsPythonFast
SemgrepURLs, ports, paths, credentials, retry configMulti-languageMedium
Env-coverageBaseSettings cross-reference, coverage gapsPythonFast
jscpdDuplicate code blocksMulti-languageSlow
gitleaksRegex-based secrets, API keys, passwordsAny (file-based)Fast

Output Formats

JSON (--output json)
json
{
"summary": {
"total_findings": 42,
"by_tool": { "ruff": 15, "semgrep": 20, "jscpd": 7 },
"by_severity": { "high": 5, "medium": 25, "low": 12 }
},
"findings": [
{
"id": "MAGIC-001",
"tool": "ruff",
"rule": "PLR2004",
"file": "src/config.py",
"line": 42,
"column": 8,
"message": "Magic value used in comparison: 8123",
"severity": "medium",
"suggested_fix": "Extract to named constant"
}
],
"refactoring_plan": [
{
"priority": 1,
"action": "Create constants/ports.py",
"finding_ids": ["MAGIC-001", "MAGIC-003"]
}
]
}
Compiler-like Text (--output text)
src/config.py:42:8: PLR2004 Magic value used in comparison: 8123 [ruff]
src/probe.py:15:1: hardcoded-url Hardcoded URL detected [semgrep]
src/client.py:20-35: Clone detected (16 lines, 95% similarity) [jscpd]
Summary: 42 findings (ruff: 15, semgrep: 20, jscpd: 7)

CLI Options

--output {json,text,both} Output format (default: both)
--tools {all,ast-grep,ruff,semgrep,jscpd,gitleaks,env-coverage,bandit,trufflehog,whispers} Tools to run
--severity {all,high,medium,low} Filter by severity (default: all)
--exclude PATTERN Glob pattern to exclude (repeatable)
--no-parallel Disable parallel execution
--skip-preflight Skip tool availability check

References

Related

  • ADR-0046: Semantic Constants Abstraction
  • ADR-0047: Code Hardcode Audit Skill
  • code-clone-assistant - PMD CPD-based clone detection (DRY focus)

Troubleshooting

IssueCauseSolution
Ruff PLR2004 zero outputPLR2004 globally suppressedRun preflight: uv run --python 3.14 --script scripts/preflight.py -- .
Ruff PLR2004 not foundRuff not installed or olduv tool install ruff or upgrade
ast-grep not foundBinary not installedcargo install ast-grep or brew install ast-grep
Semgrep timeoutLarge codebase scanUse --exclude to limit scope
jscpd memory errorToo many filesIncrease Node heap: NODE_OPTIONS=--max-old-space-size=4096
gitleaks false positivesTest data flaggedAdd patterns to .gitleaks.toml allowlist
Env-coverage missesNot using BaseSettingsOnly detects pydantic BaseSettings; other config patterns skipped
No findings in outputWrong directory specifiedVerify path exists and contains source files
JSON parse errorTool output malformedRun tool individually with --output text
Missing tool in PATHTool not installed globallyRun preflight first, then install missing tools
Bandit false positivespassword = '' in initFilter B105 by confidence: --confidence HIGH
TruffleHog timeoutScanning .venv/node_modulesAll tools respect .gitignore; ensure large dirs are gitignored
TruffleHog regex errorGlob patterns in .gitignoreComplex globs (**/*.rs.bk) are auto-skipped; only simple names used
Whispers slow scanLarge directoriesExclude via .gitignore; whispers config auto-generated from it
Whispers zero findingsNo config files in scopeWhispers targets YAML/JSON/Docker/INI; use on project root, not src/
Severity filter emptyNo findings at that levelUse --severity all to see all findings

Post-Execution Reflection

After this skill completes, check before closing:

  1. Did the command succeed? — If not, fix the instruction or error table that caused the failure.
  2. Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
  3. Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
62
Repository forks
10
7-day trend score
21

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/terrylica/cc-skills/code-hardcode-audit/badge)](https://verified-skill.com/skills/terrylica/cc-skills/code-hardcode-audit)

Something wrong with this skill or its page? Tell us.