Skip to content

Commit d43cc82

Browse files
Merge branch 'main' into create-pull-request/patch
2 parents 78d52b6 + c71af38 commit d43cc82

4 files changed

Lines changed: 80 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ repos:
6969
additional_dependencies:
7070
- tomli
7171
priority: 0
72+
- repo: local
73+
hooks:
74+
- id: check-skills-documented
75+
name: check-skills-documented
76+
entry: uv run --frozen --offline hooks/check-skills-documented.py
77+
language: system
78+
always_run: true
79+
pass_filenames: false
80+
priority: 0
7281
- repo: local
7382
hooks:
7483
- id: deptry

AGENTS.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,33 @@ Follow standard contributing guidelines as documented in CONTRIBUTING.md.
1010

1111
## Agent Skills
1212

13-
The .agent/skills directory contains agent skills.
13+
The `.agents/skills` directory contains agent skills.
1414

1515
### Important skills
1616

1717
- Always run static checks using the `usethis-qa-static-checks` skill before finishing a task.
1818
- If modifying Python code, always use the `usethis-python-code`, `usethis-python-code-modify`, and `usethis-python-module-layout-modify` skills.
19+
20+
### Skills registry
21+
22+
<!-- This list is validated by the hooks/check-skills-documented.py hook. -->
23+
24+
| Skill | Description |
25+
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
26+
| `github-actions-update` | Update GitHub Actions workflows |
27+
| `usethis-file-remove` | Remove files from the project |
28+
| `usethis-pre-commit` | Guidance on pre-commit hooks — this project uses prek, not pre-commit directly |
29+
| `usethis-prek-add-hook` | Add a prek hook for dev |
30+
| `usethis-prek-hook-bespoke-create` | Write bespoke prek hooks as Python scripts for custom project-specific checks |
31+
| `usethis-python-code` | Guidelines for Python code design decisions such as when to share vs. duplicate code |
32+
| `usethis-python-code-modify` | Modify Python code (e.g. refactor, add new code, or delete code) |
33+
| `usethis-python-enum` | Style and testing conventions for working with Python enums |
34+
| `usethis-python-functions` | Guidelines for Python function design, including return types and signature simplicity |
35+
| `usethis-python-module-layout-modify` | Modify the Python module layout (create, move, rename, or delete modules) |
36+
| `usethis-python-ruff` | Guidelines for complying with Ruff linter rules instead of suppressing them |
37+
| `usethis-python-test-affected-find` | Identify tests that are potentially affected by code changes, to catch regressions before CI |
38+
| `usethis-qa-import-linter` | Use the Import Linter software on the usethis project |
39+
| `usethis-qa-static-checks` | Perform static code checks |
40+
| `usethis-skills-create` | Create new agent skills (SKILL.md files) following best practices for content quality, structure, and discoverability |
41+
| `usethis-skills-modify` | Modify agent skills (SKILL.md files) |
42+
| `usethis-test-with-coverage` | Write tests that achieve full code coverage and verify coverage locally before pushing |

hooks/check-skills-documented.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""Check that all skills in .agents/skills/ are mentioned in AGENTS.md."""
2+
3+
from __future__ import annotations
4+
5+
import sys
6+
from pathlib import Path
7+
8+
AGENTS_MD = Path("AGENTS.md")
9+
SKILLS_DIR = Path(".agents/skills")
10+
11+
12+
def main() -> int:
13+
if not AGENTS_MD.is_file():
14+
print(f"ERROR: {AGENTS_MD} not found.", file=sys.stderr)
15+
return 1
16+
17+
if not SKILLS_DIR.is_dir():
18+
print(f"ERROR: {SKILLS_DIR} directory not found.", file=sys.stderr)
19+
return 1
20+
21+
agents_md_content = AGENTS_MD.read_text()
22+
23+
missing = [
24+
d.name
25+
for d in sorted(SKILLS_DIR.iterdir())
26+
if d.is_dir() and d.name not in agents_md_content
27+
]
28+
29+
if missing:
30+
print(
31+
"ERROR: The following skills are not mentioned in AGENTS.md:",
32+
file=sys.stderr,
33+
)
34+
for skill in missing:
35+
print(f" - {skill}", file=sys.stderr)
36+
print(file=sys.stderr)
37+
print("Please add them to the skills registry in AGENTS.md.", file=sys.stderr)
38+
return 1
39+
40+
print("All skills are documented in AGENTS.md.")
41+
return 0
42+
43+
44+
if __name__ == "__main__":
45+
raise SystemExit(main())

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ lint.select = [
142142
]
143143
lint.ignore = [ "PLR2004", "S101", "SIM108" ]
144144
lint.per-file-ignores."!tests/**/*.py" = [ "ARG002", "PT" ]
145+
lint.per-file-ignores."hooks/**" = [ "D", "INP001" ]
145146
lint.per-file-ignores."src/usethis/_ui/interface/**/*.py" = [ "PLR0913", "TC001" ]
146147
lint.per-file-ignores."tests/**" = [ "D", "INP", "S603", "TC" ]
147148
lint.flake8-bugbear.extend-immutable-calls = [ "typer.Argument", "typer.Option" ]

0 commit comments

Comments
 (0)