constraint-design
/constraint-design
This skill should be used when the user asks to "add a constraint", "design a constraint", "write a harness rule", "choose enforcement type", "promote a constraint", "configure a verification slot", or needs guidance on the Constraints section of HARNESS.md.
- Author
- Habitat-Thinking ↗
- Repository
- ai-literacy-superpowers ↗
- Licence
- Apache-2.0
- Last repository change
- 19.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 19.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
This skill should be used when the user asks to "add a constraint", "design a constraint", "write a harness rule", "choose enforcement type", "promote a constraint", "configure a verification slot", or needs guidance on the Constraints section of HARNESS.md.
Triggers from the description
Original author description
This skill should be used when the user asks to "add a constraint", "design a constraint", "write a harness rule", "choose enforcement type", "promote a constraint", "configure a verification slot", or needs guidance on the Constraints section of HARNESS.md.
How it works
- Anatomy of a Constraint
- Writing a Verifiable Rule
- Choosing Enforcement Type
- Choosing Scope
- The Verification Slot Interface
- Common Constraint Patterns
- Additional Resources
SKILL.md preview
--- name: constraint-design description: This skill should be used when the user asks to "add a constraint", "design a constraint", "write a harness rule", "choose enforcement type", "promote a constraint", "configure a verification slot", or needs guidance on the Constraints section of HARNESS.md. --- # Constraint Design A constraint is a rule that must be enforced — not a suggestion, but a hard boundary. In the harness framework, each constraint occupies a **verification slot** that can be filled by either a deterministic tool or an agent-based review. The system does not care which backs the slot; only whether the constraint passed. ## Anatomy of a Constraint Every constraint in HARNESS.md has four fields: - **Rule** — what must be true, written precisely enough for objective verification - **Enforcement** — `deterministic`, `agent`, or `unverified` - **Tool** — which tool or agent checks this (or "none yet") - **Scope** — when the check runs: `commit`, `pr`, `weekly`, `manual` ## Writing a Verifiable Rule The rule field is the most important. Apply the same enforceability test used for conventions: 1. Describe what compliant code looks like 2. Describe what violating code looks like 3. Confirm a reviewer (human or agent) could check this without ambiguity Consult the `context-engineering` skill's convention patterns for detailed examples. ## Choosing Enforcement Type | Question | If yes | If no | | --- | --- | --- | | Does a deterministic tool exist for this? | Use deterministic | Continue | | Is the rule precise enough for consistent LLM review? | Use agent | Use unverified | | Is the team ready to set up tooling? | Use deterministic | Start with agent | Start with unverified if unsure. Promote when ready. ### Command Risk Classification For tool-level constraints, a specific pattern applies: **Command Risk Classification** assigns each tool or command an allow, ask, or deny disposition based on two criteria: - **Reversibility** — can the action be undone? File reads are always reversible. File writes are reversible through git. `rm -rf /` is not. - **Blast radius** — how much damage if it goes wrong? A typo in a test file affects one test. A typo in a deployment script affects production. The classification is a spectrum, not a binary. Pattern matching refines it: the same command with different arguments carries different risk. Commands that repeatedly pass human review can be promoted from ask to allow, following the same promotion ladder that constraints use. For the full promotion lifecycle (unverified to agent to deterministic), consult `references/promotion-ladder.md`. ## Choosing Scope | Scope | When it runs | Use for | | --- | --- | --- | | `commit` | PreToolUse hook (advisory) | Fast checks — formatting, naming | | `pr` | CI pipeline (strict) | Thorough checks — tests pass, no secrets | | `weekly` | Scheduled run | Slow checks — dependency audit, structural tests | | `manual` | `/harness-audit` only | Exploratory — new rules being calibrated | Start with `pr` scope for most constraints. Move to `commit` only for fast checks that benefit from immediate feedback. Use `weekly` for checks that are too slow or expensive for every PR. ## The Verification Slot Interface The `harness-enforcer` agent uses a uniform contract: **Input:** constraint definition + scope + file set **Output:** pass/fail + findings list (file:line references) This means the enforcer does not care whether it shells out to `eslint` or reads code against a prose rule — the interface is the same. Promote a constraint from agent to deterministic by changing the enforcement field in HARNESS.md; no other changes needed. For technical details on integrating custom tools into verification slots, consult the `verification-slots` skill. ## Common Constraint Patterns ### Formatting / Style - **Rule**: All source files pass the configured formatter - **Typical enforcement**: Deterministic (prettier, gofmt, black) - **Typical scope**: commit ### Secret Detection - **Rule**: No API keys, tokens, or passwords in source files - **Typical enforcement**: Deterministic (gitleaks, trufflehog) - **Typical scope**: commit ### Test Suite - **Rule**: All tests pass with zero failures - **Typical enforcement**: Deterministic (test runner) - **Typical scope**: pr ### Documentation Quality - **Rule**: Doc comments explain reasoning, not signatures - **Typical enforcement**: Agent (nuanced quality check) - **Typical scope**: pr ### Architectural Boundaries - **Rule**: Package X does not import package Y - **Typical enforcement**: Deterministic (ArchUnit, go-cleanarch) or agent - **Typical scope**: pr ### Executable Spec Conformance A spec describes what should be built; tests verify it was built correctly. The executable spec constraint bridges the two: it is a constraint whose tool command runs the spec's associated test suite. The spec itself is never executed — the tests are the executable verification. - **Rule**: All code changes covered by a spec must pass the spec's associated test suite before merge - **Typical enforcement**: Deterministic (project test runner) - **Typical scope**: pr **HARNESS.md entry example:** ```markdown ### Spec conformance - **Rule**: All code changes covered by a spec in `docs/specs/` must pass the spec's associated test suite before merge - **Enforcement**: deterministic - **Tool**: <project test runner command> - **Scope**: pr ``` **Linking specs to tests (naming convention):** Spec files map to test directories or files by name. A spec at `specs/YYYY-MM-DD-feature-design.md` corresponds to tests at `tests/feature/` or `tests/feature_test.go`. The constraint runner uses this convention to determine which tests to execute when spec-covered code changes. **The `deterministic + agent` enforcement pattern:** A single constraint type is not enough. Deterministic tests catch "code doesn't work" — functional failures that a test runner can detect mechanically. Agent review catches "code works but doesn't match what was specified" — intent drift that requires reading the spec and judging alignment. Both are needed for full spec conformance: | Layer | What it catches | Enforcement | | --- | --- | --- | | Test suite | Functional failures | Deterministic | | Agent review | Intent drift from spec | Agent | **Connection to BDD/Cucumber:** For teams using BDD, the executable spec pattern is the gold standard. Gherkin scenarios ARE the spec AND the test — there is zero drift between intent and verification because they are the same artifact. For teams not using BDD, the naming convention approach (spec file to test directory) is the pragmatic alternative. Either way, the harness constraint runs tests, not specs. ## Additional Resources ### Reference Files - **`references/promotion-ladder.md`** — Complete lifecycle of a constraint from unverified through agent to deterministic, including partial promotion, demotion, and decision signals
Files in this package (2)
- SKILL.md 7 KB
- references/promotion-ladder.md 4 KB
Versions
The database has no other skills named constraint-design.
Database snapshot: 13.11.2026 · package version eb9da36506b8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 90constraint-enforce
Use when the user asks to "/constraint-enforce", "enforce constraints", "run constraint tests", "跑 constraint 驗證", or "run constraint enforcement". Runs the 4-layer deterministic enforcement pipeline on generated constraint artifacts. - 100governance-constraint-design
Use when writing governance constraints for HARNESS.md, translating governance language into operational meaning, reviewing existing governance constraints for falsifiability, or when "/governance-constrain" needs guidance on the authoring workflow. - 100constraint-generate
Use when the user asks to "/constraint-generate", "generate constraint tests", "generate constraint artifact", "產生 constraint 的 test", or "generate test from constraint". Reads constraints/*.md and produces deterministic test artifacts. - 100verification-slots
This skill should be used when the user asks about "verification slots", "integrating a linter", "adding a deterministic tool", "harness-enforcer", "constraint enforcement interface", "wrapping a tool", or needs the technical reference for how deterministic and agent-based… - 90constraint-interpretation-skill
将 StructuredRequirement 中的原始约束解读为结构化 ConstraintInterpretation, 区分明确约束、软约束、歧义、明确不限与缺失信息,并输出可追溯的正式约束语义, 供 retrieval-matrix-generation 使用;在需求结构化完成、进入检索前,或用户请求解析约束时使用。 - 100harness-design
Decide where each piece of a Claude Code harness belongs (CLAUDE.md, rules, skills, hooks, subagents, scripts, MCP) with token budgets, then build the files from templates. Use when designing or building skills, agents, commands, hooks or CLAUDE.md for a harness or plugin, when…