Skip to content

Tools: Use native agent skill discovery - #80811

Merged
ciampo merged 15 commits into
trunkfrom
codex/native-skill-setup
Jul 29, 2026
Merged

Tools: Use native agent skill discovery#80811
ciampo merged 15 commits into
trunkfrom
codex/native-skill-setup

Conversation

@ciampo

@ciampo ciampo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Follow up to #80597.

What?

Moves Gutenberg's committed skills to .agents/skills and makes them available through supported agents' native discovery or generated compatibility views.

Why?

Universal instructions remain in AGENTS.md; task-specific guidance should use agents' native skill discovery. This removes the legacy root skills/ layout and manual skill-loading guidance while retaining Claude Code compatibility.

How?

  • Uses each SKILL.md frontmatter description for native discovery.
  • Documents .agents/skills as the repository skill catalog.
  • Installs a generated .claude/skills compatibility view when its entries all match the catalog, keeping ordinary catalog changes synchronized automatically.
  • Leaves that view unchanged when it finds unmatched local entries; npm run agents:setup is the explicit reconciliation command and asks before removing them.
  • Tests the setup script through normal Jest discovery; static checks run the focused Jest command directly.

Testing Instructions

In a disposable checkout:

  1. Run npm install and confirm .claude/skills/testing/SKILL.md matches .agents/skills/testing/SKILL.md.
  2. Change a catalog skill or add one, then run npm run postinstall; confirm the generated view updates.
  3. Add .claude/skills/private/SKILL.md, then run npm run postinstall; confirm it remains and the command directs you to npm run agents:setup.
  4. Run npm run agents:setup, confirm the prompt, and verify it reconciles the generated view.
  5. Run npm run test:unit -- tools/agents/test/setup-skills.test.js --runInBand.

Testing Instructions for Keyboard

Not applicable; this changes repository tooling and documentation only.

Screenshots or screencast

Not applicable.

Use of AI Tools

Codex was used to investigate the current skill layout, implement and test the setup script, and draft this pull request.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 7.76 MB

compressed-size-action

@ciampo
ciampo force-pushed the codex/native-skill-setup branch from b97f9d1 to 3aea1db Compare July 28, 2026 20:38
@ciampo ciampo changed the title Tools: Add native agent skill setup Tools: Use native agent skill discovery Jul 28, 2026
@ciampo ciampo self-assigned this Jul 28, 2026
@ciampo
ciampo requested a review from Copilot July 28, 2026 20:49
@ciampo
ciampo force-pushed the codex/native-skill-setup branch from 3aea1db to 996937c Compare July 28, 2026 20:50
@ciampo ciampo added the [Type] Code Quality Issues or PRs that relate to code quality label Jul 28, 2026

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

Comment thread package.json Outdated

This comment was marked as resolved.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Flaky tests detected in 37f1da4.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30465864292
📝 Reported issues:

@ciampo
ciampo marked this pull request as ready for review July 29, 2026 13:49

@jeryj jeryj 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.

Sorry for being pedantic here, but my gut instinct is to split this into smaller PRs. I think moving the skills to a root is fine. I was worried about premature optimization, but since refactors are so cheap now, I do think it's better to go with a default skill structure for now and address context bloat as it comes up.

So, if this PR is just moving the agent skills structure, I'm fine to approve. I'm less sure about the CI checks and setup-skills. I'll need to look into those more.

@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

The postintall script is responsible for creating the correct agent-specific (ie. claude) aliases depending on which platform (macos, linux, windows). It is based off what the skills npm package does when installing a skill

Without that script, I guess our best alternative would be to manually commit those alias files as real skills that internally re-direct to the equivalent .agents/skills — although I don't know if I like that alternative; it would be extra manual work, it would more expensive to run (claude would need to load an addiitonal skill), and it's not adhering to the tranditional conventions.

@jeryj

jeryj commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The postintall script is responsible for creating the correct agent-specific (ie. claude) aliases depending on which platform (macos, linux, windows). It is based off what the skills npm package does when installing a skill

Gotcha. I'm understanding the framework more and seeing your point. What about when we remove or add new skills - does the npm run test:agents:setup need to get run again? Does it handle pruning old skills and adding new symlinks as needed?

@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Good questions, and actually a few missing gaps that I now addressed. npm run agents:setup now:

  • Adds aliases for supported agents (symlinks, if not available Windows junctions, if not available a full copy)
  • Prunes removed skills aliases (only for managed skills)
  • Preserves unmanaged aliases

I also updated the guide to mention to re-run the setup script after changing the skill catalog.


Edit: see update

@aduth

aduth commented Jul 29, 2026

Copy link
Copy Markdown
Member

This looks like it's in the right direction 👍 What we had before was not skills, it was a folder of markdown files that we called "skills". Skills, as I understand them, have their existence mechanically understood by agents because they scan specific folders. .agents/ seems like the sensible cross-agent default, and adding whatever backfills for other popular clients that use their proprietary setup (e.g. Claude).

Comment thread package.json Outdated
Comment thread tools/agents/setup-skills.mjs
@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@jeryj and @aduth — following this suggestion, I pushed an update that greatly simplifies the setup script (and related tests) by assuming that the entire .claude/skills folder is disposable (and git ignored).

@aduth

aduth commented Jul 29, 2026

Copy link
Copy Markdown
Member

@jeryj and @aduth — following this suggestion, I pushed an update that greatly simplifies the setup script (and related tests) by assuming that the entire .claude/skills folder is disposable (and git ignored).

I think it's still possible developers might have their own personal skills and I don't know that I'd go as far as to say it's entirely disposable. The command I shared in the thread would have preserved a developer's own, with the exception of any which have conflicting names (not super likely, and we'd have the option to choose to either force-override or skip in these cases). Is that possible to retain? It feels like removing the rm would suffice. I guess the risk there is that it could accumulate stale skills for things that have been removed, but how likely is it that we'd be frequently removing skills?

@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

The command I shared in the thread would have preserved a developer's own, with the exception of any which have conflicting names

That setup would work well on a first pass, but it would not work well in a bunch of edge cases (naming conflicts, skill renaming / removal, etc). And as we cover all of these edge cases, we'd basically go back to the previous version.

More in general, I believe that we should favor agent-agnostic tooling (ie. .agents/skills over .claude/skills). We already do that for AGENTS.md and CLAUDE.md, so the current approach feels consistent ?

If a consumer of the repo has a skill in .claude/skills, we could argue that they should switch to one of the following:

  • if it's a useful skill for everyone, propose it as a repo-wide skill in .agents/skills
  • it's a personal skill, move it to whatever local configuration they have on their machine

If we're worried about wiping out existing .claude/skills files, we could add a check in the setup script?

@aduth

aduth commented Jul 29, 2026

Copy link
Copy Markdown
Member

Maybe it's fine. I'm not as sure on the point of "it's a personal skill, move it to whatever local configuration they have on their machine". Is it possible to have a personal skill tailored to a particular project that lives outside the project itself? I guess it could be a "global" skill and using description to provide clues to an agent that it's relevant to a particular project.

@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Maybe it's fine. I'm not as sure on the point of "it's a personal skill, move it to whatever local configuration they have on their machine". Is it possible to have a personal skill tailored to a particular project that lives outside the project itself? I guess it could be a "global" skill and using description to provide clues to an agent that it's relevant to a particular project.

that's what I personally do — in the skill description and body, I specify that it targets a specific project.

Would you be ok to merge as-is, and refine the approach if/as needed?

@aduth

aduth commented Jul 29, 2026

Copy link
Copy Markdown
Member

If agents:setup is run manually, then it seems a bit more reasonable that it would supersede personal skills as an explicit choice to perform that setup. It'd be more concerning if it was done automatically. We'd probably want to document this. The setup script documentation is a bit buried here 😅

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested this locally and it functions as expected when running npm run agents:setup 👍

For bonus points, I also tested in a Claude Code conversation with a vaguely related question and it immediately picked up the existing skill:

image

@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Nice! I've pushed a final commit which adds some docs refinements, and also adds a prompt when running the setup script if we find claude-specific skills that don't have a match in the .agents/skills folder (this is mostly to avoid wiping out a personal skill sitting in that folder)

I think this is a good starting point!

@ciampo
ciampo enabled auto-merge (squash) July 29, 2026 20:05
@ciampo
ciampo disabled auto-merge July 29, 2026 20:19
@ciampo

ciampo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@aduth Follow-up: postinstall now refreshed the aliases, but stops conservatively if it finds a mismatch.

Running the script again manually allows to force the override, hopefully a good compromise between automatizing the process without wiping out files unexpectedly.

@ciampo
ciampo enabled auto-merge (squash) July 29, 2026 20:34
@ciampo
ciampo merged commit 6787e54 into trunk Jul 29, 2026
54 of 56 checks passed
@ciampo
ciampo deleted the codex/native-skill-setup branch July 29, 2026 21:58
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Jul 29, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ideally, that tools/agents should be a workspace with a package.json file like other tools in that directory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Sponsor
SponsoredKunjungi sekarang
Promo