agentleFS
iberi22iberi22/skills/skills/general/browser-automation/SKILL.md

browser-automation

Skill0 starsChanged 36 days agoMITView on GitHub

Create AI agents that control web pages using natural language. Based on Alibaba's page-agent architecture. Use when building browser AI copilots, web automation agents, or DOM-based tool systems.

  • Reads credentials

53 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use karpathy-coder, api-test-suite-builder and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • csiddhant796-blipSkill

    karpathy-coder

    Use when writing, reviewing, or committing code to enforce Karpathy's 4 coding principles — surface assumptions before coding, keep it simple, make surgical changes, define verifiable goals. Triggers on "review my diff", "check complexity", "am I overcomplicating this", "karpathy check", "before I commit", or any code quality concern where the LLM might be overcoding.

    Also in 5 projects that use this

  • Arnav-0Skill

    api-test-suite-builder

    Use when the user asks to generate API tests, create integration test suites, test REST endpoints, or build contract tests.

    Also in 6 projects that use this

  • Hussain-ElfalahSkill

    andreessen

    Also in 4 projects that use this

  • Hussain-ElfalahSkill

    business-investment-advisor

    Also in 4 projects that use this

  • csiddhant796-blipSkill

    self-eval

    Honestly evaluate AI work quality using a two-axis scoring system. Use after completing a task, code review, or work session to get an unbiased assessment. Detects score inflation, forces devil's advocate reasoning, and persists scores across sessions.

    Also in 5 projects that use this

  • DorianGalloSkill

    binary-diff

    跨版本符号迁移与二进制差分。当你有旧版本的符号/逆向结果,需要快速迁移到新版本时使用。 适用场景:内核缺 PDB 用旧版符号推导、程序更新后批量迁移函数名、应用更新后快速定位新偏移。 核心方法:用 LLM 做结构化差异比对,程序化输入输出,成本极低(200 函数 ~1 元)。 触发关键词:符号迁移、bindiff、跨版本、PDB 缺失、函数偏移迁移、symbol migration、binary diff、版本对比。

    Also in 5 projects that use this

  • +1 more from Hussain-Elfalah

The file

Files
SKILL.md

Browser Automation Agent

Build AI agents that control web interfaces with natural language — no browser extensions, no Python, no headless browsers. Everything happens in-page.

Architecture Pattern (page-agent style)

User Action (natural language)
    ↓
Agent (LLM + Tools)
    ↓
PageController (DOM operations)
    ↓
Web Page (actual browser DOM)

Core Components

1. PageController

Handles all DOM operations — no LLM dependency.

// Core methods every PageController must implement
class PageController {
  async updateTree()           // Extract live DOM
  async getSimplifiedHTML()    // Dehydrate for LLM
  async getPageInfo()          // Page metadata
  async clickElement(index)    // Indexed element interaction
  async inputText(index, text) // Form input
  async scroll(direction)      // Navigation
}

2. Agent Brain (LLM Client)

Stateless LLM client with retry logic and reflection-before-action.

interface AgentConfig {
  model: string
  baseURL: string
  apiKey: string
  language: string
}

3. Tool System

Tools are defined as functions that the LLM can call. Each tool:

  1. Calls PageController for DOM operations
  2. Returns structured result to LLM
  3. LLM decides next action

Key Files to Create

FilePurpose
PageController.tsDOM extraction + element operations
Agent.tsLLM client + tool executor + ReAct loop
tools/index.tsTool definitions
prompts/system.mdSystem prompt for the agent
types.tsTypeScript interfaces

DOM Pipeline

1. Live DOM → FlatDomTree (page-controller)
2. FlatDomTree → Simplified text (dehydration)
3. Simplified text → LLM (action plan)
4. Action plan → PageController operations (by index)

Quick Start Pattern

import { PageAgent } from 'page-agent'

const agent = new PageAgent({
  model: 'qwen3.5-plus',
  baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
  apiKey: process.env.API_KEY,
  language: 'en-US',
})

await agent.execute('Click the login button')

Monorepo Structure Pattern

packages/
├── core/                    # Agent logic without UI (stateless)
├── page-controller/         # DOM operations (no LLM dependency)
├── llms/                    # LLM client with retry/reflection
├── ui/                      # Optional panel/overlay
└── page-agent/              # Main entry (core + controller + ui)

Best Practices

  1. Indexed operations — Don't pass DOM elements to LLM, use integer indices
  2. Simplified HTML — Remove noise (styles, scripts) before sending to LLM
  3. Retry logic — LLM calls fail; implement exponential backoff
  4. Visual feedback — Optional mask overlay shows agent actions to user
  5. No screenshots — Text-based DOM manipulation only (faster, cheaper)

When to Use

  • ✅ Building an AI copilot for a web app
  • ✅ Automating form filling workflows
  • ✅ Creating accessibility overlays
  • ✅ Multi-page browser agents
  • ❌ Server-side scraping (use puppeteer/playwright instead)
  • ❌ Complex visual tasks requiring screenshots

Integration Options

ApproachUse Case
NPM packageFull control, custom UI
Chrome extensionMulti-page tasks
MCP ServerExternal agent control
IIFE script tagQuick integration

Not the same as agentic testing

This skill builds agents that operate a page for a user (copilots, DOM tools). To TEST an app with an agent — natural-language steps, replay cache, exploratory bug bashes with repro tests — use agentic-e2e (tester-army/e2e) instead.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.