Skip to content

Commit 7165ab1

Browse files
committed
skills added
1 parent 150db19 commit 7165ab1

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

packages/skill-installer/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# @devlensio/skill
2+
3+
Installs the **DevLens Agent Skill** (`/devlens`) into your AI coding tool. The skill teaches the agent to drive the [DevLens CLI](https://www.npmjs.com/package/@devlensio/cli) — querying a precomputed code graph (nodes, typed edges, technical/business/security summaries) instead of grepping and reading whole files.
4+
5+
## Install
6+
7+
```bash
8+
# Install into the AI tools detected in this project (defaults to Claude Code if none found)
9+
npx @devlensio/skill install
10+
11+
# Force a specific tool
12+
npx @devlensio/skill install --harness=cursor
13+
14+
# Install into your home directory instead of the current project
15+
npx @devlensio/skill install --global
16+
17+
# Re-copy after an update / overwrite an existing install
18+
npx @devlensio/skill update # or: install --force
19+
20+
# See whether your install is up to date
21+
npx @devlensio/skill check
22+
```
23+
24+
> Requires the DevLens CLI itself: `npm install -g @devlensio/cli`. Behind a corporate proxy? set `NODE_EXTRA_CA_CERTS` to your org root CA.
25+
26+
After installing, reload your tool and type `/devlens` — e.g. `/devlens architecture`, `/devlens security-analysis`, `/devlens diagram`.
27+
28+
## Supported tools
29+
30+
| Harness | Project skills dir | Global (`--global`) dir |
31+
| :-- | :-- | :-- |
32+
| Claude Code | `.claude/skills/devlens/` | `~/.claude/skills/devlens/` |
33+
| Cursor | `.cursor/skills/devlens/` | `~/.cursor/skills/devlens/` |
34+
| Kilo Code | `.kilo/skills/devlens/` | `~/.kilocode/skills/devlens/` |
35+
| opencode | `.opencode/skills/devlens/` | `~/.config/opencode/skills/devlens/` |
36+
| pi | `.agents/skills/devlens/` | `~/.pi/agent/skills/devlens/` |
37+
38+
Without `--harness`, the installer auto-detects which tools are in use from their marker dirs (`.claude`, `.cursor`, `.kilo`/`.kilocode`, `.opencode`, `.pi`/`.agents`) and installs to each. (`.agents/skills/` is a shared convention also read by Kilo Code and opencode.)
39+
40+
Claude Code users can alternatively install via the plugin marketplace:
41+
42+
```text
43+
/plugin marketplace add devlensio/devlensOSS
44+
/plugin install devlens@devlensio
45+
```
46+
47+
---
48+
49+
## For maintainers
50+
51+
### How this package is built
52+
53+
The skill content has **one source of truth**: [`plugins/devlens/skills/devlens/`](../../plugins/devlens/skills/devlens) in this repo (the Claude plugin). This installer package does **not** keep its own copy in git. Instead, a copy is generated at publish time:
54+
55+
- `scripts/bundle-skill.mjs` copies that source skill into `packages/skill-installer/skill/`.
56+
- It runs automatically on the **`prepack`** npm lifecycle hook (i.e. before `npm pack` / `npm publish`).
57+
- `skill/` is gitignored — it only exists transiently during a publish.
58+
59+
This is why the package can't just reference `../../plugins/...`: an npm tarball can only contain files inside the package directory, so the skill must be bundled in.
60+
61+
### `package.json` fields that matter
62+
63+
- **`bin`** (`{ "skill": "bin/skill.mjs" }`) — declares the executable. This is what makes `npx @devlensio/skill …` resolve to and run `bin/skill.mjs`.
64+
- **`files`** (`["bin/", "skill/"]`) — the whitelist of what ships in the tarball. Paths are **relative to this `package.json`**, so `bin/` = `packages/skill-installer/bin/` and `skill/` = `packages/skill-installer/skill/`. `scripts/` is intentionally **not** listed — `bundle-skill.mjs` is a build-time tool and must not ship.
65+
- **`prepack`** script — runs `bundle-skill.mjs` to populate `skill/` before packing.
66+
67+
So `bin/skill.mjs` runs on the **user's** machine; `scripts/bundle-skill.mjs` runs on the **publisher's** machine. Same package, two roles.
68+
69+
### Releasing a new version
70+
71+
The skill product is versioned **independently of the `@devlensio/cli`**. The version lives in two files that must stay identical:
72+
73+
- `packages/skill-installer/package.json` → drives `npx @devlensio/skill update`
74+
- `plugins/devlens/.claude-plugin/plugin.json` → gates Claude `/plugin update`
75+
76+
Stamp both at once from the repo root:
77+
78+
```bash
79+
node scripts/set-skill-version.mjs 0.2.0
80+
```
81+
82+
Then publish each channel:
83+
84+
```bash
85+
# npx installer
86+
cd packages/skill-installer && npm publish # prepack rebundles skill/; first publish: --access public + 2FA
87+
88+
# Claude plugin
89+
git commit -am "skill 0.2.0" && git push # users update via /plugin update
90+
```
91+
92+
> Do **not** add these versions to the CLI's `scripts/set-version.mjs` — keeping them separate ensures a CLI release never bumps the skill.

scripts/set-skill-version.mjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Sets ONE version across the DevLens Agent Skill's two channels so they never
2+
// drift: the npx installer (`@devlensio/skill`) and the Claude plugin
3+
// (`plugins/devlens`). This is the SKILL product version — deliberately separate
4+
// from the CLI's `scripts/set-version.mjs`, so a CLI release never bumps the skill.
5+
//
6+
// Usage: node scripts/set-skill-version.mjs 0.2.0
7+
8+
import fs from "node:fs";
9+
import path from "node:path";
10+
import { fileURLToPath } from "node:url";
11+
12+
const version = process.argv[2];
13+
if (!version || !/^\d+\.\d+\.\d+/.test(version)) {
14+
console.error("usage: node scripts/set-skill-version.mjs <semver> (e.g. 0.2.0)");
15+
process.exit(1);
16+
}
17+
18+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
19+
const writeJson = (file, obj) => fs.writeFileSync(file, JSON.stringify(obj, null, 2) + "\n");
20+
21+
const targets = [
22+
{ file: path.join(root, "packages", "skill-installer", "package.json"), label: "installer (@devlensio/skill)" },
23+
{ file: path.join(root, "plugins", "devlens", ".claude-plugin", "plugin.json"), label: "plugin (devlens)" },
24+
];
25+
26+
for (const { file, label } of targets) {
27+
if (!fs.existsSync(file)) {
28+
console.error(`set-skill-version: missing ${file}`);
29+
process.exit(1);
30+
}
31+
const pkg = JSON.parse(fs.readFileSync(file, "utf8"));
32+
pkg.version = version;
33+
writeJson(file, pkg);
34+
console.log(`✔ ${label}${version}`);
35+
}
36+
37+
console.log(`\nSkill version set to ${version}. Next: republish the installer (cd packages/skill-installer && npm publish) and commit+push for the plugin channel.`);

0 commit comments

Comments
 (0)