design-before-code
Skill2 starsChanged 6 months agoMITView on GitHub
Use before implementing any new AI feature UI component. Requires a written shape/spec — layout, states, copy, interactions — before a single line of implementation code is written. Blocks "I'll design it as I build it" completions.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- zhaoyii/my-skillstheir own version, first seen Feb 3, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- zhaoyii/my-skills★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessible-ai-outputSkill
- ai-component-patternsSkill
- ai-onboarding-designSkill
- ai-output-designSkill
- ai-states-requiredSkill
- design-token-auditSkill
- prompt-ux-designSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 65
Write the actual copy for every text element — not "label here" but the final words.
- Very specific: line 90
Create design/specs/<component-name>.md with the four sections above.
- Distinctive: line 94
Before starting code, verify the spec answers:
- Distinctive: line 107
Before marking the PR ready, check the implementation against each spec section.
- Distinctive: line 121
When design-before-code is satisfied, state it like this:
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Design Before Code
The Law
CODE WRITTEN WITHOUT A SPEC IS ALWAYS A PROTOTYPE.
"I'll design it as I build it" produces UI shaped by what was easy to code — not by what users need.
A written layout, state definitions, final copy, and interaction map IS a spec.When to Use
Trigger before:
- Implementing any new AI feature UI component
- Refactoring a component that changes its interaction model
- Adding a new page or major section to an AI product
- Implementing the output of an agent or multi-step AI workflow
When NOT to Use
- Hotfixes to existing, already-designed components (wording changes, colour tweaks)
- Backend-only changes with no UI surface
- Prototypes explicitly scoped as throwaway (label them as such)
The Spec Format
A spec does not need to be a Figma file. It needs to answer four questions:
1 — Layout
What is the visual structure? Describe it in words or ASCII:
┌─────────────────────────────────┐
│ [Avatar] User message │
│ │
│ AI response [Avatar] │
│ ─ ─ streaming ─ ─ │
│ │
│ [Prompt input ___________] [▶] │
└─────────────────────────────────┘Note: column widths, alignment, responsive behaviour (stacks on mobile? collapses?), max-width constraints.
2 — States
Which states does this component have? (See ai-states-required for the full list.) For each state, note the visual difference.
| State | Visual change |
|----------|----------------------------------------|
| Loading | Response area shows streaming cursor |
| Error | Red border, inline error copy |
| Success | Full text, feedback buttons appear |3 — Copy
Write the actual copy for every text element — not "label here" but the final words.
Placeholder: "Ask anything about this document…"
Error: "Something went wrong. Try again."
Empty: "No messages yet. Start by asking a question."
Loading: "Thinking…"4 — Interactions
What can the user do, and what happens?
Send message → POST /api/chat → show loading → stream response
Stop generation → abort stream → show partial + [Continue] button
Retry → resend last message → loading state
Copy response → clipboard → toast "Copied"
Thumbs down → open feedback modalThe Process
Step 1 — Write the Spec
Create design/specs/<component-name>.md with the four sections above. Takes 15–30 minutes. Saves 4 hours of back-and-forth after implementation.
Step 2 — Review for Completeness
Before starting code, verify the spec answers:
- Does every state from
ai-states-requiredhave a visual treatment? - Is every text element written out (no placeholder copy)?
- Is the responsive behaviour defined?
- Is every user action mapped to a consequence?
- Are edge cases noted (long text, empty response, simultaneous requests)?
Step 3 — Implement Against the Spec
Code to the spec, not alongside it. If implementation reveals a gap in the spec, stop and update the spec before continuing. The spec is the source of truth.
Step 4 — Review Implementation Against Spec
Before marking the PR ready, check the implementation against each spec section. A diff between spec and implementation is either a spec update (conscious decision) or a regression.
Rationalization Red Flags
These thoughts mean no spec exists — stop:
- "I know what it should look like" — then writing it down takes 15 minutes and saves hours of review cycles
- "It's a simple component" — simple components have 7 AI states, 4 interactions, and 3 edge cases
- "I'll spec it after implementation" — post-implementation specs document what was built, not what should have been built; they have no enforcement value
- "Design and code can happen simultaneously" — they can; the spec is what keeps them aligned when they diverge, which they always do
- "We're moving fast" — you are; a spec keeps you from spending that speed redoing work
Completion Statement Format
When design-before-code is satisfied, state it like this:
Spec written.
Component: <name>
File: design/specs/<component-name>.md ✓
Layout: <described — responsive behaviour noted> ✓
States: <N states documented — all from ai-states-required covered> ✓
Copy: <all text elements written — no placeholder copy> ✓
Interactions: <all user actions mapped to consequences> ✓
Edge cases noted: <long text / empty response / simultaneous submit> ✓
Ready to implement.Why This Matters
UI built without a spec is designed by the path of least resistance through the code, not by what users need. AI product UIs are especially vulnerable: the model's output is unpredictable in length, format, and latency. Without a spec, every edge case the model produces becomes a visual surprise the developer handles ad hoc — inconsistently, incompletely, and under time pressure.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

