organize-functions
Installation
SKILL.md
Scope Mode
- File mode: if a file path is provided, only organize that file.
- Branch mode: if no file path is provided, inspect changed files on the current branch and organize files that need updates.
Selection Mode
- Changed-only mode (default):
- only organize candidate functions touched on the current branch
- candidate functions are newly added, renamed, or changed visibility (
def<->defp) - do not move untouched function definitions, even if out of order
- Override mode (explicit request only):
- organize all functions in the selected scope, including unchanged definitions
Ordering Rules
- LiveView and LiveComponent modules:
- prefer execution and lifecycle order over alphabetical order
- keep
render/1before anyhandle_event/3clauses - keep callback groups contiguous, especially
handle_event/3 - order
handle_event/3clauses in workflow chronology, not alphabetical order
- Non-LiveView modules:
- public functions first (
def), sorted alphabetically by function name - private functions second (
defp), sorted alphabetically by function name
- public functions first (
Structural Safety Rules
- Treat all clauses of the same function name and arity as one unit.
- Keep clause order by match specificity (specific first, broad fallback last). In the case of a tie, use alphabetical order based on the main atom involved.
- Keep each moved function body unchanged except for location.
- Preserve module structure, comments, spacing conventions, and non-function code.
Output Expectations
- Make the minimum movement needed to satisfy ordering rules for candidate functions.
- In changed-only mode:
- file mode: if the target file has no candidate functions, make no reordering changes
- branch mode: skip files with no candidate functions and only modify files that need reordering
- In override mode, organize all functions in the selected scope, even if definitions are unchanged.
- Preserve behavior: do not make ordering changes that alter pattern matching outcomes.
- In LiveView and LiveComponent modules, callback lifecycle order wins over alphabetical order.
Related skills
More from jasonharmongit/jh-skills
doctor
Runs pre-PR formatting, checking and testing.
30organize-elixir-functions
Organize functions in a file or across a branch.
30walkthrough-process
Writes a deep markdown walkthrough for code understanding - how a function, module, or process fits into the system. Also supports branch-change walkthroughs when the user explicitly asks about PR/branch diffs.
24solutionize
Plan-only workflow with a human partner; no implementation while this skill governs the turn
22create-skill
>-
21implement-next-phase
Prepare to implement the next pending todo phase from a solutionize sketch plan (frontmatter todos); implementation only after explicit user approval.
8