skills 1.0.6 → 1.0.7
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.
- package/README.md +32 -1
- package/dist/cli.js +58 -0
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ npx skills
|
|
|
12
12
|
|
|
13
13
|
| Command | Description |
|
|
14
14
|
|---------|-------------|
|
|
15
|
+
| `skills init [name]` | Initialize a skill (`<name>/SKILL.md` or `./SKILL.md`) |
|
|
15
16
|
| `skills add <package>` | Add a skill package |
|
|
16
17
|
| `skills a <package>` | Alias for `add` |
|
|
17
18
|
| `skills install <package>` | Alias for `add` |
|
|
@@ -24,8 +25,38 @@ npx skills
|
|
|
24
25
|
| `skills find <query>` | Search for skills |
|
|
25
26
|
| `skills update` | Update installed skills |
|
|
26
27
|
|
|
27
|
-
##
|
|
28
|
+
## Examples
|
|
28
29
|
|
|
29
30
|
```bash
|
|
31
|
+
# Initialize skills (multiple skills per repo)
|
|
32
|
+
npx skills init hydration-fix
|
|
33
|
+
npx skills init waterfall-data-fetching
|
|
34
|
+
|
|
35
|
+
# Add an existing skill package
|
|
30
36
|
npx skills add vercel-labs/agent-skills
|
|
31
37
|
```
|
|
38
|
+
|
|
39
|
+
## Skill Format
|
|
40
|
+
|
|
41
|
+
Each skill lives in its own folder with a `SKILL.md` file:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
my-repo/
|
|
45
|
+
├── hydration-fix/
|
|
46
|
+
│ └── SKILL.md
|
|
47
|
+
└── waterfall-data-fetching/
|
|
48
|
+
└── SKILL.md
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `SKILL.md` file uses YAML frontmatter:
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
---
|
|
55
|
+
name: hydration-fix
|
|
56
|
+
description: A brief description of what this skill does
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# hydration-fix
|
|
60
|
+
|
|
61
|
+
Instructions for the agent to follow when this skill is activated.
|
|
62
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
|
+
import { writeFileSync, existsSync, mkdirSync } from "fs";
|
|
6
|
+
import { basename, join } from "path";
|
|
5
7
|
var RESET = "\x1B[0m";
|
|
6
8
|
var BOLD = "\x1B[1m";
|
|
7
9
|
var DIM = "\x1B[38;5;102m";
|
|
@@ -34,6 +36,7 @@ function showBanner() {
|
|
|
34
36
|
console.log(`${DIM}The open agent skills ecosystem${RESET}`);
|
|
35
37
|
console.log();
|
|
36
38
|
console.log(` ${DIM}$${RESET} ${TEXT}npx skills --help${RESET}`);
|
|
39
|
+
console.log(` ${DIM}$${RESET} ${TEXT}npx skills init ${DIM}[name]${RESET}`);
|
|
37
40
|
console.log(` ${DIM}$${RESET} ${TEXT}npx skills add ${DIM}[package]${RESET}`);
|
|
38
41
|
console.log();
|
|
39
42
|
console.log(`${DIM}try:${RESET} npx skills add vercel-labs/agent-skills`);
|
|
@@ -44,6 +47,7 @@ function showHelp() {
|
|
|
44
47
|
${BOLD}Usage:${RESET} skills <command> [options]
|
|
45
48
|
|
|
46
49
|
${BOLD}Commands:${RESET}
|
|
50
|
+
init [name] Initialize a skill (creates <name>/SKILL.md or ./SKILL.md)
|
|
47
51
|
add <package> Add a skill package
|
|
48
52
|
e.g. vercel-labs/agent-skills
|
|
49
53
|
https://github.com/vercel-labs/agent-skills
|
|
@@ -53,6 +57,7 @@ ${BOLD}Options:${RESET}
|
|
|
53
57
|
--version, -v Show version number
|
|
54
58
|
|
|
55
59
|
${BOLD}Examples:${RESET}
|
|
60
|
+
${DIM}$${RESET} skills init my-skill
|
|
56
61
|
${DIM}$${RESET} skills add vercel-labs/agent-skills
|
|
57
62
|
`);
|
|
58
63
|
}
|
|
@@ -65,6 +70,54 @@ function runAddSkill(packages) {
|
|
|
65
70
|
process.exit(code ?? 0);
|
|
66
71
|
});
|
|
67
72
|
}
|
|
73
|
+
function runInit(args) {
|
|
74
|
+
const cwd = process.cwd();
|
|
75
|
+
const skillName = args[0] || basename(cwd);
|
|
76
|
+
const hasName = args[0] !== undefined;
|
|
77
|
+
const skillDir = hasName ? join(cwd, skillName) : cwd;
|
|
78
|
+
const skillFile = join(skillDir, "SKILL.md");
|
|
79
|
+
const displayPath = hasName ? `${skillName}/SKILL.md` : "SKILL.md";
|
|
80
|
+
if (existsSync(skillFile)) {
|
|
81
|
+
console.log(`${TEXT}Skill already exists at ${DIM}${displayPath}${RESET}`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (hasName) {
|
|
85
|
+
mkdirSync(skillDir, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
const skillContent = `---
|
|
88
|
+
name: ${skillName}
|
|
89
|
+
description: A brief description of what this skill does
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
# ${skillName}
|
|
93
|
+
|
|
94
|
+
Instructions for the agent to follow when this skill is activated.
|
|
95
|
+
|
|
96
|
+
## When to use
|
|
97
|
+
|
|
98
|
+
Describe when this skill should be used.
|
|
99
|
+
|
|
100
|
+
## Instructions
|
|
101
|
+
|
|
102
|
+
1. First step
|
|
103
|
+
2. Second step
|
|
104
|
+
3. Additional steps as needed
|
|
105
|
+
`;
|
|
106
|
+
writeFileSync(skillFile, skillContent);
|
|
107
|
+
console.log(`${TEXT}Initialized skill: ${DIM}${skillName}${RESET}`);
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(`${DIM}Created:${RESET}`);
|
|
110
|
+
console.log(` ${displayPath}`);
|
|
111
|
+
console.log();
|
|
112
|
+
console.log(`${DIM}Next steps:${RESET}`);
|
|
113
|
+
console.log(` 1. Edit ${TEXT}${displayPath}${RESET} to define your skill instructions`);
|
|
114
|
+
console.log(` 2. Update the ${TEXT}name${RESET} and ${TEXT}description${RESET} in the frontmatter`);
|
|
115
|
+
console.log();
|
|
116
|
+
console.log(`${DIM}Publishing:${RESET}`);
|
|
117
|
+
console.log(` ${DIM}GitHub:${RESET} Push to a repo, then ${TEXT}npx skills add <owner>/<repo>${RESET}`);
|
|
118
|
+
console.log(` ${DIM}URL:${RESET} Host the file, then ${TEXT}npx skills add https://example.com/${displayPath}${RESET}`);
|
|
119
|
+
console.log();
|
|
120
|
+
}
|
|
68
121
|
function main() {
|
|
69
122
|
const args = process.argv.slice(2);
|
|
70
123
|
if (args.length === 0) {
|
|
@@ -74,6 +127,11 @@ function main() {
|
|
|
74
127
|
const command = args[0];
|
|
75
128
|
const restArgs = args.slice(1);
|
|
76
129
|
switch (command) {
|
|
130
|
+
case "init":
|
|
131
|
+
showLogo();
|
|
132
|
+
console.log();
|
|
133
|
+
runInit(restArgs);
|
|
134
|
+
break;
|
|
77
135
|
case "i":
|
|
78
136
|
case "install":
|
|
79
137
|
case "a":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "The open agent skills ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "bun build ./src/cli.ts --outdir ./dist --target node",
|
|
15
15
|
"dev": "bun run ./src/cli.ts",
|
|
16
|
+
"test": "vitest",
|
|
16
17
|
"prepublishOnly": "bun run build"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
@@ -23,9 +24,7 @@
|
|
|
23
24
|
],
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@types/bun": "latest"
|
|
27
|
-
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"typescript": "^5"
|
|
27
|
+
"@types/bun": "latest",
|
|
28
|
+
"vitest": "^4.0.17"
|
|
30
29
|
}
|
|
31
30
|
}
|