Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

petrinaut

БесплатноЗапускает вложенные скриптыНе проверен

Read and write a Petri net (SDCPN) document by Automerge URL. Use when creating, editing, or querying Petri nets — adding or removing places, transitions…

hashintelот hashintel★ 38 звёзд на GitHub

Об этом скилле

Petrinaut Skill

Read and write a Stochastic Dynamic Coloured Petri Net (SDCPN) document. Supports individual element operations, batch modifications, and cascading deletes.

Top-level API

Method Description
await createPetriNet(title?) Create a new empty Petri net document. Returns { handle, url }.
await getPetriNet(url) Get a read/write interface for an existing Petri net document.

Types

// Place — a state/location in the net (drawn as a circle)
{
  id: string,           // UUID, auto-generated
  name: string,
  colorId: string|null, // references a Color by id
  dynamicsEnabled: boolean,
  differentialEquationId: string|null,
  x: number,
  y: number,
  visualizerCode?: string  // custom SVG/JSX rendering function
}

// Transition — a transformation/event in the net (drawn as a rectangle)
{
  id: string,           // UUID, auto-generated
  name: string,
  inputArcs: Arc[],     // required, arcs from places into this transition (pass [] if none)
  outputArcs: Arc[],    // required, arcs from this transition to places (pass [] if none)
  lambdaType: "predicate" | "stochastic",
  lambdaCode: string,   // firing-condition function body
  transitionKernelCode: string,  // output-token colouring function body
  x: number,
  y: number
}

// Arc — connects a place to a transition (or vice versa)
{
  placeId: string,      // references a Place by id
  weight: number        // number of tokens consumed/produced (>= 1)
}

// Color (Type) — defines token structure for places
{
  id: string,
  name: string,
  iconSlug: string,     // e.g. "circle"
  displayColor: string, // hex code, e.g. "#3498db"
  elements: ColorElement[]
}

// ColorElement — a dimension/field of a Color
{
  elementId: string,
  name: string,
  type: "real" | "integer" | "boolean"
}

// DifferentialEquation — continuous dynamics for a color type
{
  id: string,
  name: string,
  colorId: string,      // references a Color by id
  code: string          // dynamics function body
}

// Parameter — a global parameter accessible in all code blocks
{
  id: string,
  name: string,
  variableName: string, // identifier used in code, e.g. "alpha"
  type: "real" | "integer" | "boolean",
  defaultValue: string
}

Petri net object

Returned by getPetriNet(url). All read methods are synchronous; all write methods are synchronous (they mutate the Automerge document in place).

Method Description
url The Automerge URL of the backing document.
getPlaces() Returns all places as Place[].
getTransitions() Returns all transitions as Transition[].
getArcs() Returns all arcs as flat list with { id, direction, placeId, transitionId, weight }.
getColors() Returns all color types as Color[].
getDifferentialEquations() Returns all differential equations.
getParameters() Returns all global parameters.
getTitle() Returns the document title.
addPlace(args) Add a place. Returns the created Place.
addTransition(args) Add a transition. inputArcs and outputArcs are required (use [] if none). Returns the created Transition.
addArc(args) Add an arc between a place and a transition.
addColor(args) Add a color/type definition. Returns the created Color.
addDifferentialEquation(args) Add a differential equation. Returns the created equation.
addParameter(args) Add a global parameter. Returns the created Parameter.
setTitle(title) Set the document title.
removeItems(items) Cascading delete — see Remove Items below.
modifyNetElements({ add, remove }) Batch add and/or remove in a single transaction.

Method Details

createPetriNet(title?)

const { handle, url } = await createPetriNet("SIR Model");

getPetriNet(url)

const net = await getPetriNet(url);
const places = net.getPlaces();

addPlace(args)

net.addPlace({
  name: "Susceptible",         // required
  x: 200,                      // optional, defaults to 100
  y: 150,                      // optional, defaults to 100
  colorId: "<color-uuid>",     // optional, null if untyped
  dynamicsEnabled: false,      // optional, defaults to false
  differentialEquationId: null, // optional
  visualizerCode: "..."        // optional, custom SVG renderer
});

The visualizerCode is a function that receives { tokens, parameters } and returns JSX/SVG:

export default Visualization(({ tokens, parameters }) => {
  return <svg>
    <circle cx="50" cy="50" r="40" stroke="black" strokeWidth="3" fill="red" />
  </svg>
});

addTransition(args)

net.addTransition({
  name: "Infect",              // required
  inputArcs: [                 // required, arcs from places into this transition (use [] if none)
    { placeId: "<place-uuid>", weight: 1 }
  ],
  outputArcs: [                // required, arcs f
Полный SKILL.md на GitHub

Установить petrinaut в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

datatype.tsindex.tsskill-api.tstool.tsxvite-env.d.ts

FAQ

Что делает скилл petrinaut?

Read and write a Petri net (SDCPN) document by Automerge URL. Use when creating, editing, or querying Petri nets — adding or removing places, transitions, arcs, color types, differential equations, and parameters.

Как установить скилл petrinaut?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл petrinaut запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить petrinaut с