opencli-autofix
What it does
This skill fixes an OpenCLI command that stopped working because a website changed. It collects a trace, updates the adapter file, and retries the command.
When to use it
- βWhen an OpenCLI command fails because a website changed its layout or data.
- βWhen a command returns empty results after a site update.
- βWhen you want an OpenCLI adapter repaired and reported upstream after a verified fix.
Skill link
https://github.com/jackwener/OpenCLI/blob/main/skills/opencli-autofix/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMy OpenCLI command for this site stopped returning results. Diagnose it, fix the adapter, and retry.β
5 new skills a week. 1 minute to read.
How it works
The agent checks whether the failure is a login or connection issue first, since those need the user to act. For other failures, it patches only the adapter file, retries, and stops after three repair rounds if the problem remains.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
OpenCLI AutoFix β Automatic Adapter Self-Repair
When an opencli command fails because a website changed its DOM, API, or response schema, automatically diagnose, fix the adapter, and retry β don't just report the error.
Safety Boundaries
Before starting any repair, check these hard stops:
AUTH_REQUIRED(exit code 77) β STOP. Do not modify code. Tell the user to log into the site in Chrome.BROWSER_CONNECT(exit code 69) β STOP. Do not modify code. Tell the user to runopencli doctor.- CAPTCHA / rate limiting β STOP. Not an adapter issue.
Scope constraint:
- Only modify the file at
adapterSourcePathin the tracesummary.mdfront matter β this is the authoritative adapter location (may beclis/<site>/in repo or~/.opencli/clis/<site>/for npm installs) - Never modify
src/,extension/,tests/,package.json, ortsconfig.json
Retry budget: Max 3 repair rounds per failure. If 3 rounds of diagnose β fix β retry don't resolve it, stop and report what was tried.
Prerequisites
opencli doctor # Verify extension + daemon connectivity
When to Use This Skill
Use when opencli <site> <command> fails with repairable errors:
- SELECTOR β element not found (DOM changed)
- EMPTY_RESULT β no data returned (API response changed)
- API_ERROR / NETWORK β endpoint moved or broke
- PAGE_CHANGED β page structure no longer matches
- COMMAND_EXEC β runtime error in adapter logic
- TIMEOUT β page loads differently, adapter waits for wrong thing
Before Entering Repair: "Empty" β "Broken"
EMPTY_RESULT β and sometimes a structurally-valid SELECTOR that returns nothing β is often not an adapter bug. Platforms actively degrade results under anti-scrape heuristics, and a "not found" response from the site doesn't mean the content is actually missing. Rule this out before committing to a repair round:
- Retry with an alternative query or entry point. If
opencli xiaohongshu search "X"returns 0 butopencli xiaohongshu search "X ζ»η₯"returns 20, the adapter is fine β the platform was shaping results for the first query. - Spot-check in a normal Chrome tab. If the data is visible in the user's own browser but the adapter comes back empty, the issue is usually authentication state, rate limiting, or a soft block β not a code bug. The fix is
opencli doctor/ re-login, not editing source. - Look for soft 404s. Sites like xiaohongshu / weibo / douyin return HTTP 200 with an empty payload instead of a real 404 when an item is hidden or deleted. The snapshot will look structurally correct. A retry 2-3 seconds later often distinguishes "temporarily hidden" from "actually gone".
- "0 results" from a search is an answer. If the adapter successfully reached the search endpoint, got an HTTP 200, and the platform returned
results: [], that is a valid answer β report it to the user as "no matches for this query" rather than patching the adapter.
Only proceed to Step 1 if the empty/selector-missing result is reproducible across retries and alternative entry points. Otherwise you're patching a working adapter to chase noise, and the patched version will break the next working path.
Step 1: Collect Trace Context
Run the failing command with failure-retained trace enabled:
opencli <site> <command> [args...] --trace retain-on-failure 2>trace-error.yaml
On failure, stderr contains the normal error envelope plus a small trace block:
ok: false
error:
code: SELECTOR
message: "Could not find element: .old-selector"
trace:
schemaVersion: 1
opencliVersion: "..."
traceId: "..."
dir: "/path/to/.opencli/profiles/default/traces/..."
summaryPath: "/path/to/.opencli/profiles/default/traces/.../summary.md"
receiptPath: "/path/to/.opencli/profiles/default/traces/.../receipt.json"
Read summaryPath first. It is the LLM-oriented entry point and includes front matter:
---
schemaVersion: 1
opencliVersion: "..."
traceId: "..."
status: failure
site: "example"
command: "example/search"
adapterSourcePath: "/path/to/clis/example/search.js"
errorCode: "SELECTOR"
errorMessage: "Could not find element: .old-selector"
---
The artifact directory contains:
summary.md # start here
receipt.json # machine-readable trace receipt
trace.jsonl # full redacted timeline
network.jsonl # redacted network events
console.jsonl # redac
FAQ
Will it fix login problems?
No. Login and connection errors stop the repair, and the agent asks you to act.
How many repair attempts does it make?
At most three rounds of diagnosis, fix, and retry for each failure.
Which files can it change?
Only the single adapter file identified in the trace. Core source and test files stay untouched.
Details
Original description by the author
Automatically fix broken OpenCLI adapters when commands fail. Load this skill when an opencli command fails β it guides you through collecting a trace artifact, patching the adapter, retrying, and filing an upstream GitHub issue after a verified fix. Works with any AI agent.
repo: jackwener/OpenCLI
Popularity
- GitHub stars
- 31k
- Ranking position
- #9333
- License
- Apache-2.0
- Updated
- 10/26/2026
Comments
- β¦
More skills from this repository
opencli-adapter-author
31kHelps your agent build a reusable OpenCLI adapter that lets commands fetch data from a website reliably.
opencli-browser
31kHelps your agent drive Chrome to open pages, read them, click through sites, and capture what it needs.
opencli-usage
31kHelps your agent find and run OpenCLI commands for websites and Chrome, and read their results correctly.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.