Best for
- SELECTOR — element not found (DOM changed)
- EMPTYRESULT — no data returned (API response changed)
- APIERROR / NETWORK — endpoint moved or broke
jackwener/OpenCLI/skills/opencli-autofix/SKILL.md
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.
Decision brief
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.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/jackwener/OpenCLI --skill "skills/opencli-autofix"Inspect the Agent Skill "opencli-autofix" from https://github.com/jackwener/OpenCLI/blob/399c0de2a76eb979aee3a3836cf2d24fd247780f/skills/opencli-autofix/SKILL.md at commit 399c0de2a76eb979aee3a3836cf2d24fd247780f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Run the failing command with failure-retained trace enabled:
Read the trace summary and the adapter source. Classify the root cause:
Use opencli browser to inspect the live website. Never use the broken adapter — it will just fail again.
Read the adapter source file at adapterSourcePath from the trace summary front matter and make targeted fixes. This path is authoritative — it may be in the repo (clis/) or user-local (/.opencli/clis/).
Review the “Step 5: Verify the Fix” section in the pinned source before continuing.
Permission review
The documentation asks the agent to create, modify, or delete local files.
**Only modify the file at `adapterSourcePath` in the trace `summary.md` front matter** — this is the authoritative adapter location (may be `clis/<site>/` in repo or `~/.opencli/clis/<site>/` for npm installs)The documentation includes network, browsing, or remote request actions.
**"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" ratThe documentation asks the agent to run terminal commands or scripts.
Run the failing command with failure-retained trace enabled:The documentation asks the agent to read local files, directories, or repositories.
If you redirected stderr to a file, read that file and copy `trace.summaryPath`.The documentation asks the agent to read local files, directories, or repositories.
What is the adapter trying to do? (Read the file at `adapterSourcePath`)The documentation includes network, browsing, or remote request actions.
opencli browser open https://example.com/target-page && opencli browser stateThe documentation asks the agent to run terminal commands or scripts.
**Test after patching** — run the command again to verifyThe documentation asks the agent to create, modify, or delete local files.
gh issue create --repo jackwener/OpenCLI \Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 90/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 27,702 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
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.
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 run opencli doctor.Scope constraint:
adapterSourcePath in the trace summary.md front matter — this is the authoritative adapter location (may be clis/<site>/ in repo or ~/.opencli/clis/<site>/ for npm installs)src/, extension/, tests/, package.json, or tsconfig.jsonRetry budget: Max 3 repair rounds per failure. If 3 rounds of diagnose → fix → retry don't resolve it, stop and report what was tried.
opencli doctor # Verify extension + daemon connectivity
Use when opencli <site> <command> fails with repairable errors:
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:
opencli xiaohongshu search "X" returns 0 but opencli xiaohongshu search "X 攻略" returns 20, the adapter is fine — the platform was shaping results for the first query.opencli doctor / re-login, not editing source.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.
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 # redacted console events
state/ # final snapshots when available
screenshots/ # final screenshots when available
If you redirected stderr to a file, read that file and copy trace.summaryPath.
Do not ask the user to rerun with legacy diagnostic env vars. Trace is the repair evidence path.
Read the trace summary and the adapter source. Classify the root cause:
| Error Code | Likely Cause | Repair Strategy |
|---|---|---|
| SELECTOR | DOM restructured, class/id renamed | Explore current DOM → find new selector |
| EMPTY_RESULT | API response schema changed, or data moved | Check network → find new response path |
| API_ERROR | Endpoint URL changed, new params required | Discover new API via network intercept |
| AUTH_REQUIRED | Login flow changed, cookies expired | STOP — tell user to log in, do not modify code |
| TIMEOUT | Page loads differently, spinner/lazy-load | Add/update wait conditions |
| PAGE_CHANGED | Major redesign | May need full adapter rewrite |
Key questions to answer:
adapterSourcePath)summary.md, then state/ if needed)Failed Network in summary.md, then network.jsonl if needed)Use opencli browser to inspect the live website. Never use the broken adapter — it will just fail again.
# Open the page and inspect current DOM
opencli browser open https://example.com/target-page && opencli browser state
# Look for elements that match the adapter's intent
# Compare the snapshot with what the adapter expects
# Open page with network interceptor, then trigger the action manually
opencli browser open https://example.com/target-page && opencli browser state
# Interact to trigger API calls
opencli browser click <N> && opencli browser network
# Narrow to the request you care about by the fields its body should have
opencli browser network --filter author,text,likes
# Inspect specific API response (key is the `key` field from the default JSON output)
opencli browser network --detail <key>
Read the adapter source file at adapterSourcePath from the trace summary front matter and make targeted fixes. This path is authoritative — it may be in the repo (clis/) or user-local (~/.opencli/clis/).
Use the Read tool on the exact path from summary.md front matter.
Selector update:
// Before: page.evaluate('document.querySelector(".old-class")...')
// After: page.evaluate('document.querySelector(".new-class")...')
API endpoint change:
// Before: const resp = await page.evaluate(`fetch('/api/v1/old-endpoint')...`)
// After: const resp = await page.evaluate(`fetch('/api/v2/new-endpoint')...`)
Response schema change:
// Before: const items = data.results
// After: const items = data.data.items // API now nests under "data"
Wait condition update:
// Before: await page.wait({ selector: '.loading-spinner', hidden: true })
// After: await page.wait({ selector: '[data-loaded="true"]' })
columns and return format must stay compatible@jackwener/opencli/* imports only — never add third-party package importsverify/<cmd>.json fixtures to silence a failure. A failing patterns / notEmpty / mustNotContain / mustBeTruthy rule means the adapter's output is broken. Tighten the adapter so it produces correct values; do not loosen the fixture to accept the broken values. The one legitimate reason to edit a fixture during repair is when the site itself changed shape (e.g. URL format migration) — in that case update the fixture and note the change in ~/.opencli/sites/<site>/notes.md. Otherwise editing the fixture is covering up a silent correctness regression.# Run the command normally
opencli <site> <command> [args...]
If it still fails, go back to Step 1 and collect a fresh trace. You have a budget of 3 repair rounds (trace → fix → retry). If the same error persists after a fix, try a different approach. After 3 rounds, stop and report what was tried.
If the retry passes, the local adapter has drifted from upstream. File a GitHub issue so the fix flows back to jackwener/OpenCLI.
Do NOT file for:
AUTH_REQUIRED, BROWSER_CONNECT, ARGUMENT, CONFIG — environment/usage issues, not adapter bugsOnly file after a verified local fix — the retry must pass first.
Procedure:
[autofix] <site>/<command>: <error_code> (e.g. [autofix] zhihu/hot: SELECTOR)## Summary
OpenCLI autofix repaired this adapter locally, and the retry passed.
## Adapter
- Site: `<site>`
- Command: `<command>`
- OpenCLI version: `<version from opencli --version>`
## Original failure
- Error code: `<error_code>`
~~~
<error_message>
~~~
## Local fix summary
~~~
<1-2 sentence description of what you changed and why>
~~~
_Issue filed by OpenCLI autofix after a verified local repair._
Ask the user before filing. Show them the draft title and body. Only proceed if they confirm.
If the user approves and gh auth status succeeds:
gh issue create --repo jackwener/OpenCLI \
--title "[autofix] <site>/<command>: <error_code>" \
--body "<the body above>"
If gh is not installed or not authenticated, tell the user and skip — do not error out.
Hard stops (do not modify code):
Soft stops (report after attempting):
opencli-adapter-author skillIn all stop cases, clearly communicate the situation to the user rather than making futile patches.
1. User runs: opencli zhihu hot
→ Fails: SELECTOR "Could not find element: .HotList-item"
2. AI runs: opencli zhihu hot --trace retain-on-failure 2>trace-error.yaml
→ Gets trace summary with final state and failed action evidence
3. AI reads summary/state: page loaded but uses ".HotItem" instead of ".HotList-item"
4. AI explores: opencli browser open https://www.zhihu.com/hot && opencli browser state
→ Confirms new class name ".HotItem" with child ".HotItem-content"
5. AI patches: Edit adapter at `adapterSourcePath` — replace ".HotList-item" with ".HotItem"
6. AI verifies: opencli zhihu hot
→ Success: returns hot topics
7. AI prepares upstream issue draft, shows it to the user
8. User approves → AI runs: gh issue create --repo jackwener/OpenCLI --title "[autofix] zhihu/hot: SELECTOR" --body "..."
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
JasonColapietro/suede-creator-skills
Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).
narrative-io/narrative-skills-marketplace
Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "