From 6ec4e50cf6a56a72d26e4e6d49a4e2f94b1a2266 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Fri, 13 Mar 2026 08:54:34 +1300 Subject: [PATCH] Add a skill for modifying Python code --- .../usethis-python-code-modify/SKILL.md | 36 +++++++++++++++++++ .../SKILL.md | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .agents/skills/usethis-python-code-modify/SKILL.md diff --git a/.agents/skills/usethis-python-code-modify/SKILL.md b/.agents/skills/usethis-python-code-modify/SKILL.md new file mode 100644 index 00000000..0f7d74f5 --- /dev/null +++ b/.agents/skills/usethis-python-code-modify/SKILL.md @@ -0,0 +1,36 @@ +--- +name: usethis-python-code-modify +description: Modify Python code (e.g. refactor, add new code, or delete code) +compatibility: usethis, Python, pytest +license: MIT +metadata: + version: "1.0" +--- + +# Modifying Python code + +## Procedure + +1. Run a subset of the tests for `src/` regularly from the parallel module in the `tests/` directory. Never run the entire test suite. +2. After finishing your modifications, run the static checks (e.g. `usethis-qa-static-checks`) to check for any issues. + +## Run a subset of tests regularly + +When modifying Python code, regularly run a relevant subset of the tests. The test suite is structured such that there are tests for each module in the `src` directory in the `tests` directory. For example, if we had `src/usethis/_a.py`, we would have `tests/test_a.py` with tests for that module. + +### Never run the entire test suite + +Running the entire test suite is unusually unnecessary and it is slow. The CI will run the entire test suite, so it is unnecessary for you to do so. + +### What to do when tests fail + +There are two reasons why tests might fail: + +- The tests' expectations are no longer correct (e.g. because you changed the behavior of the code) +- There is a bug in the code + +In the first case, update the tests to have the correct expectations, or perhaps remove the test entirely. In the second case, fix the bug in the code. + +## Run static checks after finishing modifications + +After finishing your modifications, run the static checks (e.g. `usethis-qa-static-checks`) to check for any issues before merging. diff --git a/.agents/skills/usethis-python-module-layout-modify/SKILL.md b/.agents/skills/usethis-python-module-layout-modify/SKILL.md index a8165f1a..609da098 100644 --- a/.agents/skills/usethis-python-module-layout-modify/SKILL.md +++ b/.agents/skills/usethis-python-module-layout-modify/SKILL.md @@ -1,7 +1,7 @@ --- name: usethis-python-module-layout-modify description: Modify the Python module layout (create, move, rename, or delete modules) -compatibility: usethis, Python +compatibility: usethis, Python, pytest license: MIT metadata: version: "1.2"