Command Palette

Search for a command to run...

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

reorganize

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

Analyze and reorganize a directory structure with safe reference updates

coalesce-labsот coalesce-labs★ 20 звёзд на GitHub

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

Reorganize Directory

You are tasked with analyzing a directory structure, identifying clutter and organizational issues, proposing a reorganization plan, and safely executing it with reference updates.

Initial Response

When invoked, check the argument:

  • If a directory path was provided: validate it exists and is inside a git repo
  • If no argument: ask the user which directory to reorganize
I'll analyze and reorganize a directory structure.

This command will:
1. Analyze the directory for empty, sparse, and overlapping categories
2. Map cross-references to assess move risk
3. Propose a reorganization plan
4. Execute safely via move-and-rereference.sh after your approval

Which directory should I analyze?

Process

Step 1: Validate Input

# Check directory exists
if ! -d "<directory>"; then
  echo "Error: Directory does not exist: <directory>"
  exit 1
fi

# Check git repo
REPO_ROOT=$(cd "<directory>" && git rev-parse --show-toplevel 2>/dev/null)
if -z &quot;$REPO_ROOT&quot;; then
  echo "Error: Directory is not inside a git repository"
  exit 1
fi

Determine the relative path of the directory within the repo root. All paths in the analysis and mapping should be relative to the repo root.

Step 2: Parallel Analysis

Spawn 3 Task agents simultaneously to analyze the directory.

Task 1 — Structure Analysis (subagent_type: Explore):

Analyze the directory structure of <directory>. For each subdirectory:
1. Count the number of real files (exclude .gitkeep, .DS_Store)
2. Identify empty directories (0 files)
3. Identify sparse directories (1-2 files)
4. Identify large directories (>20 files)
5. Detect naming overlaps (e.g., notes/ vs meeting-notes/, research/ vs other_research/)

Return a structured report with:
- Directory name, file count, and category (empty/sparse/active/large)
- Any detected naming overlaps with specific directory pairs
- Total file count

Task 2 — Cross-Reference Analysis (subagent_type: Explore):

Analyze cross-references within <directory>. Search all .md files for path references to files and
directories within this directory tree:

1. Grep for path patterns that reference sibling files/directories
2. Count inbound references per directory (how many times paths under that dir are referenced)
3. Identify the highest-risk directories to move (most references)

Return:
- Per-directory reference count (sorted by count, descending)
- Total reference count
- Top 5 most-referenced individual files

Task 3 — Content Analysis (subagent_type: Explore):

Sample files from each subdirectory of <directory> (read first 20 lines of up to 3 files per
subdirectory). For each subdirectory:

1. Categorize the content type (research, plans, notes, meetings, analyses, handoffs, etc.)
2. Flag any files that seem miscategorized (e.g., a meeting note in research/)
3. Note if the subdirectory name accurately describes its content

Return:
- Per-directory content summary (directory name, content type, sample file names)
- List of potentially miscategorized files with suggested locations

WAIT for all 3 tasks to complete.

Step 3: Present Findings

Combine the results into a structured report:

## Directory Analysis: <directory>

### Summary
- {N} subdirectories, {M} files
- {X} empty directories (can remove)
- {Y} overlapping categories (can merge)
- {Z} sparse directories (can consolidate)

### Empty (can remove)
- decisions/ (0 files)
- journey-maps/ (0 files)
...

### Overlapping (can merge)
- notes/ ({N} files) + meeting-notes/ ({M} files) → notes/
- other_research/ ({N} files) + research/ ({M} files) → research/
...

### Sparse (can consolidate)
- business/ (1 file) → could merge into notes/ or keep
- learnings/ (1 file) → could merge into notes/ or keep
...

### Large (might benefit from subdirectories)
- research/ ({N} files) — consider subfolders by topic
...

### Cross-Reference Impact
- research/ has {N} inbound references (highest risk — most refs to update)
- plans/ has {N} inbound references
- analyses/ has {N} inbound references
...

### Content Issues
- {file} in {dir}/ appears to be a {type}, consider moving to {suggested_dir}/
...

Step 4: Propose Reorganization

Based on the analysis, generate a reorganization proposal. Present it as a table:

## Proposed Reorganization

| # | Current Path | Proposed Path | Reason | Risk |
|---|---|---|---|---|
| 1 | decisions/ | (remove) | Empty directory | None |
| 2 | other_research/file.md | research/file.md | Merge into research/ | Low (1 ref) |
| 3 | meeting-notes/file.md | notes/meetings/file.md | Consolidate under notes/ | Medium (3 refs) |
| 4 | research-synthesis/file.md | research/synthesis/file.md | Subdir of research/ | Low (1 ref) |
...

### Not Moving (keeping as-is)
- research/ — active, well-organized (73 files)
- plans/ — active, well-organized (36 files)
- handoffs/ — active, well-organized
...

**Ask for user feedb

Полный SKILL.md на GitHub

Установить reorganize в Claude Code и Claude Desktop

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

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

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

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

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

Read
Glob
Grep
Bash
Task
Write

FAQ

Что делает скилл reorganize?

Analyze and reorganize a directory structure with safe reference updates

Как установить скилл reorganize?

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

Скилл reorganize запускает скрипты?

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

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

Сравнить reorganize с