skills-init 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: simplify
3
+ description: Use when refining recently written code, reviewing a diff for unnecessary complexity, doing cleanup passes, removing dead indirection, collapsing duplicate concepts, reducing helper bloat, or checking whether a change can be smaller without losing clarity.
4
+ ---
5
+
6
+ # Simplify
7
+
8
+ Use this skill to make code smaller, clearer, and easier to reason about. The
9
+ default posture is deletion, but the goal is not the fewest lines at any cost.
10
+ The goal is the simplest behavior-preserving shape that a future maintainer can
11
+ trust.
12
+
13
+ ## Use And Near Misses
14
+
15
+ Use this when:
16
+
17
+ - refining code you just wrote;
18
+ - reviewing a PR or branch for avoidable complexity;
19
+ - doing a cleanup pass;
20
+ - a value changes names across layers;
21
+ - helper functions, wrapper types, or translation objects do not earn their
22
+ existence;
23
+ - one concept has multiple code paths.
24
+
25
+ Do not use this as the controlling skill when:
26
+
27
+ - the main task is a correctness, security, or data-loss fix;
28
+ - adding tests or safety checks increases lines but reduces risk;
29
+ - a public API needs a small adapter for compatibility;
30
+ - a domain concept is complex because the domain is complex;
31
+ - readability would get worse just to make `git diff --stat` smaller.
32
+
33
+ Line count is a signal, not a verdict. If simplification adds lines, explain why
34
+ the resulting code is still simpler.
35
+
36
+ ## Core Questions
37
+
38
+ Ask these before proposing or accepting a shape:
39
+
40
+ - Can't we just use the existing value, function, or type?
41
+ - How many names does this concept have between source and use?
42
+ - Does this layer own a real decision, or is it just passing data through?
43
+ - Is this state derived from existing data?
44
+ - Is this abstraction used enough to earn a name?
45
+ - Would deleting this make the code harder to misuse?
46
+
47
+ ## Simplification Moves
48
+
49
+ ### Prefer The Direct Version
50
+
51
+ Before adding a service, helper, or abstraction, write the direct version. If the
52
+ direct version works and stays readable, use it.
53
+
54
+ ```ts
55
+ // Overbuilt: strategy object for one lookup.
56
+ const resolver = new PriceResolver(items);
57
+ const price = resolver.resolve(type);
58
+
59
+ // Direct.
60
+ const price = items.find((item) => item.type === type)?.price ?? null;
61
+ ```
62
+
63
+ ### Inline Single-Use Helpers
64
+
65
+ Extract when a helper removes real duplication, names a non-obvious domain
66
+ operation, or isolates a boundary. Inline when it only wraps a one-liner.
67
+
68
+ ```ts
69
+ // Weak helper.
70
+ function getDefaultId(items: Item[], type: string) {
71
+ return items.find((item) => item.type === type)?.id ?? null;
72
+ }
73
+ const id = getDefaultId(items, type);
74
+
75
+ // Simpler.
76
+ const id = items.find((item) => item.type === type)?.id ?? null;
77
+ ```
78
+
79
+ Exception: keep a single-use helper when it creates a meaningful boundary, such
80
+ as parsing untrusted input, encapsulating a tricky browser API, or naming a
81
+ business rule that would otherwise be opaque.
82
+
83
+ ### Flatten Control Flow
84
+
85
+ Prefer guard clauses and early returns over deeply nested conditionals.
86
+
87
+ ```ts
88
+ function process(item: Item | null) {
89
+ if (!item?.isValid || item.type !== "active") {
90
+ return null;
91
+ }
92
+
93
+ return doWork(item);
94
+ }
95
+ ```
96
+
97
+ One ternary is fine. Nested ternaries are usually a rewrite.
98
+
99
+ ### Derive Instead Of Synchronizing
100
+
101
+ If a value is computable from existing state, derive it at the point of use
102
+ unless caching is required and justified.
103
+
104
+ ```ts
105
+ // Sync liability.
106
+ const [filteredItems, setFilteredItems] = useState<Item[]>([]);
107
+ useEffect(() => {
108
+ setFilteredItems(items.filter(predicate));
109
+ }, [items]);
110
+
111
+ // Derived.
112
+ const filteredItems = items.filter(predicate);
113
+ ```
114
+
115
+ Use memoization only when there is a measured or obvious cost. Do not add cache
116
+ invalidation problems to avoid cheap computation.
117
+
118
+ ### Collapse Parallel Code Paths
119
+
120
+ Two functions that differ only by mode are usually one function with a clear
121
+ option.
122
+
123
+ ```ts
124
+ function getItems({
125
+ config,
126
+ includeDeprecated = false,
127
+ }: {
128
+ config: Config;
129
+ includeDeprecated?: boolean;
130
+ }) {
131
+ // shared logic
132
+ }
133
+ ```
134
+
135
+ Do not over-collapse true domain differences. If two code paths enforce
136
+ different invariants, keep the boundary and make the distinction explicit.
137
+
138
+ ### Keep One Name Per Concept
139
+
140
+ Name drift creates mapping code that hides bugs. Carry the same concept name
141
+ through the stack unless crossing a real boundary or language convention.
142
+
143
+ ```text
144
+ // Name drift.
145
+ repo layer -> workspace
146
+ service layer -> workspaceData
147
+ component layer -> currentContext
148
+
149
+ // One concept, one name.
150
+ repo layer -> workspace
151
+ service layer -> workspace
152
+ component layer -> workspace
153
+ ```
154
+
155
+ Acceptable boundary changes include `workspace_id` at the database layer and
156
+ `workspaceId` in TypeScript. That is syntax convention, not semantic renaming.
157
+
158
+ ### Pass Objects Whole
159
+
160
+ Do not destructure and rebuild objects just to rename fields. Preserve the
161
+ original shape and add only what is new.
162
+
163
+ ```ts
164
+ const enrichedProject = {
165
+ ...project,
166
+ isActive: project.settings.active,
167
+ };
168
+ ```
169
+
170
+ ### Delete Translation Theater
171
+
172
+ Mapping functions that only pick fields and rename them are suspicious. Keep
173
+ them only when they enforce a real wire contract, privacy boundary, or versioned
174
+ API.
175
+
176
+ ```ts
177
+ // Usually unnecessary if no boundary is being enforced.
178
+ function toSessionSummary(session: Session): SessionSummary {
179
+ return {
180
+ sessionId: session.id,
181
+ sessionStatus: session.status,
182
+ messageCount: session.messages.length,
183
+ };
184
+ }
185
+ ```
186
+
187
+ If the summary type is a public API response, the adapter may be correct. If it
188
+ is internal plumbing, delete it and use the original object.
189
+
190
+ ## Anti-Patterns
191
+
192
+ | Smell | Better move |
193
+ | --- | --- |
194
+ | Helper used in one place | Inline unless it names a real boundary. |
195
+ | `useState` plus effect for derived data | Derive during render or memoize only when needed. |
196
+ | Value has three names across layers | Collapse to one concept name. |
197
+ | Same name used for different concepts | Disambiguate at the source. |
198
+ | Function destructures and rebuilds with new keys | Spread and extend, or delete the function. |
199
+ | Wrapper type only renames fields | Use the original type or define a real boundary DTO. |
200
+ | Admin/app duplicate functions | One function with a clear option if invariants match. |
201
+ | Stored field computable from existing data | Derive it unless persistence is required. |
202
+ | New helper when an existing one does most of it | Extend existing code or use it directly. |
203
+ | Dense reducer replacing clear code | Prefer readable multi-step code. |
204
+
205
+ ## Review Output
206
+
207
+ When reporting simplification opportunities, keep them concrete:
208
+
209
+ ```markdown
210
+ 1. `<path>` / `<symbol>`
211
+ Current shape: <what exists now>
212
+ Simpler shape: <what to delete, inline, derive, or unify>
213
+ Why it is safe: <behavior-preserving reason or boundary note>
214
+ Impact: <rough line delta or removed concept>
215
+ ```
216
+
217
+ For implementation, make one simplification at a time and run the narrowest
218
+ check that proves behavior stayed intact.
219
+
220
+ ## Done Criteria
221
+
222
+ - Removed or collapsed at least one real source of complexity, or explicitly
223
+ concluded that the current complexity earns its place.
224
+ - Preserved behavior and public contracts.
225
+ - Did not replace clear code with clever dense code.
226
+ - Ran a focused check when code changed.
227
+ - If line count increased, explained why the new shape is simpler.
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: writing-skills
3
+ description: Use when creating, editing, packaging, consolidating, routing, validating, or publishing agent skills under .agents/skills or a tool-specific skill directory.
4
+ ---
5
+
6
+ # Writing Skills
7
+
8
+ A skill is reusable operational guidance that helps a future agent recognize a
9
+ situation and apply a proven approach. Treat skill writing like product work for
10
+ agents: define the job, make discovery reliable, keep the path through the docs
11
+ obvious, and verify that the skill changes behavior.
12
+
13
+ ## Start With Intent
14
+
15
+ Before writing or editing a skill, answer these from the current task and the
16
+ target project. Ask only for gaps that cannot be inferred.
17
+
18
+ - What task should this help agents do?
19
+ - When should it trigger? Include user phrases, symptoms, tools, paths, and
20
+ near-miss cases.
21
+ - What should the agent produce or decide after reading it?
22
+ - What 2-3 concrete tasks should it handle end to end?
23
+ - Who is the audience: repository developer agents, user-facing runtime agents,
24
+ or a packaged skill bundle for many projects?
25
+ - What existing skill, always-on guidance, script, lint, or test already covers
26
+ part of this?
27
+
28
+ Those concrete tasks become the should-trigger prompts used during validation.
29
+
30
+ ## Choose The Right Home
31
+
32
+ Do placement before writing content.
33
+
34
+ | Home | Use for |
35
+ | --- | --- |
36
+ | `.agents/skills/<skill>/SKILL.md` | Project-local source of truth for reusable skills. |
37
+ | Tool-specific links, such as `.claude/skills` | Generated symlinks or copies that point back to `.agents/skills`. |
38
+ | `AGENTS.md` or equivalent always-on guidance | Broad rules that should apply even when no skill is invoked. |
39
+ | `scripts/`, lint, or tests | Mechanical behavior that can be enforced automatically. |
40
+ | Runtime workspace skill directory | User-facing skills that must be visible to a sandbox or runtime agent. |
41
+
42
+ Search before adding a top-level skill:
43
+
44
+ ```bash
45
+ rg --files .agents/skills | rg '/SKILL\.md$' | sort
46
+ rg -n "keyword|tool|old-skill-name" .agents AGENTS.md .
47
+ ```
48
+
49
+ Prefer adding a nested reference file under an existing skill when the new
50
+ guidance is really a variant of an existing workflow. Keep a separate top-level
51
+ skill when separate discovery metadata matters.
52
+
53
+ ## When To Create Or Keep A Skill
54
+
55
+ Create or keep a skill when the guidance is reusable and requires judgment.
56
+
57
+ Good fits:
58
+
59
+ - non-obvious techniques;
60
+ - repeated debugging or review workflows;
61
+ - routing decisions;
62
+ - tool-specific setup or failure modes;
63
+ - API or command references that agents often misuse;
64
+ - rubrics, quality gates, and heuristics.
65
+
66
+ Poor fits:
67
+
68
+ - one-off history;
69
+ - project facts that belong in always-on guidance;
70
+ - mechanical checks that should be linted;
71
+ - obvious language or library docs;
72
+ - postmortems with no reusable decision rule.
73
+
74
+ If reliable automation can enforce the behavior, add or use the automation and
75
+ make the skill point to the command.
76
+
77
+ ## Frontmatter
78
+
79
+ Every `SKILL.md` needs:
80
+
81
+ ```yaml
82
+ ---
83
+ name: lowercase-hyphen-name
84
+ description: Use when triggering situations, symptoms, tools, paths, and user phrases apply.
85
+ ---
86
+ ```
87
+
88
+ Rules:
89
+
90
+ - `name` is lowercase hyphen-separated and matches the directory.
91
+ - `description` is the main discovery surface.
92
+ - Start descriptions with `Use when`.
93
+ - Describe triggering conditions, not the workflow.
94
+ - Include concrete keywords an agent or user would mention.
95
+ - Include near-miss routing when adjacent skills could compete.
96
+ - Keep descriptions under 1024 characters.
97
+ - Keep XML-style angle brackets out of descriptions because descriptions are
98
+ often injected into structured prompts.
99
+
100
+ Bad:
101
+
102
+ ```yaml
103
+ description: Use when debugging - checks logs and writes a fix.
104
+ ```
105
+
106
+ Good:
107
+
108
+ ```yaml
109
+ description: Use when production errors, service health regressions, logs, traces, incidents, or failing monitors need investigation.
110
+ ```
111
+
112
+ ## Body Content
113
+
114
+ Write for a future agent under time pressure.
115
+
116
+ - Lead with the core principle in 1-3 sentences.
117
+ - Put routing decisions near the top.
118
+ - Use imperative instructions when the agent must do something.
119
+ - Explain why a rule matters when that helps the agent generalize.
120
+ - Prefer one excellent example over several generic examples.
121
+ - Use tables for quick reference and comparisons.
122
+ - Keep examples copy-pasteable when they are commands or code.
123
+ - Avoid generic labels like `step1`, `helper2`, or `pattern3`.
124
+ - Avoid all-caps rules unless the constraint is safety-critical or agents have
125
+ repeatedly rationalized around it.
126
+
127
+ Do not include:
128
+
129
+ - storytelling about a specific past session;
130
+ - long transcripts or postmortems;
131
+ - multiple language examples for the same idea;
132
+ - full API docs that could live in `references/`;
133
+ - instructions to use skills that are not installed with this package.
134
+
135
+ ## Progressive Disclosure
136
+
137
+ Skills should load only the context needed for the task.
138
+
139
+ - Keep `SKILL.md` as the entry point and router.
140
+ - Move heavy material over roughly 100-300 lines into `references/`.
141
+ - Put deterministic or repetitive work in `scripts/`.
142
+ - Put reusable prompts, templates, and assets in `templates/` or `assets/`.
143
+ - In the root doc, say exactly when to read each nested file.
144
+ - Use repo-relative file paths for local references.
145
+
146
+ ## Cross-References
147
+
148
+ Make dependency strength explicit.
149
+
150
+ - Use `REQUIRED: Use <skill-name>` when the other skill must be followed.
151
+ - Use `REQUIRED BACKGROUND: Read <skill-name>` when concepts from another skill
152
+ are needed.
153
+ - Use `Optional reference: <path>` for supporting docs.
154
+ - Avoid vague "see also" lists.
155
+
156
+ ## Validation
157
+
158
+ Skill writing is documentation, but the output is agent behavior. Validate
159
+ enough for the risk.
160
+
161
+ ### Lightweight Validation
162
+
163
+ Use for small edits, reference updates, and typo-level fixes.
164
+
165
+ - Search for stale references with `rg`.
166
+ - Check local paths exist.
167
+ - Run the package or repo skill linter.
168
+ - Regenerate symlinks or tool copies.
169
+
170
+ ### Standard Validation
171
+
172
+ Use for new skills, routing changes, and meaningful behavior changes.
173
+
174
+ - Write 2-3 realistic prompts that should trigger the skill.
175
+ - Write 2-3 near-miss prompts that should not trigger it.
176
+ - Read the skill as the future agent and trace what instruction each prompt
177
+ should use.
178
+ - If practical, compare with-skill behavior against without-skill behavior.
179
+ - Fix gaps where the agent would fail to discover, over-apply, or misroute the
180
+ skill.
181
+
182
+ ### Rigorous Validation
183
+
184
+ Use for high-risk discipline skills, broad consolidations, or skills that
185
+ enforce behavior agents tend to rationalize away.
186
+
187
+ - Define pressure scenarios first.
188
+ - Observe the baseline failure if practical.
189
+ - Write the minimal guidance that addresses the failure mode.
190
+ - Rerun the scenario.
191
+ - Prefer scripts or assertions for objectively checkable outputs.
192
+ - Use human review for subjective quality.
193
+
194
+ Do not turn every skill edit into an eval project. Use rigor where the cost of a
195
+ bad skill is meaningful.
196
+
197
+ ## Improving Existing Skills
198
+
199
+ - Preserve the original skill name unless intentionally renaming or
200
+ consolidating.
201
+ - Read references and callers before changing routing.
202
+ - Prefer deleting stale guidance over layering exceptions.
203
+ - If feedback came from a review, fix both the specific issue and the pattern
204
+ that allowed it.
205
+ - Call out non-obvious tradeoffs in release notes or PR descriptions.
206
+
207
+ ## Description Quality Pass
208
+
209
+ Before finishing, test the description mentally against realistic prompts.
210
+
211
+ - Would expected user phrasing trigger this skill?
212
+ - Would common setup, review, or debugging workflows route correctly?
213
+ - Would near misses avoid triggering it?
214
+ - Does the description avoid summarizing the workflow?
215
+ - Does it include old names or synonyms that users still say?
216
+
217
+ If discovery is shaky, improve the description before expanding the body.
218
+
219
+ ## Anti-Patterns
220
+
221
+ | Anti-pattern | Why it fails | Fix |
222
+ | --- | --- | --- |
223
+ | Narrative skill | Future agents cannot reuse a one-off story. | Extract the repeatable decision, command, or pattern. |
224
+ | Workflow hidden in description | Agent may follow the summary and skip the body. | Put triggers in description, steps in body. |
225
+ | Missing synonyms | Users mention old tool names and the skill does not trigger. | Add old names, symptoms, and common phrasing. |
226
+ | Link-only routing | Agents do not know when to open which doc. | Add explicit routing bullets. |
227
+ | Overgrown root file | Agents load too much irrelevant context. | Move heavy sections to references. |
228
+ | Excessive hard rules | Agents follow rigidly or fight the instruction. | Explain why; reserve hard rules for real constraints. |
229
+ | Untested routing change | Skill looks clean but is undiscoverable. | Run trigger and near-miss checks. |
230
+
231
+ ## Checklist
232
+
233
+ - [ ] Correct home: `.agents/skills`, tool-specific link, always-on guidance,
234
+ script, or runtime workspace skill.
235
+ - [ ] Top-level skill is justified.
236
+ - [ ] Name is lowercase hyphen-separated and matches the directory.
237
+ - [ ] Frontmatter has `name` and `description`.
238
+ - [ ] Description starts with `Use when` and contains concrete triggers.
239
+ - [ ] Description does not summarize the workflow.
240
+ - [ ] Description is under 1024 characters and has no XML-style tags.
241
+ - [ ] Local references point to existing files.
242
+ - [ ] Heavy details are moved to references, templates, assets, or scripts.
243
+ - [ ] Examples are reusable, not narrative.
244
+ - [ ] Validation level matches risk.