AI rules
How to use MOTION.md with Claude Code and Cursor.
MOTION.md tells an AI coding agent how your app moves. With it, a new component gets the same motion as the rest of the app, without hand-tuning. It is complete on its own: the agent needs no other file to follow it.
What is in it
- Personality. One paragraph from your knob values, for example "Snappy: quick and responsive, with a hair of overshoot, and moderate travel."
- Hard rules. For example: every clickable element uses
press; never write a raw duration or easing; never animate opacity with a spring. - Which recipe to use. A table from interface element to recipe: dialogs use
overlay, toasts usenotify, and so on. - Tokens. Every value, with its name in
motif.tsandmotif.css. - Reduced motion. What changes when the user asks for less motion.
- Wrong vs right. A short example of each.
Claude Code
- Put
MOTION.mdandmotif.ts(ormotif.css) in your repo. The repo root is a good place forMOTION.md. - Add this line to your
CLAUDE.md, so every session loads the rules:
Follow @MOTION.md for all motion and animation.
- Ask for components as usual, for example: "Build a confirmation dialog for deleting a project." The agent picks the
overlayrecipe and imports its values frommotif.ts.
Cursor
- Put
MOTION.mdandmotif.ts(ormotif.css) in your repo. - Add a project rule in
.cursor/rules/that applies to every request and tells the agent to followMOTION.md. You can also paste the contents ofMOTION.mdinto the rule.
Codex
- Put
MOTION.mdandmotif.ts(ormotif.css) in your repo. - Add the same line to
AGENTS.mdat the repo root. Codex reads it before each task.
Keep it current
When you change the knobs, export all files again. The header of each file holds a link that re-opens your exact knobs in the playground.