Skip to content

Add usethis-python-enum agent skill and dict comprehensiveness test#1492

Merged
nathanjmcdougall merged 2 commits intomainfrom
copilot/configure-agent-skills-enum
Mar 25, 2026
Merged

Add usethis-python-enum agent skill and dict comprehensiveness test#1492
nathanjmcdougall merged 2 commits intomainfrom
copilot/configure-agent-skills-enum

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

Type checkers catch missing enum cases in if/elif chains via assert_never, but cannot catch missing keys in enum-keyed dicts. A new agent skill codifies this pattern, and a test is added for the existing _STATUS_TO_CLASSIFIER_MAP.

  • New skill (.agents/skills/usethis-python-enum/SKILL.md): Documents two enum conventions — assert_never for exhaustive branching, and mandatory unit tests for dicts with enum keys
  • New test (TestStatusToClassifierMap.test_keys_match_enum): Asserts _STATUS_TO_CLASSIFIER_MAP keys exactly match DevelopmentStatusEnum members
class TestStatusToClassifierMap:
    def test_keys_match_enum(self):
        assert set(_STATUS_TO_CLASSIFIER_MAP.keys()) == set(DevelopmentStatusEnum)
Original prompt

This section details on the original issue you should resolve

<issue_title>Configure agent skills to encourage appropriate style when working with enums</issue_title>
<issue_description>Probably a new skill called usethis-python-enum

Originally encountered here:

@copilot Please add a unit test that checks this dict is comprehensive, i.e. its keys are the same as the enum elements

Originally posted by @nathanjmcdougall in #1469 (comment)

Type checkers will capture a lot of patterns if we are careful. The assert_never pattern used in the codebase, etc.

There's this particular example of a dict with an enum key, which deserves a dedicated unit test to ensure it's kept updated to ensure complete coverage over the enum</issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…ATUS_TO_CLASSIFIER_MAP

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/8b73af53-8aa9-4d64-903e-93112ce1ac5d
Copilot AI changed the title [WIP] Add unit test for enum key coverage in dict Add usethis-python-enum agent skill and dict comprehensiveness test Mar 25, 2026
Copilot AI requested a review from nathanjmcdougall March 25, 2026 00:25
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/configure-agent-skills-enum (2b5f023) with main (955929a)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 25, 2026 00:50
@nathanjmcdougall nathanjmcdougall merged commit d69f331 into main Mar 25, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/configure-agent-skills-enum branch March 25, 2026 00:50
@nathanjmcdougall nathanjmcdougall linked an issue Apr 1, 2026 that may be closed by this pull request
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.

Explain the assert_never pattern better in agent skills Configure agent skills to encourage appropriate style when working with enums

2 participants