Token导航 LogoToken导航

Agent Skill · 研究检索

code-hardcode-audit(代码 hardcode 审核)

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

code-hardcode-audit 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 32,980。

总安装 2,424周安装 102GitHub Stars 37下载 849核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-hardcode-audit(代码 hardcode 审核)
来源仓库:https://github.com/terrylica/cc-skills
仓库路径:skills/code-hardcode-audit
安装命令:
npx skills add https://github.com/terrylica/cc-skills --skill code-hardcode-audit
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/terrylica/cc-skills --skill code-hardcode-audit

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

code-hardcode-audit 自动检测硬编码值、魔法数字与重复常量,识别潜在的安全与可维护性问题。适用于代码审计、秘密扫描与 DRY 原则合规检查,支持多种工具如 semgrep、gitleaks、ast-grep。输出为详细报告而非直接修改文件,提供替换建议与 SSoT(单一事实来源)违规说明。

涉及密钥或令牌时应先脱敏处理,避免泄露敏感信息;生产环境使用前务必验证最小权限范围。本技能为辅助工具,不能替代人工安全评审,建议结合 CI 流水线定期运行以持续监控风险。

来源仓库内路径:skills/code-hardcode-audit

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/terrylica/cc-skills --skill code-hardcode-audi…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

code-hardcode-audit 怎么安装?

在终端执行 npx skills add https://github.com/terrylica/cc-skills --skill code-hardcode-audit。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

code-hardcode-audit 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

code-hardcode-audit 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

code-hardcode-audit 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

code-hardcode-audit 用的人多吗?

公开数据是累计安装 2,424 次,近一周安装 102 次,下载 849 次,GitHub 37 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

code-hardcode-audit 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
code-hardcode-audit

代码 hardcode 审核 · 本页

2,42437需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

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

# Preflight — verify all tools installed and configured
uv run --python 3.13 --script scripts/preflight.py -- .

# Full audit (all 9 tools, preflight + both outputs)
uv run --python 3.13 --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.13 --script scripts/run_bandit.py -- src/

# Entropy-based secret detection (catches secrets regex can't)
uv run --python 3.13 --script scripts/run_trufflehog.py -- src/

# Config file secrets (YAML, JSON, Dockerfile, .env, .properties)
uv run --python 3.13 --script scripts/run_whispers.py -- src/

# AST-based hardcode detection (numeric args, URLs, paths, sleep)
uv run --python 3.13 --script scripts/run_ast_grep.py -- src/

# Python magic numbers only (fastest)
uv run --python 3.13 --script scripts/run_ruff_plr.py -- src/

# Pattern-based detection (URLs, ports, paths, sleep, circuit breaker)
uv run --python 3.13 --script scripts/run_semgrep.py -- src/

# Env-var coverage audit (BaseSettings cross-reference)
uv run --python 3.13 --script scripts/audit_env_coverage.py -- src/

# Copy-paste detection
uv run --python 3.13 --script scripts/run_jscpd.py -- src/

# Regex-based secret scanning (API keys, tokens, passwords)
uv run --python 3.13 --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)

{
  "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.13 --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.

平台分布

Claude Code

25.01%
按下载量换算212

OpenCode

24.4%
按下载量换算207

Antigravity

17.34%
按下载量换算147

Codex

13.23%
按下载量换算112

Gemini CLI

8.16%
按下载量换算69

windsurf

3.77%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills