skilldotmd 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.
Files changed (2) hide show
  1. package/package.json +28 -0
  2. package/src/index.js +122 -0
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "skilldotmd",
3
+ "version": "0.1.0",
4
+ "description": "Teach your AI any library. Install skills for Claude Code, Cursor, Windsurf and more.",
5
+ "type": "module",
6
+ "bin": {
7
+ "skilldotmd": "src/index.js"
8
+ },
9
+ "keywords": [
10
+ "claude",
11
+ "cursor",
12
+ "windsurf",
13
+ "ai",
14
+ "skills",
15
+ "agent-skills"
16
+ ],
17
+ "author": "imPiyushkashyap",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@clack/prompts": "^0.7.0",
21
+ "commander": "^12.0.0",
22
+ "picocolors": "^1.0.0",
23
+ "ora": "^8.0.0"
24
+ },
25
+ "engines": {
26
+ "node": ">=18.0.0"
27
+ }
28
+ }
package/src/index.js ADDED
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { intro, outro, select, text, spinner } from "@clack/prompts"
4
+ import { Command } from "commander"
5
+ import pc from "picocolors"
6
+ import { execSync } from "child_process"
7
+ import fs from "fs"
8
+ import path from "path"
9
+
10
+ const VERSION = "0.1.0"
11
+
12
+ const TOOLS = {
13
+ claude: { label: "Claude Code", projectPath: ".claude/skills" },
14
+ cursor: { label: "Cursor", projectPath: ".cursor/skills" },
15
+ windsurf: { label: "Windsurf", projectPath: ".windsurf/skills" },
16
+ cline: { label: "Cline", projectPath: ".cline/skills" },
17
+ copilot: { label: "GitHub Copilot", projectPath: ".github/skills" },
18
+ }
19
+
20
+ function printBanner() {
21
+ console.log("")
22
+ console.log(pc.bold(pc.cyan(" SkillDotMD")))
23
+ console.log(pc.dim(" Teach your AI any library"))
24
+ console.log("")
25
+ }
26
+
27
+ function detectTool() {
28
+ const cwd = process.cwd()
29
+ if (fs.existsSync(path.join(cwd, ".claude"))) return "claude"
30
+ if (fs.existsSync(path.join(cwd, ".cursor"))) return "cursor"
31
+ if (fs.existsSync(path.join(cwd, ".windsurf"))) return "windsurf"
32
+ if (fs.existsSync(path.join(cwd, ".cline"))) return "cline"
33
+ if (fs.existsSync(path.join(cwd, ".github"))) return "copilot"
34
+ return null
35
+ }
36
+
37
+ const program = new Command()
38
+
39
+ program
40
+ .name("skilldotmd")
41
+ .description("Teach your AI any library")
42
+ .version(VERSION)
43
+
44
+ program
45
+ .command("add [skill]")
46
+ .description("Install a skill into your project")
47
+ .option("--for <tool>", "AI tool to install for")
48
+ .action(async (skill, options) => {
49
+ printBanner()
50
+ intro(pc.bold("Add a skill"))
51
+
52
+ let skillPath = skill
53
+
54
+ if (!skillPath) {
55
+ skillPath = await text({
56
+ message: "Which skill do you want to install?",
57
+ placeholder: "imPiyushkashyap/SkillDotMD-Library/groq",
58
+ validate(value) {
59
+ if (!value) return "Please enter a skill path"
60
+ },
61
+ })
62
+ if (typeof skillPath === "symbol") process.exit(0)
63
+ }
64
+
65
+ let tool = options.for
66
+ if (!tool) {
67
+ const detected = detectTool()
68
+ tool = await select({
69
+ message: "Which AI tool are you using?",
70
+ options: Object.entries(TOOLS).map(([value, config]) => ({
71
+ value,
72
+ label: config.label,
73
+ hint: value === detected ? "detected" : undefined,
74
+ })),
75
+ initialValue: detected || "claude",
76
+ })
77
+ if (typeof tool === "symbol") process.exit(0)
78
+ }
79
+
80
+ const s = spinner()
81
+ s.start(`Installing ${pc.cyan(skillPath)}`)
82
+
83
+ try {
84
+ execSync(`npx skills add ${skillPath}`, { stdio: "pipe" })
85
+ s.stop(`${pc.green("✓")} Installed ${pc.cyan(skillPath)}`)
86
+ } catch (err) {
87
+ s.stop(`${pc.red("✗")} Failed to install skill`)
88
+ process.exit(1)
89
+ }
90
+
91
+ outro(`${pc.green("✓")} Your AI now knows this skill. Restart your editor to use it.`)
92
+ })
93
+
94
+ program
95
+ .command("list")
96
+ .description("List installed skills")
97
+ .action(() => {
98
+ printBanner()
99
+ intro(pc.bold("Installed skills"))
100
+ const cwd = process.cwd()
101
+ let found = false
102
+ for (const [, config] of Object.entries(TOOLS)) {
103
+ const dir = path.join(cwd, config.projectPath)
104
+ if (fs.existsSync(dir)) {
105
+ const skills = fs.readdirSync(dir).filter(f =>
106
+ fs.statSync(path.join(dir, f)).isDirectory()
107
+ )
108
+ if (skills.length > 0) {
109
+ found = true
110
+ console.log(`\n ${pc.bold(config.label)}`)
111
+ skills.forEach(s => console.log(` ${pc.green("●")} ${s}`))
112
+ }
113
+ }
114
+ }
115
+ if (!found) {
116
+ console.log(pc.dim("\n No skills installed."))
117
+ }
118
+ console.log("")
119
+ outro("Done")
120
+ })
121
+
122
+ program.parse()