Project Hardening Audit
Perform a systematic hardening audit of this project. Work through each phase below, exploring the codebase to find real issues — not hypothetical ones. For each finding, explain the risk and suggest a concrete fix.
When to Use
- When user types
/harden
- When user wants to audit a project for security, test coverage, or code quality
- Before making a private repo public
- After a major feature or refactor to check for regressions
- When onboarding to an unfamiliar codebase to assess its health
Process
Step 1: Context Gathering (Phase 0)
Before scanning, ask these questions to calibrate the audit. The user can answer inline or say "skip" to assume worst-case (strictest ratings).
- Visibility — Is this repo private, or could it go public?
- Access — Just you, a team, or open source?
- Deployment — Local only, server, or cloud?
- Compliance — Any regulatory or legal requirements? (government forms, PII rules, HIPAA, etc.)
- Known issues — Areas you already know are problematic? (prioritize or skip)
Use the answers to calibrate severity ratings throughout the audit. For example:
- "Private repo, solo access" — PII in git is medium, not critical
- "Going public" — PII in git is critical
- "Government forms" — output validation is high priority
If the user skips, assume: public visibility, shared access, compliance required.
After calibration, state assumptions:
Based on the answers, tell the user what this audit covers and what it doesn't. For example:
- "Covering: source code, config files, git history, dependencies, test coverage"
- "Not covering: infrastructure, CI/CD pipeline, database security, runtime monitoring"
- "Does this match your expectations, or should I adjust?"
Tailor the scope assumptions to the project. A web app with a Dockerfile gets different assumptions than a CLI tool. Let the user confirm or adjust before proceeding.
Step 2: Audit Scopes
Work through these one at a time. After each scope, summarize findings and ask if the user wants to go deeper or move to the next scope.
Scope 1: Security
- Input validation and output sanitization (including stderr/log leakage)
- Secrets in code, config, and git history (not just current files — check committed history)
- Permission and access control
- Dependency hygiene (pinning, unused deps expanding attack surface, known CVEs)
- File system access patterns (path traversal, unsafe reads/writes)
Scope 2: AI-Specific Gaps
- Prompt injection risks (user input flowing into prompts unsanitized)
- Data exposure through AI context (secrets, PII, or sensitive content visible to the model)
- Access control on AI interfaces (who can invoke the AI, rate limits, cost controls)
- Output validation (does the system verify AI outputs before acting on them?)
- Fragile model assumptions (hardcoded model names, unpinned versions, deterministic output expectations)
Scope 3: Test Coverage
- Map existing test coverage (what has tests, what doesn't)
- Flag high-risk untested code (touches files, network, secrets, user input, money)
- Verify security and AI findings from Scopes 1-2 have test coverage
- Identify missing error path tests (what happens when things fail?)
- Suggest highest-value tests to add first, prioritized by risk
Scope 4: Code Quality
- Linter and formatter configuration (is one configured? If not, recommend one for the language/framework)
- Error handling (silent failures, bare
except, swallowed exceptions)
- Dead code and stale config (unused functions, abandoned imports, orphaned files from refactors)
- Edge cases (empty inputs, nulls, unexpected types, boundary values)
- Consistency (naming, patterns, structure across similar components)
- Network and retry behavior (connection limits, timeout handling, backoff)
- Hardcoded values that should be configurable (paths, filenames, magic numbers)
Scope 5: Decoupling & Data Separation
- Tightly coupled components that should be independent (shared state, circular dependencies, components modifying same files)
- Private or sensitive data committed to the repo (PII, personal content, customer data)
.gitignore coverage for sensitive and generated files
- Environment-specific config committed as if universal
- Data that should live outside the repo (personal content, user-specific state, local config)
- Clear boundaries between framework code and user data
Step 3: Checkpoint Questions
During each scope, if you encounter something ambiguous — ask before rating severity. Only ask questions the codebase can't answer.
Examples:
- "This file has what looks like a real SSN — is this test data or production?"
- "This API key is in a committed file — is this a throwaway/dev key or production?"
- "Two skills modify the same file — is this intentional or a gap?"
If the codebase can answer it, don't ask. If only the user knows, ask.
Do NOT turn the audit into an interview. The skill's strength is autonomous exploration. Reserve questions for decisions that change severity or skip/prioritize a finding.
Step 4: Scorecard
After completing all scopes, present a scorecard with letter grades per scope.
Grading formula:
- Points per finding: Critical = 4, High = 3, Medium = 2, Low = 1
- Any critical finding in a scope = D minimum for that scope (cannot grade above D until critical is resolved)
| Grade |
Points |
| A |
0 |
| B |
1-4 |
| C |
5-9 |
| D |
10-14 |
| F |
15+ |
Overall grade: Average of scope grades (A=4, B=3, C=2, D=1, F=0), rounded.
Step 5: Batch Plan
Propose batches for fixing the findings.
Batching rules:
- Dependencies first — if finding X blocks finding Y, X goes in an earlier batch
- Logical grouping — findings that touch the same files or fix related problems go together
- Severity within batches — higher severity batches come first when no dependency constraint
Step 6: Issue Creation (Optional)
After presenting the batch plan, ask: "Ready to create GitHub issues? I'll file them in batch order."
Only create issues after the user reviews and approves the batches.
Output Format
Scorecard
| Scope | Grade | Findings |
|-------|-------|----------|
| Security | C | 1 critical, 2 high, 1 medium |
| AI | B | 2 high |
| Tests | D | 3 high |
| Code Quality | B | 1 medium, 2 low |
| Decoupling | C | 2 high |
Overall: C
Batch Plan
### Batch 1 — [description] ([count] issues)
Resolves: [finding numbers]
Dependency: [what must be done first, or "None — do this first"]
Effort: [Low / Medium / High]
Rules
- Explore the codebase yourself before asking questions. Read files, check configs, scan for patterns.
- Only flag real issues you find in the code — not theoretical risks.
- Prioritize findings by severity: critical > high > medium > low, calibrated by Phase 0 context.
- The scorecard and batch plan are mandatory outputs. Do not skip them.
Skill created: 2026-04-06
1---2name: harden3description: Audit a software project for hardening — security, AI gaps, test coverage, code quality, and decoupling. Use when user wants to harden a project, audit for vulnerabilities, check test coverage, or separate private data from code.4license: MIT5---67# Project Hardening Audit89Perform a systematic hardening audit of this project. Work through each phase below, exploring the codebase to find real issues — not hypothetical ones. For each finding, explain the risk and suggest a concrete fix.1011## When to Use1213- When user types `/harden`14- When user wants to audit a project for security, test coverage, or code quality15- Before making a private repo public16- After a major feature or refactor to check for regressions17- When onboarding to an unfamiliar codebase to assess its health1819## Process2021### Step 1: Context Gathering (Phase 0)2223Before scanning, ask these questions to calibrate the audit. The user can answer inline or say "skip" to assume worst-case (strictest ratings).24251. **Visibility** — Is this repo private, or could it go public?262. **Access** — Just you, a team, or open source?273. **Deployment** — Local only, server, or cloud?284. **Compliance** — Any regulatory or legal requirements? (government forms, PII rules, HIPAA, etc.)295. **Known issues** — Areas you already know are problematic? (prioritize or skip)3031Use the answers to calibrate severity ratings throughout the audit. For example:32- "Private repo, solo access" — PII in git is medium, not critical33- "Going public" — PII in git is critical34- "Government forms" — output validation is high priority3536If the user skips, assume: public visibility, shared access, compliance required.3738**After calibration, state assumptions:**39Based on the answers, tell the user what this audit covers and what it doesn't. For example:40- "Covering: source code, config files, git history, dependencies, test coverage"41- "Not covering: infrastructure, CI/CD pipeline, database security, runtime monitoring"42- "Does this match your expectations, or should I adjust?"4344Tailor the scope assumptions to the project. A web app with a Dockerfile gets different assumptions than a CLI tool. Let the user confirm or adjust before proceeding.4546### Step 2: Audit Scopes4748Work through these one at a time. After each scope, summarize findings and ask if the user wants to go deeper or move to the next scope.4950#### Scope 1: Security51- Input validation and output sanitization (including stderr/log leakage)52- Secrets in code, config, and git history (not just current files — check committed history)53- Permission and access control54- Dependency hygiene (pinning, unused deps expanding attack surface, known CVEs)55- File system access patterns (path traversal, unsafe reads/writes)5657#### Scope 2: AI-Specific Gaps58- Prompt injection risks (user input flowing into prompts unsanitized)59- Data exposure through AI context (secrets, PII, or sensitive content visible to the model)60- Access control on AI interfaces (who can invoke the AI, rate limits, cost controls)61- Output validation (does the system verify AI outputs before acting on them?)62- Fragile model assumptions (hardcoded model names, unpinned versions, deterministic output expectations)6364#### Scope 3: Test Coverage65- Map existing test coverage (what has tests, what doesn't)66- Flag high-risk untested code (touches files, network, secrets, user input, money)67- Verify security and AI findings from Scopes 1-2 have test coverage68- Identify missing error path tests (what happens when things fail?)69- Suggest highest-value tests to add first, prioritized by risk7071#### Scope 4: Code Quality72- Linter and formatter configuration (is one configured? If not, recommend one for the language/framework)73- Error handling (silent failures, bare `except`, swallowed exceptions)74- Dead code and stale config (unused functions, abandoned imports, orphaned files from refactors)75- Edge cases (empty inputs, nulls, unexpected types, boundary values)76- Consistency (naming, patterns, structure across similar components)77- Network and retry behavior (connection limits, timeout handling, backoff)78- Hardcoded values that should be configurable (paths, filenames, magic numbers)7980#### Scope 5: Decoupling & Data Separation81- Tightly coupled components that should be independent (shared state, circular dependencies, components modifying same files)82- Private or sensitive data committed to the repo (PII, personal content, customer data)83- `.gitignore` coverage for sensitive and generated files84- Environment-specific config committed as if universal85- Data that should live outside the repo (personal content, user-specific state, local config)86- Clear boundaries between framework code and user data8788### Step 3: Checkpoint Questions8990During each scope, if you encounter something ambiguous — **ask before rating severity**. Only ask questions the codebase can't answer.9192Examples:93- "This file has what looks like a real SSN — is this test data or production?"94- "This API key is in a committed file — is this a throwaway/dev key or production?"95- "Two skills modify the same file — is this intentional or a gap?"9697**If the codebase can answer it, don't ask. If only the user knows, ask.**9899Do NOT turn the audit into an interview. The skill's strength is autonomous exploration. Reserve questions for decisions that change severity or skip/prioritize a finding.100101### Step 4: Scorecard102103After completing all scopes, present a scorecard with letter grades per scope.104105**Grading formula:**106- Points per finding: Critical = 4, High = 3, Medium = 2, Low = 1107- **Any critical finding in a scope = D minimum for that scope (cannot grade above D until critical is resolved)**108109| Grade | Points |110|-------|--------|111| A | 0 |112| B | 1-4 |113| C | 5-9 |114| D | 10-14 |115| F | 15+ |116117**Overall grade:** Average of scope grades (A=4, B=3, C=2, D=1, F=0), rounded.118119### Step 5: Batch Plan120121Propose batches for fixing the findings.122123**Batching rules:**1241. **Dependencies first** — if finding X blocks finding Y, X goes in an earlier batch1252. **Logical grouping** — findings that touch the same files or fix related problems go together1263. **Severity within batches** — higher severity batches come first when no dependency constraint127128### Step 6: Issue Creation (Optional)129130After presenting the batch plan, ask: **"Ready to create GitHub issues? I'll file them in batch order."**131132Only create issues after the user reviews and approves the batches.133134## Output Format135136### Scorecard137138```139| Scope | Grade | Findings |140|-------|-------|----------|141| Security | C | 1 critical, 2 high, 1 medium |142| AI | B | 2 high |143| Tests | D | 3 high |144| Code Quality | B | 1 medium, 2 low |145| Decoupling | C | 2 high |146147Overall: C148```149150### Batch Plan151152```153### Batch 1 — [description] ([count] issues)154Resolves: [finding numbers]155Dependency: [what must be done first, or "None — do this first"]156Effort: [Low / Medium / High]157```158159## Rules160161- Explore the codebase yourself before asking questions. Read files, check configs, scan for patterns.162- Only flag real issues you find in the code — not theoretical risks.163- Prioritize findings by severity: critical > high > medium > low, calibrated by Phase 0 context.164- The scorecard and batch plan are mandatory outputs. Do not skip them.165166---167168*Skill created: 2026-04-06*