From dev-utils
Use when writing new functions, extracting helpers, refactoring modules, or reorganizing code — any time function placement order is a decision
How this skill is triggered — by the user, by Claude, or both
Slash command
/dev-utils:vertical-orderingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Place caller functions above their callees. High-level logic first, implementation details below. Read top-down like a newspaper article.
Place caller functions above their callees. High-level logic first, implementation details below. Read top-down like a newspaper article.
This is the "Vertical Ordering" principle from Clean Code (Robert C. Martin, Chapter 5).
# ✅ CORRECT: Caller above callee
def process_order(order):
validate_order(order)
submit_order(order)
def validate_order(order):
...
def submit_order(order):
...
# ❌ WRONG: Helpers defined before caller
def validate_order(order):
...
def submit_order(order):
...
def process_order(order):
validate_order(order)
submit_order(order)
| Scenario | Ordering |
|---|---|
| Extract a helper from a function | Helper goes below the function it was extracted from |
| Public API function calls private helpers | Public function first, private helpers below |
| Chain of calls: A → B → C | Order: A, then B, then C |
| Multiple callers share a helper | Helper goes below its first caller |
npx claudepluginhub dimagi/dimagi-claude-workflows --plugin dev-utilsEnforces consistent declaration order in files (docstring, imports, constants, types, classes, functions, entry point) and classes (constants, constructor, public/private methods). Improves code readability.
Refactors code to improve structure, readability, and maintainability while preserving behavior. Guides test-driven cycle, checklists, and patterns like extract function.
Surgical refactoring improves maintainability without changing behavior: extracts functions, renames variables, breaks god functions, boosts type safety, fixes code smells, applies patterns. For gradual cleanups of hard-to-maintain code.