gitnexus-refactoring
하는 일
함수 이름을 바꾸거나 새 파일로 옮기는 식으로 코드를 재구성하되, 그것에 의존하는 부분은 깨지지 않게 하는 방법을 안내합니다. 일관되고 안전한 리팩터링을 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓프로젝트 전체에서 함수나 클래스 이름을 안전하게 바꾸고 싶을 때.
- ✓파일의 일부를 독립된 모듈로 빼내고 싶을 때.
- ✓큰 서비스를 더 작은 파일로 나누거나 옮기고 싶은 경우.
스킬 링크
https://github.com/abhigyanpatwari/GitNexus/blob/main/.claude/skills/gitnexus-refactoring/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“프로젝트 전체에서 calculateTotal 함수를 computeTotal로 이름을 바꿔 주시고, 변경 내용을 먼저 보여 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 저장소를 확인하고 변경 미리보기를 실행한 뒤, 영향을 받는 파일을 검토합니다. 그다음에야 실제로 편집을 적용합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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 analyzein terminal. Hot-toolstalenessnames which index answered (branch/lastCommit) and how fresh it is (status). Re-analyze only forbehindordiverged—currentis identity,unknownis 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
자주 묻는 질문
변경을 쓰기 전에 미리 볼 수 있나요?
예. 스킬은 이름 변경을 실제로 적용하기 전에 미리보기를 검토하라고 안내합니다.
색인된 프로젝트가 여러 개라면 어떻게 하나요?
스킬은 호출할 때마다 저장소 이름을 밝히고, 어느 저장소인지 알 수 없으면 사용자에게 묻도록 합니다.
연결된 워크트리의 코드도 리팩터링할 수 있나요?
예. 서버를 실행한 곳이 아닌 워크트리에 변경이 있으면 그 워크트리 경로를 지정할 수 있습니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 48k
- 순위
- #3612
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
gitnexus-cli
48kGitNexus 명령을 실행해 코드 프로젝트를 색인하고, 상태를 확인하고, 색인을 지우고, 위키를 만들도록 돕습니다.
gitnexus-debugging
48k코드베이스에서 버그를 추적해 오류가 시작된 곳과 실패한 부분을 호출하는 코드를 찾도록 돕습니다.
gitnexus-exploring
48k에이전트가 낯선 코드베이스를 탐색하도록 돕습니다. 주요 부분이 어떻게 연결되는지, 로그인 같은 기능이 어떻게 동작하는지 설명합니다.
gitnexus-guide
48kGitNexus 도구, 리소스, 지식 그래프에 대한 빠른 참고 자료를 제공하고 알맞은 안내서를 알려 줍니다.