Write a UI micro-interaction spec
You get a detailed, ready-to-use prompt for a coding assistant that describes one micro interaction in full, including timings, keyboard behaviour and edge cases. It works because the AI is forced to decide every state and fallback up front, so the coding assistant has little left to guess.
The prompt
Act as a senior front-end engineer who specialises in accessible interface motion.
Task: write an implementation prompt that I can give to an AI coding assistant to build one micro interaction for {component_name} in {tech_stack}. The interaction should achieve this goal: {interaction_goal}.
Steps:
1. State the trigger, the start state and the end state of the interaction in one short paragraph.
2. List every intermediate state (for example hover, focus, loading, success, error) and say exactly what changes visually in each, including durations in milliseconds and easing.
3. Describe the keyboard and screen reader behaviour, plus a reduced-motion fallback.
4. Add edge cases to handle: {edge_cases}.
5. Finish with acceptance checks that someone could test by hand.
Output: a single ready-to-paste prompt under the headings Behaviour, States, Accessibility, Edge cases and Acceptance checks. Use bullet points, no code, and keep it under 350 words.
Change the parts in curly braces. Use it when you want a polished button, input or modal behaviour and your first attempts at asking an AI for it came back generic or inaccessible.
What happened when we ran it
We sent
Act as a senior front-end engineer who specialises in accessible interface motion. Task: write an implementation prompt that I can give to an AI coding assistant to build one micro interaction for a 'Delete project' button in a project settings page of a project-management app in React 18, TypeScript and Tailwind CSS, with Framer Motion for animation. The interaction should achieve this goal: Stop accidental deletions by requiring the user to press and hold the button for 1.5 seconds, with a fill animation showing progress, before the project is deleted. Steps: 1. State the trigger, the start state and the end state of the interaction in one short paragraph. 2. List every intermediate state (for example hover, focus, loading, success, error) and say exactly what changes visually in each, including durations in milliseconds and easing. 3. Describe the keyboard and screen reader behaviour, plus a reduced-motion fallback. 4. Add edge cases to handle: the user releases early, the user taps on a touch screen, the user holds the Space key, the network request fails after the hold completes, and the button is pressed twice quickly. 5. Finish with acceptance checks that someone could test by hand. Output: a single ready-to-paste prompt under the headings Behaviour, States, Accessibility, Edge cases and Acceptance checks. Use bullet points, no code, and keep it under 350 words.
The model replied
Run on Claude Sonnet 5.5, 09 Nov 2026. Automatic check: 2 out of 5.
Mentioned for
Claude, ChatGPT, Gemini, Cursor
Where it came from
Found on Hacker News, shared by elwingo1: Show HN: UI micro interactions prompts for AI.
This is our own version of the idea, written and tested by us. The original may differ.