reorganize
Skill3 starsChanged 6 months agoApache-2.0View on GitHub
Reorganize code file structure: rearrange modules, extract reuse, remove redundancy, add section comments. Preserves all functionality and logic. Use when the user asks to reorganize, restructure or tidy the layout of a file, a directory or the uncommitted diff ('reorganize src/engine.go', 'restructure this module', 'tidy up these files without changing behavior'). Not for reviewing or fixing code (use review-pr or code-quality-loop).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- kborovik/spec-driven-devtheir own version, first seen Aug 4, 2026
- kborovik/grok-skillstheir own version, first seen Jul 19, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- kborovik/grok-skills★ 2same name
- kborovik/spec-driven-dev★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- guideSkill
- paired-sessionSkill
- review-loopSkill
- review-prSkill
- code-quality-loopSkill
- guideSkill
- paired-sessionSkill
- review-loopSkill
- review-prSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 14 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
If no argument is provided, prompt the user to specify a target.
- Distinctive: line 41
Read the entire file and analyze:
- Distinctive: line 42
All type definitions, constants, variables, functions/methods present
- Distinctive: line 55
Keep the same package/module, ensure compilation passes
- Distinctive: line 56
Place shared type definitions in the most logical file, or a separate types file
- Distinctive: line 58
If the file is already focused and coherent, do not split.
- Distinctive: line 60
After splitting, apply steps 2.3-2.7 to each resulting file.
- Distinctive: line 87
Delete unused functions, types, constants, variables
- Distinctive: line 88
Delete duplicate implementations (keep the better one)
- Very specific: line 89
Delete meaningless comments (e.g., empty // TODO, placeholder // xxx)
- Distinctive: line 97
No comments needed for utility methods or self-explanatory code
- Distinctive: line 98
Do not translate existing comments -- leave them as-is
- Distinctive: line 102
Run compilation and test checks on modified files.
- Distinctive: line 109
If any check fails, fix the issue and re-check.
- Distinctive: line 113
After each file is processed, briefly report what was done and the build/test result.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code File Reorganization
Restructure the specified code files: rearrange module layout, reorder logically, extract shared logic, remove redundancy, add section separators and comments. Must not change any functionality or logic.
Target Scope
$ARGUMENTS specifies the target:
- File path:
/reorganize src/engine.go— reorganize a single file - Directory path:
/reorganize src/core/— reorganize all code files in the directory diff:/reorganize diff— reorganize all uncommitted files (viagit diff --name-only --diff-filter=d HEAD, plus untracked files fromgit ls-files --others --exclude-standard)
If no argument is provided, prompt the user to specify a target.
Execution Flow
Step 1: Determine File List
Resolve the file list from $ARGUMENTS. For directories, recursively collect all code files (excluding vendor, node_modules, generated files, etc.). For diff, collect all uncommitted modified files (staged + unstaged) and the untracked, non-ignored files.
Output:
REORGANIZE
Target: {file/dir/diff}
Files: {N} files
{file list}Step 2: Analyze and Reorganize Each File
Process files one at a time. Complete each file before moving to the next.
2.1 Read and Analyze Current Structure
Read the entire file and analyze:
- All type definitions, constants, variables, functions/methods present
- Dependencies and relationships between sections
- Duplicate or reusable logic patterns within this file
- Whether the file couples multiple unrelated functional modules
2.2 Decide Whether to Split the File
Split into multiple files when the file couples multiple clearly distinct functional modules, making it hard to read and maintain:
- The decision is based on module coupling, not line count
- Each resulting file should have focused, single responsibility
When splitting:
- Name new files clearly to reflect their purpose (e.g.,
engine.go->engine.go+engine_strategies.go+engine_signals.go) - Keep the same package/module, ensure compilation passes
- Place shared type definitions in the most logical file, or a separate types file
If the file is already focused and coherent, do not split.
After splitting, apply steps 2.3-2.7 to each resulting file.
Import fixing: After splitting, scan the project for files that import or reference the original file. If the split moved symbols to new files, update the affected imports. This may require modifying files outside the original target scope — this is the only case where that is allowed.
2.3 Restructure File Layout
Organize code blocks in a logical order based on the file's actual content. Common reference (adapt as needed):
- package/module declaration, imports
- constants, variables
- type definitions
- constructors
- core business methods
- helper / utility methodsCore principle: a reader scanning top-to-bottom should naturally understand the file's structure and business flow. Keep related code together; high-level logic before implementation details.
Separate functional sections with divider comments. First check if the project already uses a divider style (scan existing files for patterns like // ---, // ===, #region, etc.) and adopt that style. If no existing convention is found, use a simple comment divider appropriate for the language.
2.4 Extract Reusable Logic
Check for duplicate code patterns within the file being processed (do not modify files outside the target scope). Extract a helper when the duplicated logic is substantial enough that one shared definition is easier to read and maintain than the copies; leave short, incidental repetition inline. Name extracted helpers clearly and place them in the helper/utility section.
2.5 Remove Redundancy
- Delete unused functions, types, constants, variables
- Delete duplicate implementations (keep the better one)
- Delete meaningless comments (e.g., empty
// TODO, placeholder// xxx) - Do not delete comments with business meaning or doc comments
2.6 Add Comments
- Section divider comments for each functional area
- Concise comment before core business methods (one line, explain what it does)
- Concise comment before type definitions
- No comments needed for utility methods or self-explanatory code
- Do not translate existing comments -- leave them as-is
2.7 Verify
Run compilation and test checks on modified files. Detect build/test commands from the project:
- Go:
go build ./...thengo test ./... - Rust:
cargo checkthencargo test - TypeScript:
tsc --noEmitthennpm test - Python:
python -m py_compilethenpytest - Other: language-appropriate compile check then test suite
If any check fails, fix the issue and re-check. Max 3 attempts.
Step 3: Output Report
After each file is processed, briefly report what was done and the build/test result. After all files, output summary:
REORGANIZE COMPLETE
Files processed: {N}
Files split: {list, or "none"}
Build: {PASS / FAIL}
Tests: {PASS / FAIL / no tests found}Constraints
- Preserve functionality and logic -- this is restructuring, not rewriting. Input/output behavior must remain identical.
- Preserve public API -- exported functions, methods, and type signatures must not change.
- Preserve tests -- if corresponding test files exist, all tests must pass after reorganization.
- Conservative splitting -- only split when a file truly couples multiple distinct modules causing confusion.
- Conservative extraction -- only extract when there is genuine multi-site duplication with meaningful complexity.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

