Skip to content

chore(skills): switch to public MetaMask/skills with optional Consensys overlay#30180

Merged
abretonc7s merged 12 commits into
mainfrom
chore/skills-public-source
May 21, 2026
Merged

chore(skills): switch to public MetaMask/skills with optional Consensys overlay#30180
abretonc7s merged 12 commits into
mainfrom
chore/skills-public-source

Conversation

@abretonc7s

@abretonc7s abretonc7s commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #29853. Switches yarn skills to the new public MetaMask/skills repo, with the private Consensys/skills repo available as an optional overlay for internal-only material. Adds a postinstall hook so engineers get an auto-updated skill set on every yarn install — no manual yarn skills needed.

Why public

  • Cloud agents (Cursor cloud, Codex cloud, Claude.ai web) can't git clone a private repo or set engineer-managed env vars. The public repo solves this with a one-liner curl bootstrap (no SSH, no auth).
  • New engineers don't need Consensys SSO to start using skills — the public set installs cleanly on its own.
  • Out-of-the-box auto-sync via postinstall (Ramon's ask in #engineering-mobile).

Engineer experience (zero-config)

yarn install   # postinstall clones MetaMask/skills into .skills-cache/ and installs
yarn skills    # auto-detects the cache, no env var or shell rc edit needed

Override only if you keep a separate clone:

export METAMASK_SKILLS_DIR=~/dev/metamask/skills
export CONSENSYS_SKILLS_DIR=~/dev/Consensys/skills   # optional private overlay

Changes

  • scripts/skills-sync.mts — multi-source aware wrapper (was bash, ported to node .mts for cross-platform consistency). Resolution order: METAMASK_SKILLS_DIRCONSENSYS_SKILLS_DIR → auto-fallback to .skills-cache/metamask-skills. When the cache is used, injects METAMASK_SKILLS_DIR=<cache> so the bash sync underneath sees the source.
  • scripts/skills-postinstall.mts (new) — auto-clones MetaMask/skills into .skills-cache/metamask-skills and runs the installer on every yarn install. Layered with CONSENSYS_SKILLS_DIR when set. Best-effort: skipped on CI, on SKILLS_SKIP_POSTINSTALL=1, or when offline. Opt back in on CI with SKILLS_FORCE_POSTINSTALL=1.
  • .gitignore — adds .skills-cache/, updates comments to reference public canonical.
  • package.json — adds postinstall hook + lavamoat "$root$": true allowScripts entry; skills script uses tsx scripts/skills-sync.mts (node 20 has no native TS).
  • .skills.local.example — documents new zero-config default + optional env-var override.

Companion PRs

Out of scope

  • TS rewrite of CLI.
  • Personal-skills tooling.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: zero-config yarn skills sync

  Scenario: fresh clone, no env vars
    Given the engineer cloned this branch and has no METAMASK_SKILLS_DIR set
    When they run `yarn install`
    Then `.skills-cache/metamask-skills/` is populated from MetaMask/skills
    And skills are installed under `.claude/`, `.cursor/`, `.agents/`
    And `git status --short` reports a clean working tree
    When they later run `yarn skills`
    Then the wrapper auto-detects the cache and re-syncs without any env var

  Scenario: engineer with explicit clone
    Given METAMASK_SKILLS_DIR points at a separate clone outside the repo
    When the engineer runs `yarn skills`
    Then the explicit clone is used in preference to the cache

  Scenario: federation with private overlay
    Given METAMASK_SKILLS_DIR and CONSENSYS_SKILLS_DIR both point at valid clones
    When the engineer runs `yarn skills`
    Then skills from both sources install
    And on name collision the Consensys (private) version wins

  Scenario: CI install skips postinstall by default
    Given CI=1 is set
    When the engineer runs `yarn install`
    Then skills-postinstall.mts exits immediately without writing anything

  Scenario: CI install opts back in
    Given CI=1 and SKILLS_FORCE_POSTINSTALL=1 are set
    When the engineer runs `yarn install`
    Then skills-postinstall.mts clones the cache and runs the install

  Scenario: opt out per machine
    Given SKILLS_SKIP_POSTINSTALL=1 is set
    When the engineer runs `yarn install`
    Then skills-postinstall.mts exits immediately

  Scenario: Windows engineer without WSL/Git Bash
    Given the engineer runs the wrapper on Windows PowerShell
    When they run `yarn skills` or `yarn install`
    Then the node wrappers execute without requiring bash on PATH at the wrapper layer

Screenshots/Recordings

No UI change — agent tooling and repo wiring only.

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Medium risk because it changes install-time behavior via a new postinstall script (runs git and writes to .skills-cache/) and updates Lavamoat allow-scripts, which could impact developer/CI installs if misconfigured.

Overview
Updates agent-skills tooling to prefer the public MetaMask/skills source (optionally layered with Consensys/skills) and replaces the old bash-only scripts/skills-sync.sh with a tsx wrapper that auto-detects sources via env vars or .skills.local.

Adds a best-effort postinstall hook that clones/updates MetaMask/skills into .skills-cache/ (skipped on CI unless opted in) and updates docs/config templates plus .gitignore/Lavamoat settings to support the new zero-config workflow.

Reviewed by Cursor Bugbot for commit ca9187e. Bugbot is set up for automated code reviews on this repo. Configure here.

…ys overlay

- scripts/skills-sync.sh: prefer METAMASK_SKILLS_DIR (public, no auth), fall
  back to CONSENSYS_SKILLS_DIR. Multi-source aware via the public tools/sync.
- scripts/skills-postinstall.sh: auto-clone MetaMask/skills into .skills-cache
  and install on every `yarn install`. Best-effort — skipped on CI or when
  SKILLS_SKIP_POSTINSTALL=1, silent on offline.
- .gitignore: add .skills-cache/, update comments to reference public canonical.
- package.json: add postinstall hook that runs skills-postinstall.sh.
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2 metamaskbotv2 Bot added the team-perps Perps team label May 14, 2026
Comment thread scripts/skills-postinstall.sh Outdated
Cross-platform consistency with other scripts/*.mjs. Engineers on Windows
without WSL/Git Bash can now run `yarn skills` and the postinstall hook
without bash on the wrapper level (bash is still used for the actual
install/sync from the skills repo, but that's invoked via spawnSync).
Behavior is unchanged: same env var precedence, same cache location,
same skip rules.
@github-actions github-actions Bot added size-M and removed size-S labels May 14, 2026
Comment thread scripts/skills-postinstall.mts Outdated
CI default-skip stays. Jobs that genuinely need skills installed (agent-
driven review bots, e2e jobs that hit skills, etc.) can set
SKILLS_FORCE_POSTINSTALL=1 to override.
Matches the parallel extension PR (#42488) and the mobile repo's
existing TS-first stance. Mobile uses node 20 (no native TS) so the
scripts run via the already-installed `tsx` direct dep — same runner
the e2e scripts use.
Per Cursor Bugbot review:
- skills-postinstall.mts: `git clone` now pins `--branch main` so the
  initial clone matches the fetch/reset path (`origin/main`). Avoids
  drift if the default branch ever changes.
- skills-postinstall.mts: `--target` is now `process.cwd()` (absolute)
  to match `--source`. Prior `.` would break if the installer ever
  `cd`s internally.
- .skills.local.example: documents METAMASK_SKILLS_DIR + CONSENSYS_SKILLS_DIR
  env vars and the install-all default per upstream change.
@abretonc7s abretonc7s requested a review from gambinish May 18, 2026 09:29
Comment thread scripts/skills-postinstall.mts
CI `yarn allow-scripts` rejected the new postinstall hook because the
root package wasn't in the allowScripts allowlist. Adding "$root$": true
matches the extension repo convention and unblocks postinstall on CI.
Zero-config defaults per @gauthierpetetin feedback on the ext PR. The
postinstall hook already clones MetaMask/skills into
.skills-cache/metamask-skills. The wrapper now picks that up
automatically when METAMASK_SKILLS_DIR is unset, injecting
METAMASK_SKILLS_DIR=<cache> into the spawned bash so tools/sync sees
the source. Engineers run `yarn install && yarn skills` with no
shell rc edit.

Env var still wins as override for engineers who keep a separate clone.
mkdirSync/statSync/existsSync can throw (EPERM, read-only FS, file-vs-dir
conflict on .skills-cache). The script promises 'never fails the install'
but an uncaught throw would propagate as non-zero exit and break
`yarn install` for every engineer. Wrap main body in try/catch, log
warning, exit 0.
@abretonc7s abretonc7s enabled auto-merge May 20, 2026 01:49

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 84c221b. Configure here.

Comment thread scripts/skills-sync.mts

@geositta geositta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abretonc7s Thanks for setting this up. From what I can tell, the new zero config path has two correctness gaps that will make local setup behave differently from the documented contract.

On stock macOS, postinstall invokes the skills installer with Bash 3.2 even though the installer requires Bash 4 syntax, so the install is skipped while yarn install still succeeds. Separately, postinstall installs all domains directly through tools/install, ignoring the .skills.local domain selection that yarn skills saves and honors. The .skills.local.example path guidance also needs to match what the TypeScript wrapper can resolve.

Am requesting changes so the automatic setup path and the manual yarn skills path use the same shell selection and source/domain resolution semantics.

Comment thread scripts/skills-postinstall.mts Outdated
Comment thread scripts/skills-postinstall.mts Outdated
Comment thread scripts/skills-sync.mts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 98%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 7 changed files are purely developer tooling related to AI agent skills infrastructure:

  1. package.json: Only changes are to the skills script (bash→tsx) and adding a postinstall hook for skills cache management, plus a lavamoat allowScripts entry for the root package. No app dependencies, no runtime code changes.

  2. scripts/skills-sync.mts (new): TypeScript rewrite of the skills sync script. Developer tooling only — syncs AI agent skills (Cursor, Claude Code, Codex) from MetaMask/skills repo. No app code.

  3. scripts/skills-postinstall.mts (new): Auto-clones MetaMask/skills on yarn install. Explicitly skipped on CI (process.env.CI check), so it won't affect CI builds or E2E test runs.

  4. scripts/skills-sync.sh (deleted): Replaced by the TypeScript version above.

  5. .gitignore: Added .skills-cache/ entry. No app impact.

  6. .skills.local.example: Updated developer configuration template. No app impact.

  7. README.md: Documentation update for the new skills setup workflow. No app impact.

None of these changes touch app source code, controllers, navigation, UI components, test infrastructure, or any user-facing functionality. The postinstall script is a no-op on CI. No E2E tests or performance tests are needed.

Performance Test Selection:
No performance-relevant changes. All modifications are developer tooling scripts for AI agent skills management with no impact on app rendering, data loading, state management, or any user-facing flows.

View GitHub Actions results

@abretonc7s abretonc7s requested a review from geositta May 21, 2026 03:47
@sonarqubecloud

Copy link
Copy Markdown

@abretonc7s abretonc7s added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit b4f31a4 May 21, 2026
153 of 158 checks passed
@abretonc7s abretonc7s deleted the chore/skills-public-source branch May 21, 2026 06:38
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-M team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants