/compliance-trestle:trestle-validationfrom compliance-trestle
Validates OSCAL compliance models using trestle, troubleshoots common validation errors, schema issues, and workspace structure problems.
Ships in compliance-trestle. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
trestle validate -a
This command validates every OSCAL model in the workspace. -a is short for --all.
This skill uses -a in all examples.
What a clean run looks like: On a new workspace with no models, trestle validate -a finds no models.
The command exits with code 0. Little or no output is normal. No output means pass. It is not a failure.
After you add models, a pass lists each validated model. There are no ERROR lines. The exit code is 0.
trestle validate -t catalog -n my-catalog
trestle validate -t profile -n my-profile
trestle validate -t component-definition -n my-compdef
trestle validate -t system-security-plan -n my-ssp
trestle validate -t assessment-plan -n my-assessment
trestle validate -t assessment-results -n my-results
trestle validate -t plan-of-action-and-milestones -n my-poam
trestle validate -f catalogs/my-catalog/catalog.json
| Error | Cause | Fix |
|---|---|---|
Additional properties not allowed | Extra fields in JSON that are not in the OSCAL schema | Remove the unexpected field |
required property 'uuid' missing | Required UUID field is missing | Add a valid UUID (python -c "import uuid; print(uuid.uuid4())") |
is not of type 'string' | Wrong data type for a field | Check the OSCAL schema for the expected type |
does not match pattern | Value does not match the expected regex | Check format rules. Examples: UUID, date-time |
| Error | Cause | Fix |
|---|---|---|
Not in a trestle workspace | No .trestle/ directory found | Run trestle init or go to the workspace root |
Model not found | Model directory or file does not exist | Check spelling. Make sure you imported the model |
Duplicate model names | Two models share the same name | Rename one of the conflicting models |
| Error | Cause | Fix |
|---|---|---|
Markdown directory not found | Generated markdown directory is missing | Run trestle author *-generate first |
YAML header parse error | Invalid YAML in markdown frontmatter | Fix YAML syntax in the control markdown file |
Unexpected markdown structure | Manual edits broke the expected format | Generate markdown again. Then apply your changes |
Parameter not found | Reference to a parameter ID that does not exist | Check parameter IDs in the catalog or profile |
| Error | Cause | Fix |
|---|---|---|
Invalid OSCAL model | Source file is not valid OSCAL | Validate the source file against the OSCAL schema |
Model type mismatch | File content does not match the -t flag | Check the model type. Or omit -t for auto-detection |
File format not supported | Unsupported file extension | Use .json or .yaml/.yml |
# Verify workspace
ls -la .trestle/
# Check config
cat .trestle/config.ini
# List all models
ls catalogs/ profiles/ component-definitions/ system-security-plans/ 2>/dev/null
trestle validate -a 2>&1
For each model that fails validation:
# Validate specific model with verbose output
trestle validate -t <type> -n <name>
# Check the model file directly
python -c "import json; json.load(open('<path>/model.json'))"
import uuid
print(str(uuid.uuid4()))
Replace any bad or missing UUIDs with new ones.
Common YAML problems in control markdown:
--- delimiters around frontmatterProfiles reference catalogs by href. Check:
"imports": [
{ "href": "trestle://catalogs/nist-800-53/catalog.json" }
]
The referenced catalog must exist at that path in the workspace.
If assemble fails after markdown edits:
trestle author ssp-generate --name <ssp> --output <md_dir>-fresh
Then diff the fresh output against your edited version.If a model is corrupt:
dist/ has a previously assembled good copy.trestle validate after imports, edits, and assemblies.trestle validate -a in pipelines.dist/ often. Keep those files as validated snapshots.Trestle validation errors follow this pattern:
ERROR: [model_type] [model_name]: [error_description]
When you report an issue:
trestle version).python --version).Trestle includes several specialized validators. These go beyond basic schema validation:
| Validator | What It Checks | What It Misses | When to Use |
|---|---|---|---|
duplicates | Duplicate UUIDs inside one model | Cross-model UUID collisions | After manual UUID edits or model merges |
refs | Internal UUID references resolve. Example: a finding related-observations value points to a real observation UUID | References to external models | After you edit assessment-results or POA&M files with UUID references |
links | href values point to files and resources that exist | Whether the linked content is valid OSCAL | After you restructure workspace directories or rename files |
catalog | Catalog-specific structure: valid groups, controls, parameters, and back-matter | Semantic correctness of control text | After you import or manually edit catalogs |
rules | Component-definition rule consistency: rule IDs, parameter references, and control mappings | Whether rules are testable | After csv-to-oscal-cd or manual component-definition edits |
Run specific validators with:
trestle validate -t <model-type> -n <model-name>
All validators run automatically as part of trestle validate -a.
After you use trestle split, individual fragment files are not valid OSCAL documents by themselves.
Follow this workflow:
Do not validate during a split. A split model's root file references child files with the trestle split convention. The individual pieces do not pass schema validation on their own.
Always merge before you validate:
trestle merge -e catalog.* # merge all split parts back
trestle validate -t catalog -n my-catalog
Partial check. Do not run schema validation on split files. You can check that they are valid JSON:
python -c "import json, pathlib; [json.loads(p.read_text()) for p in pathlib.Path('.').rglob('*.json')]"
Pattern: The correct workflow is always split → edit → merge → validate. Do not skip the merge step before validation.
CI/CD validation is optional for first tests.
Run trestle validate -a on your machine during exploration.
Add the pipeline patterns below after models are in version control and change often.
name: OSCAL Validation
on:
pull_request:
paths:
- 'catalogs/**'
- 'profiles/**'
- 'component-definitions/**'
- 'system-security-plans/**'
- 'assessment-results/**'
- 'plan-of-action-and-milestones/**'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install trestle
run: pip install compliance-trestle
- name: Initialize trestle workspace
run: |
cd ${{ github.workspace }}
trestle init --govdocs
- name: Validate all OSCAL models
run: |
trestle validate -a 2>&1 | tee validation-report.txt
if grep -q "ERROR" validation-report.txt; then
echo "::error::OSCAL validation failed"
exit 1
fi
- name: Validate governed docs
run: trestle author docs validate -tn policies -hv
- name: Upload validation report
if: always()
uses: actions/upload-artifact@v4
with:
name: validation-report
path: validation-report.txt
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: trestle-validate
name: Validate OSCAL models
entry: bash -c 'trestle validate -a'
language: system
pass_filenames: false
files: '\.(json|yaml|yml)$'
Tip: For faster feedback during development, validate only the model you changed:
trestle validate -t system-security-plan -n my-ssp
Reserve trestle validate -a for CI/CD pipelines.
Assessment results and POA&M documents use a JSON workflow. Use split and merge. Do not use generate and assemble. Validate after every merge. These models have many UUID references.
| Issue | Cause | Fix |
|---|---|---|
Missing import-ap href | Assessment results must reference an assessment plan | Set import-ap.href to a valid path. Example: trestle://assessment-plans/my-plan/assessment-plan.json |
Findings without target.status | Every finding needs a determination status | Add target.status.state with value satisfied or not-satisfied |
| Orphaned observation UUIDs | A finding refers to a deleted observation | Update the finding related-observations list. Or restore the observation |
| Issue | Cause | Fix |
|---|---|---|
| Broken observation UUID references | POA&M item refers to an observation that does not exist | Check poam-items[].related-observations UUIDs against actual observations |
| Broken risk UUID references | POA&M item refers to a risk that does not exist | Check poam-items[].related-risks UUIDs against actual risks in the model |
Missing import-ssp href | POA&M must reference its parent SSP | Set import-ssp.href to the SSP path |
Tip: Always validate with the specific type for faster feedback:
trestle validate -t assessment-results -n my-results
trestle validate -t plan-of-action-and-milestones -n my-poam
refs validator is required.refs and duplicates validation.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub oscal-compass-lab/compliance-trestle-skills --plugin compliance-trestleOther plugins' skills for the same job
11 skills in this plugin
/trestle-assessmentUse this skill for OSCAL assessment plans and assessment results models in Compliance Trestle. Use it for assessment plans, assessment results, security assessments, SAP, SAR, assessment activities, findings, observations, or assessment-related OSCAL models./trestle-authoring-workflowUse this skill for the Compliance Trestle authoring workflow. The workflow is the generate-edit-assemble cycle that converts OSCAL documents to markdown and back. Use it for authoring catalogs, profiles, SSPs, or component definitions. Use it for editing control markdown, YAML headers, or the roundtrip workflow between JSON and markdown./trestle-compliance-pipelineUse this skill for end-to-end compliance pipelines with Compliance Trestle. Topics include GRC personas, artifact ownership, multi-repository coordination, two-phase component definition authoring, CI/CD pipeline integration, and the Compliance-to-Policy (C2P) bridge. Use it for compliance pipelines, personas, artifact ownership, multi-repo workflows, component definition dual-mapping (control-to-rule, rule-to-check), C2P, or end-to-end workflow design./trestle-control-implementationUse this skill to write control implementation responses, rules, parameters, and component-level responses. Use it for inheritance and leveraged SSPs in Compliance Trestle. Use it for control responses, implementation status, rules, parameters, component definitions, SSP implementation details, or compliance documentation content./trestle-governanceUse this skill for the Compliance Trestle document governance system. The system checks document structure and YAML headers. Use it for document governance, header checks, template validation, governed headings, and governed folders. Use it for trestle author docs, headers, folders, template setup, or CI/CD document validation./trestle-jinja-templatingUse this skill for the Compliance Trestle Jinja2 templating system for compliance documents. Use it for Jinja templates, document generation from OSCAL data, and custom trestle Jinja tags. Tags include mdsection_include, md_clean_include, and md_datestamp. Filters include as_list, get_party, parties_for_role, and diagram_href. Use it for SSP document rendering, lookup tables, or bracket formatting.