Skip to content

docs(skill): add step-down rule to usethis-python-code skill#1798

Merged
nathanjmcdougall merged 2 commits into
mainfrom
copilot/fix-step-down-rule-violation
Apr 4, 2026
Merged

docs(skill): add step-down rule to usethis-python-code skill#1798
nathanjmcdougall merged 2 commits into
mainfrom
copilot/fix-step-down-rule-violation

Conversation

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Agents were placing new private helpers at the top of modules — above their callers — because the usethis-python-code skill had no guidance on intra-module function ordering.

Changes

  • usethis-python-code SKILL.md (v1.5 → v1.6): adds a "Ordering functions: the step-down rule" section covering:
    • Procedure — locate the caller first, place the helper below it
    • Key principle — readers encounter a function before its helpers, never after
    • Example showing the bad pattern (helper above caller) vs. the correct ordering
    • Common mistakes — specifically the reflex of adding helpers at the top of the file
# Bad: helper placed above its caller
def _format_version(v: str) -> str:
    return v.strip()

def get_version() -> str:
    return _format_version(read_version_file())

# Good: caller first, helper below
def get_version() -> str:
    return _format_version(read_version_file())

def _format_version(v: str) -> str:
    return v.strip()

Copilot AI changed the title [WIP] Fix helper function placement to follow step-down rule docs(skill): add step-down rule to usethis-python-code skill Apr 4, 2026
Copilot AI requested a review from nathanjmcdougall April 4, 2026 00:49
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 4, 2026 00:51
@nathanjmcdougall nathanjmcdougall merged commit 4ab1304 into main Apr 4, 2026
1 check passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/fix-step-down-rule-violation branch April 4, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent: follow the step-down rule when adding helper functions to modules

2 participants