
§1Start with the skill contract
A skill is a reusable operating contract for one class of work. It tells an agent what it may receive, what it may do, what it must return, how the result is checked, and when it must stop. The prompt is only one component.
Inputs
The files, facts, URLs, constraints, and definition of the requested outcome.
Authority
The tools and state changes allowed, plus the boundary that needs approval.
Method
The ordered checks and actions that make the capability repeatable.
Output
The exact shape of the answer or artifact, including its intended reader.
Evidence
The observable facts required before the skill may claim success.
Failures
Known ways the work can look complete while the outcome is still broken.
Stop conditions
Attempt, time, cost, risk, and confidence limits that prevent endless motion.
If two capable agents can use the skill and produce results that satisfy the same evidence standard, the contract is doing useful work. If success depends on guessing what the author meant, the skill is still only a prompt.
§2Deterministic loops: the answer can be exact
A deterministic outcome has a testable predicate: the command exited cleanly, every internal link resolves, the structured data parses, the file hash matches the deployed asset, or the redirect lands on the canonical URL. The loop should be mechanical and idempotent.
- 01ObserveRead the current state.
- 02CompareEvaluate an exact predicate.
- 03ActMake one bounded change.
- 04Re-runUse the same check again.
- 05ExitPass, or stop at the retry budget.
while attempts < 3:
state = inspect()
if predicate(state) is true:
return PASS(state.evidence)
apply_bounded_fix(state)
return BLOCKED(last_evidence)
The important properties are a stable predicate, a fixed retry budget, observable evidence, and safe repetition. “Keep trying until it looks right” is not deterministic; “run the link checker until it reports zero broken internal links, with at most three repair passes” is.
§3Non-deterministic loops: quality needs judgment
Research synthesis, naming, visual critique, prioritisation, and explanatory writing do not have one provably correct answer. Re-running the same model can produce a different useful result. The loop therefore manages variance instead of pretending variance does not exist.
- 01FrameState audience and rubric.
- 02SampleProduce one or more candidates.
- 03CritiqueScore claims and trade-offs.
- 04SynthesiseKeep the strongest parts.
- 05GateAccept, retry, or ask a human.
Control comes from a named rubric, independent review, claim-level sourcing, a confidence threshold, and a hard attempt or time budget. More generations are not automatically more truth. A second reviewer is useful only when it has a distinct job: falsify claims, test the audience fit, or expose a missed trade-off.
In software, non-deterministic is the precise term. “Undeterministic” is understandable, but the design problem is the same: the process can vary, so the acceptance rule must be explicit.
§4The hybrid pattern: uncertain core, exact enclosure
Most valuable agent work is hybrid. Let the model interpret, propose, rank, or write where judgment helps. Then surround that uncertain core with checks that do not depend on taste.
Identity, source set, permissions, schema, format, budget
Interpret · propose · compare · synthesise
Claims, links, tests, policy, hashes, live-state evidence
| Work | Non-deterministic core | Deterministic enclosure |
|---|---|---|
| Research | Select and explain the most useful evidence. | Primary-source requirement, dates, links, quotation limits, claim ledger. |
| Page design | Choose hierarchy, rhythm, imagery, and emphasis. | Tokens, breakpoints, contrast, overflow, performance budget, browser checks. |
| Release review | Judge which diff creates material risk. | Revision identity, changed-path inventory, test suite, preview, live hash. |
| Monitoring | Decide whether an observed change matters. | Fetch status, timestamp, diff, known categories, escalation threshold. |
§5One operating loop for both kinds of work
The loop is complete only when the observed outcome can improve the contract. A recurring failure should become a new precondition, test, or stop condition—not another paragraph telling the agent to “be careful.”
§6Prevent infinite refinement
- Attempt budget: a fixed number of repair or generation passes.
- Evidence delta: continue only if the last pass added new evidence or removed a known defect.
- Confidence floor: below it, label uncertainty or escalate instead of smoothing the language.
- Risk gate: irreversible, public, financial, permission, or message-sending actions pause for a human.
- Definition of done: tie completion to the user outcome, not to the agent having produced an artifact.
The compact rule
- Design a skill as a contract, not a personality.
- Use exact predicates wherever the world offers them.
- Manage uncertain work with rubrics, independent critique, and budgets.
- Put deterministic controls around probabilistic judgment.
- Turn repeated failures into better contracts.
For a working example, see how Hermes routes skills through Telegram. To apply the pattern, start with the verification and routing templates.