You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Always call `clear_functools_caches()` after adding `@functools.cache`. | Whenever a caching decorator is added, ensure the cache is cleared in tests. |
51
+
|`validate_or_raise` accepts `err=`, not `error_cls`. | Validation helpers often have specific argument conventions — check the signature before use. |
52
+
| Update `AGENTS.md` when adding a skill to `.agents/skills/`. | Keep all registry files in sync whenever a new entry is added to a tracked directory. |
53
+
| Put new helpers in `src/mypackage/_utils/helpers.py`. | Place new helpers near their primary caller, following the project's module layout conventions. |
54
+
29
55
## When to create a lesson
30
56
31
57
Create a lesson whenever you:
@@ -45,7 +71,10 @@ cause is self-evident and offers no transferable principle.
45
71
2.**Perform root cause analysis** — ask "why?" iteratively to move from the
46
72
symptom to an underlying cause. See the section below.
47
73
3.**Generalise the principle** — restate the root cause as a transferable rule or
48
-
heuristic that applies beyond this specific situation.
74
+
heuristic that applies beyond this specific situation. Write it so it remains useful
75
+
even if the exact code, file, or function name changes. Avoid naming specific
76
+
implementation details unless the principle is truly about that specific thing.
77
+
See the "Self-containment and abstraction" section above for guidance.
49
78
4.**Fill in the lesson template** — see the template below.
50
79
5.**File as a GitHub issue** using the `usethis-github-issue-create` skill, with
51
80
label `agent` and any other relevant labels (e.g. `bug`, `documentation`).
@@ -94,7 +123,8 @@ cause, not the symptom.>
94
123
95
124
<A transferable rule or heuristic — written so it applies beyond this specific
96
125
situation. Phrase it as actionable guidance: "Always ...", "Never ...", "When X,
97
-
do Y ...".>
126
+
do Y ...". Avoid naming specific functions, classes, or files unless the principle is
127
+
truly about that specific thing. Do not reference memories or prior sessions.>
Copy file name to clipboardExpand all lines: .agents/skills/usethis-skills-modify/SKILL.md
+32-5Lines changed: 32 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: "Enforce version bumping, scope checking, and content quality guide
4
4
compatibility: usethis, agent skills, markdown
5
5
license: MIT
6
6
metadata:
7
-
version: "1.5"
7
+
version: "1.6"
8
8
---
9
9
10
10
# Modifying Agent Skills
@@ -14,9 +14,35 @@ metadata:
14
14
When modifying any `SKILL.md` file in `.agents/skills/`:
15
15
16
16
1.**Check scope** — verify the new content belongs in this skill (see "Before modifying: check scope" below).
17
-
2. Make the necessary content changes to the skill.
18
-
3. Increment the version number in the YAML frontmatter `metadata.version` field.
19
-
4. Verify the YAML frontmatter is valid (all required fields present, version is quoted).
17
+
2.**Generalise the instruction** — if the instruction you received is highly specific (names an exact function, file, or code object), lift it to a transferable principle before writing the skill content. See "Generalising incoming instructions" below.
18
+
3. Make the necessary content changes to the skill.
19
+
4. Increment the version number in the YAML frontmatter `metadata.version` field.
20
+
5. Verify the YAML frontmatter is valid (all required fields present, version is quoted).
21
+
22
+
## Generalising incoming instructions
23
+
24
+
You will often receive instructions that are phrased in terms of a specific situation:
25
+
"add guidance about function X", "mention that file Y must be updated", or "note that
26
+
class Z behaves this way". Before writing this into a skill, lift the instruction to a
27
+
more abstract principle.
28
+
29
+
Ask: **What general rule does this specific case illustrate?** A skill should remain
30
+
useful as the codebase evolves. If the specific function, file, or class mentioned in
31
+
the instruction were renamed or removed, would the guidance still be relevant? If not,
32
+
rewrite it so it would be.
33
+
34
+
| Specific instruction received | Generalised skill content |
| "Add a note that `foo_helper()` must be called before `bar()`." | "Certain setup steps must be completed before the main operation — check the API contract for ordering requirements." |
37
+
| "Note that `config.toml` must be updated when adding a new flag." | "When adding a feature that introduces new configuration, update all files that declare or document available options." |
38
+
| "Warn that `TypeAdapter.validate_python` is banned, use `validate_or_raise`." | "Some standard-library or third-party APIs may be banned by project convention — consult the linter configuration or project documentation before reaching for them." |
39
+
40
+
Avoid adding guidance that:
41
+
42
+
- Names specific functions, classes, or files unless the principle is **only** about
43
+
that specific thing (e.g. a skill about a single tool's CLI interface).
44
+
- Reads like a changelog or incident report ("we discovered that X did Y").
45
+
- Would become incorrect or confusing if the named entity were refactored.
20
46
21
47
## Before modifying: check scope
22
48
@@ -67,7 +93,8 @@ When modifying skill content, maintain these principles:
67
93
68
94
-**Don't make descriptions prescriptive.** If you update the `description` field in the YAML frontmatter, don't use commanding language like "ALWAYS use when..." — describe what the skill covers in neutral terms. See the `usethis-skills-create` skill for detailed description-writing guidelines.
69
95
-**Describe procedures, not state.** Skills should explain how to approach situations, not describe the current state of the codebase. State descriptions become outdated; procedures remain valid. See the `usethis-skills-create` skill for detailed guidance.
70
-
-**Keep content general.** Write instructions that remain valid as the codebase evolves. Avoid embedding specific file paths, class names, or constants unless strictly necessary.
96
+
-**Keep content general.** Write instructions that remain valid as the codebase evolves. Avoid embedding specific file paths, class names, or constants unless strictly necessary. See "Generalising incoming instructions" above.
97
+
-**Never reference memories.** Skill content is read with no access to agent session history or stored memories. Do not write phrases like "as noted in a previous session" or "per the stored memory about X". Everything the reader needs must be present in the skill itself.
71
98
-**Be concise.** Only include information the agent doesn't already know. If a paragraph doesn't justify its token cost, remove it.
72
99
-**Avoid time-sensitive information.** Don't include current version numbers, file counts, or lists that grow over time.
73
100
-**Use consistent terminology.** Don't introduce synonyms for concepts that already have established terms in the skill.
0 commit comments