layout-extract

A command for turning reference images or written prompts into a description of a webpage's structure and layout. It can explore several layout options or refine one existing option for desktop, mobile, tablet, or responsive screens.

In plain words
What is it for?
Generating layout templates that describe page structure, component hierarchy, responsive behavior, spacing, and breakpoints.
Why use it?
It separates the page's structural decisions from its visual styling, making it easier to plan or adjust the underlying HTML and CSS.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/catlog22/claude-code-workflow/layout-extract
Clone the repo
git clone --depth 1 https://github.com/catlog22/Claude-Code-Workflow

Made for: Claude Code.

Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 6,806 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.06806
Opus 5 $0.00012 $0.03403
Sonnet 5 $0.00005 $0.01361
Haiku 4.5 $0.00002 $0.00681

Measured 2d ago against content hash 6285d3a9c152, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

layout-extract scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/workflow/ui-design/layout-extract.md · 793 lines

How it starts

The opening of the file, as written. The whole thing — 793 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Auto Mode

When --yes or -y: Skip all clarification questions, use AI-inferred layout decisions.

Layout Extraction Command

Overview

Extract structural layout information from reference images or text prompts using AI analysis. Supports two modes:

  1. Exploration Mode (default): Generate multiple contrasting layout variants
  2. Refinement Mode (--refine): Refine a single existing layout through detailed adjustments

This command separates the "scaffolding" (HTML structure and CSS layout) from the "paint" (visual tokens handled by style-extract).

Strategy: AI-Driven Structural Analysis

  • Agent-Powered: Uses ui-design-agent for deep structural analysis
  • Dual Mode: Exploration (multiple contrasting variants) or Refinement (single layout fine-tuning)
  • Output: layout-templates.json with DOM structure, component hierarchy, and CSS layout rules
  • Device-Aware: Optimized for specific device types (desktop, mobile, tablet, responsive)
  • Token-Based: CSS uses var() placeholders for spacing and breakpoints

Execution Process

Input Parsing:
   ├─ Parse flags: --design-id, --session, --images, --prompt, --targets, --variants, --device-type, --interactive, --refine
   └─ Decision (mode detection):
      ├─ --refine flag → Refinement Mode (variants_count = 1)
      └─ No --refine → Exploration Mode (variants_count = --variants OR 3)

Phase 0: Setup & Input Validation
   ├─ Step 1: Detect input, mode & targets
   ├─ Step 2: Load inputs & create directories
   └─ Step 3: Memory check (skip if cached)

Phase 1: Layout Concept/Refinement Options Generation
   ├─ Step 0.5: Load existing layout (Refinement Mode only)
   ├─ Step 1: Generate options (Agent Task 1)
   │  └─ Decision:
   │     ├─ Exploration Mode → Generate contrasting layout concepts
   │     └─ Refinement Mode → Generate refinement options
   └─ Step 2: Verify options file created

Phase 1.5: User Confirmation (Optional)
   └─ Decision (--interactive flag):
      ├─ --interactive present → Present options, capture selection
      └─ No --interactive → Skip to Phase 2

Phase 2: Layout Template Generation
   ├─ Step 1: Load user selections or default to all
   ├─ Step 2: Launch parallel agent tasks
   └─ Step 3: Verify output files

Read the full file on GitHub · 793 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 793 lines · 0 tokens per session scan A 6285d3a9c152

Subscribe to this mod's changes

layout-extract is a command published in the GitHub repository catlog22/Claude-Code-Workflow (2,135 stars, last pushed 2mo ago), licensed MIT. It adds 23 tokens to every session and 6,806 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.