Command Palette

Search for a command to run...

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

verify-in-place

БесплатноБез исполняемых скриптовНе проверен

Verify existing agent code without changing it. Write a model of its control flow as a @statelyai/agent machine, prove the model's rules with canReach, record…

statelyaiот statelyai★ 86 звёзд на GitHub

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

Verify existing code in place

Targets @statelyai/agent 2.0 alpha, as on the next branch. Needs a version whose @statelyai/agent/testing exports checkConformance and recordAiSdk, and whose RecordedModelCall type has aiSdkCall (check the package, not the version number). APIs change between alphas: when a call here does not match the installed package, check node_modules/@statelyai/agent/CHANGELOG.md.

You leave the code alone and build evidence about it: a model of its control flow, proofs of the model's rules, and a check that recorded runs of the code conform to the model.

rules → seam → model → proofs → record → map → conformance → coverage → bite check → hand back

The claim you hand back is "the model is proved, and these recorded runs conform". Never "the code is verified": a run nobody recorded can still break a rule. Runtime enforcement comes from migrating with loop-to-machine, which this skill does not do.

Worked example: examples/verify-in-place. Guide: docs/verify-in-place.md.

1. Read the code: rules and units of work

  • Write each rule as one sentence a search can falsify: "a refund over 100 never runs without approval", "at most 3 decisions". Read thresholds and caps from the code; ask the user only for rules the code does not state.
  • List the units of work: each side effect the loop makes (a model call, a tool, a write, a person's answer). Each one becomes a model actor or event.

2. The seam

The check records the code's side effects without editing it.

The code Record with
Side effects go through one object or injected functions recorder.fn(name, fn) around each function
It calls an SDK client it receives recorder.client(name, client, { methods })
It receives an AI SDK model recorder.model(standIn) (no name argument), plus the AI SDK recipe below so retries are attributed
It builds an AI SDK model inline, or passes module-level tools to generateText The AI SDK recipe below
Other side effects are module imports with no injection point Module mocks in the test (vi.mock) that wrap the real functions with recorder.fn
A framework takes an AI SDK model through its own adapter (openai-agents aisdk(model)) recorder.model(standIn) passed to that adapter and set as the framework's default model. Every agent the scenario builds must resolve to the stand-in: override each agent's own model with it, and mock the provider packages (vi.mock("@ai-sdk/openai")) to throw, so a call to any other model fails the scenario
It does its work when imported (calls main(), reads stdin, calls process.exit) Mock stdin (node:readline) and process.exit, call vi.resetModules(), then a dynamic import() per scenario (a cached module does not run main() again); keep seam state on globalThis so it survives the reset. import() can resolve while an unawaited main() still runs, so wait for a completion signal (the mocked process.exit, or the last mocked effect resolving a promise) before reading the recording or starting the next scenario. The mocked process.exit must stop execution at the call, so nothing after it runs or is recorded, and its exit code is the scenario's outcome. When the script calls process.exit itself, run each scenario in a child process and read its exit code

AI SDK code. Mock "ai" with recordAiSdk: each generateText and streamText call runs on the real AI SDK with the seam's model in place of the code's, and its tools wrapped with recorder.tools. The code's own tool loop runs, and the provider needs no mock:

// seam.ts: current = { recorder, model: recorder.model(new MockLanguageModelV3(...)) } per scenario
export const currentSeam = () => current;

// the test
vi.mock("ai", async (importOriginal) => {
  const ai = await importOriginal<typeof import("ai")>();
  const { recordAiSdk } = await import("@statelyai/agent/testing");
  const { currentSeam } = await import("./seam");
  return { ...ai, ...recordAiSdk(ai, currentSeam) };
});
  • The seam module must not import "ai", or the mock deadlocks. Import error classes from @ai-sdk/provider.
  • recordAiSdk replaces the model, not the tools: each tool's real execute runs. Before recording, read every tool the code passes. A tool with an external effect (it moves money, sends a message, writes to a shared store) must run against a stand-in: mock the module or client it calls, the same way as other module imports. Ask the user before any scenario would reach a real external system, and never record against production.
  • A call while currentSeam() returns undefined throws, so no test reaches a real provider.
  • A tool with execute runs inside the generateText call, before the loop sees the
Полный SKILL.md на GitHub

Установить verify-in-place в Claude Code и Claude Desktop

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

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

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

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

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

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

FAQ

Что делает скилл verify-in-place?

Verify existing agent code without changing it. Write a model of its control flow as a @statelyai/agent machine, prove the model's rules with canReach, record runs of the unchanged code, and check them against the model with checkConformance and traceCoverage. Use when asked to "verify my agent without rewriting it", "check my existing agent against a model", "prove my loop never does X", "model my existing workflow", "conformance", or "add guarantees to this agent" for code that already runs and should stay as it is. Migration to a machine is a separate step (loop-to-machine).

Как установить скилл verify-in-place?

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

Скилл verify-in-place запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить verify-in-place с