Skip to content

Commit 569e061

Browse files
abretonc7sclaude
andauthored
chore(skills): use shared skills package (MetaMask#8965)
## Summary - Add `yarn skills` integration for Core, mirroring Mobile/Extension behavior. - Delegate skills sync/setup to the shared `@metamask/skills` CLI instead of keeping Core-local sync scripts. - Ignore generated skill outputs and document Core skill usage. ## Related - ADR 57: MetaMask/decisions#162 - Shared package PR: MetaMask/skills#24 ## Validation Validated against the published `@metamask/skills` npm package (`^0.1.0`): - `node --check bin/metamask-skills.mjs` - `npm pack --pack-destination /tmp` - packed CLI `sync --target /Users/deeeed/dev/metamask/core-4 --dry-run` - packed CLI `postinstall --target /Users/deeeed/dev/metamask/core-4 --dry-run` with `SKILLS_AUTO_UPDATE=1` - packed CLI target override with `METAMASK_SKILLS_TARGET_REPO=core` The lockfile has been refreshed against the published package, so dependency install / immutable install checks now pass. ## **How to use** Run manual sync: ```bash yarn skills ``` To opt into best-effort regeneration during setup/install, add this to `.skills.local` or your shell: ```bash SKILLS_AUTO_UPDATE=1 ``` Optional filters work through the shared installer: ```bash SKILLS_DOMAINS=testing,coding SKILLS_INCLUDE=agentic/recipe-harness ``` Use `METAMASK_SKILLS_TARGET_REPO` locally for forks or unusual remotes that should use the canonical `core` overlays. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Developer-only tooling and install hooks; no runtime library or controller code changes. > > **Overview** > Wires Core into the shared **`@metamask/skills`** CLI so agent skills sync matches Mobile/Extension instead of repo-local scripts. > > **`package.json`** adds **`yarn skills`** (`metamask-skills sync`), **`skills:postinstall`**, and a root **`postinstall`** hook (optional refresh when **`SKILLS_AUTO_UPDATE=1`**). **`@metamask/skills@^0.1.0`** is a devDependency with an updated **`yarn.lock`**. LavaMoat **`allowScripts`** now allows **`$root$`** so install can run the skills postinstall. > > **`.gitignore`** excludes **`.skills.local`**, **`.skills-cache/`**, and generated outputs under **`.claude/skills/`**, **`.agents/skills/`**, and **`.cursor/rules/`**. **`.skills.local.example`** documents domain filters and env overrides; **README** adds an **Agent skills** section with usage commands. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 08001cc. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6112b2b commit 569e061

5 files changed

Lines changed: 85 additions & 4 deletions

File tree

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ packages/*/*.tsbuildinfo
3939
# AI
4040
.sisyphus/
4141

42+
# Agent skills
43+
# Copy `.skills.local.example` to `.skills.local` and edit `SKILLS_DOMAINS=`.
44+
.skills.local
45+
46+
# Public MetaMask/skills cache maintained by `yarn skills` / `yarn setup`.
47+
.skills-cache/
48+
49+
# Generated by MetaMask/skills tools/install. Run `yarn skills` to refresh.
50+
.claude/skills/
51+
.agents/skills/
52+
.cursor/rules/
53+
4254
# Docusaurus
4355
**/.docusaurus
4456
packages/wallet-framework-docs/site/build

.skills.local.example

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Template for per-engineer skills config used by `yarn skills`.
2+
# Copy this file to `.skills.local` (gitignored).
3+
#
4+
# Zero-config default: the shared @metamask/skills CLI refreshes
5+
# `.skills-cache/metamask-skills` during setup. `yarn skills` auto-detects that
6+
# cache when no env var is set, and falls back to the bundled package snapshot
7+
# if the cache is unavailable — nothing to do.
8+
#
9+
# Optional persistent skills config belongs in this file. Environment variables
10+
# with the same names are only for one-off shell or CI overrides and take
11+
# precedence over this file.
12+
# METAMASK_SKILLS_DIR path to MetaMask/skills source checkout (optional override)
13+
# CONSENSYS_SKILLS_DIR path to Consensys/skills checkout (private overlay)
14+
# METAMASK_SKILLS_TARGET_REPO canonical repo overlay for forks/unusual remotes
15+
#
16+
# Example local setup (only if you want to override the cache):
17+
# METAMASK_SKILLS_DIR=~/dev/metamask/skills
18+
# CONSENSYS_SKILLS_DIR=~/dev/Consensys/skills # optional
19+
# METAMASK_SKILLS_TARGET_REPO=metamask-mobile # optional fork override
20+
#
21+
# Default behavior installs ALL stable domains available for Core. Set
22+
# SKILLS_DOMAINS to opt out of some:
23+
# SKILLS_DOMAINS= # all (default)
24+
# SKILLS_DOMAINS=perps # single domain
25+
# SKILLS_DOMAINS=perps,coding,pr-workflow # multiple domains
26+
#
27+
# Optional: regenerate gitignored installed skills during yarn install/setup after
28+
# the public cache refreshes. Off by default for backward compatibility.
29+
# SKILLS_AUTO_UPDATE=1 # also accepts true/yes
30+
#
31+
# Override per-run with `SKILLS_DOMAINS=... yarn skills` or `--domain <list>`.
32+
# Pick interactively with `yarn skills --select`.
33+
# Use `yarn skills --reset` to wipe.
34+
SKILLS_DOMAINS=

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ See the [Contributor Documentation](./docs) for help on:
1616

1717
Each package in this repository has its own README where you can find installation and usage instructions. See `packages/` for more.
1818

19+
## Agent skills
20+
21+
This repo can install MetaMask agent skills for Claude, Cursor, and Codex/OpenAI.
22+
`yarn setup` keeps the public [`MetaMask/skills`](https://github.com/MetaMask/skills)
23+
cache available through the shared `@metamask/skills` CLI. Run `yarn skills` any
24+
time to install or refresh the gitignored generated skills under `.claude/skills/`,
25+
`.cursor/rules/`, and `.agents/skills/`.
26+
27+
By default, all stable skills that support Core are installed when you run `yarn skills`.
28+
Set `SKILLS_AUTO_UPDATE=1` to opt into best-effort regeneration during setup. The shared package keeps sync/cache behavior uniform with Mobile and Extension.
29+
To persist a local selection, copy `.skills.local.example` to `.skills.local` and
30+
set values such as `SKILLS_DOMAINS=perps`.
31+
32+
```bash
33+
yarn skills # refresh default stable Core skills
34+
yarn skills --domain perps # install only the perps domain
35+
yarn skills --select # interactively choose domains
36+
yarn skills --reset # clear saved local selection
37+
```
38+
1939
## Packages
2040

2141
<!-- start package list -->

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
"test:packages": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter",
4343
"test:scripts": "NODE_OPTIONS=--experimental-vm-modules yarn jest --config ./jest.config.scripts.js --silent",
4444
"test:verbose": "yarn workspaces foreach --all --parallel --verbose run test:verbose",
45-
"workspaces:list-versions": "./scripts/list-workspace-versions.sh"
45+
"workspaces:list-versions": "./scripts/list-workspace-versions.sh",
46+
"skills": "metamask-skills sync",
47+
"skills:postinstall": "metamask-skills postinstall",
48+
"postinstall": "yarn skills:postinstall"
4649
},
4750
"devDependencies": {
4851
"@lavamoat/allow-scripts": "^3.0.4",
@@ -56,6 +59,7 @@
5659
"@metamask/eth-json-rpc-provider": "^6.0.1",
5760
"@metamask/json-rpc-engine": "^10.5.0",
5861
"@metamask/network-controller": "^32.0.0",
62+
"@metamask/skills": "^0.1.0",
5963
"@metamask/utils": "^11.9.0",
6064
"@ts-bridge/cli": "^0.6.4",
6165
"@types/jest": "^29.5.14",
@@ -108,12 +112,13 @@
108112
"packageManager": "yarn@4.16.0",
109113
"lavamoat": {
110114
"allowScripts": {
111-
"@lavamoat/preinstall-always-fail": false,
115+
"$root$": true,
112116
"@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true,
117+
"@lavamoat/preinstall-always-fail": false,
113118
"babel-runtime>core-js": false,
119+
"eslint-plugin-import-x>unrs-resolver": false,
114120
"simple-git-hooks": false,
115-
"tsx>esbuild": false,
116-
"eslint-plugin-import-x>unrs-resolver": false
121+
"tsx>esbuild": false
117122
}
118123
}
119124
}

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6283,6 +6283,7 @@ __metadata:
62836283
"@metamask/eth-json-rpc-provider": "npm:^6.0.1"
62846284
"@metamask/json-rpc-engine": "npm:^10.5.0"
62856285
"@metamask/network-controller": "npm:^32.0.0"
6286+
"@metamask/skills": "npm:^0.1.0"
62866287
"@metamask/utils": "npm:^11.9.0"
62876288
"@ts-bridge/cli": "npm:^0.6.4"
62886289
"@types/jest": "npm:^29.5.14"
@@ -8324,6 +8325,15 @@ __metadata:
83248325
languageName: unknown
83258326
linkType: soft
83268327

8328+
"@metamask/skills@npm:^0.1.0":
8329+
version: 0.1.0
8330+
resolution: "@metamask/skills@npm:0.1.0"
8331+
bin:
8332+
metamask-skills: bin/metamask-skills.mjs
8333+
checksum: 10/e8c0fc1387c3d3706d0f2a49ef61ecba2a320e68c0bc00eb40077defc9fbf407c8830b20f10e31acc1481c6a2d7541c7f1c5294b62b0d3e6d0df3d6cfd533ce9
8334+
languageName: node
8335+
linkType: hard
8336+
83278337
"@metamask/slip44@npm:^4.3.0, @metamask/slip44@npm:^4.4.0":
83288338
version: 4.4.0
83298339
resolution: "@metamask/slip44@npm:4.4.0"

0 commit comments

Comments
 (0)