/constraint:constraint-generatefrom constraint
Reads constraints/*.md files and generates deterministic test artifacts (parameterized tests, PBT, lint rules, runtime validation) adapted to the detected language and toolchain.
Ships in constraint. 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.
Read when SKILL.md points to them.
You read constraint files from constraints/*.md and generate deterministic test artifacts that enforce them mechanically.
Scan constraints — read every file matching constraints/*.md. Parse YAML frontmatter (rule, kind, scope, subject, enforce) and body sections (Given, When, Then, Unless, Examples, Properties).
Understand the format — read references/constraint-format.md for the canonical constraint file structure.
Detect repo toolchain — check for package.json, tsconfig.json, dune-project, Cargo.toml, pyproject.toml, etc. to determine language and available tooling. Adapt all generated artifacts to the detected language — do not refuse non-TypeScript repos or force TypeScript output.
Select tools — read references/toolchain-matrix.md to pick the correct test runner, linter, PBT library, and mutation tool for the detected language. If the matrix has no entry for the detected language, research the ecosystem's idiomatic PBT and lint tools before generating.
Generate artifacts — for each constraint file, produce the applicable artifacts using the detected language's idiomatic tools and file conventions:
| Section | Artifact (adapt to language) |
|---|---|
| Examples table | Parameterized tests (TS: it.each, OCaml: Alcotest.test_case with concrete cases, Rust: #[test] with test cases, Python: @pytest.mark.parametrize) |
| Properties | PBT tests (TS: fast-check, OCaml: QCheck, Rust: proptest, Python: Hypothesis) |
| Prohibition + structural lint | .ast-grep/rules/*.yml or semgrep rules (check language support in toolchain-matrix) |
| Validation | Runtime validation at trust boundaries using the language's idiomatic library |
File conventions:
Generated from constraints/<RULE_ID>-<slug>.md — do not edit manually (use the language's comment syntax)*.constraint.test.ts, OCaml: test/test_<slug>_properties.ml, Rust: tests/<slug>_constraint.rs, Python: test_<slug>_constraint.py).Post-generate: verify and suggest — after generating artifacts:
/constraint-enforce for the full 4-layer enforcement pipeline. If a real violation was detected, mention it in the suggestion.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub caasi/dong3 --plugin constraint3 skills in this plugin
/constraint-enforceUse 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./constraint-writeUse when the user asks to "/constraint-write", "write constraint", "define constraint", "幫我寫 constraint", "定義 constraint", or when the agent detects prohibition ("不能", "禁止", "must not"), obligation ("必須", "一定要", "always"), or invariant ("roundtrip", "idempotent") language in conversation and wants to suggest writing a constraint.