# CSV Reporting

> Output vulnerability reports as a formatted CSV file.

- Skill: `cxcscmu/csv-reporting` (Agent Skill)
- Install (CLI): `npx get-skill add cxcscmu/csv-reporting`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cxcscmu/csv-reporting/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: cxcscmu (https://skillmd.com/u/cxcscmu)
- Updated: 2026-11-24
- Page: https://skillmd.com/skills/cxcscmu/csv-reporting

---


# Vulnerability CSV Reporting

After parsing a vulnerability JSON report from a tool like Trivy, it is common to output the extracted findings to a CSV file for security audits or compliance checks.

## Usage

This Python code snippet demonstrates how to export vulnerabilities to a CSV file according to a defined schema, such as: `Package,Version,CVE_ID,Severity,CVSS_Score,Fixed_Version,Title,Url`.

```python
import csv
import json

def generate_csv(json_path, csv_path):
    with open(json_path, 'r', encoding='utf-8') as f:
        trivy_report = json.load(f)

    # Required CSV fields
    fieldnames = ['Package', 'Version', 'CVE_ID', 'Severity', 'CVSS_Score', 'Fixed_Version', 'Title', 'Url']

    with open(csv_path, 'w', newline='', encoding='utf-8') as f:
        writer = csv.DictWriter(f, fieldnames=fieldnames)
        writer.writeheader()

        for result in trivy_report.get('Results', []):
            for vuln in result.get('Vulnerabilities', []):
                # Only include HIGH and CRITICAL severities
                severity = vuln.get('Severity', '')
                if severity not in ['HIGH', 'CRITICAL']:
                    continue

                # Prepare the row
                row = {
                    'Package': vuln.get('PkgName', ''),
                    'Version': vuln.get('InstalledVersion', ''),
                    'CVE_ID': vuln.get('VulnerabilityID', ''),
                    'Severity': severity,
                    'CVSS_Score': extract_cvss(vuln),
                    'Fixed_Version': vuln.get('FixedVersion', 'N/A'),
                    'Title': vuln.get('Title', vuln.get('Description', '')).replace('\n', ' ').strip()[:100],
                    'Url': vuln.get('PrimaryURL', '')
                }
                writer.writerow(row)

# The extract_cvss function would be defined elsewhere or imported
```

This ensures properly-formatted tabular reports. Note how it limits the output strictly to HIGH and CRITICAL vulnerabilities.

