Security Audit Skill
You perform a comprehensive security audit of the current codebase. The audit consists of three phases: Analysis, Epic creation, and PDF report generation.
Scope: $ARGUMENTS (default: full – all categories). Possible restrictions: docker, api, auth, dependencies, config, network.
Language: Parse $ARGUMENTS for a lang=XX parameter (e.g. lang=de, lang=fr). Default language is English. If a lang parameter is found, produce ALL output (epics, PDF report content, section headings, findings, summary) in the specified language. The lang parameter can be combined with a scope, e.g. /security-audit docker lang=de.
Phase 1 – Analysis
Examine the codebase systematically across these categories:
1.1 Analysis Categories
| Category |
What to check |
| Source Code |
Injection vulnerabilities (SQL, Command, SSRF, XSS), insecure deserialization, missing input validation, hardcoded secrets, insecure crypto |
| Authentication & Authorization |
Token handling, session management, missing auth checks, token leakage (logs, errors), credential storage |
| Docker & Containers |
Root user, unnecessary packages, missing security options (read_only, no-new-privileges, cap_drop), secret handling, base image currency |
| CI/CD Pipeline |
Secret exposure in logs, missing image scans, insecure registry configuration, missing SAST/DAST |
| Dependencies |
Known CVEs (check package.json/requirements.txt/go.mod etc.), outdated packages, unnecessary dependencies |
| Configuration |
Missing TLS enforcement, open CORS, missing rate limits, insecure defaults, missing security headers |
| Network & Transport |
Cleartext transmission, missing timeouts, unlimited body sizes, DNS rebinding |
1.2 Procedure
- Read
CLAUDE.md, README.md, package.json (or equivalent) for project overview
- Search
src/ (or main source directory) recursively
- Check
Dockerfile, docker-compose*.yml, .gitlab-ci.yml, .github/workflows/
- Check configuration files (
.env*, config.*, etc.)
- Check
package-lock.json/yarn.lock/go.sum for known vulnerable versions
1.3 Finding Classification
Classify each finding by severity:
| Severity |
Criteria |
Prefix |
| CRITICAL |
Directly exploitable, Remote Code Execution, credential theft, full compromise |
C1, C2, ... |
| HIGH |
Exploitable with preconditions, significant impact, data loss possible |
H1, H2, ... |
| MEDIUM |
Defense-in-depth gap, best-practice violation with concrete risk |
M1, M2, ... |
| LOW |
Hardening measure, minimal direct impact, improvement suggestion |
L1, L2, ... |
For each finding document:
- ID and title
- File and line (where possible)
- Description of the problem
- Current code (relevant excerpt)
- Recommended fix with concrete code suggestion
- OWASP Top 10 mapping (if applicable)
- CWE number (consult the references.md in this skill directory)
1.4 Positive Findings
Also document what is already well implemented. Examples:
- Existing input validation
- Correct secret handling
- Security headers present
- Dependency management up to date
Phase 2 – Create or Update Epics
Create or update one epic per severity level with concrete tickets in docs/epics/:
2.1 Existing Epics – Read First
Before creating or modifying epics, check if docs/epics/epic-security-*.md files already exist. If they do:
- Read all existing epic files to understand previously documented findings
- Compare each existing ticket against the current analysis results
- Update each ticket according to these rules:
- Fixed issue: Mark the ticket as
✓ RESOLVED. Add a **Resolution:** section describing what was done. Check off the acceptance criteria. NEVER delete the ticket.
- Still open (unchanged): Keep the ticket as-is
- Worsened or changed: Re-evaluate the ticket. Update the description, severity, affected code, and recommended fix. Add a
**Re-evaluation ([Date]):** note explaining what changed. If severity changed, move the ticket to the appropriate epic file (and leave a cross-reference in the old location)
- New finding: Add as a new ticket with the next available ID
- NEVER delete any ticket or finding – resolved issues serve as audit trail
- Set the epic Status to
closed when all tickets within it are resolved
2.2 Epic Structure
For each severity level (where findings exist) create a file:
docs/epics/epic-security-critical.md – Critical findings
docs/epics/epic-security-high.md – High findings
docs/epics/epic-security-medium.md – Medium findings
docs/epics/epic-security-low.md – Low findings
2.3 Epic Format
# Epic: Security Hardening – [Severity] Findings
**Status:** open | closed
**Priority:** [CRITICAL/HIGH/MEDIUM/LOW]
**Source:** Security Audit, [Date]
## Description
[1-2 sentence summary]
---
## Tickets
### [Epic-Nr].[Ticket-Nr] – [Title]
**File:** `[Path]`
**Finding:** [ID] – [Short description]
**Current Code ([File]:[Lines]):**
\`\`\`[language]
[code]
\`\`\`
**Required Changes:**
1. [Concrete instruction with code example]
2. [...]
---
### [Epic-Nr].[Ticket-Nr] – [Title] ✓ RESOLVED
**File:** `[Path]`
**Finding:** [ID] – [Short description]
**Resolution:** [What was done to fix the issue]
---
## Acceptance Criteria
- [ ] [Testable criterion 1]
- [x] [Resolved criterion]
2.4 Rules for Epics
- Every ticket must reference file and line
- Every ticket must contain concrete fix code (not just "should be fixed")
- Acceptance criteria must be testable (e.g. "Request with X returns Y")
- Cross-reference tickets when fixes overlap
- Order within an epic: by effort/impact descending
- NEVER delete tickets or findings – they are part of the audit trail
- Resolved tickets stay in the epic with their resolution documented
Phase 3 – Generate PDF Report
Generate a professional security audit report as PDF.
3.1 Procedure
Read the HTML template from this skill directory: report-template.html
Read the references from this skill directory: references.md
Populate the template with the audit results (replace the placeholder comments). Set the <html lang="..."> attribute to the active language code (e.g. en, de, fr)
Create the output directory docs/security-audit/ if it does not exist
Determine the output filename. Use the timestamp format YYYY-MM-DD-HHmmSS (current date and time):
- First audit (no existing PDF in
docs/security-audit/): [projectname]-security-audit-YYYY-MM-DD.pdf
- Subsequent reviews (an audit PDF already exists):
[projectname]-security-review-YYYY-MM-DD-HHmmSS.pdf
This keeps the original audit as baseline and creates timestamped reviews alongside it for traceability.
Write the populated HTML file to docs/security-audit/[filename].html
Detect the platform and resolve the Chrome binary path:
- macOS:
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
- Linux:
google-chrome-stable or google-chrome (whichever is found in PATH)
- Windows (WSL/Git Bash):
"/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" or "C:\Program Files\Google\Chrome\Application\chrome.exe"
If Chrome is not found, inform the user and skip PDF generation (epics and summary are still produced).
Convert via Chrome headless to PDF:
<resolved-chrome-path> \
--headless --disable-gpu --no-sandbox \
--print-to-pdf="docs/security-audit/[filename].pdf" \
--print-to-pdf-no-header \
"docs/security-audit/[filename].html"
Delete the temporary HTML file
3.2 Report Content
The report must contain:
- Title page – Project name, audit date, auditor (Claude Code), overall rating
- Executive Summary – 3-5 sentence summary for management
- Scoring – Overall score as rating (A/B+/B/C/D) based on:
- A: No critical/high findings, max 2 medium
- B+: No critical, max 2 high, few medium
- B: No critical, several high
- C: 1-2 critical or many high
- D: Multiple critical findings
- Findings table – All findings with ID, severity, title, OWASP/CWE
- Detailed findings – Per finding: description, affected code, recommendation
- Positive findings – What is already well implemented
- Risk matrix – Likelihood vs. impact grid
- References – OWASP, CWE, NIST references (from references.md)
3.3 Score Ring
Calculate the score as percentage:
Score = 100 - (Critical * 20) - (High * 10) - (Medium * 4) - (Low * 1)
Score = max(0, min(100, Score))
Mapping:
- 90-100: A (dark green)
- 75-89: B+ (green)
- 60-74: B (yellow)
- 40-59: C (orange)
- 0-39: D (red)
Output
At the end of the audit show a summary:
Security Audit completed.
Result: [Rating] ([Score]/100)
- Critical: [n] findings
- High: [n] findings
- Medium: [n] findings
- Low: [n] findings
- Positive: [n] findings
Generated files:
- docs/epics/epic-security-critical.md (if findings exist)
- docs/epics/epic-security-high.md (if findings exist)
- docs/epics/epic-security-medium.md (if findings exist)
- docs/epics/epic-security-low.md (if findings exist)
- docs/security-audit/[projectname]-security-audit-YYYY-MM-DD.pdf (first audit)
- docs/security-audit/[projectname]-security-review-YYYY-MM-DD-HHmmSS.pdf (subsequent reviews)
1---2name: security-audit3description: Comprehensive security audit with findings classification, epic generation, and PDF report4---56# Security Audit Skill78You perform a comprehensive security audit of the current codebase. The audit consists of three phases: Analysis, Epic creation, and PDF report generation.910**Scope:** `$ARGUMENTS` (default: `full` – all categories). Possible restrictions: `docker`, `api`, `auth`, `dependencies`, `config`, `network`.1112**Language:** Parse `$ARGUMENTS` for a `lang=XX` parameter (e.g. `lang=de`, `lang=fr`). Default language is **English**. If a `lang` parameter is found, produce ALL output (epics, PDF report content, section headings, findings, summary) in the specified language. The `lang` parameter can be combined with a scope, e.g. `/security-audit docker lang=de`.1314---1516## Phase 1 – Analysis1718Examine the codebase systematically across these categories:1920### 1.1 Analysis Categories2122| Category | What to check |23|----------|---------------|24| **Source Code** | Injection vulnerabilities (SQL, Command, SSRF, XSS), insecure deserialization, missing input validation, hardcoded secrets, insecure crypto |25| **Authentication & Authorization** | Token handling, session management, missing auth checks, token leakage (logs, errors), credential storage |26| **Docker & Containers** | Root user, unnecessary packages, missing security options (read_only, no-new-privileges, cap_drop), secret handling, base image currency |27| **CI/CD Pipeline** | Secret exposure in logs, missing image scans, insecure registry configuration, missing SAST/DAST |28| **Dependencies** | Known CVEs (check package.json/requirements.txt/go.mod etc.), outdated packages, unnecessary dependencies |29| **Configuration** | Missing TLS enforcement, open CORS, missing rate limits, insecure defaults, missing security headers |30| **Network & Transport** | Cleartext transmission, missing timeouts, unlimited body sizes, DNS rebinding |3132### 1.2 Procedure33341. Read `CLAUDE.md`, `README.md`, `package.json` (or equivalent) for project overview352. Search `src/` (or main source directory) recursively363. Check `Dockerfile`, `docker-compose*.yml`, `.gitlab-ci.yml`, `.github/workflows/`374. Check configuration files (`.env*`, `config.*`, etc.)385. Check `package-lock.json`/`yarn.lock`/`go.sum` for known vulnerable versions3940### 1.3 Finding Classification4142Classify each finding by severity:4344| Severity | Criteria | Prefix |45|----------|----------|--------|46| **CRITICAL** | Directly exploitable, Remote Code Execution, credential theft, full compromise | C1, C2, ... |47| **HIGH** | Exploitable with preconditions, significant impact, data loss possible | H1, H2, ... |48| **MEDIUM** | Defense-in-depth gap, best-practice violation with concrete risk | M1, M2, ... |49| **LOW** | Hardening measure, minimal direct impact, improvement suggestion | L1, L2, ... |5051For each finding document:52- **ID** and **title**53- **File and line** (where possible)54- **Description** of the problem55- **Current code** (relevant excerpt)56- **Recommended fix** with concrete code suggestion57- **OWASP Top 10** mapping (if applicable)58- **CWE number** (consult the references.md in this skill directory)5960### 1.4 Positive Findings6162Also document what is already well implemented. Examples:63- Existing input validation64- Correct secret handling65- Security headers present66- Dependency management up to date6768---6970## Phase 2 – Create or Update Epics7172Create or update one epic per severity level with concrete tickets in `docs/epics/`:7374### 2.1 Existing Epics – Read First7576Before creating or modifying epics, check if `docs/epics/epic-security-*.md` files already exist. If they do:77781. **Read all existing epic files** to understand previously documented findings792. **Compare** each existing ticket against the current analysis results803. **Update** each ticket according to these rules:81 - **Fixed issue:** Mark the ticket as `✓ RESOLVED`. Add a `**Resolution:**` section describing what was done. Check off the acceptance criteria. **NEVER delete the ticket.**82 - **Still open (unchanged):** Keep the ticket as-is83 - **Worsened or changed:** Re-evaluate the ticket. Update the description, severity, affected code, and recommended fix. Add a `**Re-evaluation ([Date]):**` note explaining what changed. If severity changed, move the ticket to the appropriate epic file (and leave a cross-reference in the old location)84 - **New finding:** Add as a new ticket with the next available ID854. **NEVER delete any ticket or finding** – resolved issues serve as audit trail865. Set the epic **Status** to `closed` when all tickets within it are resolved8788### 2.2 Epic Structure8990For each severity level (where findings exist) create a file:9192- `docs/epics/epic-security-critical.md` – Critical findings93- `docs/epics/epic-security-high.md` – High findings94- `docs/epics/epic-security-medium.md` – Medium findings95- `docs/epics/epic-security-low.md` – Low findings9697### 2.3 Epic Format9899```markdown100# Epic: Security Hardening – [Severity] Findings101102**Status:** open | closed103**Priority:** [CRITICAL/HIGH/MEDIUM/LOW]104**Source:** Security Audit, [Date]105106## Description107108[1-2 sentence summary]109110---111112## Tickets113114### [Epic-Nr].[Ticket-Nr] – [Title]115116**File:** `[Path]`117**Finding:** [ID] – [Short description]118119**Current Code ([File]:[Lines]):**120\`\`\`[language]121[code]122\`\`\`123124**Required Changes:**1251261. [Concrete instruction with code example]1272. [...]128129---130131### [Epic-Nr].[Ticket-Nr] – [Title] ✓ RESOLVED132133**File:** `[Path]`134**Finding:** [ID] – [Short description]135136**Resolution:** [What was done to fix the issue]137138---139140## Acceptance Criteria141142- [ ] [Testable criterion 1]143- [x] [Resolved criterion]144```145146### 2.4 Rules for Epics147148- Every ticket must reference **file and line**149- Every ticket must contain **concrete fix code** (not just "should be fixed")150- Acceptance criteria must be **testable** (e.g. "Request with X returns Y")151- Cross-reference tickets when fixes overlap152- Order within an epic: by effort/impact descending153- **NEVER delete tickets or findings** – they are part of the audit trail154- Resolved tickets stay in the epic with their resolution documented155156---157158## Phase 3 – Generate PDF Report159160Generate a professional security audit report as PDF.161162### 3.1 Procedure1631641. Read the HTML template from this skill directory: `report-template.html`1652. Read the references from this skill directory: `references.md`1663. Populate the template with the audit results (replace the placeholder comments). Set the `<html lang="...">` attribute to the active language code (e.g. `en`, `de`, `fr`)1674. Create the output directory `docs/security-audit/` if it does not exist1685. Determine the output filename. Use the timestamp format `YYYY-MM-DD-HHmmSS` (current date and time):169 - **First audit** (no existing PDF in `docs/security-audit/`): `[projectname]-security-audit-YYYY-MM-DD.pdf`170 - **Subsequent reviews** (an audit PDF already exists): `[projectname]-security-review-YYYY-MM-DD-HHmmSS.pdf`171172 This keeps the original audit as baseline and creates timestamped reviews alongside it for traceability.1736. Write the populated HTML file to `docs/security-audit/[filename].html`1747. Detect the platform and resolve the Chrome binary path:175 - **macOS:** `"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"`176 - **Linux:** `google-chrome-stable` or `google-chrome` (whichever is found in PATH)177 - **Windows (WSL/Git Bash):** `"/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"` or `"C:\Program Files\Google\Chrome\Application\chrome.exe"`178179 If Chrome is not found, inform the user and skip PDF generation (epics and summary are still produced).180181 Convert via Chrome headless to PDF:182 ```bash183 <resolved-chrome-path> \184 --headless --disable-gpu --no-sandbox \185 --print-to-pdf="docs/security-audit/[filename].pdf" \186 --print-to-pdf-no-header \187 "docs/security-audit/[filename].html"188 ```1898. Delete the temporary HTML file190191### 3.2 Report Content192193The report must contain:1941951. **Title page** – Project name, audit date, auditor (Claude Code), overall rating1962. **Executive Summary** – 3-5 sentence summary for management1973. **Scoring** – Overall score as rating (A/B+/B/C/D) based on:198 - A: No critical/high findings, max 2 medium199 - B+: No critical, max 2 high, few medium200 - B: No critical, several high201 - C: 1-2 critical or many high202 - D: Multiple critical findings2034. **Findings table** – All findings with ID, severity, title, OWASP/CWE2045. **Detailed findings** – Per finding: description, affected code, recommendation2056. **Positive findings** – What is already well implemented2067. **Risk matrix** – Likelihood vs. impact grid2078. **References** – OWASP, CWE, NIST references (from references.md)208209### 3.3 Score Ring210211Calculate the score as percentage:212213```214Score = 100 - (Critical * 20) - (High * 10) - (Medium * 4) - (Low * 1)215Score = max(0, min(100, Score))216```217218Mapping:219- 90-100: A (dark green)220- 75-89: B+ (green)221- 60-74: B (yellow)222- 40-59: C (orange)223- 0-39: D (red)224225---226227## Output228229At the end of the audit show a summary:230231```232Security Audit completed.233234Result: [Rating] ([Score]/100)235- Critical: [n] findings236- High: [n] findings237- Medium: [n] findings238- Low: [n] findings239- Positive: [n] findings240241Generated files:242- docs/epics/epic-security-critical.md (if findings exist)243- docs/epics/epic-security-high.md (if findings exist)244- docs/epics/epic-security-medium.md (if findings exist)245- docs/epics/epic-security-low.md (if findings exist)246- docs/security-audit/[projectname]-security-audit-YYYY-MM-DD.pdf (first audit)247- docs/security-audit/[projectname]-security-review-YYYY-MM-DD-HHmmSS.pdf (subsequent reviews)248```