{
 "schema": "aiblocks-page/1",
 "id": "agency-engineering-rust-refactoring-specialist",
 "type": "agent",
 "name": "Rust refactoring planner",
 "summary": "Get a Rust refactoring plan or a full change set, with every affected file named and the cargo checks to run before you merge.",
 "headline": "Rust refactoring planner",
 "subhead": "Share your Rust code, the refactor goal and what must not change. It finds every place the change reaches, lists the findings or writes the change set, and gives the cargo checks to run.",
 "job": {
  "id": "test-and-fix-code",
  "name": "Test and fix code"
 },
 "level": "intermediate",
 "thinking": "high",
 "tested": true,
 "updated": "2026-11-03",
 "first_published": "2026-10-26",
 "inputs": [
  {
   "type": "question",
   "required": true,
   "label": "Question",
   "what": "the problem, decision or piece of work you want help with, and what a good outcome looks like"
  },
  {
   "type": "codebase",
   "required": true,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  }
 ],
 "outputs": [
  {
   "type": "code_change",
   "required": true,
   "label": "Code change",
   "what": "a change to the code, with what it fixes and how it was checked"
  },
  {
   "type": "audit_report",
   "required": true,
   "label": "Audit report",
   "what": "findings with evidence, severity, missing inputs and next actions"
  }
 ],
 "you_give": [
  "The Rust code in scope, such as files, a module or a crate, pasted or attached",
  "The goal in one sentence, such as \"borrow paths instead of cloning them\" or \"split config.rs into modules\"",
  "Whether you want an audit list or the full change",
  "What must not change, such as the public API, error types or the minimum Rust version",
  "Your Cargo.toml and the current test or Clippy results (optional)"
 ],
 "you_get": [
  "In audit mode, a numbered list of findings, each with place, evidence, end state, risk and how to verify",
  "In change mode, the full set of edits across every affected file, with before and after code",
  "A note on what stays the same, and any change in behavior that needs your yes",
  "The cargo commands to run, marked as run or not run",
  "A list of what it could not check, such as feature flags or other targets"
 ],
 "use_when": [
  "You want a rename, a module split or a signature change done everywhere it reaches, not just where you spotted it.",
  "Clippy or compiler warnings have piled up, and you want them fixed without turning off the lint.",
  "A function takes owned values and clones them at every call, and you want to borrow instead.",
  "You inherited a Rust crate and want a ranked list of safe clean-ups before you touch it."
 ],
 "skip_when": [
  "You need a one-line bug fix with the smallest possible diff. Use the Focused code fix developer.",
  "Your code is not Rust. Use the Code Reviewer agent, or the Full stack developer for other languages.",
  "You want a security review of unsafe code or crypto. Use the Application security reviewer, and have a Rust expert review it.",
  "You have no tests and no way to run cargo. Expect a plan and a list of tests to write first, not changes you can trust."
 ],
 "output_sample": {
  "input": [
   "The Rust files, module or crate in scope",
   "The goal, and whether you want an audit or the full change",
   "What must not change, such as public API or the minimum Rust version",
   "Your Cargo.toml and current test results (optional)"
  ],
  "prerequisites": [
   "Rust and cargo installed, to run the checks the AI lists",
   "Your tests passing first, or a list of the ones that already fail"
  ],
  "output": [
   {
    "name": "Scope and goal",
    "contains": "The goal in one line, the mode, what must stay the same, and what is missing."
   },
   {
    "name": "Findings",
    "contains": "Each opportunity with place, evidence, end state, risk and how to verify it (audit mode)."
   },
   {
    "name": "Change set",
    "contains": "Before and after code for every affected file, so no caller or test is left behind."
   },
   {
    "name": "Behavior and API",
    "contains": "What stays identical, and any public change that waits for your yes."
   },
   {
    "name": "Verification",
    "contains": "The cargo format, test and Clippy commands to run, with what a pass looks like."
   },
   {
    "name": "Remaining risk",
    "contains": "What it could not check, such as other targets or feature flags, and deferred ideas."
   }
  ]
 },
 "output_shape": "SCOPE AND GOAL\n  goal <one sentence> | mode <audit or change> | must not change <list> | ASSUMED: <list> | MISSING: <list>\n\nFINDINGS (audit mode)\n  RUST-<number> | <type> | <title>\n    location <file and symbol> | evidence <what you saw> | end state <what it becomes>\n    coupled changes <files> | API or behavior impact <none or described> | risk and value <low, medium, high> | verification <commands>\n\nCHANGE SET (change mode)\n  <file> | <before and after code> | why it changes\n\nBEHAVIOR AND API\n  kept the same <list> | needs your yes <list>\n\nVERIFICATION\n  <cargo command> | what a pass looks like | RUN or NOT RUN\n\nREMAINING RISK\n  <coverage gaps> | <deferred opportunities>",
 "how_to_use": [
  "Download the pack from this page and add it to your AI as a skill. Or paste SKILL.md into a new chat, then paste references/source-agent.md after it.",
  "Paste your goal, what must not change, and the code. Say \"audit only\" if you want findings first. A chat AI can read only what you paste, so add the callers and tests too.",
  "Read the findings or plan first. Remove any item you do not want, then ask for the change.",
  "Check the list of public items it will touch. Say yes or no to each. It will not change public API without your yes.",
  "In your own terminal, run cargo fmt, cargo test and cargo clippy as listed. Paste any failure back into the chat.",
  "Use a coding AI that can open your repo, such as Claude Code, for a large crate. It can follow every reference and run cargo itself."
 ],
 "checks": [
  "The result addresses your actual task and cites the evidence used.",
  "Examples, role-play experience and targets are kept separate from verified results.",
  "Claims of tests, memory, tool access or completed actions match what actually happened."
 ],
 "next": [
  {
   "name": "Pull request risk reviewer",
   "url": "https://useaiblocks.com/skills/pull-request-risk-reviewer",
   "why": "Pull request risk reviewer"
  }
 ],
 "source": {
  "by": "Michael Sitarzewski and Agency Agents contributors",
  "repo": "msitarzewski/agency-agents",
  "url": "https://github.com/msitarzewski/agency-agents/blob/b37b5bb33b78f2c1d6567d98e25ca818e3259219/engineering/engineering-rust-refactoring-specialist.md",
  "licence": "MIT",
  "original_name": "Rust Refactoring Specialist",
  "commit": "b37b5bb33b78f2c1d6567d98e25ca818e3259219"
 },
 "credits": [
  {
   "title": "Rust Refactoring Specialist",
   "by": "Michael Sitarzewski and Agency Agents contributors",
   "url": "https://github.com/msitarzewski/agency-agents/blob/b37b5bb33b78f2c1d6567d98e25ca818e3259219/engineering/engineering-rust-refactoring-specialist.md",
   "used": "Original agent profile, preserved in references/source-agent.md; AI Blocks adds setup and review instructions."
  }
 ],
 "files": [
  "LICENSE",
  "references/source-agent.md",
  "SETUP.md",
  "source.json"
 ],
 "links": {
  "page": "https://useaiblocks.com/agents/agency-engineering-rust-refactoring-specialist",
  "markdown": "https://useaiblocks.com/agents/agency-engineering-rust-refactoring-specialist.md",
  "json": "https://useaiblocks.com/agents/agency-engineering-rust-refactoring-specialist.json",
  "instructions": "https://useaiblocks.com/skills/agency-engineering-rust-refactoring-specialist/SKILL.md",
  "download": "https://useaiblocks.com/skills/agency-engineering-rust-refactoring-specialist.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/agency-engineering-rust-refactoring-specialist",
  "api_document": "https://useaiblocks.com/api/v1/documents/agent/agency-engineering-rust-refactoring-specialist",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
