diff --git a/.gitignore b/.gitignore index 2f1de08239..587c73925b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,16 @@ scripts/coverage packages/*/*.tsbuildinfo # AI -.sisyphus/ \ No newline at end of file +.sisyphus/ + +# Agent skills +# Copy `.skills.local.example` to `.skills.local` and edit `SKILLS_DOMAINS=`. +.skills.local + +# Public MetaMask/skills cache maintained by `yarn skills` / `yarn setup`. +.skills-cache/ + +# Generated by MetaMask/skills tools/install. Run `yarn skills` to refresh. +.claude/skills/ +.agents/skills/ +.cursor/rules/ diff --git a/.skills.local.example b/.skills.local.example new file mode 100644 index 0000000000..8254a792a1 --- /dev/null +++ b/.skills.local.example @@ -0,0 +1,34 @@ +# Template for per-engineer skills config used by `yarn skills`. +# Copy this file to `.skills.local` (gitignored). +# +# Zero-config default: the shared @metamask/skills CLI refreshes +# `.skills-cache/metamask-skills` during setup. `yarn skills` auto-detects that +# cache when no env var is set, and falls back to the bundled package snapshot +# if the cache is unavailable — nothing to do. +# +# Optional persistent skills config belongs in this file. Environment variables +# with the same names are only for one-off shell or CI overrides and take +# precedence over this file. +# METAMASK_SKILLS_DIR path to MetaMask/skills source checkout (optional override) +# CONSENSYS_SKILLS_DIR path to Consensys/skills checkout (private overlay) +# METAMASK_SKILLS_TARGET_REPO canonical repo overlay for forks/unusual remotes +# +# Example local setup (only if you want to override the cache): +# METAMASK_SKILLS_DIR=~/dev/metamask/skills +# CONSENSYS_SKILLS_DIR=~/dev/Consensys/skills # optional +# METAMASK_SKILLS_TARGET_REPO=metamask-mobile # optional fork override +# +# Default behavior installs ALL stable domains available for Core. Set +# SKILLS_DOMAINS to opt out of some: +# SKILLS_DOMAINS= # all (default) +# SKILLS_DOMAINS=perps # single domain +# SKILLS_DOMAINS=perps,coding,pr-workflow # multiple domains +# +# Optional: regenerate gitignored installed skills during yarn install/setup after +# the public cache refreshes. Off by default for backward compatibility. +# SKILLS_AUTO_UPDATE=1 # also accepts true/yes +# +# Override per-run with `SKILLS_DOMAINS=... yarn skills` or `--domain `. +# Pick interactively with `yarn skills --select`. +# Use `yarn skills --reset` to wipe. +SKILLS_DOMAINS= diff --git a/README.md b/README.md index 5a6cd3bd82..3351f08931 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,26 @@ See the [Contributor Documentation](./docs) for help on: Each package in this repository has its own README where you can find installation and usage instructions. See `packages/` for more. +## Agent skills + +This repo can install MetaMask agent skills for Claude, Cursor, and Codex/OpenAI. +`yarn setup` keeps the public [`MetaMask/skills`](https://github.com/MetaMask/skills) +cache available through the shared `@metamask/skills` CLI. Run `yarn skills` any +time to install or refresh the gitignored generated skills under `.claude/skills/`, +`.cursor/rules/`, and `.agents/skills/`. + +By default, all stable skills that support Core are installed when you run `yarn skills`. +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. +To persist a local selection, copy `.skills.local.example` to `.skills.local` and +set values such as `SKILLS_DOMAINS=perps`. + +```bash +yarn skills # refresh default stable Core skills +yarn skills --domain perps # install only the perps domain +yarn skills --select # interactively choose domains +yarn skills --reset # clear saved local selection +``` + ## Packages diff --git a/package.json b/package.json index a01894190c..41ebe3b6a9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,10 @@ "test:packages": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter", "test:scripts": "NODE_OPTIONS=--experimental-vm-modules yarn jest --config ./jest.config.scripts.js --silent", "test:verbose": "yarn workspaces foreach --all --parallel --verbose run test:verbose", - "workspaces:list-versions": "./scripts/list-workspace-versions.sh" + "workspaces:list-versions": "./scripts/list-workspace-versions.sh", + "skills": "metamask-skills sync", + "skills:postinstall": "metamask-skills postinstall", + "postinstall": "if [ -x ./node_modules/.bin/metamask-skills ]; then ./node_modules/.bin/metamask-skills postinstall; else echo \"metamask-skills not installed; skipping skills cache refresh\"; fi" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", @@ -56,6 +59,7 @@ "@metamask/eth-json-rpc-provider": "^6.0.1", "@metamask/json-rpc-engine": "^10.5.0", "@metamask/network-controller": "^32.0.0", + "@metamask/skills": "^0.1.0", "@metamask/utils": "^11.9.0", "@ts-bridge/cli": "^0.6.4", "@types/jest": "^29.5.14", @@ -108,12 +112,13 @@ "packageManager": "yarn@4.14.1", "lavamoat": { "allowScripts": { - "@lavamoat/preinstall-always-fail": false, + "$root$": true, "@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true, + "@lavamoat/preinstall-always-fail": false, "babel-runtime>core-js": false, + "eslint-plugin-import-x>unrs-resolver": false, "simple-git-hooks": false, - "tsx>esbuild": false, - "eslint-plugin-import-x>unrs-resolver": false + "tsx>esbuild": false } } }