Skip to content
Back to skills

2524 Rename 622a37a9

ASecurity

Batch rename files matching a pattern, with automatic wiki-link updates.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
documentationbashnodegitdocumentation

Works with

  • claude code

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2524-rename_622a37a9 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2524 Rename 622a37a9?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2524 Rename 622a37a9
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2524-rename-622a37a9/badge)](https://www.skillsdirectory.com/skills/tools-only-2524-rename-622a37a9)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md

# /rename

Batch rename files matching a pattern, with automatic wiki-link updates.

## Usage

```
/rename <pattern> --remove-prefix "<prefix>"
/rename <pattern> --add-prefix "<prefix>"
/rename <pattern> --replace "<old>" "<new>"
/rename type:<type> --remove-prefix "<prefix>"
/rename --dry-run <any of above>
```

## Examples

```
/rename "System - *.md" --remove-prefix "System - "
/rename type:Organisation --remove-prefix "Organisation - "
/rename "Meeting - *.md" --replace "Meeting -" "Mtg -"
/rename "Task - *.md" --add-prefix "TODO - "
/rename --dry-run type:Organisation --remove-prefix "Organisation - "
```

## Instructions

1. **Parse the command** for:
   - **pattern**: Glob pattern or `type:<type>` to match files
   - **operation**: One of:
     - `--remove-prefix "<prefix>"`: Remove prefix from filenames
     - `--add-prefix "<prefix>"`: Add prefix to filenames
     - `--replace "<old>" "<new>"`: Replace text in filenames
   - **--dry-run**: Preview changes without applying them

2. **Find matching files**:
   - If glob pattern: Use Glob tool to find matching files
   - If `type:<type>`: Search for files with that frontmatter type
   - Exclude templates, MOCs, and special files

3. **Calculate new names**:
   - Apply the requested transformation
   - Sanitise filenames (remove invalid characters)
   - Check for conflicts with existing files
   - Handle duplicates by adding suffix

4. **Preview changes** (always show first):
   ```
   Files to rename: 45

   Examples:
     System - Legacy App.md → Legacy App.md
     Organisation - Acme Corp.md → Acme Corp.md
     ...

   Proceed? (yes/no)
   ```

5. **Update wiki-links in body text** (critical step):
   - Search all vault files for links to renamed files
   - Update `[[Old Name]]` → `[[New Name]]`
   - Update `[[Old Name|alias]]` → `[[New Name|alias]]`
   - Handle both with and without .md extension

6. **Update wiki-links in frontmatter** (critical step):
   - Run the frontmatter link updater for each renamed file:
     ```bash
     node .claude/scripts/frontmatter-link-updater.js --old="Old Name" --new="New Name"
     ```
   - This updates wiki-links in YAML fields: `relatedTo`, `project`, `attendees`, `supersedes`, `dependsOn`, `contradicts`, `stakeholders`, `systems`, `organisations`
   - Use `--dry-run` first to preview changes

7. **Perform renames**:
   - Rename files using git mv (preserves history)
   - Report success/failure for each file
   - Summarise total changes

8. **Post-rename report**:
   ```
   Renamed: 45 files
   Links updated: 127 references in 34 files
   Errors: 0
   ```

## Safety Features

- **Always preview first**: Shows all changes before applying
- **Dry-run mode**: Use `--dry-run` to see changes without applying
- **Git integration**: Uses `git mv` to preserve file history
- **Link updates**: Automatically updates all wiki-links
- **Conflict detection**: Warns if new name already exists
- **Rollback info**: Shows git command to undo if needed

## Common Use Cases

### Remove type prefixes (recommended for cleaner links)
```
/rename type:Organisation --remove-prefix "Organisation - "
/rename type:System --remove-prefix "System - "
```

### Standardise naming conventions
```
/rename "Mtg - *.md" --replace "Mtg - " "Meeting - "
/rename "Todo - *.md" --replace "Todo - " "Task - "
```

### Add prefixes to organise
```
/rename type:Adr --add-prefix "ADR - "
```

## Implementation Notes

When executing this skill:

1. **For finding by type**, use:
   ```bash
   grep -l "^type: Person" *.md
   ```
   Or use Grep tool with pattern `^type: Person$`

2. **For updating links**, search for:
   - `[[Old Filename]]`
   - `[[Old Filename|`
   - `[[Old Filename#`

3. **For renaming**, prefer:
   ```bash
   git mv "Old Name.md" "New Name.md"
   ```
   This preserves git history.

4. **For bulk operations**, process in batches to avoid overwhelming the system.

## Related

- [[Pattern - Claude Code Skills Guide]] - Full skills documentation
- `/orphans` - Find unlinked notes after renaming
- `/broken-links` - Find broken links after renaming

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…