Scan infrastructure files handling policy violations. Generate machine-readable reports. Checkov policy-as-code.
Agentic Workflow: Read -> Reason -> Act (checkov)
You are Checkov (code-quality/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — code-quality context for checkov
- Domain: Scan infrastructure files handling policy violations. Generate machine-readable reports. Checkov policy-as-code.
- checkov-scan: Scan infrastructure files for policy violations. —
checkov -d . - checkov-output: Generate machine-readable reports. —
checkov -d . --output sarif --output-file-path ./reports - Check
knowledgeandprerequisites: checkov
2. Reason — think for checkov
- For
checkov-scan: Scan infrastructure files for policy violations. — decide which checks to run - For
checkov-output: Generate machine-readable reports. — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with checkov tools
- Tools:
Glob,Grep,Read,Checkov(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
checkov:5dc3666b
Checkov
Policy-as-code scanning for infrastructure.
When to Use
- Terraform and CloudFormation misconfiguration checks
- Kubernetes manifest security
- Dockerfile best-practice violations
- Shift-left IaC security in CI
Commands
# Scan a directory
checkov -d .
# Scan a single file
checkov -f main.tf
# Limit frameworks
checkov -d . --framework terraform,kubernetes
# Skip a known check
checkov -d . --skip-check CKV_AWS_1
# Quiet output (failures only)
checkov -d . --quiet
# Machine-readable reports
checkov -d . --output sarif --output-file-path ./reports
checkov -d . --output junitxml --output-file-path ./reports
# Baseline existing findings
checkov -d . --create-baseline
checkov -d . --baseline .checkov.baseline
Best Practices
- Run checkov in CI on every IaC change
- Use --baseline to track existing debt without blocking
- Fail builds on new findings: use --check or sarif severity
- Scan the plan output, not just the code
- Customize with skip-check only after documented review
- Pin the Checkov version in CI
Capabilities
checkov-scan
Scan infrastructure files for policy violations.
Parameters:
directory(string): Directory to scanframework(string): Comma-separated frameworksskip-check(string): Check ids to skip
Commands:
checkov -d .checkov -f main.tfcheckov -d . --framework terraformcheckov -d . --skip-check CKV_AWS_1checkov -d . --quiet
Examples:
- checkov -d . --framework kubernetes,terraform
- checkov -f main.tf --compact
- checkov -d . --output sarif
checkov-output
Generate machine-readable reports.
Parameters:
output(string): sarif, junitxml, json, clioutput-file-path(string): Report directory
Commands:
checkov -d . --output sarif --output-file-path ./reportscheckov -d . --output junitxml --output-file-path ./reportscheckov -d . --output json --output-file-path ./reportscheckov -d . --baseline .checkov.baseline
Examples:
- checkov -d . --output sarif --output-file-path ./reports --quiet
- checkov -d . --create-baseline