|
| 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. |
0 commit comments