Skip to content
Skillpedia
General coding48k Β· #3612

gitnexus-refactoring

What it does

It guides your agent to restructure code, such as renaming a function or moving it to a new file, without breaking the parts that depend on it. It is for developers who want safe, consistent refactoring.

When to use it

  • βœ“When you want to rename a function or class across a project safely.
  • βœ“When you want to extract a part of a file into its own module.
  • βœ“When you want to move or split a large service into smaller files.

Skill link

https://github.com/abhigyanpatwari/GitNexus/blob/main/.claude/skills/gitnexus-refactoring/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/abhigyanpatwari/GitNexus/blob/main/.claude/skills/gitnexus-refactoring/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you rename the function calculateTotal to computeTotal everywhere in this project, and show me the changes first?”

5 new skills a week. 1 minute to read.

How it works

The agent confirms the repository, runs a preview of the change, and reviews the affected files before writing anything. Only after that does it apply the edit.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Refactoring with GitNexus

When to Use

  • "Rename this function safely"
  • "Extract this into a module"
  • "Split this service"
  • "Move this to a new file"
  • Any task involving renaming, extracting, splitting, or restructuring code

Bind the repository first

Refactoring writes to disk. rename with dry_run: false edits files in whichever repository was resolved, so binding identity here is a safety gate, not bookkeeping.

Call list_repos {} before the first tool call. With one indexed repository, use the examples below as written. With more than one, pass repo on every call: an omitted repo normally errors, but under an MCP policy with a configured default it resolves to that default silently. If you cannot tell which repository is meant, stop and ask. Never run rename with dry_run: false until the preview in the same bound repository has been reviewed β€” its returned file_path values show which checkout is about to be written, so read them as a confirmation of identity.

list_repos is paginated, so page with offset: pagination.nextOffset until hasMore is false before concluding a repository is absent.

detect_changes takes worktree when you are editing a linked worktree the MCP server was not launched from; otherwise git diff runs in the wrong checkout and reports nothing changed, which reads as a verified refactor.

Workflow

0. list_repos {}                                  β†’ Bind repo (and worktree)
1. impact({target: "X", direction: "upstream"})  β†’ Map all dependents
2. query({search_query: "X"})                            β†’ Find execution flows involving X
3. context({name: "X"})                           β†’ See all incoming/outgoing refs
4. Plan update order: interfaces β†’ implementations β†’ callers β†’ tests

If "Index is stale" β†’ run node .gitnexus/run.cjs analyze in terminal. Hot-tool staleness names which index answered (branch/lastCommit) and how fresh it is (status). Re-analyze only for behind or diverged β€” current is identity, unknown is unmeasurable.

Checklists

Rename Symbol

- [ ] list_repos {} β€” bind repo; explicit repo when >1 indexed, ask if ambiguous
- [ ] rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) β€” preview semantic edits (omitting dry_run also previews)
- [ ] Confirm the previewed file paths are in the bound repository/worktree
- [ ] Review exact graph-backed semantic spans, coverage, and limitations
- [ ] If satisfied: rename({..., dry_run: false, plan_token: "<token from preview>"}) β€” apply exactly the reviewed edits
- [ ] detect_changes() β€” verify only expected files changed
- [ ] Run tests for affected processes

Extract Module

- [ ] list_repos {} β€” bind repo; explicit repo when >1 indexed, ask if ambiguous
- [ ] context({name: target}) β€” see all incoming/outgoing refs
- [ ] impact({target, direction: "upstream"}) β€” find all external callers
- [ ] Define new module interface
- [ ] Extract code, update imports
- [ ] detect_changes() β€” verify affected scope
- [ ] Run tests for affected processes

Split Function/Service

- [ ] list_repos {} β€” bind repo; explicit repo when >1 indexed, ask if ambiguous
- [ ] context({name: target}) β€” understand all callees
- [ ] Group callees by responsibility
- [ ] impact({target, direction: "upstream"}) β€” map callers to update
- [ ] Create new functions/services
- [ ] Update callers
- [ ] detect_changes() β€” verify affected scope
- [ ] Run tests for affected processes

Tools

rename β€” semantic rename; preview first, then apply:

rename({symbol_name: "validateUser", new_name: "authenticateUser", repo: "my-app", dry_run: true})
β†’ 12 edits across 8 files
β†’ semantic_edits: 12, coverage: {name: "gitnexus-semantic", scope: "indexed-repository", limitations: [...]}
β†’ changes: [{file_path, edits: [{start, length, line, old_text, new_text, confidence: "semantic"}]}]

dry_run omitted or true previews and never writes; dry_run: false requires the successful preview's plan_token. Keep the same repository, selected symbol, and destination name. Tokens are single-use, expire after 15 minutes or a server restart, and may be evicted when retained previews reach 16 plans or 64 MiB. Any apply attempt consumes the token; request and review a fresh preview to retry. An MCP server started with GITNEXUS_MCP_READ_ONLY=1 still lists rename, but as preview-only: it rejects any dry_run other than omitted or true, so apply through

FAQ

Does it preview changes before writing them?

Yes. The skill says to review a preview of the rename before applying it for real.

What if I have more than one project indexed?

The skill says to name the repository on every call, and to ask you if it cannot tell which one you mean.

Can it refactor code in a linked worktree?

Yes. It can take a worktree path when the changes are in a worktree the server was not launched from.

Details

Original description by the author

Use when the user wants to rename, extract, split, move, or restructure code safely. Examples: \"Rename this function\", \"Extract this into a module\", \"Refactor this class\", \"Move this to a separate file\"

repo: abhigyanpatwari/GitNexus

Popularity

GitHub stars
48k
Ranking position
#3612
License
β€”
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills