Skip to content

feat: add Agent Skill for S1 to S2 migration#9778

Merged
reidbarber merged 37 commits intomainfrom
s1-to-s2-upgrade-skill
Apr 8, 2026
Merged

feat: add Agent Skill for S1 to S2 migration#9778
reidbarber merged 37 commits intomainfrom
s1-to-s2-upgrade-skill

Conversation

@reidbarber
Copy link
Copy Markdown
Member

@reidbarber reidbarber commented Mar 11, 2026

This PR adds an Agent Skill that helps users upgrade from v3 to S2. TLDR is that it tells the agent how to effectively run the codemods, then fix everything the codemod couldn't fix automatically.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Install the skill:

npx skills add https://d1pzu54gtk2aed.cloudfront.net/pr/c0f1ac37b568c9f2c129bd25a37d704166f76dd3/ --skill migrate-react-spectrum-v3-to-s2

and invoke it when upgrading your project.

Important

The skill mentions running the codemod with "--agent". This has not been released yet, so you may need to manually update the skill to point to a nightly release, which does include it: https://www.npmjs.com/package/@react-spectrum/codemods?activeTab=versions.
Example: Replace npx @react-spectrum/codemods s1-to-s2 --agent with npx @react-spectrum/codemods@3.0.0-nightly-7ba11ce33-260324 s1-to-s2 --agent

🧢 Your Project:

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 11, 2026

Base automatically changed from codemod-fixes to main March 17, 2026 22:20
@reidbarber reidbarber changed the title [WIP]: add Agent Skill for S1 to S2 migration feat: add Agent Skill for S1 to S2 migration Mar 18, 2026
@rspbot
Copy link
Copy Markdown

rspbot commented Mar 18, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 23, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 30, 2026

@github-actions github-actions bot added the S2 label Mar 31, 2026
@rspbot
Copy link
Copy Markdown

rspbot commented Mar 31, 2026


To install the migration skill and the general S2 skill, run:

<Command command="npx skills add https://react-spectrum.adobe.com --skill migrate-react-spectrum-v3-to-s2 --skill react-spectrum-s2" />
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I decide to have this command include both skills (migrate-react-spectrum-v3-to-s2 and react-spectrum-s2) since the main S2 skill is useful for referencing component docs during migration.

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 1, 2026

yihuiliao
yihuiliao previously approved these changes Apr 1, 2026
function generateMigrationSkillMd(skillConfig) {
return `${generateFrontmatter(skillConfig)}# React Spectrum v3 to S2 migration

Upgrade React Spectrum v3 codebases to S2 by following these seven steps in order.
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.

The agent skill is still spinning its wheels for me for now, but one interesting thing I noticed, I'll add more as it runs:

  • it only installed S2 0.9.0 since it saw the project was still using React 18, maybe it should attempt to always use latest since it is technically compatible. Otherwise maybe it should let the user know to attempt an upgrade to React 19?

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.

Interestingly enough it began to degrade the version of S2 to attempt to find something to match the React 18 dependency, and began trying to fix some Next configs which seemed unrelated. Should we also add instructions so that it stays strictly in bounds of the codemod? Or is this something I messed up on my end?

Copy link
Copy Markdown
Member Author

@reidbarber reidbarber Apr 3, 2026

Choose a reason for hiding this comment

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

Added a new Scope section at the beginning, as well as a final step to generate a report with any follow-up needed. This should indicate to the Agent not to do any massive upgrades (like React major version bumps), but to mention them in the final report as follow-up work.

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 2, 2026

Copy link
Copy Markdown
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

I tested this again against my sample repo again, it works pretty well. I will note that it still ended up bumping the project's Next version for some reason, as well as writing a patch for isRTL...

I verified that the agent SKILL.md had the proper "Scope" section that forbids major upgrades, so it seems like the the "Scope" section of the skill isn't being 100% followed by the agent, not sure if there is much we can do about that.

Maybe we can add some guidance around this in the future, will have to see how often that may come up.

@reidbarber reidbarber added this pull request to the merge queue Apr 8, 2026
Merged via the queue into main with commit 7ca31ae Apr 8, 2026
30 checks passed
@reidbarber reidbarber deleted the s1-to-s2-upgrade-skill branch April 8, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants