model-first-reasoning_skill

This skill applies Model-First Reasoning to code tasks, ensuring a formal model guides implementation for correctness and reduced hallucinations.
  • Makefile

2

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill petekp/agent-skills --skill model-first-reasoning

  • MODEL_TEMPLATE.json1.5 KB
  • SKILL.md8.0 KB

Overview

This skill applies Model-First Reasoning (MFR) to code generation tasks by enforcing a strict two-phase workflow: produce an explicit model first, then implement only from that frozen model. It is designed to reduce hallucinations and drift by turning the model into a contract that governs planning, coding, and testing.

How this skill works

Phase 1 produces an inspectable model (entities, state, actions, constraints, goals, unknowns) with no code or implementation steps. A mandatory model audit (coverage, operability, consistency, testability) must pass before moving on. Phase 2 implements only items defined in the audited model, writes tests for every constraint, and uses MODEL PATCH if any model change is required.

When to use it

  • When the task requests “model-first”, “MFR”, or “formal modeling before coding”
  • Complex state machines with nontrivial transitions and invariants
  • Business logic that must enforce invariants and strict constraints
  • Multi-step workflows or protocols where operations depend on state
  • Safety-critical or high-assurance features where correctness matters

Best practices

  • Produce a complete, explicit model before any implementation or planning
  • List unknowns in the model; stop and resolve them before Phase 2
  • Run the model audit and fix coverage, operability, consistency, and testability issues
  • Map each requirement to exactly one model element (constraint, goal, or action)
  • Implement tests that directly validate each constraint (test oracle per constraint)
  • If new info is needed during implementation, emit a minimal MODEL PATCH and restart Phase 2

Example use cases

  • Designing a shopping cart with limits, uniqueness, and total-cost invariants
  • Specifying and implementing a protocol or state machine (e.g., payment workflow)
  • Creating data transformation pipelines where input/output contracts must hold
  • Implementing authorization rules with invariants that must never be violated
  • Building multi-step onboarding flows where steps depend on prior state

FAQ

Stop. Resolve unknowns before implementation. If unknowns remain, return exactly 'MODEL INCOMPLETE' plus the required information.

Can I use informal prose for the model or must it be JSON?

The model can be natural language, semi-structured text, or JSON—what matters is that it is explicit, inspectable, and stable. For code tasks, a structured JSON-like model is recommended.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
model-first-reasoning skill by petekp/agent-skills | VeilStrat