Browser Automation, AI Commits, Lifecycle Hooks
Markus Klug
German IT Entrepreneur since 1997, now based in Lisbon.
Award-Winning Founder and Builder, FinTech Veteran,
Agentic Coding Pioneer.
Folders that extend Claude with on-demand capabilities
Scripts & assets
Not just markdown
Tool restrictions
allowed-tools limits scope
Model selection
model: haiku, sonnet, opus
14 CLI tools for Chrome automation via CDP
| Script | Usage | Purpose |
|---|---|---|
| start.js | node start.js | Launch Chrome with CDP on :9222 |
| nav.js | node nav.js <url|back|forward|reload> | Navigate |
| dom.js | node dom.js [--selector] [--depth] [--a11y] | DOM / accessibility tree |
| click.js | node click.js <selector> [--double] [--right] | Click elements |
| type.js | node type.js <selector> 'text' [--clear] | Type into inputs |
| screenshot.js | node screenshot.js [--full] [--selector] | Capture page |
| scroll.js | node scroll.js [--up|--down] [--amount] | Scroll page / element |
| eval.js | node eval.js '<code>' | Run JS in page |
| console.js | node console.js [--filter] [--clear] | Console messages |
| network.js | node network.js [--filter] | Network snapshot |
| wait.js | node wait.js <selector|text> [--gone] | Wait for condition |
| hover.js | node hover.js <selector> | Hover over element |
| select.js | node select.js <selector> <value> | Dropdown selection |
| tabs.js | node tabs.js <list|switch|close> | Tab management |
Prefer dom.js over screenshots. The DOM tree is faster and more informative than pixel data.
Launch Chrome stable with CDP — reuse real cookies
Idempotent start — checks if CDP is already running, exits early
Chrome stable only — kills stable, leaves Beta untouched
Cookie sync — copies auth files from real profile so you're logged into everything
Dedicated data dir — CDP won't enable on Chrome's default dir
One dependency: playwright-core
All scripts connect to CDP via playwright-core's chromium.connectOverCDP()
/browser in action
start.js — launch Chrome with CDP
nav.js — navigate to a page
dom.js --a11y — inspect the accessibility tree
click.js / type.js — interact with elements
screenshot.js — visual verification
AI-Powered Commit Messages
Interactive vs headless — same commit guidelines, different UX
Interactive — runs inside Claude conversation
Runs gather-context script
Presents message via AskUserQuestion
Options: Commit / Push / Edit / Cancel
Background — runs outside Claude, pops up in tmux
Receives diff via stdin pipe
Outputs raw commit message text only
Review happens in tmux popup via gum
Both use Haiku for cost efficiency. Both share the same commit message guidelines.
Two phases: background AI call, then interactive review
Non-blocking
Runs entirely in background with ( ... ) & disown
Smart truncation
Large diffs get stat summary + truncated diff
Zero-tool skill
SKILL.md forbids all tools — pure text in, text out
/git-staged-headless in action
Stage some changes with git add
Run ~/.claude/skills/git-staged-headless/run
tmux shows "Generating commit message..."
Popup appears with proposed message + gum chooser
Choose: Commit / Commit & Push / Edit / Cancel
Making Claude Self-Aware
Shell commands, HTTP endpoints, LLM prompts, or agents — fired at every stage
5 shell scripts wired to 18 events in ~/.claude/settings.json
Window title reflects Claude's state
Queue-and-flush auto-formatting
Claude can edit its own config without asking
Every event streams to localhost:8002
5 scripts + 1 HTTP endpoint = full observability over every Claude session
31 lines that make Claude visible in your terminal
Running 3 Claude sessions in parallel?
Glance at tmux tab bar to see which needs input.
No context switching. No guessing.
Queue on edit, flush on stop — never interrupts Claude
PostToolUse hook — matcher: Edit|Write
Stop hook — runs when Claude finishes a turn
Session-scoped queue
Each session has its own temp file
Deduplication
grep -qxF prevents duplicate entries
Clean cleanup
Queue file removed after flush
Claude manages its own .claude/ config without prompting
PreToolUse hook — matcher: Edit|Write
Claude frequently updates its own skills, memory, and settings files inside ~/.claude/.
Without this hook, every edit to a skill or memory file would trigger a permission prompt.
This hook auto-approves only paths containing /.claude/ — everything else falls through to normal permission handling.
PreToolUse hooks can allow, deny, or pass through.
Return empty {} to not interfere.
This is the only blocking hook type that can override permissions programmatically.
How hooks connect to events in settings.json
matcher: "Edit|Write"
Filter hooks by tool name — regex supported
Hook input via stdin
Every hook receives JSON context: session_id, tool_input, etc.
Three patterns for extending Claude Code
Skill as a tool suite
14 CLI scripts + playwright-core
CDP-based Chrome automation
DOM-first observation strategy
Skill as a headless API
Zero tools, pure text pipeline
Background Claude + tmux popup
gum-based interactive review
5 shell scripts, 18 events
tmux state indicators
Queue-and-flush auto-formatting
Programmatic permission control
Claude Code is a development platform — skills and hooks are the extension API