codemeridian-refactor

A safer planning process for changing existing code with CodeMeridian, a tool that maps relationships between code symbols and files. It checks callers, dependencies, tests, duplicate code, and architecture risks before edits begin.

In plain words
What is it for?
Use it to plan refactors such as splitting classes, extracting services, removing duplication, simplifying flows, or reducing coupling.
Why use it?
It reduces the chance that a rename, move, deletion, or cleanup silently breaks other parts of the project. It also checks whether the relationship map matches the current working files.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/driftya/code-meridian/codemeridian-refactor
Any agent
npx skills add Driftya/code-meridian --skill codemeridian-refactor
Clone the repo
git clone --depth 1 https://github.com/Driftya/code-meridian

Made for: Claude Code, Codex.

Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,529 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00034 $0.01529
Opus 5 $0.00017 $0.00764
Sonnet 5 $0.00007 $0.00306
Haiku 4.5 $0.00003 $0.00153

Measured 2d ago against content hash 21cb8623a368, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codemeridian-refactor 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 2d 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.

docs/agent-capabilities/skills/codemeridian-refactor/SKILL.md · 329 lines

How it starts

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

CodeMeridian Refactor Skill

Use this skill when working in a repository indexed by CodeMeridian and the user asks to refactor, rename, split, extract, move, simplify, deduplicate, delete, or replace code.

The goal is to make refactoring safer by using graph context before changing files.

projectContext can be found in meridian.json in field project.

When To Use

Use this skill when the request includes words or intent like:

  • refactor this
  • clean this up
  • split this class
  • extract a service
  • extract an interface
  • rename this
  • move this code
  • remove duplication
  • delete unused code
  • simplify this flow
  • replace this implementation
  • reduce coupling
  • improve architecture
  • make this more maintainable

Core Rule

Do not start a refactor from a single file only.

First identify:

  1. what the code is
  2. who calls it
  3. what it calls
  4. which tests protect it
  5. what graph data is stale or uncertain
  6. which edits are safe versus risky

Workflow

1. Check Graph Freshness

Before trusting exact targets, check whether the graph matches the working tree.

Prefer:

  • check_graph_freshness
  • find_graph_drift

Report freshness clearly:

Graph freshness: fresh / stale / unknown

If freshness is stale or unknown, use graph results as guidance only and confirm exact files manually.

2. Resolve Exact Refactor Target

If the user names a class, method, endpoint, interface, component, or file, resolve it before editing.

Prefer:

  • resolve_exact_symbol
  • get_context_for_editing

Avoid refactoring by fuzzy name match when exact symbol resolution is available.

Report:

Refactor target:
- Symbol:
- File:
- Confidence:

3. Build Minimal Context

Gather the smallest useful context pack.

Prefer:

  • build_minimal_context
  • find_implementation_surface
  • source snippets with strict budgets when available

Do not load large unrelated files unless CodeMeridian cannot answer the question.

Report why each file matters when possible:

Read the full file on GitHub · 329 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 329 lines · 34 tokens per session scan A 21cb8623a368

Subscribe to this mod's changes

codemeridian-refactor is a skill published in the GitHub repository Driftya/code-meridian (4 stars, last pushed 3d ago), licensed MIT. It adds 34 tokens to every session and 1,529 once invoked, about $0.0002 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-08-31.

Related

Other skills, from other repositories

graph

Whole-codebase structural map of the codanna index as one self-contained HTML disc. Wedges per top-level module, concentric rings with hubs at the centre, hover or click a symbol to light its edge web, search, hide or highlight modules, brush a date range on the ribbon timeline (symbols dated by git blame), heatmap of…

bartolli/codanna · 131 tokens

x-ray

Deep codebase exploration using semantic search and relationship mapping. Use when you need to understand the current codebase.

bartolli/codanna · 25 tokens

use-ivygrep

Gather focused local repository context with ivygrep before implementing, debugging, reviewing, or explaining code. Use for coding tasks involving unfamiliar paths, branch changes, stack traces, architectural relationships, callers, dependents, tests, configuration, or documentation. Prefer one bounded context pack…

bvolpato/ivygrep · 65 tokens

memtrace-first

Route code discovery, debugging, flow tracing, how-code-works questions, and pre-edit rationale checks in indexed source-code repos to Memtrace graph plus Cortex decision tools. Use first before searching/reading code, and before editing, refactoring, deleting, or re-picking an approach that may have a recorded…

syncable-dev/memtrace-public · 115 tokens

memtrace-style-fingerprint

Pull the codebase's empirical style norm from Memtrace and match it when writing or editing source code in an indexed repo. Use when choosing between competing idioms (ternary vs if-else, arrow vs function declaration, const vs let, await vs .then, early-return vs nested-return), matching naming case, or when the user…

syncable-dev/memtrace-public · 111 tokens

memtrace-decision-memory

Use Cortex decision memory through the normal Memtrace MCP tools. Trigger for free-text questions about what was decided, chosen, rejected, banned, or established as a convention; for why a symbol exists or which contracts constrain it; for whether a known decision held, drifted, or was violated; and for the…

syncable-dev/memtrace-public · 137 tokens