agentleFS
maiconlaramaiconlara/design-system-extraction/SKILL.md

design-system-extraction

Skill1 starsChanged 4 months agoMITView on GitHub

Extracts the complete design system of an existing site (color tokens, type scale, spacing, breakpoints, radius, components, states, motion) by running scripts in the Chrome console, validates every contrast pair against WCAG, and turns it into an implementation guide ready for a coding-agent session. Use whenever the user mentions copying, cloning, replicating, taking inspiration from or matching a site visual language, asks what fonts or colors a page uses, talks about reverse-engineering a UI or a design system, or simply pastes a URL as a design reference. Works the same for prompts in Portuguese, como extrair o design system, copiar o estilo desse site, que fontes e cores esse site usa, quero um site parecido com X, engenharia reversa de UI. Do not wait for the words extract or extracao, they almost never appear.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. ManojDevHub1/visual-engineering-suite★ 1same 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.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the environment has restricted network access, test before promising.

    line 29
  2. Distinctive:

    If one exists, a page with a form, which reveals input and error states

    line 36
  3. Very specific:

    Every function takes a pagination argument.

    line 48
  4. Very specific:

    If you are running through browser automation, output is usually truncated around a thousand characters.

    line 51
  5. Very specific:

    If you are walking the user through DevTools, wrap the call in copy(...) to send the result to the clipboard instead of fighting the …

    line 53
  6. Distinctive:

    Run in this order. The order matters: the first step determines how you read all the rest.

    line 60
  7. Very specific:

    After x.stack(), read references/by-stack.md and follow only the section matching the result.

    line 76
  8. Very specific:

    If x.stack() reports blocked sheets, your token extraction is incomplete.

    line 80
  9. Very specific:

    Wait two seconds after each scroll before shooting.

    line 93
  10. Very specific:

    Follow assets/output-template.md.

    line 132
  11. Distinctive:

    Ask for the brand colors early: If the user will use their own palette instead of the extracted site's, isolate the color block at the top …

    line 149

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Design system extraction

Reconstructs the tokens, type scale, layout system and component patterns of a site you did not build, using its real CSS instead of squinting at a screenshot and guessing.

The deliverable is an implementation document, not a list of colors.

What this method does not do

It does not copy the site. What gets extracted are measurements and composition patterns. So images, proprietary icons, copy and product names stay out. If the result could be mistaken for the original by someone on their team, it went too far.

Tell the user this once, up front, without lecturing. Most already know, and whoever does not needs to hear it before investing time.

Before you start

You need browser access. Either through a connected Chrome extension, or by asking the user to run the scripts in DevTools and paste the output back. If neither is available, say so: with screenshots alone you can estimate typography and spacing by eye, but the values will be approximate and you must say that clearly.

If the environment has restricted network access, test before promising. A curl that comes back 403 from the proxy means you depend entirely on the browser.

Pick the pages. Two or three, and different from each other:

  1. The home, which usually has the widest variety of components
  2. An inner content page, which shows the system in ordinary use
  3. If one exists, a page with a form, which reveals input and error states

Extracting from the home alone is the most common mistake. It is a showcase and often has one-off components that do not represent the system.


Phase 1: setup

Paste scripts/setup.js into the page console, whole, once per page. It registers a global namespace x holding every extractor.

Every function takes a pagination argument. If the output comes back truncated, call it again with the next number: x.tokens(0), x.tokens(1), x.tokens(2).

If you are running through browser automation, output is usually truncated around a thousand characters. Do not try to work around it with console.log, use the pagination. If you are walking the user through DevTools, wrap the call in copy(...) to send the result to the clipboard instead of fighting the console.


Phase 2: extraction

Run in this order. The order matters: the first step determines how you read all the rest.

CallWhat it returns
x.stack()Framework, libraries, and how many stylesheets are blocked
x.tokens()Declared custom properties. What the system says it is
x.type()Type scale, responsive overrides, loaded families
x.layout()Container, grids, gaps, section padding, breakpoints
x.shape()Radius, shadow, gradient, border, uppercase
x.colors()Computed color audit. What the system is
x.comp()Class definitions for button, card, chip, input
x.states()Hover, focus, active, disabled
x.motion()Transitions, animations, and whether reduced-motion is respected
x.map()Section map with height and scroll position
x.heads()Heading hierarchy, reveals the content architecture

After x.stack(), read references/by-stack.md and follow only the section matching the result. Webflow, Tailwind, CSS-in-JS, WordPress and hand-rolled sites need different strategies, and following the wrong one wastes a lot of time.

If x.stack() reports blocked sheets, your token extraction is incomplete. Record that and tell the user instead of delivering false confidence.


Phase 3: visual capture

x.map() returns the coordinates of every section. Scroll to each one and capture:

x.go(4050)     // instant scroll, never smooth

Wait two seconds after each scroll before shooting. Intersection Observer entrance animations need that time, and without it you capture the section at opacity: 0.

Capture the top, two or three mid points, and the footer. If you can, also capture a hover state and the mobile version.


Phase 4: interpretation

Read references/interpretation.md in full before writing the document. It covers the three lines of reasoning that separate a useful extraction from a list of values.

A summary of the three, so you know what you are looking for:

Absence is signal. An empty result for shadow or gradient is not a script failure, it is the most valuable finding it delivers. Record every absence explicitly and turn it into an anti-pattern in the final document.

The diff between declared and measured. Compare x.tokens() against x.colors(). They almost never match, and the gap is token drift. Always build from the declared side, which is the intent, never from the measured side, which includes their mistakes.

Contrast. Run scripts/contrast.py:

python contrast.py "#fdaccd" "#ffffff"     # one pair
python contrast.py --ramp "#fdaccd"        # 10-step ramp with suggested usage
python contrast.py --audit tokens.json     # ink x bg matrix with a failure report

Production systems violate contrast far more often than people assume. When you find a violation in the original, tell the user and do not reproduce it. The fix is almost never abandoning the color, it is adding a step. Details in references/interpretation.md.


Phase 5: the document

Follow assets/output-template.md. Thirteen sections, ordered for consumption by a coding agent, not for linear human reading.

Two sections carry the result and are exactly the ones that get skipped:

Anti-patterns, derived from the absences. Phrased negatively and verifiably: "if X shows up in the result, it is wrong". This keeps the agent from reintroducing defaults the source system rejected on purpose, which is the most common failure mode.

Acceptance checklist, with objectively answerable items. "Layout looks good" does not work. "No horizontal scroll at 375, 768, 992 and 1440px" does. Without it the agent declares success on its own.


Behavior notes

Ask for the brand colors early. If the user will use their own palette instead of the extracted site's, isolate the color block at the top of the document and flag it for replacement. Swapping later becomes a one-block edit.

Do not copy the naming. Step structure yes, names no. The original's names carry another team's history.

Say what is extracted and what is proposed. On a site with no system, much of the result is your own reconstruction. That distinction matters when someone questions a decision later.

One question that saves time. Up front, clarify whether the user wants the system or the look. This method solves the system. The look also requires understanding the composition decisions, and for that screenshots and human reading are worth more than any script.


Files

FileWhen to read
scripts/setup.jsAlways. Paste into the console before anything else
scripts/contrast.pyIn phase 4, to validate the color tokens
references/by-stack.mdRight after x.stack(). Read only the detected stack's section
references/interpretation.mdBefore writing the document. Read it in full
assets/output-template.mdWhen assembling the final document

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.