Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

model-first-reasoning模型优先推理

Agent Skill

model-first-reasoning 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

630

周安装

26

GitHub Stars

4

下载量

206
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:model-first-reasoning(模型优先推理)
来源仓库:https://github.com/petekp/agent-skills
仓库路径:skills/model-first-reasoning
安装命令:
npx skills add https://github.com/petekp/agent-skills --skill model-first-reasoning
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/petekp/agent-skills --skill model-first-reasoning

简介

用于查找、检索和筛选相关信息,支持优先推理任务。

  • 适合根据关键词或任务场景快速定位候选结果。
  • 可结合来源仓库和原始 README 继续核验用法。
  • 安装前建议确认权限范围和维护状态。model-first-reasoning 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 支持 Codex、Claude、Cursor、Gemini CLI;通过 github 安装。

SKILL.md

Model-First Reasoning (MFR)

A rigorous methodology that REQUIRES constructing an explicit problem MODEL before any reasoning or implementation. The model becomes a frozen contract that governs all downstream work.

Based on Kumar & Rana (2025), "Model-First Reasoning LLM Agents: Reducing Hallucinations through Explicit Problem Modeling" (arXiv:2512.14474)

Why MFR Works

Hallucination is not merely the generation of false statements—it is a symptom of reasoning performed without a clearly defined model of the problem space.

Reasoning does not create structure; it operates on structure. When that structure is implicit or unstable, reasoning becomes unreliable. MFR provides "soft symbolic grounding"—enough structure to stabilize reasoning without imposing rigid formalism.

Core Principle

Phase 1 produces the MODEL. Phase 2 reasons/implements ONLY within the model.

This prevents the common failure mode where reasoning introduces ad-hoc decisions, missing constraints, or invented behavior not grounded in the problem definition.

Non-Negotiable Rules

  1. Phase 1 (Model) produces NO code, no solution steps—only the formal model
  2. Phase 2 (Implement) may NOT introduce new entities, state, actions, or constraints
  3. If you need something not in the model: output exactly MODEL INCOMPLETE + what to add, then STOP
  4. No invented APIs or dependencies. If not provided, either ask (unknowns) or create a stub clearly marked STUB

The Model as Contract

After creating the model, run a MODEL AUDIT before coding:

Audit Checks

CheckDescription
CoverageEvery user requirement is represented in exactly one of: a constraint, the goal/acceptance criteria, or an action precondition/effect
OperabilityEvery operation your plan would require is present as an action
ConsistencyConstraints don't contradict each other; action effects don't violate invariants
TestabilityEvery constraint has ≥1 test oracle

If any audit check fails, revise the model (still Phase 1) until it passes.

Freeze Rule

Once the audit passes, treat the model as read-only source of truth.

If later you discover missing info during implementation:

  1. Emit a MODEL PATCH (minimal change)
  2. Restart Phase 2 from scratch using the updated model

Validation

After creating the model, write it to model.json and run the validator:

python scripts/validate-model.py model.json

Exit codes:

  • 0 = Valid, ready for Phase 2
  • 1 = Invalid structure (fix and retry)
  • 2 = Valid but has unknowns (STOP after Phase 1)

Output Format

Phase 1: MODEL

The model may be expressed in natural language, semi-structured text, or JSON. Flexibility improves compliance—what matters is that the representation is explicit, inspectable, and stable.

For code generation tasks, the structured format below is recommended. Use MODEL_TEMPLATE.json as a reference:

{
  "deliverable": {
    "description": "What we're building",
    "files_expected": ["path/to/file.ts", ...]
  },
  "entities": [
    {"name": "EntityName", "description": "...", "properties": [...]}
  ],
  "state_variables": [
    {"name": "varName", "type": "...", "initial": "...", "description": "..."}
  ],
  "actions": [
    {
      "name": "actionName",
      "description": "...",
      "preconditions": ["..."],
      "effects": ["..."],
      "parameters": [...]
    }
  ],
  "constraints": [
    {"id": "C1", "statement": "...", "type": "invariant|precondition|postcondition"}
  ],
  "initial_state": ["description of starting conditions"],
  "goal": ["acceptance criteria"],
  "assumptions": ["things we assume to be true"],
  "unknowns": ["questions that must be answered before proceeding"],
  "requirement_trace": [
    {
      "requirement": "<verbatim from user>",
      "represented_as": "goal|constraint|action",
      "ref": "C1|action_name|goal_item"
    }
  ],
  "test_oracles": [
    {"id": "T1", "maps_to": ["C1"], "description": "how to verify constraint"}
  ]
}

Critical: If unknowns is non-empty, STOP after Phase 1. Do not implement until unknowns are resolved.

Phase 1.5: MODEL AUDIT

Return:

{
  "audit_pass": true|false,
  "issues": [
    {"type": "coverage|operability|consistency|testability", "detail": "..."}
  ]
}

If audit_pass is false, STOP and return to Phase 1 to revise the model.

Phase 2: IMPLEMENTATION

Using ONLY the frozen model:

A) PLAN

Numbered steps where each step must be an instance of a defined action:

Step 1: [action_name]
  - Preconditions check: [list which preconditions are satisfied]
  - Effects applied: [what state changes]
  - Constraints check: [C1, C2, ...]

B) CODE

Create all files in deliverable.files_expected:

Model ElementCode Translation
entities / state_variablesTypes, interfaces, data models
actionsFunctions/modules with validation + explicit failure modes
constraintsRuntime checks, defensive parsing, invariants

C) TESTS

Implement all test_oracles. Every constraint must be covered by ≥1 test.

D) VERIFICATION MAP

For each constraint, document:

  • Where it is enforced in code (file:line)
  • Which tests cover it

When to Use MFR

MFR is most valuable for:

  • Complex state machines — where transitions must be valid
  • Business logic with invariants — rules that must never be violated
  • Data transformations — where input/output contracts matter
  • Multi-step workflows — with dependencies between steps
  • Safety-critical features — where bugs have high cost
  • Collaborative specifications — where the model serves as documentation

When NOT to use: Simple, single-step tasks where the overhead of explicit modeling exceeds its benefit.

Relationship to Other Reasoning Strategies

MFR is complementary, not competing:

  • With Chain-of-Thought: Use CoT within Phase 2 for step-by-step reasoning over the model
  • With ReAct: Treat the model as persistent state that actions operate on
  • With planning agents: The model provides the domain specification that planners reason over

MFR provides a foundational layer that improves robustness of any reasoning strategy in constraint-heavy domains.

Example Workflow

User: Build a shopping cart that enforces: max 10 items, no duplicate SKUs,
      total can't exceed $1000

You: [PHASE 1: MODEL]
{
  "entities": [
    {"name": "CartItem", "properties": ["sku", "price", "quantity"]}
  ],
  "constraints": [
    {"id": "C1", "statement": "cart.items.length <= 10", "type": "invariant"},
    {"id": "C2", "statement": "all SKUs in cart are unique", "type": "invariant"},
    {"id": "C3", "statement": "sum(items.price * items.quantity) <= 1000", "type": "invariant"}
  ],
  "actions": [
    {
      "name": "addItem",
      "preconditions": ["cart.items.length < 10", "sku not in cart", "new total <= 1000"],
      "effects": ["item added to cart"]
    }
  ],
  ...
}

[PHASE 1.5: MODEL AUDIT]
{
  "audit_pass": true,
  "issues": []
}

[PHASE 2: IMPLEMENTATION]
// Now implementing strictly from the model...

Remember

The model is not overhead—it IS the specification. Most failures in complex reasoning are representational, not inferential: the reasoning was fine, but it operated on an incomplete or unstable understanding of the problem.

By externalizing the model, we make assumptions inspectable, constraints enforceable, and errors diagnosable. The model becomes the contract between intent and implementation.

Model first. Then reason. Never invert this.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.95%
按下载量换算56

OpenCode

20.5%
按下载量换算42

Codex

17.85%
按下载量换算37

windsurf

12.16%
按下载量换算25

Gemini CLI

7.86%
按下载量换算16

Cursor

2.97%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills