원클릭으로
consumer-migration-guide
// Use when creating a per-component migration guide for application developers upgrading from Spectrum 1 Web Components to Spectrum 2 components.
// Use when creating a per-component migration guide for application developers upgrading from Spectrum 1 Web Components to Spectrum 2 components.
| name | consumer-migration-guide |
| description | Use when creating a per-component migration guide for application developers upgrading from Spectrum 1 Web Components to Spectrum 2 components. |
| globs | 2nd-gen/packages/swc/components/*/migration-guide.mdx |
| alwaysApply | false |
Create per-component migration guidance for application developers upgrading app code from Spectrum 1 Web Components to Spectrum 2 components. The output should be practical and consumer-facing: what changed, what to update, how to test it, and how to roll it out safely.
One .mdx file per component at:
2nd-gen/packages/swc/components/[component-name]/migration-guide.mdx
The file is Storybook-renderable MDX. Start every guide with this template so it picks up the Components title prefix wired in 2nd-gen/packages/swc/.storybook/main.ts:
import { Meta } from '@storybook/addon-docs/blocks';
<Meta title="[Component name]/Migration guide" />
# [Component name] migration guide
Use sentence case for [Component name] (for example Badge, Action button). Do not include Components/ in the <Meta title> — titlePrefix already adds it, so the doc renders at Components/[Component name]/Migration guide.
Migration guides live alongside the Spectrum 2 component source so the doc ships with the component code. Do not add them to CONTRIBUTOR-DOCS/.
Do not link to project-planning / CONTRIBUTOR-DOCS docs from the guide. Those are maintainer-facing; consumers don't need them. Link only to public consumer docs (e.g. the Spectrum 1 README on npm or the Spectrum 2 component Storybook page) when a link genuinely helps.
Nav: The guide lives in the component directory, so the CONTRIBUTOR-DOCS update-nav.js script does not manage it. Do not register it in CONTRIBUTOR-DOCS/03_project-planning/03_components/README.md, and do not include auto-generated breadcrumbs or TOC markers intended for that script.
MDX gotchas: Keep bare tag names (<sp-badge>, <swc-badge>, etc.) wrapped in backticks in prose, and keep HTML/JS examples inside fenced code blocks. Avoid loose { / } outside code blocks; MDX parses them as JS expressions.
Before writing anything, read CONTRIBUTOR-DOCS/03_project-planning/03_components/[component]/migration-plan.md. Locate every item in the documentation checklist that is flagged as "deferred to consumer migration guide" — these are the breaking changes Phase 7 has already identified as needing coverage here. They are the primary input for this guide's ## What changed and ## Update your code sections. If the migration plan is absent, derive the breaking changes from the 1st-gen and 2nd-gen source comparison and note the risk.
Scope the guide to what actually shipped. The migration plan categories (Must-ship, Additive, Deferred) reflect planning intent, not final state — by the time the guide is written, some Additive items may have been implemented and some Must-ship items may have slipped. The 2nd-gen source is the only authority. For every feature you consider including: verify it exists in the shipped source. If it is there, include it regardless of how the plan categorized it. If it is not in the source, exclude it regardless of how the plan categorized it.
All guides follow the same import and tag name conventions. Do not grep for these — derive them from the component name:
| Spectrum 1 | Spectrum 2 | |
|---|---|---|
| Tag | sp-[component] | swc-[component] |
| Side-effect import | @spectrum-web-components/[component]/sp-[component].js | @adobe/spectrum-wc/components/[component]/swc-[component].js |
Use the badge guide at 2nd-gen/packages/swc/components/badge/migration-guide.mdx as the canonical format reference.
Verify claims against the real implementation and docs before writing:
CONTRIBUTOR-DOCS/03_project-planning/03_components/[component]/migration-plan.md — primary source for what breaking changes to cover (see Step 0 above)1st-gen/packages/[component-name]/README.md, public element files such as sp-*.ts, stories, and tests when needed2nd-gen/packages/swc/components/[component-name]/src/, stories, tests, and any package README or docs that describe the public APIrendering-and-styling-migration-analysis.md and accessibility-migration-analysis.md when present.ai/rules/text-formatting.mdThe guide must be short, direct, and consumer-focused. Optimize for scannability: a consumer should be able to complete a simple migration in under 5 minutes of reading. Prefer tables, short numbered steps, and before/after snippets over prose. Cut anything that is not strictly required to update product code.
Spectrum 2 supersedes Spectrum 1. Verify every claim — especially styling hooks and public custom property names — against the actual Spectrum 2 source (2nd-gen/packages/swc/components/[component-name]/ and 2nd-gen/packages/core/components/[component-name]/). Do not carry Spectrum 1 conventions (e.g. --mod-* prefixes) into the guide unless the Spectrum 2 implementation actually uses them.
Testing is out of scope. Do not include sections on test selector updates, ARIA snapshot changes, or VRT approval. Consumers own their own tests; the guide's job is to explain what changed in the component, not how to re-test a consumer's app.
Accessibility bullets do not duplicate code examples. If an a11y action is already covered as a numbered step in ## Update your code (which must include before/after snippets), the Accessibility bullet links to that step instead of repeating the snippet. Only include a code example in ## Accessibility for an action that is not covered in ## Update your code.
Do not include an ### Unchanged sub-section in ## What changed. Unchanged API requires no consumer action and adds noise. Limit ## What changed to ### Renamed, ### Added in Spectrum 2, and ### Removed in Spectrum 2 (omit any sub-section with no entries).
Include (public API):
--mod-* and documented theming hooks)aria-label on icon-only variants)Exclude (implementation detail):
spectrum-* → swc-*); a single short "do not target internal classes or shadow DOM" caution is enough::part() shadow parts unless one is explicitly part of the public APIrendering-and-styling-migration-analysis.md insteadStructure the steps logically. In "Update your code", present numbered steps in the order a consumer would actually perform them (for example: 1. update imports, 2. rename tags, 3. fix any consumer-facing accessibility gaps, 4. optionally adopt new attributes). Do not split content into parallel subsections when a short numbered flow reads better.
For the exact document structure, required sections, source-verification expectations, writing rules, and checklist format, read:
.ai/skills/consumer-migration-guide/references/consumer-migration-guide-prompt.md
Phase 7 of 1st-gen to 2nd-gen component migration. Use to write JSDoc, Storybook stories, and usage docs so the component is usable and understandable by others.
Phase 5 of 1st-gen to 2nd-gen component migration. Use to migrate CSS to the 2nd-gen structure, apply Spectrum 2 tokens, and ensure stylelint passes.
Phase 2 of 1st-gen to 2nd-gen component migration. Use to create the 2nd-gen file and folder structure, wire up exports, and confirm the build passes before implementation begins.
Sub-task after Phase 6 of 1st-gen to 2nd-gen component migration. Use to verify all migrated files conform to the project style guides, run linters, and surface any guideline gaps as PR comment notes.
Phase 4 of 1st-gen to 2nd-gen component migration. Use to implement WCAG-aligned semantics, ARIA, keyboard support, and focus management, and document accessibility behavior.
Phase 8 of 1st-gen to 2nd-gen component migration. Use to run final checks, verify lint/tests/build/Storybook, update the workstream status table, and open a PR.