refactor-stack

refactor-stack is a command for Claude Code from navraj007in/architecture-cowork-plugin. It costs 19 tokens per session (3,125 once invoked), scanned A, original, Apache-2.0.

A coordinated architecture-change command for updating a database, framework, cloud provider, ORM, or similar technology across an SDL specification. SDL is a structured record of the system's architecture.

In plain words
What is it for?
Planning and applying changes such as moving from PostgreSQL to MongoDB, Express to FastAPI, or one cloud provider to another.
Why use it?
It keeps related architecture sections consistent and shows which generated or downstream work may need to change.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the architect plugin — 48 skills, 63 commands, 19 agents, 7 MCP servers shipped together

Good fit Planning and applying changes such as moving from PostgreSQL to MongoDB, Express to FastAPI, or one cloud provider to another.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/navraj007in/architecture-cowork-plugin/refactor-stack
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/navraj007in/architecture-cowork-plugin

Made for: Claude Code.

Or install architect, the plugin that ships this one along with the rest of its 48 skills, 63 commands, 19 agents, 7 MCP servers.

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 refactor-stack

README.md
[![agentmods](https://agentmods.dev/badge/commands/navraj007in/architecture-cowork-plugin/refactor-stack/github.svg)](https://agentmods.dev/commands/navraj007in/architecture-cowork-plugin/refactor-stack)
Your own site
<a href="https://agentmods.dev/commands/navraj007in/architecture-cowork-plugin/refactor-stack"><img src="https://agentmods.dev/badge/commands/navraj007in/architecture-cowork-plugin/refactor-stack/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 refactor-stack

Your own site · 80×15
<a href="https://agentmods.dev/commands/navraj007in/architecture-cowork-plugin/refactor-stack"><img src="https://agentmods.dev/badge/commands/navraj007in/architecture-cowork-plugin/refactor-stack.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,125 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.00019 $0.03125
Opus 5 $0.00010 $0.01563
Sonnet 5 $0.00004 $0.00625
Haiku 4.5 $0.00002 $0.00313

Measured 5d ago against content hash 9222879d5f08, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

refactor-stack 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 5d 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.

commands/refactor-stack.md · 369 lines

How it starts

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

/architect:refactor-stack

Trigger

/architect:refactor-stack [change description]

Examples:

  • /architect:refactor-stack postgres to mongodb
  • /architect:refactor-stack express to fastapi
  • /architect:refactor-stack vercel to railway
  • /architect:refactor-stack add postgres replica

Purpose

When an architecture component needs to change (database engine, framework, cloud provider, ORM), this command performs a coordinated refactor across the entire SDL. It rewrites all affected sections consistently, validates the new architecture against all 20+ SDL rules, flags what downstream artifacts need regeneration, and produces a detailed change report.

This prevents the fragmentation that happens when only a few SDL fields are updated without checking side effects.

Workflow

Quick Navigation

Phase Steps
Analysis Step 1 · Step 2 · Step 3
Validation Step 4
Execution Step 5 · Step 6
Completion Step 7 · Step 8 · Step 9

Step 1: Read Existing SDL & Validate

Check for solution.sdl.yaml in the current working directory.

If absent, respond:

"No SDL found. Run /architect:blueprint first to design your architecture, then come back to refactor it."

If present, read it in full (or if multi-file, read sdl/README.md then merge the modules).

Store the original SDL in memory for comparison after refactoring.

Step 2: Parse the Change Request

Extract what's being changed from the user's input. Use natural language understanding:

Change patterns to recognize:

User Input Parsed Change Impact
"postgres to mongodb" data.primaryDatabase.type: postgres → mongodb Database, ORM, entities, migrations
"add postgres read replica" data.secondaryDatabases += { type: postgres, ... } Deployment, cost, replication config
"express to fastapi" architecture.projects[].{framework, language, runtime} Backend service, ORM, migrations, deployment
"vercel to railway" deployment.cloud: vercel → railway Deployment, CI/CD, regions, cost
"add elasticsearch" data.search: { type: elasticsearch } Data architecture, integrations, deployment
"jwt to oauth2" auth.strategy: jwt → oauth2 Auth, dependencies, integrations, complexity

Read the full file on GitHub · 369 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. 5d ago First seen · 369 lines · 19 tokens per session scan A 9222879d5f08

Subscribe to this mod's changes

refactor-stack is a command published in the GitHub repository navraj007in/architecture-cowork-plugin (2 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 19 tokens to every session and 3,125 once invoked, about $0.0001 per session on Opus 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-09-03.