brand-dna-extractor
Purpose
Extract brand signals from multiple sites, ground every claim in evidence, and blend sources into a single composite direction.
When to use
Use when asked to:
- scrape or crawl multiple sites for brand signals
- create brand guidelines, prompt packs, or design tokens from real websites
- compare and blend multiple brands into a “composite DNA”
- capture “CSS etc” (CSS variables, computed styles, hover/focus states)
Outputs
Produce exactly three artefacts:
brand_guidelines.md
prompt_library.json
design_tokens.json
Do not output additional artefacts. Do not claim scraping or probing happened unless tool calls were actually executed in the current run.
Inputs
Accept a configuration object (see assets/sample_config.json for a working example). Support:
- optional run metadata:
run_id (recommended) to name artefact folders / receipts
- scraping lane provider: Firecrawl / Parallel / hybrid
- browser-probe lane: agent-browser (recommended) or equivalent Playwright-class tooling
- limits: max_pages, max_depth, pages_per_site for probing
- evidence limits: quote_limit_words
The 3-Pronged Approach (Scrape + Extract + Probe)
This skill works best as three parallel “lanes”, each producing different kinds of evidence:
Pick a run_folder for each run (where the three required outputs live). When brand docs are the source of truth,
it often makes sense to use something like docs/02-guidelines/inspiration/<run_id>/ so the outputs and receipts
live together.
Prong 1: Firecrawl (crawl/map + scrape)
Use Firecrawl for breadth and structured web scraping, especially within a domain:
- Best for: mapping/crawling a site, getting broad page coverage, and pulling “main content” markdown.
- Branding Format v2: Retrieve via
POST https://api.firecrawl.dev/v2/scrape with formats: ["branding"]. This can yield structured hints for colours, typography, logo/icon, layout, and personality (treat as hints, not truth).
- Evidence produced:
excerpt (from scraped markdown), plus provider metadata (scrapeId, status, etc.).
- Common failure modes: JS-heavy pages, auth walls, noisy nav/footer content, rate limits.
Recommended receipts:
- Store Firecrawl outputs under
<run_folder>/.firecrawl/<run_id>/... and reference them in evidence objects via path_or_url.
Firecrawl Branding Format v2 receipts
- Branding is a per-site identity hint: run it on the base URL (home) per site (not every crawled page).
- For JS-heavy/no-code sites, prefer using
waitFor since the v2 scrape endpoint supports it.
- Receipt naming convention:
<site_slug>.json (stored under <run_folder>/.firecrawl/<run_id>/branding/).
# Fetch Firecrawl Branding Format v2 receipts for each site URL in config
node --experimental-strip-types \
.agents/skills/00-utilities/brand-dna-extractor/scripts/firecrawl_branding_v2.ts \
--config path/to/config.json \
--run-folder docs/02-guidelines/inspiration/<run_id> \
--wait-for 10000 \
--concurrency 4
Prong 2: Parallel (Search + Extract)
Use Parallel for discovery and clean objective-led extraction:
- Best for: discovering hidden pages (Search), extracting cleaner markdown/excerpts from JS-heavy pages or PDFs (Extract).
- Evidence produced:
excerpt evidence aligned to an explicit objective (often higher signal-to-noise than raw crawls).
- Common failure modes: API availability/rate limits, objective too vague, extraction returning boilerplate.
Recommended receipts:
- Store Parallel outputs under
<run_folder>/.parallel/<run_id>/... and reference them in evidence objects via path_or_url (or config metadata).
Prong 3: Browser probe (agent-browser)
Use a real browser to ground visual claims in computed reality:
- Best for: CSS variables, computed styles (fonts/colours/radius/shadows), and interaction state deltas (hover/focus).
- Evidence produced:
css_variable, computed_style, computed_style_diff, screenshot (if enabled).
- Common failure modes: cross-origin stylesheet rule access, dynamic rendering, bot protection.
Recommended receipts:
- Store probe JSON (and optional screenshots) under
<run_folder>/.probe/<run_id>/... and reference them in evidence objects via path_or_url.
Why three prongs?
- Scrape (Firecrawl) gives you coverage and copy.
- Extract (Parallel) gives you cleaner, objective-aligned excerpts and better handling of hard pages.
- Probe (browser) gives you the “truth” for style and interaction, which scrapers can’t reliably infer.
Workflow
Follow this modular pipeline:
- Validate inputs
- Plan per-site run (pages to scrape + pages to extract + pages to probe)
- Scrape/extract pages (Firecrawl + Parallel, via
scraping.provider)
- Probe styling + interaction (agent-browser)
- Build corpora (copy + style)
- Infer signals per site with confidence + evidence
- Generate per-site prompt packs
- Blend into composite direction (with weights + blend_mode)
- Package exactly three outputs using the reference templates and schemas
- Run quality checks and record limitations
1) Validate inputs
- Require
urls to be a non-empty list.
- Normalise URLs:
- strip
utm_*, gclid, fbclid
- remove fragments
- standardise trailing slashes
- Normalise weights:
- if empty: equal weights
- if provided: normalise to sum to 1 across included URLs
2) Plan pages per site
- Build a candidate list from:
- home, product/features, pricing, about
- docs/help (important for real UI patterns)
- blog index + one recent post
- brand/press/assets pages
- Assign pages to lanes:
- scrape/extract: enough pages to cover copy + positioning + key flows
- probe: fewer pages, but must include the most “UI representative” surfaces
- Apply allow/deny:
- if include_paths present, restrict to those
- always apply exclude_paths
3) Scrape/extract lanes (Firecrawl / Parallel / hybrid)
Implement a provider adapter that yields a shared PageArtefact shape (even if tool outputs differ):
PageArtefact
- url, status, timestamp
- title, meta_description
- headings (H1–H3)
- main_text (clean)
- markdown (if available)
- raw_html (if available)
- linked_css_urls, inline_style_blocks (best effort)
- images (URLs, optional)
- provider_trace (provider name + request ids + warnings)
Provider rules:
- Use Firecrawl crawl-first for broad, within-domain coverage.
- Use Parallel Search for discovery when crawl coverage is weak or brand pages are hidden.
- Use Parallel Extract for cleaner markdown when:
- JS-heavy pages break standard scrapers
- PDFs are involved
- crawl output is low-quality or boilerplate-heavy
Noise removal (must do before inference):
- remove cookie banners and popups
- down-rank repeated nav/footer blocks
- down-rank third-party widgets unless visually dominant
4) Browser-probe lane (agent-browser)
Use browser probing to overcome “CSS variables / computed styles / interaction” limitations.
Probe plan:
- Probe up to
browser_probe.pages_per_site pages per site.
- Run at least desktop + light mode.
- If configured, also run mobile and dark mode.
- For each page × viewport × media_mode:
- capture stylesheet inventory (links + inline styles)
- best-effort CSS variable extraction
- computed styles snapshots (
getComputedStyle) for key elements
- hover/focus diffs (state deltas)
- motion primitives (transition and animation properties)
- screenshots if enabled
Use scripts/probe_css.js as the default probe payload.
Store evidence in a structured evidence_map (see schema in references/brand_dna_run.schema.json).
Evidence receipts (recommended)
To keep the “ground every claim in evidence” promise, store lane outputs as receipts and reference them:
- Keep receipts in hidden, gitignored folders by default:
<run_folder>/.firecrawl/<run_id>/...
<run_folder>/.parallel/<run_id>/...
<run_folder>/.probe/<run_id>/...
- Evidence objects should include
path_or_url when the schema supports it (e.g. design_tokens.json evidence).
- If a lane is disabled or fails for a site/page, record a limitation and reduce confidence accordingly.
5) Build corpora
Build two corpora per site:
Copy corpus
- hero headlines, subheads
- feature bullets
- CTA labels and microcopy
- pricing plan labels
- help/error text if discoverable
Style corpus
- CSS variables (declared tokens)
- computed styles (resolved tokens)
- state diffs (hover/focus)
- component-like fragments and selectors
6) Infer brand signals per site
Extract signals with:
- confidence score (0–1)
- evidence pointers for every claim
- needs_human_review=true if evidence is weak or conflicting
Signal categories:
- Colours
- Typography
- Design tokens (spacing, radius, borders, shadows, layout rhythm)
- Components inventory (with variants)
- Imagery style
- Iconography style
- Motion/interaction
- Voice/tone/personality
Evidence rules:
- Never exceed
quote_limit_words for any single excerpt.
- Prefer selectors, CSS variable names, and computed-style properties over long quotes.
- Attach evidence as one of:
- excerpt, selector, css_variable, computed_style, computed_style_diff, screenshot, branding_profile
branding_profile evidence objects should include path_or_url pointing at the stored receipt JSON.
- Confidence: if only
branding_profile supports a token, set needs_human_review=true and keep confidence low. Prefer confirming via css_variable / computed_style from the probe lane for high confidence.
7) Generate per-site prompt pack
Produce per-site prompt packs with keys:
- brand_style_prompt
- visual_direction_prompt
- ui_direction_prompt
- copywriting_prompt
- negative_prompt
- token_set (bullets grouped by: colour, type, layout, imagery, voice, motion)
Add evidence anchors like [site_id:page_id:signal_key] inline in prompts.
8) Blend multiple sites
Normalise each site into comparable token sets:
- colours: roles + hex + hue tags (+ light/dark variants if available)
- typography: families + hierarchy traits
- UI: density, radius, elevation, spacing cadence
- imagery: medium + treatment tags
- voice: traits + cadence + CTA verb style
- motion: transition duration/easing archetypes
Detect conflicts:
- palette clash
- typography clash
- voice clash
- UI shape/density clash
- theme clash (light/dark inconsistencies)
Resolve using blend_mode:
- harmonise
- bold_hybrid
- dominant_source
- theme_collage
Record conflicts and resolutions with provenance.
9) Package outputs
Use the reference files:
references/brand_guidelines_template.md
references/prompt_library.schema.json
references/design_tokens.schema.json
Constraints:
- Output exactly three artefacts.
- In
brand_guidelines.md, include the exact required headings (same order as template).
10) Quality checks
Run:
- quote limit enforcement on any excerpt evidence
- required headings check for
brand_guidelines.md
- required top-level keys check for JSON outputs
- low-confidence site flags if meaningful pages < min_meaningful_pages_per_site
- lane coverage checks (if enabled):
- Firecrawl/Parallel: at least one meaningful excerpt for positioning + CTA copy per site
- Browser-probe: at least one page has computed styles for body/h1/primary_cta
- browser-probe coverage checks (if enabled):
- body, h1, primary_cta computed styles captured at least once
- dark mode captured if requested, else record limitation
- at least one hover or focus diff captured if requested, else record limitation
Validate outputs (baseline):
python3 .agents/skills/00-utilities/brand-dna-extractor/scripts/validate_outputs.py --dir docs/02-guidelines/inspiration
What not to do
- Do not invent CSS variables or computed styles.
- Do not claim hover/focus behaviour exists unless state diffs were captured.
- Do not overfit to cookie banner styling or third-party widgets.
- Do not exceed the quote limit per page excerpt.
- Do not output more than the three required artefacts.
1---2name: brand-dna-extractor3description: This skill should be used when users want to scrape multiple websites (Firecrawl, Parallel, or hybrid), extract brand guideline signals (including CSS variables + computed styles via browser probing), generate per-site prompt packs, and blend sources into a composite brand direction with exactly three outputs: brand_guidelines.md, prompt_library.json, design_tokens.json.4license: Complete terms in LICENSE.txt5---67# brand-dna-extractor89## Purpose1011Extract brand signals from multiple sites, ground every claim in evidence, and blend sources into a single composite direction.1213## When to use1415Use when asked to:16- scrape or crawl multiple sites for brand signals17- create brand guidelines, prompt packs, or design tokens from real websites18- compare and blend multiple brands into a “composite DNA”19- capture “CSS etc” (CSS variables, computed styles, hover/focus states)2021## Outputs2223Produce exactly three artefacts:241) `brand_guidelines.md`252) `prompt_library.json`263) `design_tokens.json`2728Do not output additional artefacts. Do not claim scraping or probing happened unless tool calls were actually executed in the current run.2930## Inputs3132Accept a configuration object (see `assets/sample_config.json` for a working example). Support:3334- optional run metadata: `run_id` (recommended) to name artefact folders / receipts35- scraping lane provider: Firecrawl / Parallel / hybrid36- browser-probe lane: agent-browser (recommended) or equivalent Playwright-class tooling37- limits: max_pages, max_depth, pages_per_site for probing38- evidence limits: quote_limit_words3940## The 3-Pronged Approach (Scrape + Extract + Probe)4142This skill works best as three parallel “lanes”, each producing different kinds of evidence:4344Pick a `run_folder` for each run (where the three required outputs live). When brand docs are the source of truth,45it often makes sense to use something like `docs/02-guidelines/inspiration/<run_id>/` so the outputs and receipts46live together.4748### Prong 1: Firecrawl (crawl/map + scrape)4950Use Firecrawl for breadth and structured web scraping, especially within a domain:51- **Best for:** mapping/crawling a site, getting broad page coverage, and pulling “main content” markdown.52- **Branding Format v2:** Retrieve via `POST https://api.firecrawl.dev/v2/scrape` with `formats: ["branding"]`. This can yield structured hints for colours, typography, logo/icon, layout, and personality (treat as hints, not truth).53- **Evidence produced:** `excerpt` (from scraped markdown), plus provider metadata (`scrapeId`, status, etc.).54- **Common failure modes:** JS-heavy pages, auth walls, noisy nav/footer content, rate limits.5556Recommended receipts:57- Store Firecrawl outputs under `<run_folder>/.firecrawl/<run_id>/...` and reference them in evidence objects via `path_or_url`.5859#### Firecrawl Branding Format v2 receipts6061- Branding is a per-site identity hint: run it on the base URL (home) per site (not every crawled page).62- For JS-heavy/no-code sites, prefer using `waitFor` since the v2 scrape endpoint supports it.63- Receipt naming convention: `<site_slug>.json` (stored under `<run_folder>/.firecrawl/<run_id>/branding/`).6465```bash66# Fetch Firecrawl Branding Format v2 receipts for each site URL in config67node --experimental-strip-types \68 .agents/skills/00-utilities/brand-dna-extractor/scripts/firecrawl_branding_v2.ts \69 --config path/to/config.json \70 --run-folder docs/02-guidelines/inspiration/<run_id> \71 --wait-for 10000 \72 --concurrency 473```7475### Prong 2: Parallel (Search + Extract)7677Use Parallel for discovery and clean objective-led extraction:78- **Best for:** discovering hidden pages (Search), extracting cleaner markdown/excerpts from JS-heavy pages or PDFs (Extract).79- **Evidence produced:** `excerpt` evidence aligned to an explicit objective (often higher signal-to-noise than raw crawls).80- **Common failure modes:** API availability/rate limits, objective too vague, extraction returning boilerplate.8182Recommended receipts:83- Store Parallel outputs under `<run_folder>/.parallel/<run_id>/...` and reference them in evidence objects via `path_or_url` (or config metadata).8485### Prong 3: Browser probe (agent-browser)8687Use a real browser to ground visual claims in computed reality:88- **Best for:** CSS variables, computed styles (fonts/colours/radius/shadows), and interaction state deltas (hover/focus).89- **Evidence produced:** `css_variable`, `computed_style`, `computed_style_diff`, `screenshot` (if enabled).90- **Common failure modes:** cross-origin stylesheet rule access, dynamic rendering, bot protection.9192Recommended receipts:93- Store probe JSON (and optional screenshots) under `<run_folder>/.probe/<run_id>/...` and reference them in evidence objects via `path_or_url`.9495### Why three prongs?9697- **Scrape (Firecrawl)** gives you coverage and copy.98- **Extract (Parallel)** gives you cleaner, objective-aligned excerpts and better handling of hard pages.99- **Probe (browser)** gives you the “truth” for style and interaction, which scrapers can’t reliably infer.100101## Workflow102103Follow this modular pipeline:1041051) Validate inputs 1062) Plan per-site run (pages to scrape + pages to extract + pages to probe) 1073) Scrape/extract pages (Firecrawl + Parallel, via `scraping.provider`) 1084) Probe styling + interaction (agent-browser) 1095) Build corpora (copy + style) 1106) Infer signals per site with confidence + evidence 1117) Generate per-site prompt packs 1128) Blend into composite direction (with weights + blend_mode) 1139) Package exactly three outputs using the reference templates and schemas 11410) Run quality checks and record limitations115116### 1) Validate inputs117118- Require `urls` to be a non-empty list.119- Normalise URLs:120 - strip `utm_*`, `gclid`, `fbclid`121 - remove fragments122 - standardise trailing slashes123- Normalise weights:124 - if empty: equal weights125 - if provided: normalise to sum to 1 across included URLs126127### 2) Plan pages per site128129- Build a candidate list from:130 - home, product/features, pricing, about131 - docs/help (important for real UI patterns)132 - blog index + one recent post133 - brand/press/assets pages134- Assign pages to lanes:135 - scrape/extract: enough pages to cover copy + positioning + key flows136 - probe: fewer pages, but must include the most “UI representative” surfaces137- Apply allow/deny:138 - if include_paths present, restrict to those139 - always apply exclude_paths140141### 3) Scrape/extract lanes (Firecrawl / Parallel / hybrid)142143Implement a provider adapter that yields a shared `PageArtefact` shape (even if tool outputs differ):144145**PageArtefact**146- url, status, timestamp147- title, meta_description148- headings (H1–H3)149- main_text (clean)150- markdown (if available)151- raw_html (if available)152- linked_css_urls, inline_style_blocks (best effort)153- images (URLs, optional)154- provider_trace (provider name + request ids + warnings)155156Provider rules:157- Use Firecrawl crawl-first for broad, within-domain coverage.158- Use Parallel Search for discovery when crawl coverage is weak or brand pages are hidden.159- Use Parallel Extract for cleaner markdown when:160 - JS-heavy pages break standard scrapers161 - PDFs are involved162 - crawl output is low-quality or boilerplate-heavy163164Noise removal (must do before inference):165- remove cookie banners and popups166- down-rank repeated nav/footer blocks167- down-rank third-party widgets unless visually dominant168169### 4) Browser-probe lane (agent-browser)170171Use browser probing to overcome “CSS variables / computed styles / interaction” limitations.172173Probe plan:174- Probe up to `browser_probe.pages_per_site` pages per site.175- Run at least desktop + light mode.176- If configured, also run mobile and dark mode.177- For each page × viewport × media_mode:178 - capture stylesheet inventory (links + inline styles)179 - best-effort CSS variable extraction180 - computed styles snapshots (`getComputedStyle`) for key elements181 - hover/focus diffs (state deltas)182 - motion primitives (transition and animation properties)183 - screenshots if enabled184185Use `scripts/probe_css.js` as the default probe payload.186187Store evidence in a structured `evidence_map` (see schema in `references/brand_dna_run.schema.json`).188189### Evidence receipts (recommended)190191To keep the “ground every claim in evidence” promise, store lane outputs as receipts and reference them:192- Keep receipts in hidden, gitignored folders by default:193 - `<run_folder>/.firecrawl/<run_id>/...`194 - `<run_folder>/.parallel/<run_id>/...`195 - `<run_folder>/.probe/<run_id>/...`196- Evidence objects should include `path_or_url` when the schema supports it (e.g. `design_tokens.json` evidence).197- If a lane is disabled or fails for a site/page, record a limitation and reduce confidence accordingly.198199### 5) Build corpora200201Build two corpora per site:202203**Copy corpus**204- hero headlines, subheads205- feature bullets206- CTA labels and microcopy207- pricing plan labels208- help/error text if discoverable209210**Style corpus**211- CSS variables (declared tokens)212- computed styles (resolved tokens)213- state diffs (hover/focus)214- component-like fragments and selectors215216### 6) Infer brand signals per site217218Extract signals with:219- confidence score (0–1)220- evidence pointers for every claim221- needs_human_review=true if evidence is weak or conflicting222223Signal categories:224- Colours225- Typography226- Design tokens (spacing, radius, borders, shadows, layout rhythm)227- Components inventory (with variants)228- Imagery style229- Iconography style230- Motion/interaction231- Voice/tone/personality232233Evidence rules:234- Never exceed `quote_limit_words` for any single excerpt.235- Prefer selectors, CSS variable names, and computed-style properties over long quotes.236- Attach evidence as one of:237 - excerpt, selector, css_variable, computed_style, computed_style_diff, screenshot, branding_profile238- `branding_profile` evidence objects should include `path_or_url` pointing at the stored receipt JSON.239- Confidence: if only `branding_profile` supports a token, set `needs_human_review=true` and keep confidence low. Prefer confirming via `css_variable` / `computed_style` from the probe lane for high confidence.240241### 7) Generate per-site prompt pack242243Produce per-site prompt packs with keys:244- brand_style_prompt245- visual_direction_prompt246- ui_direction_prompt247- copywriting_prompt248- negative_prompt249- token_set (bullets grouped by: colour, type, layout, imagery, voice, motion)250251Add evidence anchors like `[site_id:page_id:signal_key]` inline in prompts.252253### 8) Blend multiple sites254255Normalise each site into comparable token sets:256- colours: roles + hex + hue tags (+ light/dark variants if available)257- typography: families + hierarchy traits258- UI: density, radius, elevation, spacing cadence259- imagery: medium + treatment tags260- voice: traits + cadence + CTA verb style261- motion: transition duration/easing archetypes262263Detect conflicts:264- palette clash265- typography clash266- voice clash267- UI shape/density clash268- theme clash (light/dark inconsistencies)269270Resolve using blend_mode:271- harmonise272- bold_hybrid273- dominant_source274- theme_collage275276Record conflicts and resolutions with provenance.277278### 9) Package outputs279280Use the reference files:281- `references/brand_guidelines_template.md`282- `references/prompt_library.schema.json`283- `references/design_tokens.schema.json`284285Constraints:286- Output exactly three artefacts.287- In `brand_guidelines.md`, include the exact required headings (same order as template).288289### 10) Quality checks290291Run:292- quote limit enforcement on any excerpt evidence293- required headings check for `brand_guidelines.md`294- required top-level keys check for JSON outputs295- low-confidence site flags if meaningful pages < min_meaningful_pages_per_site296- lane coverage checks (if enabled):297 - Firecrawl/Parallel: at least one meaningful excerpt for positioning + CTA copy per site298 - Browser-probe: at least one page has computed styles for body/h1/primary_cta299- browser-probe coverage checks (if enabled):300 - body, h1, primary_cta computed styles captured at least once301 - dark mode captured if requested, else record limitation302 - at least one hover or focus diff captured if requested, else record limitation303304Validate outputs (baseline):305```bash306python3 .agents/skills/00-utilities/brand-dna-extractor/scripts/validate_outputs.py --dir docs/02-guidelines/inspiration307```308309## What not to do310311- Do not invent CSS variables or computed styles.312- Do not claim hover/focus behaviour exists unless state diffs were captured.313- Do not overfit to cookie banner styling or third-party widgets.314- Do not exceed the quote limit per page excerpt.315- Do not output more than the three required artefacts.