Sdd guardrails
Continuous validation running inside every stage to prevent errors early. 'Guardrails, not Gates'.From its SKILL.md
npx -y skills add leoheart0125/sdd-skills --skill sdd-guardrailsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 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
6.8 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
SDD Guardrails
Unlike a traditional review engine that acts as a blocker at the end of a process, Guardrails run continuously inside other skills to provide immediate feedback. Every guardrail failure is a potential lesson.
Core Responsibilities
- Continuous Validation: Validate artifacts (JSON, YAML, Code) as they are created.
- Rule Compliance: Enforce
project_rules.mdprogrammatically at every stage — design, plan, and implementation. - Drift Detection: Compare Implementation vs. Specification.
- Security Scans: Detect basic security flaws in design/code.
- Lesson Triggers: Every guardrail fail → fix → pass cycle triggers
/sdd-learn.
Commands
/sdd-guard-check <context>: Run a specific set of checks for the given context (requirements | architecture | api | plan | code)./sdd-guard-drift: Compare the current codebase against all spec artifacts that exist for the active feature./sdd-guard-report: Generate a summary of active violations.
Check Types
1. Design Checks (Called by sdd-design-engine)
- Ambiguity Check: "Are requirements specific enough?" (flag items with low
confidence_score) - Coverage Check: "Do all Use Cases have a Component?"
- Contract Check: "Do interface contracts match their corresponding design units and data models?"
- Rule Conflict Check: "Do generated specs conflict with
project_rules.md?" — If yes, raise as BLOCKING concern.
2. Plan Checks (Called by sdd-task-planner) — NEW
- Path Convention Check: Verify each task's
target_pathconforms to the architecture conventions declared inproject_rules.md.- Read the Architecture section of
project_rules.mdto understand the declared directory structure and layer conventions - Validate that all
target_pathvalues follow the declared convention
- Read the Architecture section of
- Rule Compliance Check: Ensure task descriptions align with project rules (naming conventions, testing requirements, etc.)
- Dependency Check: Verify no circular dependencies in task graph
3. Implementation Checks (Called by sdd-implementer)
- Linting: "Does code follow project style?"
- Spec Match: "Does the implementation conform to the design specs produced for this feature?" — Validate against whichever spec artifacts are present (
object_design.json,openapi.yaml,data_model.json,interface_contract.json). Skip checks for artifacts that were not produced. - Test Coverage: "Are tests generated for this task?"
- File Placement: "Is the file at the
target_pathspecified intasks.json?" - Rule Compliance: "Does the generated code follow Coding Standards, Architecture patterns, and naming conventions declared in
project_rules.md?" — If violations found, raise as failure and fix before proceeding.
4. Artifact Integrity Check (All Phases)
- JSON Validity: All
.jsonartifacts (task.json, lesson.json, pattern.json, concerns.json, etc.) MUST be valid JSON parseable by a standard JSON parser. - String Escaping: String values MUST properly escape: double quotes (
\"), backslashes (\\), newlines (\n), tabs (\t), and other control characters. - Pre-Write Validation: Before writing any
.jsonfile, validate it is well-formed JSON. If validation fails, fix escaping issues before saving. - Failure Protocol: If a JSON artifact fails validation, treat it as a guardrail failure — fix immediately and record via
/sdd-learn.
Rule Compliance Engine
How It Works
The Rule Compliance Engine is a programmatic check, not just a declaration. It runs at specific moments:
Timing
| When | Trigger | What is Checked |
|---|---|---|
| After requirements generated | sdd-design-engine calls /sdd-guard-check requirements | Spec conflicts with project_rules |
| After architecture generated | sdd-design-engine calls /sdd-guard-check architecture | Architecture style compliance |
| After tasks generated | sdd-task-planner calls /sdd-guard-check plan | target_path conventions |
| After code generated | sdd-implementer calls /sdd-guard-check code | File placement, naming, spec match |
Architecture Style Compliance
The guardrail check procedure:
- Read the Architecture section of
project_rules.mdto understand the declared conventions (directory structure, layer ordering, naming patterns). - For each task in
tasks.json, validatetarget_pathagainst the declared conventions. - For
architecture.json, validate component grouping matches the declared style.
The source of truth for what constitutes a valid path is always project_rules.md — not any hardcoded assumption about architecture style. Different projects use different grouping strategies (feature-first, layer-first, module-based, etc.), and the guardrail must validate against what the project actually declared.
Drift Detection Logic
When /sdd-guard-drift is called:
- Scan
.sdd/spec/<feature-id>/for all spec artifacts that exist (e.g.,object_design.json,openapi.yaml,data_model.json,interface_contract.json). - Parse implemented code corresponding to the feature.
- For each spec artifact found, compare implementation against the spec:
object_design.json: Design unit names, method signatures, properties, layer assignments,kinddesignations.openapi.yaml: Parameters (Name, Type, Required), Responses (Code, Schema).data_model.json: Entity fields, types, constraints, relationships vs data-layer implementations.interface_contract.json: CLI args, SDK surface, event schemas, component props/events, GraphQL types, etc.- Skip any spec type that was not produced during design.
- If mismatch found → Report Drift → Recommend
/sdd-spec-updateor Implementation Fix.
Lesson Trigger Protocol
Every guardrail failure that gets fixed is a lesson. When a check fails and is subsequently resolved:
- Record the violation and fix as a lesson via
/sdd-learn:{ "trigger": "guard-check-<context>", "advice": "Implementation must exactly match the spec artifact. Do not add undeclared fields or deviate from contracts." } - If the same lesson triggers twice across different features → propose promotion to
project_rules.mdvia/sdd-rule-update.
Integration
- Invoked by:
sdd-design-engine(pre-save),sdd-task-planner(post-generation),sdd-implementer(pre-complete). - Consumes:
project_rules.md,context.json, Artifacts. - Triggers:
/sdd-learn(on fix cycles),/sdd-rule-update(on repeated lessons).
What ships with it: 5 files
9.0 KB alongside SKILL.md
schemas/
- architecture.schema.json960 B
- context.schema.json2.0 KB
- requirements.schema.json3.1 KB
- tasks.schema.json1.5 KB
templates/
- guard-report.md1.6 KB