Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

move-a-file

БесплатноБез исполняемых скриптовНе проверен

Move or rename a file while automatically updating all references in source code and documentation

Synthesys-Labот Synthesys-Lab★ 71 звезда на GitHub21 установка в других каталогах

Об этом скилле

Move a File

This skill instructs AI agents on how to safely move or rename files in a codebase while automatically finding and updating all references to the file in source code, documentation, and configuration files.

Inputs

The move-a-file skill takes the following inputs:

  • Old file path: The current path of the file to move/rename (relative to project root)
  • New file path: The destination path for the file (relative to project root)
  • Context: Any additional context about what the file contains or why it's being moved

Workflow for AI Agents

When this skill is invoked, the AI agent MUST follow these steps in order:

1. Validate File Paths

Before proceeding, verify that:

  • The old file path exists
  • The new file path's parent directory exists (or can be created)
  • The new file path does not already exist (to avoid overwrites)
  • Both paths are relative to the project root

If any validation fails, inform the user and abort.

2. Search for All References

Use rg (ripgrep) or grep to find all references to the file across the codebase.

IMPORTANT: Search for multiple patterns to catch all references:

  1. Exact filename: Search for the exact filename (without path)

    rg --type-add 'docs:*.md' --type-add 'config:*.{yaml,yml,json,toml}' \
       -t md -t config -t py -t js -t sh -t c -t cpp \
       "<filename>"
    
  2. Full relative path: Search for the full path from project root

    rg --type-add 'docs:*.md' --type-add 'config:*.{yaml,yml,json,toml}' \
       -t md -t config -t py -t js -t sh -t c -t cpp \
       "<old-path>"
    
  3. Path variations: Search for common path variations

    • With leading ./: "./<old-path>"
    • Without extension (if applicable): "<path-without-ext>"
    • In import statements: "import.*<filename-without-ext>"

Search scope: Include at minimum:

  • Source code files (.py, .js, .sh, .c, .cpp, etc.)
  • Documentation files (.md, .txt, .rst)
  • Configuration files (.yaml, .yml, .json, .toml)
  • Build files (Makefile, CMakeLists.txt, package.json)

3. Review and Update References

For each file containing a reference:

  • Read the file to understand the context
  • Determine the correct new path to use (may be relative to that file's location)
  • Update the reference using the Edit tool
  • Report what was changed in that file

Path calculation rules:

  • For documentation and config files: usually use paths relative to project root
  • For import statements: follow the language's import conventions
  • For file system operations: may need relative paths from the current file

4. Move the File

After updating all references, move the file:

git mv "<old-path>" "<new-path>"

If the parent directory of the new path doesn't exist:

mkdir -p "$(dirname '<new-path>')" && git mv "<old-path>" "<new-path>"

5. Verify and Report

After moving the file:

  1. Verify the new file exists: ls "<new-path>"
  2. Report summary to the user:
    • Old path → New path
    • Number of files updated
    • List of updated files with brief description of changes
    • Any references that might need manual review

Examples

Example 1: Renaming a Skill File

Context: User wants to rename git-commit/SKILL.md to commit-msg/SKILL.md

Workflow:

User: Use move-a-file to rename the git-commit skill to commit-msg

Agent: I'll move the file and update all references.

1. Validating paths...
   - Source exists: claude/skills/git-commit/SKILL.md ✓
   - Destination available: claude/skills/commit-msg/SKILL.md ✓

2. Searching for references to "git-commit"...
   Found references in:
   - claude/skills/CLAUDE.md (2 references)
   - claude/commands/README.md (1 reference)
   - README.md (1 reference)

3. Updating references...
   - claude/skills/CLAUDE.md:79 - Updated skill name reference
   - claude/skills/CLAUDE.md:123 - Updated example path
   - claude/commands/README.md:45 - Updated skill link
   - README.md:67 - Updated workflow reference

4. Moving the file...
   [Runs: mkdir -p claude/skills/commit-msg && git mv claude/skills/git-commit/SKILL.md claude/skills/commit-msg/SKILL.md]

5. Summary:
   Moved: claude/skills/git-commit/SKILL.md → claude/skills/commit-msg/SKILL.md
   Updated 4 references across 3 files

Example 2: Moving Documentation File

Context: User wants to reorganize docs by moving a file

Workflow:

User: Move docs/workflow.md to docs/agent/workflow.md

Agent: I'll move the file and update all references.

1. Validating paths...
   - Source exists: docs/workflow.md ✓
   - Creating parent directory: docs/agent/ ✓

2. Searching for references...
   Found references in:
   - README.md (3 references)
   - docs/index.md (1 reference)
   - claude/skills/plan-guideline/SKILL.md (1 reference)

3. Updating references...
   - README.md:23 - Updated link: [workflow](docs/workflow.md) → [workflow](docs/agent/workflow.md)
   - README.
Полный SKILL.md на GitHub

Установить move-a-file в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл move-a-file?

Move or rename a file while automatically updating all references in source code and documentation

Как установить скилл move-a-file?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл move-a-file запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить move-a-file с