agent-to-bricks
install
source · Clone the upstream repo
git clone https://github.com/nerveband/agent-to-bricks
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/nerveband/agent-to-bricks "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/skills/agent-to-bricks" ~/.claude/skills/nerveband-agent-to-bricks-agent-to-bricks && rm -rf "$T"
manifest:
.claude/skills/agent-to-bricks/SKILL.mdsafety · automated scan (low risk)
This is a pattern-based risk scan, not a security review. Our crawler flagged:
- makes HTTP requests (curl)
- references API keys
Always read a skill's source content before installing. Patterns alone don't mean the skill is malicious — but they warrant attention.
source content
Agent to Bricks — Build & Deploy Bricks Pages
You have access to the
bricks CLI which manages a Bricks Builder WordPress site.
It can convert HTML to native Bricks elements, push content to pages, and query
the site's design system — all without leaving the terminal.
Quick Start Workflow
When the user asks you to build or update a Bricks page, follow these steps:
Step 1: Discover the site's design system
bricks discover --json
This returns the site's colors, fonts, spacing variables, CSS framework classes, available element types, and pages. Pay attention to:
- CSS variables (
,--primary
) — use these in your HTML--space-m - Global classes (ACSS utilities) — add these as CSS classes
- Breakpoints — the site's responsive breakpoint widths
Step 2: Generate HTML using the site's design tokens
Write clean, semantic HTML that uses the site's CSS variables and class names. Structure your HTML with
<section> > <div> > content elements.
Step 3: Convert and push to the site
# Convert HTML and push directly to a page bricks convert html --push PAGE_ID --stdin <<'HTML' <section>...</section> HTML # Or from a file bricks convert html page.html --push PAGE_ID # Preview without pushing (dry run) bricks convert html --push PAGE_ID --dry-run --stdin <<'HTML' <section>...</section> HTML # Snapshot before pushing (for rollback) bricks convert html --push PAGE_ID --snapshot --stdin <<'HTML' <section>...</section> HTML
Step 4: Verify
# Use the REST API to check page elements (the CLI handles auth from config) curl -s -H "X-ATB-Key: $(grep api_key ~/.agent-to-bricks/config.yaml | awk '{print $2}')" \ "$(grep url ~/.agent-to-bricks/config.yaml | awk '{print $2}')/wp-json/agent-bricks/v1/pages/PAGE_ID/elements" # Or just use --dry-run before pushing to preview the conversion bricks convert html --push PAGE_ID --dry-run --stdin <<'HTML' <section>...</section> HTML
Patching Existing Elements (Preferred for Updates)
When you need to modify an existing page (change classes, text, styles), use
bricks patch instead of regenerating the full page. It's faster and
uses fewer tokens.
# Step 1: List elements to find IDs bricks patch PAGE_ID --list bricks patch PAGE_ID --list --json # structured output # Step 2: Patch specific settings by element ID bricks patch PAGE_ID -e ELEMENT_ID --set '_cssClasses=new-class another' bricks patch PAGE_ID -e ELEMENT_ID --set 'text=Updated Heading' bricks patch PAGE_ID -e ELEMENT_ID --set '_display=flex' --set '_gap=var(--space-m)' # Patch with JSON values (for nested settings like background, typography) bricks patch PAGE_ID -e ELEMENT_ID --set '_background={"color":{"raw":"var(--primary)"}}' bricks patch PAGE_ID -e ELEMENT_ID --set '_typography={"font-size":"var(--h2)","font-weight":"700"}' # Remove a setting bricks patch PAGE_ID -e ELEMENT_ID --rm '_padding' # Multi-element patch via JSON stdin echo '{"patches":[ {"id":"abc123","settings":{"_cssClasses":"hero-dark"}}, {"id":"def456","settings":{"text":"New text"}} ]}' | bricks patch PAGE_ID --stdin # Preview without applying bricks patch PAGE_ID -e ELEMENT_ID --set 'text=Preview' --dry-run
When to use patch vs convert:
- Patch: changing classes, text, styles, settings on existing elements
- Convert: creating new sections/pages from HTML
Available Commands
| Command | Description |
|---|---|
| Full site context dump (run first) |
| Convert HTML and push to page |
| Read HTML from stdin pipe |
| List elements with IDs on a page |
| Patch element settings |
| List available Bricks element types |
| Bricks/WP versions, element types |
| Global CSS classes |
| CSS framework config (ACSS) |
| Bricks element JSON schema |
Key Principles
- Always call
first to learn the design systembricks discover --json - Prefer
for updates — don't regenerate what you can patchbricks patch - Use the site's CSS variables — not hardcoded values
- Use ACSS global classes when available
- Use
when pushing to important pages--snapshot - Use
on any command for structured output--json - Pipe HTML from stdin with
for seamless workflow--stdin - Structure HTML as: section → div (container) → content elements
Element Mapping
| HTML Tag | Bricks Element |
|---|---|
| section, header, footer, main, article | section |
| div, aside, nav | div |
| h1-h6 | heading |
| p, span, blockquote | text-basic |
| a | text-link |
| button | button |
| img | image |
| video | video |
| ul, ol | list |
| form | form |
| code, pre | code |
Error Recovery
- 409 conflict: re-fetch elements and retry
- 401/403: check API key with
bricks doctor - Bad results: use
to inspect before pushing--dry-run - Undo:
bricks elements PAGE_ID rollback SNAP_ID