skilld 0.0.1 → 0.1.1

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -88
  3. package/dist/_chunks/config.mjs +20 -0
  4. package/dist/_chunks/config.mjs.map +1 -0
  5. package/dist/_chunks/llm.mjs +877 -0
  6. package/dist/_chunks/llm.mjs.map +1 -0
  7. package/dist/_chunks/releases.mjs +986 -0
  8. package/dist/_chunks/releases.mjs.map +1 -0
  9. package/dist/_chunks/storage.mjs +198 -0
  10. package/dist/_chunks/storage.mjs.map +1 -0
  11. package/dist/_chunks/sync-parallel.mjs +540 -0
  12. package/dist/_chunks/sync-parallel.mjs.map +1 -0
  13. package/dist/_chunks/types.d.mts +87 -0
  14. package/dist/_chunks/types.d.mts.map +1 -0
  15. package/dist/_chunks/utils.d.mts +352 -0
  16. package/dist/_chunks/utils.d.mts.map +1 -0
  17. package/dist/_chunks/version.d.mts +147 -0
  18. package/dist/_chunks/version.d.mts.map +1 -0
  19. package/dist/agent/index.d.mts +205 -0
  20. package/dist/agent/index.d.mts.map +1 -0
  21. package/dist/agent/index.mjs +2 -0
  22. package/dist/cache/index.d.mts +2 -0
  23. package/dist/cache/index.mjs +3 -0
  24. package/dist/cli.mjs +2650 -449
  25. package/dist/cli.mjs.map +1 -1
  26. package/dist/index.d.mts +5 -14
  27. package/dist/index.mjs +7 -181
  28. package/dist/retriv/index.d.mts +12 -0
  29. package/dist/retriv/index.d.mts.map +1 -0
  30. package/dist/retriv/index.mjs +76 -0
  31. package/dist/retriv/index.mjs.map +1 -0
  32. package/dist/sources/index.d.mts +2 -0
  33. package/dist/sources/index.mjs +3 -0
  34. package/dist/types.d.mts +4 -37
  35. package/package.json +39 -13
  36. package/dist/agents.d.mts +0 -56
  37. package/dist/agents.d.mts.map +0 -1
  38. package/dist/agents.mjs +0 -148
  39. package/dist/agents.mjs.map +0 -1
  40. package/dist/index.d.mts.map +0 -1
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/npm.d.mts +0 -48
  43. package/dist/npm.d.mts.map +0 -1
  44. package/dist/npm.mjs +0 -90
  45. package/dist/npm.mjs.map +0 -1
  46. package/dist/split-text.d.mts +0 -24
  47. package/dist/split-text.d.mts.map +0 -1
  48. package/dist/split-text.mjs +0 -87
  49. package/dist/split-text.mjs.map +0 -1
  50. package/dist/types.d.mts.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present Harlan Wilton
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,9 +2,25 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/skilld?color=yellow)](https://npmjs.com/package/skilld)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/skilld?color=yellow)](https://npm.chart.dev/skilld)
5
- [![license](https://img.shields.io/github/license/harlan-zw/skilld?color=yellow)](https://github.com/harlan-zw/skilld/blob/main/LICENSE.md)
5
+ [![license](https://img.shields.io/github/license/harlan-zw/skilld?color=yellow)](https://github.com/harlan-zw/skilld/blob/main/LICENSE)
6
6
 
7
- > A global database of searchable skills generated from live NPM package documentation.
7
+ > Skilld gives your AI agent skills for your npm dependencies, generated from versioned docs, dist files and GitHub data.
8
+
9
+ ## Why?
10
+
11
+ Agents already know how most packages work from training data. Skills should focus on what they *don't* know and push them to follow best practices. Without this:
12
+
13
+ - **Generic patterns** - AI uses common approaches instead of package-specific conventions
14
+ - **Missed best practices** - Optimal patterns go unused because the AI defaults to "good enough"
15
+ - **Version drift** - Training data lags behind latest APIs and deprecations
16
+
17
+ skilld generates skills from the package's *actual* documentation using your existing agent. Works with any public npm package, no author opt-in needed.
18
+
19
+ ```
20
+ npm install vueuse → skilld vueuse → AI knows current vueuse API
21
+ ```
22
+
23
+ Compatible with [skills-npm](https://github.com/antfu/skills-npm)—if a package ships a `skills/` directory, skilld uses it directly. Generation is the fallback.
8
24
 
9
25
  <p align="center">
10
26
  <table>
@@ -18,154 +34,169 @@
18
34
 
19
35
  ## Features
20
36
 
21
- - 🌐 **Global Skill DB** - Centralized, searchable skills for any NPM package
22
- - 📚 **Live Docs** - Fetches from `llms.txt` or crawls documentation sites
23
- - 🔍 **Vector Search** - SQLite-vec powered semantic search with transformers embeddings
24
- - ✂️ **Smart Chunking** - Markdown-aware recursive text splitting (LangChain-style)
25
- - 🚀 **Zero Config** - Point at a URL, get a searchable skill
37
+ - 🤖 **Agent-powered** - Uses your existing LLM to generate SKILL.md for your key dependencies; works with any coding agent
38
+ - 🎯 **Best practices first** - Token-optimized output focused on non-obvious patterns and conventions, not generic knowledge
39
+ - 🔗 **Context-aware** - Generation adapts to your preferences and accepts custom prompts
40
+ - ✏️ **You own it** - Skills live in your project, easy to customize; sync new package versions with zero config
41
+ - 🚀 **Zero friction** - Works with any public npm package, no author opt-in; respects `llms.txt` and shipped `skills/` when available
26
42
 
27
- ## How It Works
43
+ ## Installation
28
44
 
29
- ```
30
- Package name Resolve docs → Fetch → Install to agent directories
45
+ ```bash
46
+ pnpm add -g skilld
31
47
  ```
32
48
 
33
- 1. **Resolve** - Looks up npm registry for homepage, repository URL
34
- 2. **Fetch** - Tries llms.txt → docs site → GitHub README (via ungh)
35
- 3. **Install** - Writes SKILL.md to each detected agent's skill directory
49
+ ## Automatic Updates
36
50
 
37
- Supported agents: Claude Code, Cursor, Windsurf, Cline, Codex, GitHub Copilot, Gemini CLI, Goose, Amp, OpenCode, Roo Code
51
+ Add to `package.json` to keep skills fresh on install:
38
52
 
39
- ## Installation
40
-
41
- ```bash
42
- pnpm add -g skilld
53
+ ```json
54
+ {
55
+ "scripts": {
56
+ "prepare": "skilld --prepare -b"
57
+ }
58
+ }
43
59
  ```
44
60
 
61
+ skilld fast-paths unchanged versions—only regenerates when minor/major versions bump.
62
+
45
63
  ## CLI Usage
46
64
 
47
65
  ```bash
48
- # Auto-discover from package.json dependencies
66
+ # Interactive mode — auto-discover from package.json
49
67
  skilld
50
68
 
51
- # Generate skill from specific package name
69
+ # Sync specific package(s)
52
70
  skilld vueuse
53
- skilld @nuxt/kit
71
+ skilld vue,nuxt,pinia
72
+
73
+ # Search docs across installed skills
74
+ skilld nuxt -q "useFetch options"
54
75
 
55
- # Generate skill from URL
56
- skilld https://nuxt.com/docs
76
+ # Target a specific agent
77
+ skilld vueuse --agent cursor
57
78
 
58
- # Custom output directory
59
- skilld -o ./my-skills
79
+ # Install globally to ~/.claude/skills
80
+ skilld vueuse --global
60
81
 
61
- # Concurrent processing (default: 3)
62
- skilld -c 5
82
+ # Skip prompts
83
+ skilld vueuse --yes
63
84
 
64
- # Skip llms.txt and always crawl
65
- skilld --crawl
85
+ # Check skill status
86
+ skilld status
66
87
 
67
- # Limit pages fetched per package
68
- skilld -m 50
88
+ # Manage settings
89
+ skilld config
69
90
  ```
70
91
 
92
+ ### Commands
93
+
94
+ | Command | Description |
95
+ |---------|-------------|
96
+ | `skilld` | Interactive wizard (first run) or status menu (existing skills) |
97
+ | `skilld <pkg>` | Sync specific package(s), comma-separated |
98
+ | `skilld status` | Show skill status across agents |
99
+ | `skilld config` | Configure agent, model, preferences |
100
+ | `skilld install` | Restore references from lockfile |
101
+ | `skilld remove` | Remove installed skills |
102
+ | `skilld uninstall` | Remove all skilld data |
103
+
71
104
  ### CLI Options
72
105
 
73
106
  | Option | Alias | Default | Description |
74
107
  |--------|-------|---------|-------------|
75
- | `--output` | `-o` | `.skilld` | Output directory |
76
- | `--maxPages` | `-m` | `100` | Max pages to fetch |
77
- | `--chunkSize` | | `1000` | Chunk size in characters |
78
- | `--model` | | `Xenova/bge-small-en-v1.5` | Embedding model |
79
- | `--crawl` | | `false` | Skip llms.txt, always crawl |
80
- | `--concurrency` | `-c` | `3` | Concurrent package processing |
81
-
82
- ## Programmatic Usage
83
-
84
- ```ts
85
- import { generateSkill } from 'skilld'
86
-
87
- const result = await generateSkill({
88
- url: 'https://nuxt.com/docs',
89
- outputDir: '.skilld',
90
- maxPages: 100,
91
- chunkSize: 1000,
92
- chunkOverlap: 200,
93
- }, ({ url, count, phase }) => {
94
- console.log(`[${phase}] ${count}: ${url}`)
95
- })
96
-
97
- console.log(result)
98
- // {
99
- // siteName: 'nuxt.com',
100
- // skillPath: '.skilld/nuxt.com/SKILL.md',
101
- // referencesDir: '.skilld/nuxt.com/references',
102
- // dbPath: '.skilld/nuxt.com/search.db',
103
- // chunkCount: 847
104
- // }
108
+ | `--query` | `-q` | | Search docs: `skilld nuxt -q "useFetch"` |
109
+ | `--global` | `-g` | `false` | Install globally to `~/<agent>/skills` |
110
+ | `--agent` | `-a` | auto-detect | Target specific agent (claude-code, cursor, etc.) |
111
+ | `--yes` | `-y` | `false` | Skip prompts, use defaults |
112
+ | `--prepare` | | `false` | Non-interactive sync for prepare hook (outdated only) |
113
+ | `--background` | `-b` | `false` | Run `--prepare` in a detached background process |
114
+
115
+ ## How It Works
116
+
117
+ ```
118
+ Package name Resolve docs → Fetch → Generate → Install
105
119
  ```
106
120
 
121
+ 1. **Resolve** - Looks up npm registry for homepage, repository URL
122
+ 2. **Fetch** - Tries versioned git docs → GitHub README → llms.txt (via ungh)
123
+ 3. **Generate** - Your agent creates SKILL.md from fetched docs
124
+ 4. **Cache** - References stored in `~/.skilld/` (shared across projects)
125
+ 5. **Install** - Writes SKILL.md to `./<agent>/skills/<package>/` (e.g. `.claude/skills/vueuse/`)
126
+
127
+ Supported agents: Claude Code, Cursor, Windsurf, Cline, Codex, GitHub Copilot, Gemini CLI, Goose, Amp, OpenCode, Roo Code
128
+
107
129
  ## Output Structure
108
130
 
109
- Skills are installed directly to each agent's skill directory:
131
+ Skills install to each detected agent's skill directory. References are cached globally and shared across projects:
110
132
 
111
133
  ```
112
- .claude/skills/
113
- └── vueuse/
114
- └── SKILL.md # Package documentation
134
+ .claude/skills/vueuse/
135
+ └── SKILL.md # Project-specific, adapts to your conventions
115
136
 
116
- .cursor/skills/
117
- └── vueuse/
118
- └── SKILL.md # Same content, separate copy
137
+ ~/.skilld/references/
138
+ └── vueuse@10.9.0/ # Global cache, static docs
139
+ ├── chunks/
140
+ └── search.db
119
141
  ```
120
142
 
121
- Each SKILL.md includes frontmatter for agent discovery:
143
+ SKILL.md is regenerated per-project (different conventions), but references stay static (same package docs). Version frontmatter enables sync:
122
144
 
123
145
  ```yaml
124
146
  ---
125
147
  name: vueuse
148
+ version: 10.9.0
126
149
  description: Collection of Vue Composition Utilities
127
150
  ---
128
-
129
- # VueUse
130
- ...README content...
131
151
  ```
132
152
 
133
153
  ## Package.json Auto-Discovery
134
154
 
135
- Run `skilld` without arguments to generate skills for all dependencies:
155
+ Run `skilld` without arguments to interactively generate skills for your dependencies:
136
156
 
137
157
  ```bash
138
158
  cd my-project
139
159
  pnpx skilld
140
160
  ```
141
161
 
142
- This will:
143
- 1. Read `package.json` dependencies and devDependencies
144
- 2. Resolve documentation URL for each package (llms.txt homepage GitHub README)
145
- 3. Generate searchable skills in `.skilld/`
162
+ On first run, skilld launches a wizard to configure your agent and model, then lets you choose packages from:
163
+ - **Source imports** scans your code for actually used packages
164
+ - **package.json** all dependencies and devDependencies
165
+ - **Manual entry** comma-separated package names
146
166
 
147
167
  Skips `@types/*` and common dev tools (typescript, eslint, vitest, etc).
148
168
 
149
- ## NPM Package Skills
169
+ ## Roadmap
150
170
 
151
- Generate skills for specific packages by name or URL:
171
+ - [ ] **Team sync** - SKILL.md files commit with version frontmatter; `skilld sync` hydrates references from global cache
172
+ - [ ] **Community skills repo** - Pull pre-generated skills from `skilld-community/skills` before generating; `skilld --share` to submit PRs
173
+ - [ ] **Migration docs** - Generate upgrade guides when re-running after major version bumps
174
+ - [ ] **MCP server mode** - Expose search as tool for Claude Code real-time doc lookups
175
+ - [ ] **Eval command** - Validate skill quality against known patterns and usage
176
+ - [ ] **CI integration** - GitHub Action to auto-regenerate skills on dependency updates
177
+ - [ ] **Smart presets** - Auto-detect recommended packages from project config (nuxt.config.ts → nuxt, vue, nitro, h3)
152
178
 
153
- ```bash
154
- # By package name (auto-resolves docs)
155
- skilld vueuse
156
- skilld @vueuse/core
157
- skilld defu
179
+ ## Shipped Skills (skills-npm)
158
180
 
159
- # By URL
160
- skilld https://vueuse.org
161
- skilld https://nuxt.com # Uses /llms.txt automatically
181
+ skilld supports the [skills-npm](https://github.com/antfu/skills-npm) convention. If a package ships a `skills/` directory, skilld symlinks it directly — no doc fetching, no caching, no LLM generation, no tokens spent.
182
+
183
+ ```
184
+ node_modules/@slidev/cli/skills/
185
+ slidev/
186
+ SKILL.md
187
+ references/
188
+
189
+ → .claude/skills/slidev -> node_modules/@slidev/cli/skills/slidev
162
190
  ```
163
191
 
192
+ Package authors can ship skills alongside their code. skilld detects and links them automatically during sync. Generation is the fallback for packages that haven't adopted the convention yet.
193
+
164
194
  ## Related
165
195
 
196
+ - [skills-npm](https://github.com/antfu/skills-npm) - Convention for shipping agent skills in npm packages
166
197
  - [mdream](https://github.com/harlan-zw/mdream) - HTML to Markdown converter used for crawling
167
198
  - [retriv](https://github.com/harlan-zw/retriv) - Vector database abstraction layer
168
199
 
169
200
  ## License
170
201
 
171
- Licensed under the [MIT license](https://github.com/harlan-zw/skilld/blob/main/LICENSE.md).
202
+ Licensed under the [MIT license](https://github.com/harlan-zw/skilld/blob/main/LICENSE).
@@ -0,0 +1,20 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
3
+ function getVersionKey(version) {
4
+ return version;
5
+ }
6
+ function getCacheKey(name, version) {
7
+ return `${name}@${getVersionKey(version)}`;
8
+ }
9
+ function getCacheDir(name, version) {
10
+ return join(REFERENCES_DIR, getCacheKey(name, version));
11
+ }
12
+ const CACHE_DIR = join(homedir(), ".skilld");
13
+ const REFERENCES_DIR = join(CACHE_DIR, "references");
14
+ const SEARCH_DB = join(CACHE_DIR, "search.db");
15
+ function getPackageDbPath(name, version) {
16
+ return join(REFERENCES_DIR, getCacheKey(name, version), "search.db");
17
+ }
18
+ export { getCacheDir as a, getPackageDbPath as i, REFERENCES_DIR as n, getCacheKey as o, SEARCH_DB as r, getVersionKey as s, CACHE_DIR as t };
19
+
20
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../src/cache/version.ts","../../src/cache/config.ts"],"sourcesContent":["/**\n * Version utilities\n */\n\nimport { join } from 'node:path'\nimport { REFERENCES_DIR } from './config'\n\n/**\n * Get exact version key for cache keying\n */\nexport function getVersionKey(version: string): string {\n return version\n}\n\n/**\n * Get cache key for a package: name@version\n */\nexport function getCacheKey(name: string, version: string): string {\n return `${name}@${getVersionKey(version)}`\n}\n\n/**\n * Get path to cached package references\n */\nexport function getCacheDir(name: string, version: string): string {\n return join(REFERENCES_DIR, getCacheKey(name, version))\n}\n","/**\n * Cache configuration\n */\n\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport { getCacheKey } from './version'\n\n/** Global cache directory */\nexport const CACHE_DIR = join(homedir(), '.skilld')\n\n/** References subdirectory */\nexport const REFERENCES_DIR = join(CACHE_DIR, 'references')\n\n/** @deprecated Use getPackageDbPath instead */\nexport const SEARCH_DB = join(CACHE_DIR, 'search.db')\n\n/** Get search DB path for a specific package@version */\nexport function getPackageDbPath(name: string, version: string): string {\n return join(REFERENCES_DIR, getCacheKey(name, version), 'search.db')\n}\n"],"mappings":";;AAUA,SAAgB,cAAc,SAAyB;AACrD,QAAO;;AAMT,SAAgB,YAAY,MAAc,SAAyB;AACjE,QAAO,GAAG,KAAK,GAAG,cAAc,QAAQ;;AAM1C,SAAgB,YAAY,MAAc,SAAyB;AACjE,QAAO,KAAK,gBAAgB,YAAY,MAAM,QAAQ,CAAC;;AChBzD,MAAa,YAAY,KAAK,SAAS,EAAE,UAAU;AAGnD,MAAa,iBAAiB,KAAK,WAAW,aAAa;AAG3D,MAAa,YAAY,KAAK,WAAW,YAAY;AAGrD,SAAgB,iBAAiB,MAAc,SAAyB;AACtE,QAAO,KAAK,gBAAgB,YAAY,MAAM,QAAQ,EAAE,YAAY"}