From design-system-ops
Encodes human-readable governance policies into machine-executable JSON constraints for AI agents and CI pipelines to validate automatically. Outputs rule files in .ai/governance/.
npx claudepluginhub murphytrueman/design-system-opsThis skill uses the workspace's default tool permissions.
A skill for converting design system governance policies — the rules about how the system should be used, contributed to, and evolved — from human-readable documentation into machine-executable constraint definitions that AI agents validate against in real time.
Designs falsifiable governance constraints for HARNESS.md by translating governance language into operational verifications, evidence requirements, and failure actions. Guides authoring workflows and reviews.
Authors enforceable project constitutions for greenfield projects with testable principles, enforcement mechanisms, rationale, and amendment processes.
Generates custom design system rules for Figma-to-code workflows using Figma MCP tool and codebase analysis. Outputs CLAUDE.md, AGENTS.md, or Cursor rules for consistent AI code.
Share bugs, ideas, or general feedback.
A skill for converting design system governance policies — the rules about how the system should be used, contributed to, and evolved — from human-readable documentation into machine-executable constraint definitions that AI agents validate against in real time.
Most design system governance lives in documents that humans read and (sometimes) follow. Contribution guidelines in a wiki. Naming conventions in a README. Token usage rules in a Slack thread from eighteen months ago. These rules are enforced by review — a senior team member spots a violation during a PR review or a design crit and asks for a correction.
This enforcement model breaks down at scale, and it breaks down entirely with AI agents. An agent generating a component cannot read a wiki page and decide to follow the naming convention. It cannot recall a Slack conversation about token usage. It needs rules expressed as structured data with explicit conditions, constraints, and consequences that it can evaluate programmatically.
Governance encoding is the process of taking every governance rule that currently lives in a human-readable document and expressing it as a machine-checkable constraint. The output is not a better document — it is a rule engine that agents (and CI pipelines and linters) consume directly.
The distinction between governance documentation and governance encoding:
{ "rule": "component_naming", "pattern": "^[A-Z][a-zA-Z]+$", "scope": "component_export_name", "severity": "error", "message": "Component names must be PascalCase with no special characters" }Both are necessary. Documentation explains the intent. Encoding enforces the constraint.
Before producing output, check for a .ds-ops-config.yml file in the project root. If present, load:
governance.rule_format — output format preference (JSON or YAML, default: JSON)governance.severity_model — custom severity levels (default: error/warning/info)governance.categories — override default rule categoriessystem.framework — framework-specific rules (React, Vue, Svelte)system.tokens — identifies token files for token governance rulesintegrations.* — enables auto-pull for existing governance contextIf integrations are configured in .ds-ops-config.yml, pull data automatically:
GitHub (integrations.github.enabled: true):
Figma MCP (integrations.figma.enabled: true):
If an integration fails, log it and proceed with manual input.
Before encoding, catalogue what governance rules already exist and where they live.
Scan for governance sources:
For each rule found, classify:
| Rule | Source | Currently enforced by | Machine-encodable? |
|---|---|---|---|
| Component names must be PascalCase | CONTRIBUTING.md | PR review | Yes — regex pattern |
| Props must have TypeScript types | ESLint config | CI pipeline | Yes — already encoded |
| New components need design review | Wiki | Manual process | Partially — gate check |
| Tokens must use semantic tier | Style guide | PR review | Yes — import pattern |
Ask for or confirm:
Every governance rule follows the same schema, regardless of what it governs:
{
"id": "GOV-001",
"category": "naming",
"rule": "component_export_name",
"description": "Component export names must be PascalCase",
"intent": "Consistent naming enables predictable imports and tooling integration",
"scope": {
"applies_to": "component_files",
"file_pattern": "src/components/**/*.{tsx,vue,svelte}"
},
"constraint": {
"type": "pattern",
"pattern": "^[A-Z][a-zA-Z]+$",
"target": "default_export_name"
},
"severity": "error",
"enforcement": {
"automated": true,
"tool": "eslint",
"rule_ref": "naming-convention"
},
"exceptions": {
"allowed": true,
"requires": "decision_record",
"examples": ["hOTP (legacy naming, migration planned)"]
},
"references": {
"governance_doc": "CONTRIBUTING.md#naming-conventions",
"decision_record": null
}
}
Required fields:
id — unique identifier for the rule (GOV-NNN format)category — rule category (naming, structure, tokens, accessibility, contribution, release, documentation)rule — machine-readable rule namedescription — human-readable description of what the rule requiresintent — why this rule exists (the reasoning, not just the constraint)scope — where the rule appliesconstraint — the actual check definitionseverity — error (blocks), warning (flags), info (suggests)Optional fields:
enforcement — how the rule is currently enforced (automated tool, manual review, unenforced)exceptions — whether exceptions are allowed and what they requirereferences — links to governance documentation and decision recordsDifferent rules require different constraint structures:
Pattern constraint — validates against a regex:
{ "type": "pattern", "pattern": "^[A-Z][a-zA-Z]+$", "target": "export_name" }
Presence constraint — requires something to exist:
{ "type": "presence", "target": "prop_types", "requires": ["type", "default", "description"] }
Relationship constraint — validates a relationship between elements:
{ "type": "relationship", "source": "semantic_token", "target": "component_style", "rule": "no_primitive_tokens_in_components" }
Threshold constraint — validates against a numeric boundary:
{ "type": "threshold", "target": "bundle_size_gzip", "max": 10240, "unit": "bytes" }
Gate constraint — requires a process step to be completed:
{ "type": "gate", "requires": ["design_review_approved", "accessibility_audit_passed", "documentation_complete"], "before": "publish_to_npm" }
Enumeration constraint — validates against a set of allowed values:
{ "type": "enumeration", "target": "component_status", "values": ["alpha", "beta", "stable", "deprecated"] }
Rules that govern how things are named in the system:
is, has, show)Rules that govern how things are organised:
Rules that govern how design tokens are used:
Rules that govern accessibility compliance:
Rules that govern how new work enters the system:
Rules that govern how the system is published:
Rules that govern documentation quality:
Not every rule applies in every situation. The exception framework defines how teams request, document, and track governance exceptions:
{
"exception_framework": {
"levels": [
{
"level": "auto_approved",
"description": "Exceptions that are pre-approved for specific contexts",
"examples": ["Prototype/experiment branches exempt from documentation rules"],
"requires": "nothing — automatically granted based on context detection",
"expires": "When the context ends (branch merged or deleted)"
},
{
"level": "team_approved",
"description": "Exceptions approved by the component team lead",
"examples": ["Temporary naming deviation during a migration"],
"requires": "Decision record with rationale and expiry date",
"expires": "On the specified date or when the migration completes"
},
{
"level": "governance_approved",
"description": "Exceptions approved by the design system governance group",
"examples": ["Permanent deviation from token architecture for a specific product"],
"requires": "Formal decision record with business justification",
"expires": "When the governance group revokes or the justification no longer applies"
}
],
"tracking": {
"format": "exception_record",
"fields": ["rule_id", "level", "approved_by", "rationale", "scope", "expires", "status"],
"review_cadence": "Quarterly review of all active exceptions"
}
}
}
.ai/governance/
rules/
naming.json
structure.json
tokens.json
accessibility.json
contribution.json
release.json
documentation.json
exceptions/
active-exceptions.json
governance-manifest.json
enforcement-guide.md
{
"version": "1.0",
"generated": "[date]",
"system": "[design system name]",
"total_rules": 42,
"by_category": {
"naming": 8,
"structure": 6,
"tokens": 7,
"accessibility": 6,
"contribution": 5,
"release": 5,
"documentation": 5
},
"by_severity": {
"error": 15,
"warning": 18,
"info": 9
},
"enforcement_coverage": {
"automated": "60%",
"manual_review": "30%",
"unenforced": "10%"
},
"active_exceptions": 3
}
Generate an enforcement-guide.md that documents how each rule category maps to enforcement tooling:
# Governance enforcement guide
## Automated enforcement
Rules that are enforced automatically through CI/CD and linters.
For each rule: the tool that enforces it, how to configure it,
and what happens when it triggers.
## Review-based enforcement
Rules that are enforced through PR review and design review.
For each rule: what reviewers should check, the review checklist item,
and escalation path for disputes.
## Agent enforcement
Rules that AI agents should check before producing output.
For each rule: the constraint definition the agent loads,
how the agent validates its output, and what the agent does
when a constraint is violated (block, warn, or note).
## Gap analysis
Rules that are documented but not yet enforced by any mechanism.
For each rule: the recommended enforcement path and estimated
effort to implement.
For each rule, define how AI agents should use it:
Pre-generation check — the agent checks the rule before producing output:
Post-generation validation — the agent checks its own output against rules:
Gate enforcement — the agent blocks actions that require process steps:
Produce a mapping table:
| Rule ID | Agent phase | Agent action on violation |
|---|---|---|
| GOV-001 | Pre-generation | Use correct naming pattern |
| GOV-012 | Post-generation | Replace primitive token with semantic equivalent |
| GOV-025 | Gate | Block and report: "Design review required before this component can be published" |
intent — agents that understand why a rule exists can make better judgments in ambiguous situationserror severity rule with automated enforcement. A rule that blocks but is not automated creates friction without reliability.description (what) and an intent (why)error rules represent genuine risks, not preferences