@cremini/skillpack 1.1.8 → 1.2.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.
Files changed (26) hide show
  1. package/README.md +5 -1
  2. package/dist/cli.js +342 -91
  3. package/dist/runtime/registry.js +244 -0
  4. package/package.json +2 -2
  5. package/templates/builtin-skills/skill-creator/LICENSE.txt +202 -0
  6. package/templates/builtin-skills/skill-creator/SKILL.md +171 -0
  7. package/templates/builtin-skills/skill-creator/agents/analyzer.md +274 -0
  8. package/templates/builtin-skills/skill-creator/agents/comparator.md +202 -0
  9. package/templates/builtin-skills/skill-creator/agents/grader.md +223 -0
  10. package/templates/builtin-skills/skill-creator/assets/eval_review.html +146 -0
  11. package/templates/builtin-skills/skill-creator/eval-viewer/generate_review.py +471 -0
  12. package/templates/builtin-skills/skill-creator/eval-viewer/viewer.html +1325 -0
  13. package/templates/builtin-skills/skill-creator/references/schemas.md +430 -0
  14. package/templates/builtin-skills/skill-creator/scripts/__init__.py +0 -0
  15. package/templates/builtin-skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  16. package/templates/builtin-skills/skill-creator/scripts/generate_report.py +326 -0
  17. package/templates/builtin-skills/skill-creator/scripts/improve_description.py +247 -0
  18. package/templates/builtin-skills/skill-creator/scripts/package_skill.py +136 -0
  19. package/templates/builtin-skills/skill-creator/scripts/quick_validate.py +103 -0
  20. package/templates/builtin-skills/skill-creator/scripts/run_eval.py +310 -0
  21. package/templates/builtin-skills/skill-creator/scripts/run_loop.py +328 -0
  22. package/templates/builtin-skills/skill-creator/scripts/utils.py +47 -0
  23. package/web/js/api-key-dialog.js +3 -5
  24. package/web/js/chat-apps-dialog.js +4 -10
  25. package/web/js/chat.js +8 -8
  26. package/web/js/settings.js +3 -8
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/runtime/registry.ts
4
+ import crypto from "crypto";
5
+ import fs from "fs";
6
+ import os from "os";
7
+ import path from "path";
8
+ var SKILLPACK_HOME = path.join(os.homedir(), ".skillpack");
9
+ var LEGACY_REGISTRY_FILE = path.join(SKILLPACK_HOME, "registry.json");
10
+ var REGISTRY_DIR = path.join(SKILLPACK_HOME, "registry.d");
11
+ var migrationChecked = false;
12
+ function getRegistryPath() {
13
+ ensureRegistryReady();
14
+ return REGISTRY_DIR;
15
+ }
16
+ function ensureHomeDir() {
17
+ if (!fs.existsSync(SKILLPACK_HOME)) {
18
+ fs.mkdirSync(SKILLPACK_HOME, { recursive: true });
19
+ }
20
+ }
21
+ function ensureRegistryDir() {
22
+ ensureHomeDir();
23
+ if (!fs.existsSync(REGISTRY_DIR)) {
24
+ fs.mkdirSync(REGISTRY_DIR, { recursive: true });
25
+ }
26
+ }
27
+ function canonicalizeDir(dir) {
28
+ const resolved = path.resolve(dir);
29
+ try {
30
+ return fs.realpathSync(resolved);
31
+ } catch {
32
+ return resolved;
33
+ }
34
+ }
35
+ function hashDir(dir) {
36
+ return crypto.createHash("md5").update(canonicalizeDir(dir)).digest("hex");
37
+ }
38
+ function getEntryPathForCanonicalDir(dir) {
39
+ return path.join(REGISTRY_DIR, `${hashDir(dir)}.json`);
40
+ }
41
+ function getEntryPath(dir) {
42
+ ensureRegistryReady();
43
+ return getEntryPathForCanonicalDir(canonicalizeDir(dir));
44
+ }
45
+ function listEntryFiles() {
46
+ ensureRegistryReady();
47
+ return fs.readdirSync(REGISTRY_DIR).filter((file) => file.endsWith(".json")).sort().map((file) => path.join(REGISTRY_DIR, file));
48
+ }
49
+ function readEntryFile(filePath) {
50
+ try {
51
+ const raw = fs.readFileSync(filePath, "utf-8");
52
+ const data = JSON.parse(raw);
53
+ if (typeof data?.dir !== "string" || typeof data?.name !== "string" || typeof data?.version !== "string" || typeof data?.port !== "number" || typeof data?.pid !== "number" && data?.pid !== null || data?.status !== "running" && data?.status !== "stopped") {
54
+ return null;
55
+ }
56
+ return {
57
+ dir: canonicalizeDir(data.dir),
58
+ name: data.name,
59
+ version: data.version,
60
+ port: data.port,
61
+ pid: data.pid,
62
+ status: data.status,
63
+ startedAt: data.startedAt,
64
+ stoppedAt: data.stoppedAt,
65
+ updatedAt: data.updatedAt
66
+ };
67
+ } catch {
68
+ return null;
69
+ }
70
+ }
71
+ function createTmpPath(entryPath) {
72
+ const suffix = `${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}`;
73
+ return `${entryPath}.tmp.${suffix}`;
74
+ }
75
+ function writeEntryFile(entry) {
76
+ ensureRegistryReady();
77
+ const normalized = {
78
+ ...entry,
79
+ dir: canonicalizeDir(entry.dir),
80
+ updatedAt: entry.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
81
+ };
82
+ const entryPath = getEntryPathForCanonicalDir(normalized.dir);
83
+ const tmpPath = createTmpPath(entryPath);
84
+ fs.writeFileSync(tmpPath, JSON.stringify(normalized, null, 2), "utf-8");
85
+ fs.renameSync(tmpPath, entryPath);
86
+ }
87
+ function migrateLegacyRegistryIfNeeded() {
88
+ if (migrationChecked) {
89
+ return;
90
+ }
91
+ migrationChecked = true;
92
+ ensureRegistryDir();
93
+ if (!fs.existsSync(LEGACY_REGISTRY_FILE)) {
94
+ return;
95
+ }
96
+ if (listEntryFiles().length > 0) {
97
+ return;
98
+ }
99
+ try {
100
+ const raw = fs.readFileSync(LEGACY_REGISTRY_FILE, "utf-8");
101
+ const data = JSON.parse(raw);
102
+ const packs = Array.isArray(data?.packs) ? data.packs : [];
103
+ for (const pack of packs) {
104
+ try {
105
+ writeEntryFile({
106
+ ...pack,
107
+ dir: canonicalizeDir(pack.dir),
108
+ updatedAt: pack.updatedAt ?? pack.stoppedAt ?? pack.startedAt ?? (/* @__PURE__ */ new Date()).toISOString()
109
+ });
110
+ } catch {
111
+ }
112
+ }
113
+ fs.renameSync(LEGACY_REGISTRY_FILE, `${LEGACY_REGISTRY_FILE}.legacy`);
114
+ } catch (err) {
115
+ console.warn(" [Registry] Failed to migrate legacy registry.json:", err);
116
+ }
117
+ }
118
+ function ensureRegistryReady() {
119
+ ensureRegistryDir();
120
+ migrateLegacyRegistryIfNeeded();
121
+ }
122
+ function entriesEqual(a, b) {
123
+ return a.dir === b.dir && a.name === b.name && a.version === b.version && a.port === b.port && a.pid === b.pid && a.status === b.status && a.startedAt === b.startedAt && a.stoppedAt === b.stoppedAt;
124
+ }
125
+ function readEntry(dir) {
126
+ ensureRegistryReady();
127
+ return readEntryFile(getEntryPath(dir));
128
+ }
129
+ function writeEntry(entry) {
130
+ writeEntryFile(entry);
131
+ }
132
+ function deleteEntry(dir) {
133
+ ensureRegistryReady();
134
+ const entryPath = getEntryPath(dir);
135
+ if (fs.existsSync(entryPath)) {
136
+ fs.unlinkSync(entryPath);
137
+ }
138
+ }
139
+ function readRegistry() {
140
+ return { packs: readAll() };
141
+ }
142
+ function writeRegistry(data) {
143
+ ensureRegistryReady();
144
+ const nextPaths = /* @__PURE__ */ new Set();
145
+ for (const pack of data.packs) {
146
+ const normalized = {
147
+ ...pack,
148
+ dir: canonicalizeDir(pack.dir),
149
+ updatedAt: pack.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
150
+ };
151
+ const entryPath = getEntryPathForCanonicalDir(normalized.dir);
152
+ nextPaths.add(entryPath);
153
+ writeEntryFile(normalized);
154
+ }
155
+ for (const existingPath of listEntryFiles()) {
156
+ if (!nextPaths.has(existingPath)) {
157
+ fs.unlinkSync(existingPath);
158
+ }
159
+ }
160
+ }
161
+ function register(opts) {
162
+ try {
163
+ const now = (/* @__PURE__ */ new Date()).toISOString();
164
+ const entry = {
165
+ dir: canonicalizeDir(opts.dir),
166
+ name: opts.name,
167
+ version: opts.version,
168
+ port: opts.port,
169
+ pid: process.pid,
170
+ status: "running",
171
+ startedAt: now,
172
+ updatedAt: now
173
+ };
174
+ writeEntryFile(entry);
175
+ console.log(` [Registry] Registered "${opts.name}" (pid ${process.pid})`);
176
+ } catch (err) {
177
+ console.warn(" [Registry] Failed to register:", err);
178
+ }
179
+ }
180
+ function deregister(dir, pid) {
181
+ try {
182
+ const entry = readEntry(dir);
183
+ if (!entry || entry.pid !== pid) {
184
+ return;
185
+ }
186
+ const now = (/* @__PURE__ */ new Date()).toISOString();
187
+ writeEntryFile({
188
+ ...entry,
189
+ pid: null,
190
+ status: "stopped",
191
+ stoppedAt: now,
192
+ updatedAt: now
193
+ });
194
+ console.log(` [Registry] Deregistered "${entry.name}"`);
195
+ } catch (err) {
196
+ console.warn(" [Registry] Failed to deregister:", err);
197
+ }
198
+ }
199
+ function readAll() {
200
+ return listEntryFiles().map((entryPath) => readEntryFile(entryPath)).filter((entry) => entry !== null);
201
+ }
202
+ function isPidAlive(pid) {
203
+ try {
204
+ process.kill(pid, 0);
205
+ return true;
206
+ } catch {
207
+ return false;
208
+ }
209
+ }
210
+ function validateEntries() {
211
+ const entries = readAll();
212
+ const now = (/* @__PURE__ */ new Date()).toISOString();
213
+ for (const entry of entries) {
214
+ if (entry.status === "running" && entry.pid !== null && !isPidAlive(entry.pid)) {
215
+ writeEntryFile({
216
+ ...entry,
217
+ pid: null,
218
+ status: "stopped",
219
+ stoppedAt: now,
220
+ updatedAt: now
221
+ });
222
+ }
223
+ }
224
+ const nextEntries = readAll();
225
+ if (entries.length === nextEntries.length && entries.every((entry, index) => entriesEqual(entry, nextEntries[index]))) {
226
+ return entries;
227
+ }
228
+ return nextEntries;
229
+ }
230
+ export {
231
+ canonicalizeDir,
232
+ deleteEntry,
233
+ deregister,
234
+ getEntryPath,
235
+ getRegistryPath,
236
+ isPidAlive,
237
+ readAll,
238
+ readEntry,
239
+ readRegistry,
240
+ register,
241
+ validateEntries,
242
+ writeEntry,
243
+ writeRegistry
244
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cremini/skillpack",
3
- "version": "1.1.8",
3
+ "version": "1.2.0",
4
4
  "description": "Pack AI Skills into Local Agents",
5
5
  "type": "module",
6
6
  "repository": {
@@ -65,4 +65,4 @@
65
65
  "tsup": "^8.5.1",
66
66
  "typescript": "^5.9.3"
67
67
  }
68
- }
68
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: skill-creator
3
+ description: Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
4
+ ---
5
+
6
+ # Skill Creator
7
+
8
+ A skill for creating new skills and iteratively improving them inside this SkillPack.
9
+
10
+ At a high level, the process of creating a skill goes like this:
11
+
12
+ - Decide what the skill should do and when it should trigger.
13
+ - Write a draft of the skill.
14
+ - Create a few realistic test prompts.
15
+ - Run the tests, review the results with the user, and improve the skill.
16
+ - Repeat until the skill is good enough for the user's needs.
17
+
18
+ Your job when using this skill is to figure out where the user is in this process and help them move forward without overcomplicating things.
19
+
20
+ ## Communicating with the user
21
+
22
+ Adjust your language to the user's level of familiarity. Avoid unnecessary jargon. Briefly explain terms like "frontmatter", "assertion", or "benchmark" if the user does not appear comfortable with them.
23
+
24
+ If the user clearly wants a lightweight collaboration rather than a full evaluation loop, keep things simple and iterate directly with them.
25
+
26
+ ## Pack-specific rules
27
+
28
+ This SkillPack uses a fixed project-level skills directory and config file:
29
+
30
+ - Skills directory: `{{SKILLS_PATH}}`
31
+ - SkillPack config: `{{PACK_CONFIG_PATH}}`
32
+
33
+ These paths override any generic advice you may know from other environments.
34
+
35
+ When creating or updating skills in this SkillPack:
36
+
37
+ - Always place the skill under `{{SKILLS_PATH}}/<skill-name>/`.
38
+ - Always write the main skill file to `{{SKILLS_PATH}}/<skill-name>/SKILL.md`.
39
+ - Treat `skill-name` as the canonical directory name unless the user explicitly asks to preserve an existing directory layout.
40
+ - Never create new skills inside the current workspace directory just because the active cwd is elsewhere.
41
+
42
+ ## Creating a skill
43
+
44
+ ### Capture intent
45
+
46
+ Start by understanding the user's intent. The current conversation may already contain the workflow the user wants to capture. Extract answers from the conversation first, then fill the gaps with targeted questions.
47
+
48
+ Confirm these points before writing the first draft:
49
+
50
+ 1. What should this skill enable the model to do?
51
+ 2. When should this skill trigger?
52
+ 3. What output should it produce?
53
+ 4. Does the user want a lightweight draft, or a tested and iterated skill?
54
+
55
+ ### Interview and research
56
+
57
+ Ask about:
58
+
59
+ - edge cases
60
+ - input/output formats
61
+ - example prompts or files
62
+ - success criteria
63
+ - dependencies or required tools
64
+
65
+ Wait to write test prompts until these basics are clear enough.
66
+
67
+ ### Write the skill
68
+
69
+ Create the skill directory at `{{SKILLS_PATH}}/<skill-name>/`.
70
+
71
+ Create `SKILL.md` with YAML frontmatter. The frontmatter must include:
72
+
73
+ - `name`
74
+ - `description`
75
+
76
+ The `description` is the primary triggering mechanism. Make it concrete and slightly "pushy": include both what the skill does and the situations where it should be used.
77
+
78
+ Keep the skill practical:
79
+
80
+ - Put "when to use" information in the `description`, not buried in the body.
81
+ - Keep the body focused on the workflow, decisions, and output expectations.
82
+ - If the skill needs deterministic helpers, place them under `scripts/`.
83
+ - If the skill needs long reference material, place it under `references/` and tell the model when to read it.
84
+
85
+ ### Required save location
86
+
87
+ For a newly created skill named `example-skill`, the target layout must be:
88
+
89
+ ```text
90
+ {{SKILLS_PATH}}/example-skill/
91
+ {{SKILLS_PATH}}/example-skill/SKILL.md
92
+ ```
93
+
94
+ If the user is improving an existing skill, preserve the existing skill name unless they explicitly request a rename.
95
+
96
+ ### Update skillpack.json
97
+
98
+ After you create or update a skill, you must sync `{{PACK_CONFIG_PATH}}`.
99
+
100
+ Do not guess the metadata from memory. Instead:
101
+
102
+ 1. Read the final `SKILL.md`.
103
+ 2. Parse the YAML frontmatter.
104
+ 3. Extract:
105
+ - `name`
106
+ - `description`
107
+ 4. Upsert an entry into the `skills` array in `{{PACK_CONFIG_PATH}}`:
108
+
109
+ ```json
110
+ {
111
+ "name": "<frontmatter.name>",
112
+ "description": "<frontmatter.description>",
113
+ "source": "./skills/<frontmatter.name>"
114
+ }
115
+ ```
116
+
117
+ Rules for this update:
118
+
119
+ - `name` must come from `frontmatter.name`.
120
+ - `description` must come from `frontmatter.description`.
121
+ - `source` must be `./skills/<frontmatter.name>`.
122
+ - If an entry for the same skill already exists, update it instead of creating a duplicate.
123
+
124
+ ### Writing guide
125
+
126
+ Prefer imperative, clear instructions. Explain why important constraints exist. Avoid overly rigid language unless strict behavior is actually required.
127
+
128
+ Useful structure:
129
+
130
+ - purpose
131
+ - trigger guidance
132
+ - required inputs
133
+ - step-by-step workflow
134
+ - output format
135
+ - edge cases
136
+
137
+ If the skill supports multiple domains or frameworks, organize the references by variant and tell the model how to choose the right one.
138
+
139
+ ## Test and iterate
140
+
141
+ After drafting the skill, propose 2-3 realistic test prompts. The prompts should sound like something a real user would actually say.
142
+
143
+ If the user wants evaluation:
144
+
145
+ - run the test prompts with the skill
146
+ - compare the outputs against the user's expectations
147
+ - note what worked and what failed
148
+ - revise the skill
149
+
150
+ If the user does not want a heavy evaluation loop, do at least a lightweight sanity check before calling the skill complete.
151
+
152
+ ## Improving an existing skill
153
+
154
+ When updating an existing skill:
155
+
156
+ - preserve its canonical `name` unless the user explicitly asks to rename it
157
+ - keep the directory aligned with the canonical skill name
158
+ - update `SKILL.md` first
159
+ - then re-read the final frontmatter and sync `{{PACK_CONFIG_PATH}}`
160
+
161
+ Focus on general improvements rather than overfitting to one example. Keep the prompt lean and remove instructions that are not earning their place.
162
+
163
+ ## Completion checklist
164
+
165
+ Before you say the work is done, verify all of the following:
166
+
167
+ - the skill exists under `{{SKILLS_PATH}}/<skill-name>/SKILL.md`
168
+ - `SKILL.md` has `name` and `description` frontmatter
169
+ - `{{PACK_CONFIG_PATH}}` has a matching entry in `skills`
170
+ - the `source` field is `./skills/<skill-name>`
171
+ - you have either tested the skill or explicitly told the user what remains untested