Migrate an existing app
Werewolf works best when you start with it, but you can add it to an app that already ships. You decide how far and how fast to go. Read what init changes and what can break, then pick a path. Nothing runs on its own. Every step is a command you or your agent runs, and you can undo each one.
Before you start
- Meet the installation requirements: Node.js 20+, React 19 and Tailwind CSS v4, one CSS file with
@import "tailwindcss";, an import alias and a lockfile. React 18 or Tailwind CSS v3 must be upgraded first, in its own commit. - Work on a new branch. Init has no preview mode, so git is your preview and your undo.
- Commit everything else first, so the diff shows only what Werewolf changed.
git switch -c try-werewolfLet your agent plan it
Paste this into your coding agent. It reads this guide, runs init on a branch, and asks you to choose before it changes any UI code. Replace <id> with your agent: cursor, claude, copilot, windsurf, gemini, cline, codex, or other.
Read https://www.werewolf-ui.dev/docs/migration.md first. Create a new branch. Run `npx werewolf-ui init --agent <id> --yes --json`. Don't add --overwrite. If there's a conflict, stop and show me. Then run `npx werewolf-ui lint --json`. Tell me which classes it reports as `WW_CLASS_REMOVED`, which risks in the guide apply to this app, and which path you suggest: switch at once, screen by screen, or try it first. Don't change UI code until I choose.What init changes
| File | What happens |
|---|---|
werewolf.json | Records your paths and package manager. |
tokens/seed.json | Created only if missing. Choose another path with --seed. |
styles/werewolf.css | Created: every token and the Tailwind theme. Choose another path with --output. |
| Your app CSS file | One line added after @import "tailwindcss";. Nothing else in the file changes. |
AGENTS.md, and CLAUDE.md or GEMINI.md if you use Claude Code or Gemini CLI | A block between <!-- werewolf:start --> and <!-- werewolf:end --> is added or refreshed. The rest of the file stays. |
| Agent rule files | Created, for example .agents/skills/werewolf-design/SKILL.md, the rest of that skill folder, and .cursor/rules/werewolf.mdc. |
.werewolf/managed.json | Created: a hash of each file Werewolf generated, so a later run can tell your edits apart. |
Init never edits your components, pages or package.json, and installs no packages. If it would overwrite a file you edited, it stops with WW_CONFLICT and writes nothing. Run it again and files that are already up to date stay as they are.
What can break, and how to fix it
Each risk below says what you will see, why, and what to do. The first one affects almost every existing app.
Classes from Tailwind's default theme stop working
After init, classes from Tailwind's default theme stop producing CSS: palette colors such as blue-500, white and black (in bg-*, text-* and other color utilities), plus rounded-lg, shadow-md, font-bold, text-2xl, ease-in-out and similar. Elements stay on the page but lose those styles.
Why: styles/werewolf.css clears Tailwind's default colors, fonts, font weights, text sizes, radius, shadows, easing, blur and opacity, so only Werewolf tokens are left.
Still working: spacing (px-4), sizes, layout, breakpoints, and theme values your own CSS defines after the Werewolf import.
List every affected class. Lint reports each one as WW_CLASS_REMOVED, with its file and line. lint --fix won't pick a token for you. You decide: replace these with tokens now, or add a bridge so they keep working while you migrate.
npx werewolf-ui lint --jsonBridge A: point old class names at Werewolf tokens
Add an @theme inline block after the Werewolf import, one line for each old name you use. Old classes keep working and pick up the Werewolf look right away. Lint still reports them, so the list gets shorter as you replace them.
Delete each line once no class needs it, and the whole block at the end.
@import "tailwindcss";
@import "../styles/werewolf.css";
@theme inline {
--color-blue-500: var(--color-blue);
--color-white: var(--color-text-on-blue);
--radius-lg: var(--radius-container);
--shadow-md: var(--shadow-med);
--font-weight-bold: var(--font-weight-semibold);
--text-2xl: var(--font-size-xl);
--ease-in-out: var(--ease-standard);
}Bridge B: keep the old look exactly
Copy the lines for the classes you use from node_modules/tailwindcss/theme.css into a @theme block after the Werewolf import. Old screens look as before, and new Werewolf screens sit beside them, so the app shows two styles until you finish.
Treat it as temporary: lint still reports these classes, and the values are not tokens, so they won't follow your theme or dark and light mode.
@import "tailwindcss";
@import "../styles/werewolf.css";
@theme {
--color-blue-500: …;
--radius-lg: …;
--shadow-md: …;
}The page background, text and font change
Werewolf styles body: background , text , the Geist font stack and a 14px body size. Every element also gets as its default border color. Text without a size class becomes 14px, and plain border classes change color. Werewolf doesn't load the Geist font itself. Without it, the browser shows the system font.
Keep the new base if you want the Werewolf look. Otherwise, override the parts you need in your own @layer base after the Werewolf import; later rules in the same layer win. To show Werewolf's typeface, load Geist in your app (SIL Open Font License), or keep your own font by pointing --font-family-sans at it; see Use your own font.
@layer base {
body {
font-size: var(--font-size-md);
}
}The color mode follows your app, if init reads it right
Both light and dark tokens are installed. Init puts on :root the mode your app shows today: a class or data-theme on <html>, a theme provider's forcedTheme or defaultTheme, <meta name="color-scheme">, color-scheme on :root, or a prefers-color-scheme media query (system). With none of these it starts light. Its JSON result and hint name the file and line that decided. A wrong guess flips native controls and scrollbars too. Tailwind dark: variants don't follow Werewolf's theme, and lint reports them as WW_DARK_VARIANT. Before 0.1.0-beta.1, init always started in dark mode.
Pass --color-mode light, dark or system to init, or change it later with theme --color-mode. If your app has a theme switch, set data-theme="light" or "dark" on <html> from it, and replace dark: variants as you go, since tokens switch on their own. See Theming.
npx werewolf-ui theme --color-mode systemYour CSS variables have the same name as a token
Werewolf defines variables such as --color-accent, --color-border, --radius-element and --font-family-sans. If your CSS defines the same name, whichever comes later wins: Werewolf components may take your color, or your screens may take Werewolf's.
Search your CSS for names in the Tokens list. Rename yours (for example --color-brand) and update the places that use them
grep -rn -e "--color-accent" -e "--color-border" srcA component with the same file name already exists
add writes to your ui alias, @/components/ui by default. If button.tsx already exists there with other content, add stops with WW_CONFLICT and keeps yours. --overwrite replaces it, and Werewolf's props may differ from yours, so every screen that uses it can break. lib/utils.ts (the cn helper) is the same case.
Install Werewolf into its own folders, so old and new components live side by side. After init, edit both aliases and directories in werewolf.json, then run add. Each alias and its directory must point at the same folder through your tsconfig.json paths, or the CLI stops with WW_PROJECT_ALIAS. Keep the ui alias ending in /ui.
{
"aliases": {
"ui": "@/components/werewolf/ui",
"lib": "@/lib/werewolf",
"hooks": "@/hooks/werewolf"
},
"directories": {
"ui": "src/components/werewolf/ui",
"lib": "src/lib/werewolf",
"hooks": "src/hooks/werewolf"
}
}This example assumes "@/*": ["./src/*"]. Move each screen to the new components, then delete the old file when nothing imports it.
`add` installs packages
Some components need npm packages (an icon set, a rich text editor). add installs them with your package manager, which can add packages or change versions you already have.
Check the component page first: it shows how many npm packages each component brings in. Review the package.json and lockfile diff before you commit.
Your agent follows Werewolf rules everywhere
Init writes rules your agent reads on every task. It builds new UI with Werewolf tokens, and may restyle old screens it touches, even when you asked for something else.
Tell your agent the scope in each prompt, for example "only migrate the settings page". To pause the rules, remove the block between the markers in AGENTS.md; the next init run adds it back.
A Werewolf path is already taken
If styles/werewolf.css is already your own file, init stops with WW_CONFLICT. If tokens/seed.json exists but isn't a valid seed, it stops with WW_SEED. Either way it writes nothing.
Choose other paths.
npx werewolf-ui init --seed design/werewolf-seed.json --output src/styles/werewolf.cssChoose a path
There is no single right way. Pick by the size of the app and how much change you can ship at once.
Switch at once
For a small app or a prototype, when you can review every screen in one pass.
- Run init on a branch.
- Replace every class lint reports with tokens, and set
data-themeon<html>. - Replace your components with Werewolf ones (pass each file to
--overwriteonly after you check its props). - Merge when lint is clean and every screen looks right.
Move screen by screen
For most apps that already ship. The app keeps working after every step.
- Run init on a branch, add Bridge A or B, set
data-theme, and install Werewolf into its own folders. - Check every screen, then merge. No screen has changed yet, but new screens can already use Werewolf.
- Move one screen at a time: its classes to tokens, its components to Werewolf ones. Lint shows what is left.
- When lint is clean, delete the bridge and the old components.
Try it first
When you want to see it before you decide.
- Run init on a throwaway branch.
- Build one new screen with Werewolf and compare it with the rest of the app.
- Keep the branch if you like it, or delete it: nothing else changed.
Undo
Still on the branch? Switch back to your main branch and delete it. Already merged? Remove these:
- The
@importline init added to your CSS file, and any bridge you added. werewolf.json,tokens/seed.json,styles/werewolf.cssand.werewolf/.- The block between
<!-- werewolf:start -->and<!-- werewolf:end -->inAGENTS.md,CLAUDE.mdandGEMINI.md, and the agent rule files init created. - Components and packages that
addinstalled, if you added any.