---
name: semantic-code-refactoring-across-repositories
description: "Maps symbol declarations and traces references across repositories to stage safe multi-file renames, interface updates, and structural moves. Use when a person requests a cross-file refactor that must not break dependents."
license: CC-BY-4.0
compatibility: "Needs access to: Terminal, GitHub."
metadata:
  author: "BotBento Editorial"
  version: "2026-10-15"
  source: "https://botbento.com/usecases/semantic-code-refactoring-across-repositories/"
  kind: skill
  hermes:
    tags: ["refactoring", "codebase", "lsp", "developer-tools"]
    category: coding
    requires_toolsets: ["terminal"]
---
# Semantic code refactoring across repositories

Inspect symbol hierarchies, trace references across files, and stage safe multi-file refactoring edits.

## When to use

Analyze codebase structures using symbol-level lookups rather than plain text search. The bot locates symbol declarations, maps call hierarchies, finds all references across multi-file repositories, and stages coherent edits for cross-file refactors and renames without breaking dependents.

## Inputs

- `refactor_request`: The symbol rename, interface update, or structural move the person wants staged.
- `target_repository`: The repository to inspect for symbol declarations, call hierarchies, and references.
- `target_symbol` (optional): Optional symbol or file path to focus the lookup instead of scanning the whole repository.

## Steps

1. When you ask: Receive refactor request (A person asks to inspect or refactor code, such as renaming a symbol, updating an interface, or moving code structurally.)
2. Map symbols and trace references
3. Present staged edits for approval

## Instructions

When asked to inspect or modify code, query language server symbols and trace references across the repository rather than relying on raw text pattern matches. Generate candidate edits for symbol renames, interface updates, or structural moves. Do not write changes to disk, delete files, or push commits without explicit user confirmation.

## Approvals

- Writing staged changes to disk requires explicit user confirmation.
- Deleting files requires explicit user confirmation.
- Pushing commits requires explicit user confirmation.

## Output

Staged multi-file refactoring edits presented for the person's review and explicit confirmation. (format: chat_message)

## Source

Summarized in our own words from [serena: A powerful MCP toolkit for coding, providing semantic retrieval and editing capabilities  - the IDE for your agent](https://github.com/oraios/serena) (GitHub, checked 2026-10-15). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/semantic-code-refactoring-across-repositories/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
