# Layout Debug: point at UI, agent fixes the code

> Alt+click any element in your running web page or Android Compose app, drag it or type the change, and your agent edits the right line of code.

Layout Debug: point at UI, agent fixes the code is a free AI agent skill on Agensi by Anton Churaev, in Frontend & Web Apps. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Anton Churaev](https://www.agensi.io/creators/anton-churaev)
- Category: [Frontend & Web Apps](https://www.agensi.io/skills/frontend-web-apps)
- Uses: 3
- Version: 1.0
- Last updated: 2026-10-20
- Security: scan passed (2026-10-20); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/layout-debug-point-at-ui-agent-fixes-the-code
- Tags: web-design, mobile, testing, mcp-server, jetpack-compose, frontend-development, react, android

## About this skill

Stop describing UI to your agent in words. This skill teaches your agent to work with [layout-debug-mcp](https://github.com/AntonChuraev99/Layout-debug-mcp), a free open-source MCP server that opens a local window over your running UI. You Alt+click the element you mean, drag or resize it on the real screen if you like, and type what to change. Your agent gets the element's anchors, box, parents and the measured delta, edits the code, and answers in the same window while the frame refreshes with the result.

### What it does

- **No more "which element?"** The agent receives `file:line` (React/JSX with the bundled dev plugin, always on Android), test id, id, class string and text, so it edits the right element on the first try.
- **Measurements, not adjectives.** Drag a button 16 px down and the real page moves without a rebuild. The agent gets `offset 0, 16` in css-px (web) or dp (Android) and decides whether that becomes a margin, a gap, a reordered child or a `Spacer`.
- **A chat per element.** The agent listens to the window, replies in the element's thread and waits for your next message, so you iterate until it looks right.
- **Safe by default.** Page text reaches the agent marked as untrusted data, and the skill tells the agent never to follow instructions found there.

### How it works

1. The agent calls `open_window`: the local server starts and the window opens in your browser.
2. The agent calls `wait_for_message` and listens.
3. You select an element, optionally drag or resize it, and type the change.
4. The agent finds the element by its strongest anchor, edits the code and calls `reply_in_window` with what changed.
5. The window waits for hot reload, refreshes the frame, and the agent goes back to listening.

### Targets

- **Web:** any real DOM page from your dev server (React, Vue, plain HTML). `file:line` needs the bundled Vite or Babel plugin; without it the agent uses test id, id and classes.
- **Android:** Jetpack Compose on a device or emulator over `adb`, with a debug-only on-device agent library. You get the full composition tree with `file:line` from the Compose compiler and live overrides on the device.

### Requirements

- Node.js 22.12+ (or 20.19+)
- The `layout-debug-mcp` MCP server: `npx -y layout-debug-mcp` in any MCP client
- Android only: `adb` and a debug build with the on-device agent

### Known limitations

- Live edits in the window are a preview; the code changes only when the agent edits it.
- The web page is shown in an iframe; pages that forbid framing need the built-in framing proxy.
- Compose Multiplatform on wasmJs (canvas) is not supported.

## Requires

- Layout Debug MCP
- Node.js
- adb (Android only)
- ENOENT

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Layout Debug: point at UI, agent fixes the code skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill help the agent find the right element in a large codebase?

Every message from the window carries the element's anchors: file:line (always on Android; on the web with the bundled Vite or Babel dev plugin), data-testid, id, the class string and text, plus its box and parent chain. The skill tells the agent to search by the strongest anchor first and to say so when nothing matches instead of guessing.

### Do I need to change my application to use it?

Only in development. On the web you add one dev-only script tag (and, optionally, the dev-only plugin for file:line). On Android you add a debugImplementation library; release builds get an empty no-op artifact. No tool code reaches your production build.

### Which AI agents can I use?

Any agent with MCP support over stdio: Claude Code, Codex CLI, Cursor, VS Code (Copilot agent mode), Claude Desktop, Gemini CLI, Zed, and agents built on SDKs with an MCP client. The skill itself follows the open SKILL.md format.

### Does it fix layout bugs on its own?

No. You select the element in the window and say or show what you want; the agent edits the code and replies in the same window. The tool never edits your code itself.

### What do I get, and what does it cost?

The skill is free. The package contains SKILL.md, which teaches your agent the listening loop and how to turn a selected element and a drag into a code change. The layout-debug-mcp server it uses is free and open source (MIT) on npm: npx -y layout-debug-mcp.

### Which frameworks does it work with?

On the web, any real DOM page from your dev server: React, Vue, plain HTML and others. file:line comes from the bundled plugin for React/JSX; other stacks are found by test id, id and classes. On Android, Jetpack Compose 1.7+ on a device or emulator. Compose Multiplatform on wasmJs (canvas) is not supported.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
