Canonical model validator
Skill SteveGJones/jack-tar-deckhand/.claude/skills/canonical-model-validator
Validates canonical model JSON files against the schema, checks referential integrity (actor refs, SOP refs, interaction endpoints), and reports errors/warnings. Works with the existing canonical-model-manager skill.From its SKILL.md
npx -y skills add SteveGJones/jack-tar-deckhand --skill canonical-model-validatorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.9 KB, as published. Nobody here has run it
Canonical Model Validator
This skill validates a canonical service domain model JSON file for structural correctness and referential integrity. It catches broken references, orphaned entities, methodology violations, and schema mismatches before they propagate to diagrams, documentation, or governance reviews.
When to Use
- After creating or modifying a canonical model with
canonical-model-manager - Before rendering diagrams with
service-architecture-renderer - Before running
methodology-compliance-checkto ensure the model itself is sound - As part of a CI/quality gate before merging architecture changes
- When importing or merging models from different sessions or authors
Instructions
1. Locate the Model
Canonical models for this project live at:
docs/architecture/bsa/canonical-models/*.json
The collaborative (multi-company) model is:
docs/architecture/bsa/canonical-models/acid-collaborative.json
The schema is at:
.claude/agents/references/schemas/canonical-service-domain-model-schema.json
2. Structural Validation (Errors)
Check the following. Any failure here is an error (model is invalid):
Model Metadata
-
modelMetadataexists with all required fields:id,name,version,organisation,createdDate -
versionfollows semver format (e.g.,1.0.0) -
statusis one of:draft,review,approved,deprecated
Services
- Every service has
id,name,level,mission,serviceType -
serviceTypeiscoreorsupport -
levelis a non-negative integer - Level 1+ services have a
parentIdthat references an existing service - No circular
parentIdreferences - No duplicate service
idvalues - Every
parentIdpoints to a service that exists
AI Personas
- Every entry in
aiPersonashasid,serviceId - Every
serviceIdreferences a service that exists and hasisAIPersona: true - Every service with
isAIPersona: truehas a matchingaiPersonasentry -
authorityModelis one of:autonomous,hybrid,supervised - If
authorityModelishybrid,confidenceThresholdsis present withautonomousandescalatevalues - Each SOP in
sopsarray hassopIdandname
Human Actors
- Every human actor has
id,name,isExternal - Every
serviceIdinserviceAssociationsreferences an existing service -
associationTypeis one of:owner,consumer,provider,data_source,escalation_target,integration_target
System Actors
- Every system actor has
id,name - Every
serviceIdinserviceAssociationsreferences an existing service
Interactions
- Every interaction has
id,sourceId,targetId,label,interactionType -
sourceIdreferences an existing entity (service, actor, or AI persona service) -
targetIdreferences an existing entity -
interactionTypeis one of:capability_invocation,data_flow,escalation,support,external,approval - No duplicate interaction
idvalues
External Interactions
- Every external interaction has
id,internalServiceId,externalServiceName -
internalServiceIdreferences an existing service
3. Referential Integrity (Errors)
Build an index of all entity IDs across the model, then verify:
- No dangling references: Every
sourceId,targetId,serviceId,parentIdpoints to an entity that exists in the model - No orphaned AI Personas: Every
aiPersonasentry has a corresponding service withisAIPersona: true - No orphaned actors: Every actor has at least one
serviceAssociationpointing to a valid service - Bidirectional consistency: If an interaction references a service, that service should logically participate in the interaction (warning, not error)
4. Methodology Compliance (Warnings)
These are warnings (model is valid but may not conform to methodology best practice):
- Level 0 has 4-8 services
- Each Level 1 domain has 5-9 sub-services
- AI RM appears as a shared/support service (if any AI Personas exist)
- Every AI Persona has at least one SOP defined
- Every service has an
ownerfield populated - No services without any interactions (fully disconnected)
- No actors associated only with services they don't interact with
5. ID Convention Checks (Warnings)
Verify IDs follow the established naming convention:
| Entity | Expected Pattern | Example |
|---|---|---|
| Services | svc-* or short abbreviation | svc-quality, mfg, av-core-ops |
| AI Personas | ap-* | ap-quality, ap-demand |
| Human actors | ha-* | ha-plant-mgr |
| System actors | sa-* | sa-erp, sa-scada |
| Interactions | int-* | int-001, int-av-st-001 |
| External interactions | ext-* | ext-001 |
6. Report Format
Produce a structured validation report:
# Canonical Model Validation Report
**Model:** [model name]
**File:** [file path]
**Version:** [version]
**Validated:** [date]
**Result:** [PASS / PASS WITH WARNINGS / FAIL]
## Summary
- Errors: [count]
- Warnings: [count]
- Entities validated: [count] services, [count] personas, [count] actors, [count] interactions
## Errors (Must Fix)
| # | Category | Entity | Issue |
|---|----------|--------|-------|
| 1 | Referential Integrity | int-042 | targetId "svc-missing" not found |
## Warnings (Should Fix)
| # | Category | Entity | Issue |
|---|----------|--------|-------|
| 1 | Methodology | L0 | Only 3 services at Level 0 (expected 4-8) |
## Entity Index
[Summary table of all entities by type and count]
AI Persona Consistency Checks
AI Personas have dual representation in the canonical model: a service entry (in services[]) with isAIPersona: true, and a matching delegation contract (in aiPersonas[]). Both must exist and stay in sync. The checks below ensure practitioners never end up with a half-defined persona that silently breaks diagrams, governance reports, or compliance checks.
V-PERSONA-001: Bidirectional Consistency (ERROR)
Every AI Persona must be fully represented on both sides of the model. Check two directions:
-
Service to contract. For every service where
isAIPersonaistrue, there must be an entry inaiPersonas[]whoseserviceIdequals that service'sid. If missing:"The '{service.name}' service is marked as an AI Persona but has no delegation contract. Use /ai-persona-definition to complete it."
-
Contract to service. For every entry in
aiPersonas[], the referencedserviceIdmust point to a service that exists inservices[]and hasisAIPersona: true. If the service is missing entirely:"AI Persona '{aiPersona.id}' references service '{aiPersona.serviceId}', but that service does not exist. Use /canonical-model-manager to create the service entry."
If the service exists but
isAIPersonais nottrue:"AI Persona '{aiPersona.id}' references service '{service.name}', but that service is not flagged as an AI Persona. Set isAIPersona: true on the service or remove the aiPersonas entry."
V-PERSONA-002: Minimum Contract Completeness (WARNING)
A delegation contract without an authority model is incomplete. For every entry in aiPersonas[], check that authorityModel is defined and is one of autonomous, hybrid, or supervised. If missing or empty:
"AI Persona '{aiPersona.id}' has no authority model. Specify autonomous, hybrid, or supervised."
This is a warning rather than an error because the model is structurally valid without it, but no governance review or risk classification can proceed until the authority model is set.
V-PERSONA-003: ID Convention (ADVISORY)
AI Persona IDs should follow the ap- prefix convention to distinguish them from service IDs at a glance. For every entry in aiPersonas[] whose id does not start with ap-:
"AI Persona '{aiPersona.id}' does not follow the 'ap-' prefix convention. Consider renaming to 'ap-{suggested}' for consistency with the model's naming standards."
Where {suggested} is derived from the current ID by stripping any existing prefix and prepending ap-.
Relationship to Other Skills
- Upstream:
canonical-model-manager(creates/edits the models this skill validates) - Downstream:
service-architecture-renderer(validated models produce clean diagrams),methodology-compliance-check(validated models produce accurate compliance reports) - Cross-model:
cross-model-validatorhandles multi-model consistency; this skill validates a single model in isolation
Output
A validation report with PASS/FAIL result, categorised errors and warnings, and an entity summary. The model is considered valid if there are zero errors.