From dev-utils
Use when writing new functions, extracting helpers, refactoring modules, or reorganizing code — any time function placement order is a decision
npx claudepluginhub dimagi/dimagi-claude-workflows --plugin dev-utilsThis skill uses the workspace's default tool permissions.
Place caller functions above their callees. High-level logic first, implementation details below. Read top-down like a newspaper article.
Refactors code to improve structure, readability, and maintainability while preserving behavior. Guides test-driven cycle, checklists, and patterns like extract function.
Refactors code structure for better readability and maintainability without changing behavior. Applies patterns like extract/inline/rename functions, eliminates duplication, addresses code smells like long functions and deep nesting.
Surgical refactoring improves code maintainability without behavior changes: extracts functions, renames variables, breaks god functions, boosts type safety, removes smells.
Share bugs, ideas, or general feedback.
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 |