Pattern Migrator
Systematic workflow for migrating patterns between Storybook directories. Follow these five phases sequentially. See references/pattern-migration-guide.md for detailed procedures, command examples, and checklists.
Phase 1: Analysis and planning
- •Inventory all files in source and target directories (simple
.mdx,.mdx+.stories.tsx, complex directories) - •Extract Meta titles from all
.mdxfiles — record explicit titles and story references - •Map all cross-references: incoming links (other patterns → this one) and outgoing links
- •Draft a migration plan listing: source → destination paths, old → new Meta titles, old → new URLs, cross-references to update
Phase 2: File structure migration
- •Move files/directories — use
git mvto preserve history - •Update Meta titles to reflect new category structure
- •Update import paths in TypeScript files
- •Update internal cross-references within moved files
Handle simple files (.mdx only) and complex patterns (with stories/components) per the reference guide.
Phase 3: URL reference updates
Storybook URL rules: <Meta title="Category/Name" /> → ../?path=/docs/category-name--docs (spaces→hyphens, uppercase→lowercase, asterisks removed, slashes→hyphens).
- •Global search for old URL patterns across the entire codebase
- •Pattern-specific search for each moved pattern
- •Update all found references to new URLs
- •Update import paths in TypeScript files
Phase 4: Documentation updates
- •Update overview/index files that list patterns
- •Update CLAUDE.md if it references old structure
- •Update README files mentioning affected patterns
- •Verify British spelling and sentence-case headings throughout
Phase 5: Validation
- •
npm run build-storybook— must succeed - •Navigate Storybook to verify all links work and patterns appear in correct categories
- •
npm run typecheck— must succeed (if applicable) - •Cross-reference audit: no references point to old locations