agent-browser-viewport

Size the agent-browser Chromium window to fill its current screen, leaving a configurable bottom margin for the desktop panel. Use before any agent-browser automation that needs the full screen visible without elements overlapping or scrolling off (e.g. Xero, dense web apps).

9 stars

Best use case

agent-browser-viewport is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Size the agent-browser Chromium window to fill its current screen, leaving a configurable bottom margin for the desktop panel. Use before any agent-browser automation that needs the full screen visible without elements overlapping or scrolling off (e.g. Xero, dense web apps).

Teams using agent-browser-viewport should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/agent-browser-viewport/SKILL.md --create-dirs "https://raw.githubusercontent.com/aspiers/ai-config/main/.agents/skills/agent-browser-viewport/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/agent-browser-viewport/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How agent-browser-viewport Compares

Feature / Agentagent-browser-viewportStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Size the agent-browser Chromium window to fill its current screen, leaving a configurable bottom margin for the desktop panel. Use before any agent-browser automation that needs the full screen visible without elements overlapping or scrolling off (e.g. Xero, dense web apps).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# agent-browser viewport sizing

The default `agent-browser` viewport (1280x720) is too short for many
real-world web apps, causing elements to overlap or scroll unexpectedly.
This skill sizes the agent-browser Chromium window to fill its current
screen, leaving a configurable bottom margin for the desktop panel /
status bar.

## Usage

```bash
.agents/skills/agent-browser-viewport/scripts/fit-viewport.py        # default 50px bottom margin
.agents/skills/agent-browser-viewport/scripts/fit-viewport.py 80     # larger panel
```

Takes effect immediately on the current agent-browser session — no
reload needed. Run once before starting automation. Re-run if the
window has been moved to a different physical monitor.

## Why a script, not a fixed `-N` fudge

`agent-browser set viewport <w> <h>` sets the **outer** Chromium window
size, but Chromium then adds its tab strip + URL bar on top, so the
actual window ends up larger than the value you pass. The overhead
varies by Chromium version, theme, devicePixelRatio and window manager
— no fixed `-120` constant is reliable across machines.

## How the script works

It derives Chromium's chrome overhead directly from the existing window
state (no probe / resize loop, so the page layout isn't disturbed
mid-fit):

- horizontal overhead = `outerWidth - innerWidth × devicePixelRatio`
- vertical overhead = `outerHeight - innerHeight × devicePixelRatio`

`innerWidth` / `innerHeight` are CSS pixels; `outerWidth` /
`outerHeight` are device pixels. Multiplying inner by DPR brings them
into the same unit, and the difference is the chrome (tab strip + URL
bar + window border) in device pixels — exactly what `set viewport`
needs as its correction.

The script then:

1. Reads the screen the agent-browser window is currently on via
   `window-screen-info -n .agent-browser-data` (device pixels). Works
   correctly on multi-monitor setups.
2. Reads the in-page `innerWidth` / `innerHeight` / `outerWidth` /
   `outerHeight` / `devicePixelRatio` via `agent-browser eval`.
3. Computes overhead as above.
4. Issues one `agent-browser set viewport (screen_width - over_w,
   screen_height - bottom_margin - over_h)` call.

The final outer window matches `screen_width × (screen_height -
bottom_margin)` exactly (modulo half-pixel rounding at non-integer
DPR).

## Notes

- The script identifies the agent-browser window by its WM_CLASS
  instance `.agent-browser-data` — Chromium sets this from the
  `--user-data-dir` path that agent-browser passes.
- Reported screen dimensions are device pixels. `agent-browser set
  viewport` also takes device pixels, so values pass through directly.
  At `devicePixelRatio > 1` the in-page `innerWidth` / `innerHeight`
  will be smaller (CSS pixels = device pixels ÷ DPR), which is
  expected.
- If you need a different bottom margin (e.g. taller panel, multi-row
  taskbar), pass it as the first argument.

Related Skills

xero-browser

9
from aspiers/ai-config

General Xero browser automation notes. Use when automating any Xero page with agent-browser — covers non-standard UI patterns, waiting, and dropdown menus.

xlsx-to-csv

9
from aspiers/ai-config

Convert XLSX spreadsheets (single or multi-sheet) to CSV files you can read and grep. Use whenever you need to process an .xlsx report from Xero, Cryptio, bank exports, or any tool that delivers spreadsheet output.

xero-mcp

9
from aspiers/ai-config

Use the Xero MCP server — obtain/refresh OAuth2 bearer tokens, troubleshoot authentication, and pick up other operational notes for working with Xero MCP tools. Use when Xero MCP tools fail with authentication errors, when the bearer token has expired (tokens last ~30 min), before starting any Xero workflow, or for general guidance on Xero MCP usage.

test-running

9
from aspiers/ai-config

Run tests according to repository guidelines. Use after linting passes, before staging changes.

task-orchestration

9
from aspiers/ai-config

Orchestrate the complete development workflow for implementing sub-tasks from a task list. Use for end-to-end feature implementation with quality controls.

task-implementation

9
from aspiers/ai-config

Implement a single sub-task from a task list. Use when working on feature development with existing task lists.

task-generation

9
from aspiers/ai-config

Generate a detailed task list from a PRP. Use after a PRP is created and ready for implementation planning.

subagent-authoring

9
from aspiers/ai-config

Create subagent definitions for Claude Code and OpenCode that delegate to skills. Use when creating new subagents or refactoring existing ones to follow the delegation pattern.

slow-command-running

9
from aspiers/ai-config

Pipe long running commands through tee(1) to allow watching output and repeated analyses without rerunning

skill-authoring

9
from aspiers/ai-config

Create and maintain Claude Code skills following Anthropic best practices. Use when building new skills, refactoring existing ones, or ensuring skills follow official guidelines for structure, naming, progressive disclosure, and testing.

safe-rm

9
from aspiers/ai-config

Safely delete files / directories without asking for permission

prp-generation

9
from aspiers/ai-config

Generate a Product Requirements Prompt (PRP) from a feature description. Use when starting work on a new feature.