/code-quality:audit-codebase [category ...] (secrets security dependencies structure tests imports ai-patterns)from code-quality
Scores codebase health across 7 categories (secrets, security, dependencies, structure, tests, imports, AI patterns) with actionable findings and a prioritized progression plan.
Ships in code-quality. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Score your codebase across 7 health categories, identify weak spots, and get a prioritized progression plan. Each category is scored 1-10 with specific, actionable findings.
Scope: Full project, or the categories named in the arguments
You are a senior engineering consultant performing a codebase health assessment. Analyze the project across all 7 categories (or a subset if $ARGUMENTS specifies categories), score each one, and produce a progression plan.
If $ARGUMENTS contains category names (e.g., "secrets security tests"), only audit those categories. Otherwise, audit all 7.
Scan for hardcoded credentials, API keys, and sensitive data in code.
Never print secret values. Keep the cut filters below so that only file:line reaches the transcript. If you open a match to confirm it, report the location and the secret type, and never quote the value.
# API keys and tokens in code
grep -rn --include='*.js' --include='*.ts' --include='*.py' --include='*.go' --include='*.java' --include='*.rb' --include='*.php' --include='*.yaml' --include='*.yml' --include='*.json' --include='*.toml' --include='*.env' --include='*.cfg' --include='*.ini' --include='*.conf' \
-iE '(api[_-]?key|apikey|secret[_-]?key|password|passwd|token|bearer)\s*[=:]\s*["'\''"][^"'\'']{8,}' \
--exclude-dir={node_modules,vendor,.git,dist,build,target,__pycache__,.venv} . 2>/dev/null | cut -d: -f1,2 | head -20
# Known provider patterns
grep -rn -E 'sk-[a-zA-Z0-9]{20,}|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|xox[bps]-[a-zA-Z0-9\-]{20,}' \
--exclude-dir={node_modules,vendor,.git,dist,build,target} . 2>/dev/null | cut -d: -f1,2 | head -10
# .env files committed
find . -name ".env*" -not -name ".env.example" -not -path "*/node_modules/*" -not -path "*/.git/*" -type f 2>/dev/null
# .gitignore coverage
[ -f ".gitignore" ] && {
for pattern in ".env" "*.pem" "*.key" "*.p12"; do
grep -q "$pattern" .gitignore 2>/dev/null && echo "OK: $pattern in .gitignore" || echo "MISSING: $pattern not in .gitignore"
done
}
Scoring:
Check for OWASP-style vulnerabilities and unsafe patterns.
# SQL injection patterns
grep -rn --include='*.js' --include='*.ts' --include='*.py' --include='*.java' --include='*.go' --include='*.rb' --include='*.php' \
-E '(query|execute|exec)\s*\(\s*[`"'\''"].*\+|\$\{|%s|\.format\(' \
--exclude-dir={node_modules,vendor,.git,dist,build,target,test,__test__} . 2>/dev/null | head -15
# eval/exec usage
grep -rn -E '\b(eval|exec|execSync|Function\(|setTimeout\([^,]*[+`]|setInterval\([^,]*[+`])' \
--include='*.js' --include='*.ts' --include='*.py' --exclude-dir={node_modules,vendor,.git,dist} . 2>/dev/null | head -10
# Unsafe deserialization
grep -rn -E '(pickle\.loads|yaml\.load\(|JSON\.parse\(.*user|unserialize\()' \
--exclude-dir={node_modules,vendor,.git,dist} . 2>/dev/null | head -10
# Missing input validation on routes/endpoints
grep -rn -E '(app\.(get|post|put|delete|patch)|router\.(get|post|put|delete))' \
--include='*.js' --include='*.ts' --exclude-dir={node_modules,.git,dist} . 2>/dev/null | wc -l
Scoring:
Audit package health, known CVEs, and freshness.
# Report a missing or silent audit tool instead of returning empty output
run_audit() {
command -v "${1}" >/dev/null 2>&1 || { echo "NOT RUN: ${1} is not installed"; return; }
out=$("$@" 2>&1); rc=$?
printf '%s\n' "$out" | tail -20
echo "'$*' exit status: $rc"
[ -n "$out" ] || { echo "NOT RUN: '$*' printed nothing"; return; }
# A non-zero status means findings or a broken run: only a printed result tells them apart
[ "$rc" -eq 0 ] || printf '%s\n' "$out" | grep -qE '(Found [0-9]+ known vulnerabilit|[0-9]+ vulnerabilit(y|ies) found|affected by [0-9]+ vulnerabilit)' ||
echo "NOT RUN: '$*' failed without printing a vulnerability result"
}
# Node.js audit
[ -f "package-lock.json" ] && { npm audit --json | jq -e '.metadata.vulnerabilities // empty' || echo "NOT RUN: npm audit returned no vulnerability summary"; }
[ -f "package.json" ] && npx npm-check 2>/dev/null | tail -20
# Python
[ -f "requirements.txt" ] && run_audit pip-audit -r requirements.txt
[ -f "pyproject.toml" ] && run_audit pip-audit
# Rust
[ -f "Cargo.toml" ] && run_audit cargo audit
# Go
[ -f "go.mod" ] && run_audit govulncheck ./...
# Lockfile presence
for lockfile in package-lock.json yarn.lock pnpm-lock.yaml Cargo.lock go.sum poetry.lock; do
[ -f "$lockfile" ] && echo "OK: $lockfile exists"
done
[ ! -f "package-lock.json" ] && [ ! -f "yarn.lock" ] && [ ! -f "pnpm-lock.yaml" ] && [ -f "package.json" ] && echo "MISSING: No lockfile for Node.js project"
No result is not a clean result. Count zero CVEs only when an audit printed a vulnerability result that says so. If a tool shows NOT RUN, prints an error instead of a result, or no audit command above covers the project (for example yarn.lock or pnpm-lock.yaml only), mark Dependencies NOT RUN with the reason and give it no score.
Scoring:
Evaluate file organization, naming conventions, and module boundaries.
# File count per top-level directory
for dir in */; do
[ -d "$dir" ] && [ "$dir" != "node_modules/" ] && [ "$dir" != ".git/" ] && [ "$dir" != "vendor/" ] && \
echo "$dir: $(find "$dir" -type f -not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null | wc -l) files"
done
# Deeply nested files (complexity indicator)
find . -type f -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/vendor/*" -mindepth 6 2>/dev/null | head -10
# Mixed naming conventions
find . -type f -name "*_*" -not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null | head -5
find . -type f -name "*-*" -not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null | head -5
# Circular dependency indicators (for JS/TS projects)
[ -f "package.json" ] && npx madge --circular --extensions ts,js src/ 2>/dev/null | head -20
Scoring:
Assess test coverage, test quality, and testing practices.
# Test file count vs source file count
TEST_COUNT=$(find . -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" -o -path "*/test/*" -o -path "*/__tests__/*" \) \
-not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null | wc -l)
SRC_COUNT=$(find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.java" \) \
-not -name "*.test.*" -not -name "*.spec.*" -not -name "test_*" \
-not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" 2>/dev/null | wc -l)
echo "Test files: $TEST_COUNT | Source files: $SRC_COUNT | Ratio: $(echo "scale=2; $TEST_COUNT / ($SRC_COUNT + 1)" | bc)"
# Coverage config presence
for cfg in jest.config.* vitest.config.* .nycrc .coveragerc pytest.ini setup.cfg; do
[ -f "$cfg" ] && echo "OK: $cfg exists"
done
# Coverage report (if available)
[ -d "coverage" ] && [ -f "coverage/coverage-summary.json" ] && cat coverage/coverage-summary.json | jq '.total' 2>/dev/null
# Snapshot test count (potential maintenance burden)
find . -name "*.snap" -not -path "*/node_modules/*" 2>/dev/null | wc -l
Scoring:
Check for unused imports, circular dependencies, and type coverage.
# Unused imports (TypeScript/JavaScript)
# (strict mode does not report unused code; the two noUnused flags do)
if [ -f "tsconfig.json" ]; then
out=$(npx --no-install tsc --noEmit --noUnusedLocals --noUnusedParameters 2>&1); rc=$?
echo "tsc exit status: $rc"
if [ "$rc" -ne 0 ] && ! printf '%s\n' "$out" | grep -q 'error TS'; then
echo "NOT RUN: $out"
else
unused='error TS(6133|6138|6192|6196|6198|6199|6205)'
echo "Unused declarations: $(printf '%s\n' "$out" | grep -cE "$unused")"
printf '%s\n' "$out" | grep -E "$unused" | head -10
echo "Other compiler errors:"
printf '%s\n' "$out" | grep 'error TS' | grep -vE "$unused" | head -10
fi
fi
# TypeScript strict mode
[ -f "tsconfig.json" ] && grep -E '"strict"|"noImplicitAny"|"strictNullChecks"' tsconfig.json 2>/dev/null
# Python unused imports
[ -f "pyproject.toml" ] || [ -f "setup.py" ] && python -m pyflakes . 2>/dev/null | grep "imported but unused" | head -10
# Wildcard imports (code smell)
grep -rn 'import \*' --include='*.py' --include='*.ts' --include='*.js' --exclude-dir={node_modules,vendor,.git} . 2>/dev/null | head -10
If tsc shows NOT RUN, or the other errors show that it could not load the project (configuration errors, no input files), the unused count means nothing: mark Imports NOT RUN. A tsconfig.json that only holds references checks no files; run the command with -p on each referenced config.
Scoring:
Evaluate Claude Code configuration maturity and AI-assisted development readiness.
# CLAUDE.md presence and quality
[ -f "CLAUDE.md" ] && echo "OK: CLAUDE.md exists ($(wc -l < CLAUDE.md) lines)" || echo "MISSING: No CLAUDE.md"
[ -f ".claude/settings.json" ] && echo "OK: .claude/settings.json exists" || echo "MISSING: No .claude/settings.json"
# Skills and legacy commands (a skill is .claude/skills/<name>/SKILL.md)
SKILLS=$(find .claude/skills -maxdepth 2 -name "SKILL.md" 2>/dev/null | wc -l)
echo "Skills: $SKILLS"
COMMANDS=$(find .claude/commands -name "*.md" 2>/dev/null | wc -l)
echo "Legacy commands: $COMMANDS"
# Hooks
HOOKS_CFG=$(grep -c "hooks" .claude/settings.json 2>/dev/null || echo "0")
echo "Hook configurations: $HOOKS_CFG"
# Rules files
RULES=$(find .claude/rules -name "*.md" 2>/dev/null | wc -l)
echo "Rule files: $RULES"
# Agents
AGENTS=$(find .claude/agents -name "*.md" 2>/dev/null | wc -l)
echo "Agent definitions: $AGENTS"
# .gitignore for AI artifacts
grep -q "claude" .gitignore 2>/dev/null && echo "OK: Claude patterns in .gitignore" || echo "INFO: No Claude patterns in .gitignore"
Scoring:
Overall = (Secrets * 0.15) + (Security * 0.15) + (Dependencies * 0.15) +
(Structure * 0.10) + (Tests * 0.15) + (Imports * 0.10) +
(AI Patterns * 0.20)
Round to one decimal place.
A category marked NOT RUN has no score. Leave it out, divide the weighted sum by the total weight of the scored categories, and label the overall score as partial, naming the missing categories.
## Codebase Health Audit
**Project**: [directory name]
**Date**: [timestamp]
**Categories audited**: [all 7 or filtered subset]
### Overall Score: [X.X] / 10
| Category | Score | Weight | Weighted | Key Finding |
|----------|-------|--------|----------|-------------|
| Secrets | X/10 | 15% | X.XX | [one-line summary] |
| Security | X/10 | 15% | X.XX | [one-line summary] |
| Dependencies | X/10 | 15% | X.XX | [one-line summary] |
| Structure | X/10 | 10% | X.XX | [one-line summary] |
| Tests | X/10 | 15% | X.XX | [one-line summary] |
| Imports | X/10 | 10% | X.XX | [one-line summary] |
| AI Patterns | X/10 | 20% | X.XX | [one-line summary] |
| **Overall** | | **100%** | **X.XX** | |
### Detailed Findings
#### 🔴 Critical (fix immediately)
- [Finding with file:line reference and concrete fix]
#### 🟡 Warning (fix this week)
- [Finding with context and suggested approach]
#### 🟢 Info (nice to improve)
- [Observation with optional suggestion]
### Progression Plan
[Based on overall score, show the appropriate tier]
#### Tier 1: Foundation (current score <5, target: 5)
Focus on eliminating critical risks before anything else.
| Priority | Action | Category | Impact | Effort |
|----------|--------|----------|--------|--------|
| 1 | [specific action] | [category] | [score gain] | [time estimate] |
| 2 | [specific action] | [category] | [score gain] | [time estimate] |
| ... | | | | |
#### Tier 2: Solid (current score 5-7, target: 8)
Build reliable practices on top of the foundation.
| Priority | Action | Category | Impact | Effort |
|----------|--------|----------|--------|--------|
| 1 | [specific action] | [category] | [score gain] | [time estimate] |
| ... | | | | |
#### Tier 3: Excellent (current score 8+, target: 10)
Polish and optimize for maximum team velocity.
| Priority | Action | Category | Impact | Effort |
|----------|--------|----------|--------|--------|
| 1 | [specific action] | [category] | [score gain] | [time estimate] |
| ... | | | | |
### Quick Wins (< 30 minutes each)
1. [Action that improves score with minimal effort]
2. [...]
3. [...]
Approximately 70% of findings should be automatable (scripts, linters, CI checks can detect them). Flag the remaining 30% as requiring human judgment, and explain why automation falls short for those cases.
Sources:
$ARGUMENTS
What SKILL.md sets; muted values are Claude Code's defaults
mediumThree short reads, in order
npx claudepluginhub florianbruniaux/claude-code-plugins --plugin code-quality18 skills in this plugin
/ast-grep-patternsStructural code search and refactoring with ast-grep: choose it over Grep, then write tested pattern and YAML rule recipes. Use when renaming calls or changing an API signature across a large codebase, migrating a framework, or finding code by shape (async functions without try/catch, empty catch blocks, long parameter lists). Not for plain text searches, which Grep handles faster./check-cache-bugsAudit Claude Code setup for cache bugs (CC#40524): sentinel, --resume/--continue, attribution header + ArkNill B3/B4/B5/design-patternsDetect, suggest, and evaluate GoF design patterns in TypeScript/JavaScript codebases. Use when refactoring code, applying singleton/factory/observer/strategy patterns, reviewing pattern quality, or finding stack-native alternatives for React, Angular, NestJS, and Vue./diagnoseInteractive troubleshooting assistant for Claude Code issues/eval-skillsAudit a project or library of skills for metadata, trigger boundaries, workflow completion criteria, local resource closure, instruction economy, tool scope, effort, and routing evidence. Use before shipping skills, after importing a skill collection, or when a skill triggers too often or not at all./explainExplain code, concepts, or system behavior with adjustable depth levels2 plugins in one repository ship this exact skill · first indexed Nov 30, 2026
Other plugins' skills for the same job