| name | migrate-stitches |
| description | This skill should be used when the user asks to "migrate from Stitches", "convert Stitches to RSC", "upgrade to Seams", "replace @stitches/react", or mentions migrating existing Stitches.js code to Seams. |
Migrate from Stitches.js to Seams
Guide migration from the original @stitches/react or @stitches/core packages to @artmsilva/seams-react or @artmsilva/seams-core.
Migration Overview
Seams is a 1:1 API-compatible replacement. Most code works without changes. The key differences are:
- Package names:
@stitches/react → @artmsilva/seams-react
- Build plugin required: Add Next.js or Vite plugin for CSS extraction
- No runtime CSS: CSS is extracted at build time, not generated at runtime
Migration Steps
Step 1: Analyze Current Usage
Search the codebase for Stitches imports and usage patterns:
grep -r "from '@stitches" --include="*.ts" --include="*.tsx"
grep -r "from \"@stitches" --include="*.ts" --include="*.tsx"
find . -name "stitches.config.*" -type f
Step 2: Update Package Dependencies
Replace Stitches packages in package.json:
Before:
{
"dependencies": {
"@stitches/react": "^1.2.8"
}
}
After:
{
"dependencies": {
"@artmsilva/seams-react": "^0.1.0"
}
}
For core-only usage:
{
"dependencies": {
"@artmsilva/seams-core": "^0.1.0"
}
}
Step 3: Update Imports
Replace import paths throughout the codebase:
import { styled, css, globalCss, keyframes, createTheme } from "@stitches/react";
import { createStitches } from "@stitches/react";
import { styled, css, globalCss, keyframes, createTheme } from "@artmsilva/seams-react";
import { createStitches } from "@artmsilva/seams-react";
Use sed for bulk replacement:
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -exec sed -i '' "s/@stitches\/react/@artmsilva\/seams-react/g" {} +
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -exec sed -i '' "s/@stitches\/core/@artmsilva\/seams-core/g" {} +
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -exec sed -i "s/@stitches\/react/@artmsilva\/seams-react/g" {} +
Step 4: Add Build Plugin
For Next.js - Install and configure:
pnpm add @artmsilva/seams-next-plugin
Update next.config.js:
const withSeams = require("@artmsilva/seams-next-plugin");
module.exports = withSeams({
useScope: true,
useLayers: true,
})({
});
For Vite - Install and configure:
pnpm add @artmsilva/seams-vite-plugin
Update vite.config.ts:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import seams from "@artmsilva/seams-vite-plugin";
export default defineConfig({
plugins: [
react(),
seams({
useScope: true,
useLayers: true,
}),
],
});
Step 5: Handle Breaking Patterns
getCssText() Usage
The getCssText() function still works but is primarily for SSR. With build plugins, CSS is extracted automatically.
Before (SSR hydration):
<style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
After: Remove this - the build plugin handles CSS injection.
Dynamic css prop with Non-Serializable Values
Functions in css prop won't work at build time:
<Box css={{ color: () => getColor() }} />
<Box css={{ color: dynamicColor }} />
The build plugin converts dynamic values to CSS variables automatically.
Step 6: Verify Migration
-
Run the build to check for errors:
pnpm build
-
Check generated CSS for proper layer structure:
grep -r "@layer stitches" dist/
-
Test in browser - styles should apply without runtime JS
Common Migration Issues
Issue: Styles not applying
Cause: Build plugin not processing files
Fix: Check include/exclude patterns in plugin config
Issue: TypeScript errors
Cause: Type definitions slightly different
Fix: Update type imports if needed - most types are compatible
Issue: Theme tokens not resolving
Cause: Token syntax difference
Fix: Ensure $token syntax is used (same as original Stitches)
Additional Resources
See references/api-differences.md for detailed API comparison.
See examples/ for before/after migration examples.