Skip to content

Add YAGNI for function parameters to usethis-python-functions skill#1622

Merged
nathanjmcdougall merged 2 commits into
mainfrom
copilot/remove-unused-arguments
Mar 28, 2026
Merged

Add YAGNI for function parameters to usethis-python-functions skill#1622
nathanjmcdougall merged 2 commits into
mainfrom
copilot/remove-unused-arguments

Conversation

Copilot AI commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

A previous PR introduced PreCommitConfig.from_system_hook() with parameters (always_run, pass_filenames, require_serial) that were always called with the same value — a YAGNI violation. The parameters were removed in that PR; this captures the principle as a reusable agent skill.

Changes

  • usethis-python-functions skill (v1.0 → v1.1): adds a "YAGNI: don't add function parameters you don't need yet" section covering:
    • Only introduce a parameter when at least two distinct values are actually used at call sites
    • Applies especially to helper/internal functions
    • Diagnostic signs, corrective steps, and a concrete before/after example drawn from the from_system_hook case:
# Bad: always_run is always True, pass_filenames is always False
def make_hook(hook_id: str, entry: str, *, always_run: bool, pass_filenames: bool) -> Hook: ...

# Good: hardcode values that never change
def make_hook(hook_id: str, entry: str) -> Hook:
    always_run = True
    pass_filenames = False
    ...

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Remove unused arguments from agent config functions Add YAGNI for function parameters to usethis-python-functions skill Mar 28, 2026
Copilot AI requested a review from nathanjmcdougall March 28, 2026 23:33
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 28, 2026 23:41
@nathanjmcdougall nathanjmcdougall merged commit 157c235 into main Mar 28, 2026
1 check passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/remove-unused-arguments branch March 28, 2026 23:41
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 config: avoid introducing unused arguments to new functions

2 participants