AgentSkillsCN

dial-create-machine

创建 DIAL 状态机定义。当您需要以 JSON 格式定义新的决策流程时,可选用此方法。

SKILL.md
--- frontmatter
name: dial-create-machine
description: Create a DIAL state machine definition. Use when defining a new decision process as JSON.

Create a Machine Definition

Define a state machine for a decision process.

Structure

json
{
  "machine": {
    "id": "unique-machine-id",
    "description": "What this machine does",
    "defaultState": "goal-state",
    "states": { ... }
  },
  "specialists": {
    "proposers": [...],
    "voters": [...]
  }
}

Required Fields

FieldTypeDescription
machine.idstringUnique identifier for the machine
machine.defaultStatestringThe goal state that ends the session
machine.statesobjectState definitions with transitions

State Types

TypeMeaning
initialStarting state of the session
intermediateNormal state with outgoing transitions
defaultGoal state; session completes when reached

Transition Definition

json
{
  "action-name": {
    "target": "next-state",
    "prompt": "Question that guides the decision"
  }
}

Complete Example

json
{
  "machine": {
    "id": "document-approval",
    "description": "Route documents through review and approval",
    "defaultState": "approved",
    "states": {
      "draft": {
        "type": "initial",
        "transitions": {
          "submit": {
            "target": "review",
            "prompt": "Submit this document for review?"
          }
        }
      },
      "review": {
        "type": "intermediate",
        "transitions": {
          "approve": {
            "target": "approved",
            "prompt": "Document meets quality standards?"
          },
          "reject": {
            "target": "draft",
            "prompt": "Document needs revision?"
          }
        }
      },
      "approved": {
        "type": "default"
      }
    }
  },
  "specialists": {
    "proposers": [
      {
        "id": "ai-reviewer",
        "strategy": "llm",
        "config": {
          "model": "claude-sonnet-4-20250514"
        }
      }
    ],
    "voters": [
      {
        "id": "human-approver",
        "strategy": "human"
      }
    ]
  }
}

Validation

Check your machine definition:

bash
cat machine.json | jq .

Test with verbose output:

bash
npx dialai machine.json --verbose