Heuristic to Deterministic
SkillDev toolsConvert repeated heuristics into deterministic behavior: validator scripts, normalizer tools, generators, fixtures, manifests, CI jobs, and hook-ready checks. Use to codify learnings and prevent future guessing. Do NOT use for pure brainstorming or one-off edits.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Heuristic to Deterministic skill
What this skill tells your AI
The instructions your AI receives, as published by jpcaparas/skills in skills/engineering/heuristic-to-deterministic/SKILL.md and read by ahel’s review.
Turn session learnings and repeated review heuristics into repeatable checks, normalizers, generators, fixtures, CI jobs, and hook-ready workflows.
Decision Tree
What kind of heuristic are you converting?
-
A rule about required or forbidden structure Build a validator. Read
references/conversion-patterns.md. -
A rule about canonical formatting, image shape, generated output, or metadata cleanup Build a normalizer, then validate the normalized artifact.
-
A repeated scaffold or generated file layout Build a generator from a manifest or explicit plan. Keep the plan editable and the scaffold shape fixed.
-
A flaky environment or cross-platform failure Add runtime discovery, version checks, fixtures, and CI matrix coverage. Read
references/verification.md. -
A prompt guideline for generated media or model output Keep the prompt harness as source, then add deterministic post-generation checks for the properties a script can inspect.
-
A taste or judgment call with no measurable signal Do not pretend it is deterministic. Capture examples, ask for acceptance criteria, or leave it as review guidance.
Quick Reference
| Need | Artifact | First action |
|---|---|---|
| Prevent a missing file, README block, hook, or config | Validator | Encode the invariant and fail with actionable output |
| Make outputs consistent across machines | Normalizer | Strip metadata, sort keys, resize, format, or canonicalize before validation |
| Avoid hand-copying a scaffold | Generator | Use a manifest or plan file as source of truth |
| Stop repeated regressions | Fixture or golden test | Add positive and negative examples that fail before the fix |
| Reuse the check in hooks and CI | Thin wrapper | Keep the core script path-agnostic and callable from multiple adapters |
| Convert model art or prose rules | Prompt harness plus post-check | Persist the prompt, then verify dimensions, paths, format, or required metadata |
Operating Contract
- Start with the learning, not the tool. Write the observed failure as a sentence before choosing an artifact.
- Convert only stable claims. If the underlying API, docs, or product behavior can drift, add a live documentation check or version probe before freezing assumptions.
- Separate judgment from enforcement. Let humans or agents decide policy in a small plan; let scripts enforce shape, paths, schema, size, and compatibility.
- Make every check path-agnostic. Accept a target path argument, resolve from that root, and avoid machine-specific absolute paths.
- Use exit code
2for hook-blocking validation failures when the caller already uses that convention. Use1for usage or tool errors. - Print the repair path. A deterministic failure should tell the next agent which command or file fixes the drift.
Workflow
-
Inventory the heuristic.
- What did we learn?
- What repeated mistake or drift does it prevent?
- What is stable enough to enforce?
- What remains subjective?
-
Choose the lowest-freedom artifact.
- Validator for yes/no structure.
- Normalizer for canonical representation.
- Generator for repeatable creation.
- Fixture for regression behavior.
- Manifest for shared source of truth.
- CI or hook adapter for enforcement timing.
-
Build the core script first.
- Use the target repo path as input.
- Avoid global state and current-machine paths.
- Prefer standard-library code unless the repo already depends on a parser or formatter.
- Make the script idempotent.
-
Add proof.
- Positive fixture passes.
- Negative fixture fails with the expected message.
- Running the tool twice produces no diff.
- The same command works on macOS and Ubuntu when the repo claims both.
-
Wire adapters last.
- Stop hooks, Git hooks, and GitHub Actions should call the same core script.
- Keep adapter files thin so behavior does not fork by environment.
Determinism Ladder
Use this ladder to avoid over-promising:
- Structural: file exists, JSON schema matches, README block is present.
- Canonical: sorted keys, normalized PNG, formatted code, stripped metadata.
- Behavioral: fixture input produces expected output or exit code.
- Environmental: dependency versions and feature flags are detected before use.
- External: live docs or APIs are checked before freezing a spec-sensitive rule.
- Subjective: examples and review rubrics only; no hard failure unless criteria become measurable.
Helper
Use scripts/classify_conversion.py for a quick deterministic first pass:
python3 scripts/classify_conversion.py "README cards must be below install commands and hooks should block drift"
The classifier is intentionally simple. Treat it as a planning aid, not as proof that the chosen artifact is sufficient.
Reference Guide
| Need | Read |
|---|---|
| Artifact patterns and when to choose each one | references/conversion-patterns.md |
| Verification depth, fixtures, CI, hooks, and exit codes | references/verification.md |
| Common ways deterministic checks become brittle | references/gotchas.md |
Gotchas
- Do not encode a workaround as truth. If a behavior is tool-version-specific, check the version or probe the feature.
- A generated asset can be constrained deterministically without making its creative content deterministic. Validate dimensions, format, prompt file drift, size, and placement.
- Avoid duplicate enforcement logic. Hook, CI, and local commands should delegate to the same script.
- A validator that only checks the current dirty worktree can still fail in CI if files are untracked or globally ignored. Include git visibility checks when packaging matters.
- A strict check with no repair command trains agents to bypass it. Make failures actionable.
Signals
- GitHub stars
- 48
- Forks
- 3
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
heuristic-to-deterministic- Source
- github.com/jpcaparas/skills