Gaffa authoring
Use when the user mentions gaffa in a programming context (a gaffa.dev URL, a gaffa endpoint, or an existing gaffa API call) and wants concrete code. Writes, edits, ports, or reviews code that calls the gaffa.dev browser-automation REST API, loading the verified gaffa API facts and live docs first. For triaging a failing request or a brq_* id, /gaffa-debug leads instead. For a URL with only a vague goal and no script, /gaffa-find leads.From its SKILL.md
npx -y skills add GaffaAI/gaffa-for-ai --skill gaffa-authoringAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
12.7 KB, as published. Nobody here has run it
gaffa authoring
Helps a developer write, edit, port, or hand-review code that calls the gaffa.dev browser-automation REST API. Gaffa is a plain HTTP REST API with no official SDK. You emit code in whatever language and style the developer's project already uses.
Critical gaffa facts (grounding)
For anything beyond them, consult the live docs (see Doc-fetching strategy).
- Auth header is
X-API-Key: <key>. Read fromGAFFA_API_KEYenv var. Never hard-code. POST /v1/browser/requestsis async by default. Returns an id. PollGET /v1/browser/requests/{id}. Opt into sync with"async": false.- Max runtime is plan-tiered (1 / 2 / 5 min) for both sync and async.
Always set
settings.time_limitexplicitly. parse_jsonis token-priced, so its cost scales with the content parsed rather than being a flat per-call charge. Stored/v1/schemasextractions run the sameparse_jsonaction and are priced the same way. Check the live docs for the current model and token rates. Other actions are deterministically priced.- Request recordings (
settings.record_request: true) are strongly recommended for/gaffa-debug. Without one, the skill can only suggest re-running the failing request with recording enabled. Plan-tiered retention applies (7 days / 30 days / 3 months).
The API base URL is https://api.gaffa.dev.
Every /v1/... endpoint is called on that host.
The documentation and the docs MCP live on https://gaffa.dev.
API responses are wrapped in a top-level data object, so read fields as data.id, data.state, data.credit_usage, and data.actions.
A finished request has data.state equal to completed.
Each action result is a URL in data.actions[].output.
The gaffa edge rejects some default HTTP-client User-Agents (for example Python urllib) with a 403, so emitted code should set an explicit User-Agent header.
curl works with its default User-Agent.
In the request body, actions, time_limit, and record_request go under settings, while url, async, max_cache_age, and proxy_location are root-level.
time_limit is in milliseconds.
The parse_json action uses a structured data_schema of the form {name, description, fields: [{type, name, description}]}, never a flat object and never a schema or prompt field.
An optional instruction parameter sits beside data_schema (not inside it) for extra parsing guidance.
/v1/schemas is an endpoint for reusable stored schemas, not an action type.
LLM-backed extraction runs through the parse_json action, with an inline data_schema or a stored data_schema_id, and there is no separate schema action type.
parse_json is not the only way to get data off a page, see "Choosing an extraction action" below.
On a large content-rich page, parse_json over the full DOM can fail with action_failed (verified on Wikipedia), so narrow the input with a selector for the region that holds the data, or set input_token_cap.
Verified endpoint and field reference
- Endpoints:
POST/GET /v1/browser/requests,GET /v1/browser/requests/{id},POST/GET /v1/schemas,PUT /v1/schemas/{id},DELETE /v1/schemas/{id},POST/GET /v1/site/map,GET /v1/site/map/{id}. The path is singularmap, easy to typo asmaps. Schema update and delete both take the id in the path. - Settings fields under
settings:actions,time_limit,record_request,max_media_bandwidth,block_ads.max_cache_ageandproxy_locationare root-level body fields, not undersettings. max_cache_ageis in seconds. Set it to 0 to disable the cross-user cache.- If
time_limitis not set, it defaults to your plan's maximum runtime, and it must stay below that maximum. Set it explicitly so the value is visible and intentional. - Available actions:
click,scroll,type,wait,capture_cookies,capture_dom,capture_screenshot,capture_snapshot,download_file,generate_markdown,generate_simplified_dom,parse_json,print,block_dom_removals,capture_element,parse_table, andloop, which repeats nested actions inside one request. The per-action parameter catalog lives inreferences/actions.md. Read it on demand when you need a specific action's parameters. - Proxy locations are residential IPs:
us,ie,sg,fr. Setproxy_locationto route through a residential IP in that country. With none set, the request uses a generic datacenter IP.
Choosing an extraction action
Pick the action before you look up its parameters.
parse_json is LLM-backed, so it is token-priced and its output can vary between runs.
Weigh that against a deterministic path first, and tell the developer the trade-off you took so they can overrule it.
- Prefer a deterministic path when the value sits in a stable, well-structured place.
Cheaper, repeatable, identical every run.
Good for a price in a known element, a list of cards with a consistent shape, a field in a JSON blob.
The options, in rough order of how often they fit:
parse_tablewith aselectorfor a table, which returns the rows already structured.generate_markdownwith aselectorfor the region, then parse the markdown in the developer's own language. Good for repeating cards or list items, and your recon capture is often this already.capture_elementwith aselectorfor one specific element.
- Reach for
parse_jsonwhen the value is buried in free text or moves around from page to page (a salary somewhere inside a job description), or when the task is interpretive rather than a lookup (summarising, classifying). That is where the LLM earns its cost. - Do not use
parse_jsonwhen the developer needs identical output across runs.
Preferences
General preferences for using the Gaffa API. They capture guidance beyond the API docs, and we add to them over time. Follow them unless the specific task calls for something else.
- Prefer an inline
data_schemaover a storeddata_schema_idforparse_json, so the end user can see the shape of what is being extracted. Reach for a storeddata_schema_idonly when a shape is registered server-side for reuse across separate scripts or sessions.
Credential hygiene
These rules apply to every line of code and every message this skill produces.
- Read
GAFFA_API_KEYfrom env only. Never hard-code in emitted code. Reference it as${GAFFA_API_KEY}. - Never echo, log, narrate, or persist the value of
GAFFA_API_KEY. Never put it in a URL or query string. - Before showing a gaffa recording, error trace, or request body to the user, to an LLM judge, or to disk, strip the values of any fields whose names match (case-insensitive, including vendor-prefixed variants like
gaffa_api_key):Authorization,X-API-Key,api_key(andapiKey,api-key),cookie,set-cookie. Replace the value with<REDACTED>. - If the runtime value of
GAFFA_API_KEYappears as a substring anywhere in a payload you are about to show or persist, replace it with<REDACTED>. Only enable this substring scrub when the env value is at least 16 characters long and contains both a digit and a letter. Otherwise skip and warn the developer on first invocation that the entropy floor was not met (field-name and prose rules still apply). - Persisted writes (the
/gaffa-findreasoning log./.gaffa-find-<timestamp>.log, and any other on-disk artifact) go through redaction first, then to a tempfile, then atomic-rename to the final path. A crash mid-write must not leave a plaintext-secrets file on disk. - If unsure whether a string is a secret, redact it.
Doc-fetching strategy
Resolve documentation queries in two tiers, in order.
- Preferred: gaffa docs MCP server at
https://gaffa.dev/docs/~gitbook/mcp. When the developer has it configured, call its tools directly.searchDocumentation(paramquery, a string) for "how do I do X" questions.getPage(paramurl, a full URL) to fetch one page when you already have its URL. - Fallback: live HTTP fetch.
?ask=against the docs for narrow lookups,https://gaffa.dev/docs/llms.txtfor breadth,https://gaffa.dev/docs/sitemap.mdfor the full page index. Per-call timeout of 5 seconds. Used when the MCP is not configured or returns an error.
MCP availability probe, once per session, cached, total budget 10 seconds:
- JSON-RPC
initializeover POST. Confirms the endpoint speaks MCP. - Send the mandatory
notifications/initializednotification. - JSON-RPC
tools/listover POST. ConfirmssearchDocumentationandgetPage(or at least one) are present.
Per-call MCP timeout is 5 seconds. If two consecutive calls in one session time out, demote to live HTTP for the rest of the session and tell the developer once.
If both tiers fail before any code is emitted, refuse with a clear message rather than guessing from training data.
Both tiers read from gaffa.dev, so when they fail together the usual cause is that gaffa.dev is blocked by the environment's egress policy, separate from api.gaffa.dev.
The message names that first: "Live gaffa docs are unavailable.
If gaffa.dev is blocked by your environment's egress or proxy policy, allow it and retry, see the setup section in the skills README.
Otherwise retry, or consult https://gaffa.dev/docs manually." If no gaffa MCP was configured, the message also suggests registering https://gaffa.dev/docs/~gitbook/mcp for faster lookups.
First action
Before emitting code, live-fetch the doc section relevant to the developer's request (MCP preferred, HTTP fallback), grounded by the critical facts above. Do not emit code before the relevant docs are confirmed or the grounding alone is sufficient and stated as such.
Behavior
- Do not guess selectors.
When the code needs a selector (for
parse_jsonwith aselector,capture_element,click,type, orwait), do not infer it from the URL or from the existing code. First fetch the real page with gaffa using agenerate_simplified_domorcapture_domcapture, read the actual elements, then write the selector from what is really there. If that fetch fails with a connectivity error, the page is unreachable, usually because egress toapi.gaffa.devis blocked, so point the developer at the egress setup instead of guessing. If you genuinely cannot fetch the page, mark the selector as unverified and tell the developer to confirm it rather than presenting a guess as correct. - Gaffa requests work best when targeting a single URL with actions performed on that page.
Pagination and other repeat-the-same-steps flows stay inside that one request with the
loopaction, capture first, then the click that moves on, see the catalog. What remains unsupported is session state across separate requests, every request starts a fresh session, so surface that up front when the developer's request needs it. - Always set
settings.time_limitexplicitly in generated code, based on what the job is expected to take. You do not know the developer's plan max, so emit a code comment reminding the developer to verify the value fits their plan (Starter 1 min, Startup 2 min, Growth 5 min). - For any request the developer may later want to debug or audit, set
settings.record_request: truein the emitted code so/gaffa-debughas a recording to inspect within the retention window. - Default to the async pattern (POST then poll the returned id).
Use
"async": falseonly when the developer asks for a blocking call and the expected runtime is well under the plan max. - Read the template that matches the task and adapt it to the developer's language and library.
They are starting points, not literal output.
templates/async-poll.mdfor the POST-then-poll pattern.templates/sync.mdfor the blocking"async": falsepattern.templates/schema-extraction.mdfor/v1/schemasstructured extraction.
Schema design and SDK migration
- Schema design with
/v1/schemas. Same authoring trigger, constrained to one endpoint. Seetemplates/schema-extraction.md. Storing a schema uses the endpoint with a normal API key. - Migration from Playwright, Puppeteer, or Selenium to gaffa.
Read the foreign snippet and map each step to a gaffa action, a pagination while-loop maps to the
loopaction. Flag any step that relies on session state across separate requests as a known gaffa limitation.