model-first-reasoning

Construct an explicit problem model before coding or design implementation.

5|2|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/petekp/agent-skills --skill model-first-reasoning-petekp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-first-reasoning
Source: https://github.com/petekp/agent-skills/tree/main/skills/model-first-reasoning
Command: npx skills add https://github.com/petekp/agent-skills --skill model-first-reasoning-petekp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This methodology enforces constructing an explicit, frozen problem MODEL before any reasoning or implementation, reducing hallucinations and misalignment.

Core Features & Use Cases

  • Phase 1: MODEL construction (entities, state_variables, actions, constraints, initial_state, goal, assumptions, unknowns, requirement_trace, test_oracles)
  • Phase 1.5: MODEL AUDIT to ensure coverage, operability, consistency, and testability
  • Phase 2: IMPLEMENTATION strictly from the frozen model, with no new entities or constraints
  • Unknowns handling: STOP if unknowns exist until resolved
  • Validation: write model.json and run validator to proceed

Quick Start

Provide Phase 1 modeling for a given task by detailing entities, state_variables, actions, and constraints in MODEL_TEMPLATE.json format.

Frequently Asked Questions about model-first-reasoning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is model-first reasoning for software engineering and how does it prevent bugs?

Model-first reasoning is a methodology that constructs an explicit, frozen problem MODEL before any reasoning or implementation, reducing hallucinations and misalignment. By defining entities, state variables, and constraints upfront, it prevents bugs through strict validation.

How do I build a formal model for a state machine before writing code?

To build a formal model for a state machine, you detail entities, state_variables, actions, constraints, initial_state, and goal in a MODEL_TEMPLATE.json format. You then write a model.json file and run a validator to proceed with implementation.

What is the best way to handle unknowns and constraints during code generation?

The best way to handle unknowns during code generation is to stop the process until they are resolved. The model-first approach requires freezing the model after a MODEL AUDIT, ensuring no new entities or constraints are introduced during the implementation phase.

Does model-first reasoning work for multi-step workflows and complex constraints?

Yes, model-first reasoning applies to tasks involving state machines, constraints, and multi-step workflows across software engineering and design. It validates operability and consistency through a MODEL AUDIT before freezing the model for implementation.

When should I not use a formal model approach for coding?

You should not use a formal model approach when unknowns exist that cannot be resolved, as the methodology requires stopping until they are clarified. It also restricts adding new entities or constraints during the implementation phase after the model is frozen.