migrate-code

migrate-code is a command for Claude Code from authzed/authzed-marketplace. It costs 27 tokens per session (17,654 once invoked), scanned A, original, Apache-2.0.

A migration command that replaces OpenFGA authorization calls with SpiceDB client calls. OpenFGA and SpiceDB are systems that let applications define and check access rules.

In plain words
What is it for?
It adds a SpiceDB client, updates dependencies, and rewrites OpenFGA call sites into equivalent SpiceDB operations.
Why use it?
It addresses the gap between converting authorization data or rules and updating the application that still calls the old system.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Part of the spicedb-dev plugin — 8 skills, 15 commands, 3 agents shipped together

Good fit It adds a SpiceDB client, updates dependencies, and rewrites OpenFGA call sites into equivalent SpiceDB operations.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/authzed/authzed-marketplace/migrate-code
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/authzed/authzed-marketplace

Made for: Claude Code.

Or install spicedb-dev, the plugin that ships this one along with the rest of its 8 skills, 15 commands, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migrate-code

README.md
[![agentmods](https://agentmods.dev/badge/commands/authzed/authzed-marketplace/migrate-code/github.svg)](https://agentmods.dev/commands/authzed/authzed-marketplace/migrate-code)
Your own site
<a href="https://agentmods.dev/commands/authzed/authzed-marketplace/migrate-code"><img src="https://agentmods.dev/badge/commands/authzed/authzed-marketplace/migrate-code/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migrate-code

Your own site · 80×15
<a href="https://agentmods.dev/commands/authzed/authzed-marketplace/migrate-code"><img src="https://agentmods.dev/badge/commands/authzed/authzed-marketplace/migrate-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 17,654 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00027 $0.17654
Opus 5.5 $0.00011 $0.07062
Sonnet 5.5 $0.00005 $0.03531
Haiku 4.5 $0.00003 $0.01765

Measured 1mo ago against content hash 2e2af2ce5ac5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

migrate-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

spicedb-dev/commands/migrate-code.md · 937 lines

How it starts

The opening of the file, as written. The whole thing — 937 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Migrate Code

Phase 4 of the migration pipeline: add a real SpiceDB client to the project, then rewrite every OpenFGA call site into the SpiceDB equivalent -- construct by construct, per code-mapping.md -- so the conversion ends with working SpiceDB client code, not a converted schema and data set the application still checks against the old system.

It is not the last thing the plugin automates. Phase 5 (/spicedb-dev:migrate-tests) has no ordering dependency on this command and may run before or after it, and /spicedb-dev:migrate-verify automates cutover-strategies.md step 4's differential harness once phase 3 has passed verification. Step 7 of this command's own report (below) is where that routing is stated to the user; keep the two consistent.

This command does two things the earlier phases didn't need to: it changes the project's dependencies, and it edits files a human wrote. /spicedb-dev:migrate-schema, /spicedb-dev:migrate-data, and /spicedb-dev:migrate-tests all produce new, standalone artifacts (schema.zed, a migration script, validation YAML) that a human reviews before anything downstream depends on them. This command instead vendors a client into the project's own dependency manifest and rewrites existing application source files in place. Five traps are common enough to name up front, because each produces code that compiles clean and then fails or answers wrong at runtime:

  • A split relation is two names, and the write path and the check path need different ones. Phase 1 turned every source define that fused a [...] type list with an operator into a generated relation (viewer__direct) plus a same-named permission (viewer), and recorded the pair in migration-map.json's relation_splits. A rewrite that carries the source name through unchanged writes to a permission -- which SpiceDB rejects outright, on every write, at runtime -- and reads relationships through a filter that errors the same way; a rewrite that carries the generated name onto a check gets a narrower answer with no error at all. See code-mapping.md's "The relation-split obligation," and step 6 rule 3.
  • Check code cannot be ported across languages mechanically. Python's check_permission has no permission parameter at all -- it reads Relationship.resource_relation -- and Rust's check_permission (singular) returns a CheckResult wrapper, not a bare bool. Converting a Go call site's CheckOne(ctx, cs, "viewer", rel) shape into Python or Rust by find-and-replace produces code that either doesn't compile or discards a wrapper silently. See code-mapping.md's "Per-language check-signature divergence."
  • The identifier obligation fails closed, not at build time. Data written under base64url(email) by /spicedb-dev:migrate-data while a call site still checks user:[email protected] is a silent half-migration: the raw form fails SpiceDB's own object-id grammar on every single check, discovered in production traffic, not by a type checker or zed validate. Every call site that builds or reads an id of an encoded type must go through the codec phase 3 emitted -- see code-mapping.md's "The identifier obligation."
  • batchCheck ordering silently corrupts results, not just names. OpenFGA's response is a map keyed by correlation_id, with no order guarantee. The SpiceDB client returns a plain, positionally-ordered array. Code that still pairs responses back to requests by correlation_id after a rename-only conversion pairs the wrong answer to the wrong request whenever the two happen to reorder -- see code-mapping.md's "batchCheck ordering."
  • A sync OpenFGA source converting to Python's async-only client can turn a denial into a silent allow. Python is the one language of the seven where this actually happens: openfga_sdk.sync.OpenFgaClient is a real, documented sync client, but the prototype spicedb-python client has no sync form at all -- every method is async def, so the rewrite necessarily adds an await that was not in the source. A call site that misses it gets back a bare coroutine object, not a bool; a coroutine is truthy in Python's own if, so a check that would answer False takes the allowed branch instead, and the object compiles and runs without error. Confirmed live, and confirmed invisible to pyright and mypy --strict alike -- this is not a symptom of an untyped codebase, no Python type checker currently flags it. The other six languages do not share this shape: Go/Java/Ruby's SpiceDB targets are synchronous (no await to omit), and C#/Rust reject a missing await/.await at compile time; TypeScript's Promise is truthy the same way a coroutine is, but @openfga/sdk has no sync client for a rewrite to carry the habit over from, and tsc itself flags the bare case (TS2801) under a real type-check build. Review every Python call site converted from a sync OpenFGA client for a missing await by inspection -- see code-mapping.md's "Async-only target vs. sync source: the un-awaited-coroutine fail-open."

Read the full file on GitHub · 937 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +1 lines 2e2af2ce5ac5
  2. 1mo ago First seen · 936 lines · 27 tokens per session scan A b0a7156a6a9b

Subscribe to this mod's changes

migrate-code is a command published in the GitHub repository authzed/authzed-marketplace (2 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 27 tokens to every session and 17,654 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.