Agent skill

Qiaomu Opencli Autofix

by joeseesun in joeseesun/qiaomu-opencli-skills

Automatically fix broken OpenCLI adapters when commands fail.

MITAuto-check passedBackend & APIs

Install Qiaomu Opencli Autofix

skills CLI
$ npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install joeseesun/qiaomu-opencli-skills qiaomu-opencli-autofix --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/joeseesun/qiaomu-opencli-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/qiaomu-opencli-autofix .claude/skills/qiaomu-opencli-autofix && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
qiaomu-opencli-autofix
GitHub stars
993
Token cost
~2.4k tokens
SKILL.md length
901 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Automatically fix broken OpenCLI adapters when commands fail.

  • Works in 5 steps: Collect Diagnostic Context → Analyze the Failure → Explore the Current Website → …
  • Backend & APIs work in your project
  • SKILL.md covers Safety Boundaries, Prerequisites, When to Use This Skill and Before Entering Repair:…, plus 7 more sections
  • Reaches zhihu.com

What it does

Qiaomu Opencli Autofix is an agent skill from joeseesun/qiaomu-opencli-skills. Automatically fix broken OpenCLI adapters when commands fail. Load this skill when an opencli command fails — it guides you through diagnosing the failure via OPENCLIDIAGNOSTIC, patching the adapter, and retrying. Works with any AI agent.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs. The repository describes itself as: Use opencli CLI to interact with social/content websites (Bilibili, Zhihu, Twitter/X, YouTube, Weibo, 小红书, V2EX, Reddit, HackerNews, 雪球, BOSS直聘 etc.). The licence is MIT.

When your agent uses it

  • Backend & APIs work in your project

Example prompts

  • “/qiaomu-opencli-autofix”

Requirements

  • Pre-approved tools (allowed-tools): Bash(opencli:*), Read, Edit, Write

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Collect Diagnostic Context
  2. Analyze the Failure
  3. Explore the Current Website
  4. Patch the Adapter
  5. Verify the Fix

What it can do on your machine

Read from SKILL.md and the folder at commit 4d9a08e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(opencli:*)
    • Read
    • Edit
    • Write

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash, typescript and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • zhihu.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Qiaomu Opencli Autofix loads about 2.4k tokens when it runs. Until then it costs about 66 tokens; SKILL.md has 901 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from joeseesun/qiaomu-opencli-skills at commit 4d9a08e, republished under its MIT licence (© joeseesun). 901 words, ~2,406 tokens.

Download SKILL.mdSave it as .claude/skills/qiaomu-opencli-autofix/SKILL.md (or your agent's skills folder).
name
qiaomu-opencli-autofix
description
Automatically fix broken OpenCLI adapters when commands fail. Load this skill when an opencli command fails — it guides you through diagnosing the failure via OPENCLI_DIAGNOSTIC, patching the adapter, and retrying. Works with any AI agent.
allowed-tools
Bash(opencli:*), Read, Edit, Write
author
joeseesun
upstream
jackwener/opencli

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 run opencli doctor.
  • CAPTCHA / rate limiting — STOP. Not an adapter issue.

Scope constraint:

  • Only modify the file at RepairContext.adapter.sourcePath — this is the authoritative adapter location (may be clis/<site>/ in repo or ~/.opencli/clis/<site>/ for npm installs)
  • Never modify src/, extension/, tests/, package.json, or tsconfig.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

bash
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 but opencli 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 Diagnostic Context

Run the failing command with diagnostic mode enabled:

bash
OPENCLI_DIAGNOSTIC=1 opencli <site> <command> [args...] 2>diagnostic.json

This outputs a RepairContext JSON between ___OPENCLI_DIAGNOSTIC___ markers in stderr:

json
{
  "error": {
    "code": "SELECTOR",
    "message": "Could not find element: .old-selector",
    "hint": "The page UI may have changed."
  },
  "adapter": {
    "site": "example",
    "command": "example/search",
    "sourcePath": "/path/to/clis/example/search.ts",
    "source": "// full adapter source code"
  },
  "page": {
    "url": "https://example.com/search",
    "snapshot": "// DOM snapshot with [N] indices",
    "networkRequests": [],
    "consoleErrors": []
  },
  "timestamp": "2025-01-01T00:00:00.000Z"
}

Parse it:

bash
# Extract JSON between markers from stderr output
cat diagnostic.json | sed -n '/___OPENCLI_DIAGNOSTIC___/{n;p;}'
Show full SKILL.md (418 more words)Show less

Step 2: Analyze the Failure

Read the diagnostic context and the adapter source. Classify the root cause:

Error CodeLikely CauseRepair Strategy
SELECTORDOM restructured, class/id renamedExplore current DOM → find new selector
EMPTY_RESULTAPI response schema changed, or data movedCheck network → find new response path
API_ERROREndpoint URL changed, new params requiredDiscover new API via network intercept
AUTH_REQUIREDLogin flow changed, cookies expiredSTOP — tell user to log in, do not modify code
TIMEOUTPage loads differently, spinner/lazy-loadAdd/update wait conditions
PAGE_CHANGEDMajor redesignMay need full adapter rewrite

Key questions to answer:

  1. What is the adapter trying to do? (Read the source field)
  2. What did the page look like when it failed? (Read the snapshot field)
  3. What network requests happened? (Read networkRequests)
  4. What's the gap between what the adapter expects and what the page provides?

Step 3: Explore the Current Website

Use opencli browser to inspect the live website. Never use the broken adapter — it will just fail again.

DOM changed (SELECTOR errors)
bash
# 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
API changed (API_ERROR, EMPTY_RESULT)
bash
# 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

# Inspect specific API response
opencli browser network --detail <index>

Step 4: Patch the Adapter

Read the adapter source file at the path from RepairContext.adapter.sourcePath and make targeted fixes. This path is authoritative — it may be in the repo (clis/) or user-local (~/.opencli/clis/).

bash
# Read the adapter (use the exact path from diagnostic)
cat <RepairContext.adapter.sourcePath>
Common Fixes

Selector update:

typescript
// Before: page.evaluate('document.querySelector(".old-class")...')
// After:  page.evaluate('document.querySelector(".new-class")...')

API endpoint change:

typescript
// 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:

typescript
// Before: const items = data.results
// After:  const items = data.data.items  // API now nests under "data"

Wait condition update:

typescript
// Before: await page.waitForSelector('.loading-spinner', { hidden: true })
// After:  await page.waitForSelector('[data-loaded="true"]')
Rules for Patching
  1. Make minimal changes — fix only what's broken, don't refactor
  2. Keep the same output structure — columns and return format must stay compatible
  3. Prefer API over DOM scraping — if you discover a JSON API during exploration, switch to it
  4. Use @jackwener/opencli/* imports only — never add third-party package imports
  5. Test after patching — run the command again to verify

Step 5: Verify the Fix

bash
# Run the command normally (without diagnostic mode)
opencli <site> <command> [args...]

If it still fails, go back to Step 1 and collect fresh diagnostics. You have a budget of 3 repair rounds (diagnose → fix → retry). If the same error persists after a fix, try a different approach. After 3 rounds, stop and report what was tried.

When to Stop

Hard stops (do not modify code):

  • AUTH_REQUIRED / BROWSER_CONNECT — environment issue, not adapter bug
  • Site requires CAPTCHA — can't automate this
  • Rate limited / IP blocked — not an adapter issue

Soft stops (report after attempting):

  • 3 repair rounds exhausted — stop, report what was tried and what failed
  • Feature completely removed — the data no longer exists
  • Major redesign — needs full adapter rewrite via opencli-explorer skill

In all stop cases, clearly communicate the situation to the user rather than making futile patches.

Example Repair Session

1. User runs: opencli zhihu hot
   → Fails: SELECTOR "Could not find element: .HotList-item"

2. AI runs: OPENCLI_DIAGNOSTIC=1 opencli zhihu hot 2>diag.json
   → Gets RepairContext with DOM snapshot showing page loaded

3. AI reads diagnostic: snapshot shows the 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 RepairContext.adapter.sourcePath — replace ".HotList-item" with ".HotItem"

6. AI verifies: opencli zhihu hot
   → Success: returns hot topics

© joeseesun, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in qiaomu-opencli-autofix of joeseesun/qiaomu-opencli-skills.

Open the folder on GitHubat commit 4d9a08e

Compare with similar skills

Qiaomu Opencli Autofix next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Qiaomu Opencli Autofix compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Qiaomu Opencli Autofix this skilljoeseesun/qiaomu-opencli-skills993—~2.4kAutomated safety check: PassMIT
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT
Nestjs Best Practicesrolling-scopes/rsschool-app10k6 repos~1.2kAutomated safety check: PassMIT
Sub2API AdminWei-Shaw/sub2api44k1 repos~717Automated safety check: PassLGPL-3.0
Firecrawl Build Onboardingfirecrawl/firecrawl190k1 repos~1.4kAutomated safety check: NotesISC
Obsidian BasesAtmosphere/atmosphere3.8k22 repos~3.2kAutomated safety check: PassApache-2.0

Similar skills

  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Nestjs Best Practices

    rolling-scopes/rsschool-app

    NestJS best practices and architecture patterns for building production-ready applications.

    10k GitHub starsUsed in 6 repos~1.2k tokens
    Backend & APIsAuto-check passed
  • Sub2API Admin

    Wei-Shaw/sub2api

    Manages a Sub2API deployment from the command line: accounts, redeem and invitation codes, groups, proxies, imports, exports and raw admin API calls.

    44k GitHub starsUsed in 1 repo~717 tokens
    Backend & APIsAuto-check passed
  • Firecrawl Build Onboarding

    firecrawl/firecrawl

    Gets Firecrawl working in a project: signs you in through the browser, saves FIRECRAWL_API_KEY to .env and picks the first SDK or REST path.

    190k GitHub starsUsed in 1 repo~1.4k tokens
    Backend & APIsAuto-check: notes
  • Obsidian Bases

    Atmosphere/atmosphere

    Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries.

    3.8k GitHub starsUsed in 22 repos~3.2k tokens
    Backend & APIsAuto-check passed
  • Fortify Development

    coollabsio/coolify

    ACTIVATE when the user works on authentication in Laravel. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 4 repos~1.9k tokens
    Backend & APIsAuto-check passed

More from joeseesun/qiaomu-opencli-skills

  • Qiaomu Opencli Oneshot

    joeseesun/qiaomu-opencli-skills

    A skill your agent uses when quickly generating a single OpenCLI command from a specific URL and goal description.

    993 GitHub stars~1.4k tokensUpdated 6 mo ago
    Auto-check passed
  • Qiaomu Opencli Usage

    joeseesun/qiaomu-opencli-skills

    A skill your agent uses when running OpenCLI commands to interact with websites (Bilibili, Twitter, Reddit, Xiaohongshu, etc.), desktop apps (Cursor, Notion), or public APIs (HackerNews, arXiv).

    993 GitHub stars~3k tokensUpdated 6 mo ago
    Auto-check passed
  • Qiaomu Opencli Explorer

    joeseesun/qiaomu-opencli-skills

    A skill your agent uses when creating a new OpenCLI adapter from scratch, adding support for a new website or platform, exploring a site's API endpoints via browser DevTools, or when a user asks to…

    993 GitHub stars~6.4k tokensUpdated 6 mo ago
    Auto-check passed
  • Qiaomu Opencli Browser

    joeseesun/qiaomu-opencli-skills

    Make websites accessible for AI agents. An agent skill from joeseesun/qiaomu-opencli-skills.

    993 GitHub stars~3.4k tokensUpdated 6 mo ago
    Auto-check passed

Categories

Questions about Qiaomu Opencli Autofix

What does Qiaomu Opencli Autofix do?

Automatically fix broken OpenCLI adapters when commands fail. Qiaomu Opencli Autofix is an agent skill from joeseesun/qiaomu-opencli-skills. Automatically fix broken OpenCLI adapters when commands fail.

When should I use Qiaomu Opencli Autofix?

Qiaomu Opencli Autofix fits situations like: backend & APIs work in your project.

How do I install Qiaomu Opencli Autofix in Claude Code?

Run `npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a claude-code`. Or copy the skill folder (qiaomu-opencli-autofix in joeseesun/qiaomu-opencli-skills) into .claude/skills/qiaomu-opencli-autofix in your project. Claude Code loads it when a task matches its description.

How do I install Qiaomu Opencli Autofix in Codex?

Run `npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a codex`. Or copy the skill folder (qiaomu-opencli-autofix in joeseesun/qiaomu-opencli-skills) into .agents/skills/qiaomu-opencli-autofix in your project. Codex loads it when a task matches its description.

Can I use Qiaomu Opencli Autofix in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/qiaomu-opencli-autofix, .gemini/skills/qiaomu-opencli-autofix, .github/skills/qiaomu-opencli-autofix and .opencode/skills/qiaomu-opencli-autofix in your project.

What does Qiaomu Opencli Autofix need to run?

SKILL.md names no scripts, command-line tools or credentials: Qiaomu Opencli Autofix is instructions for the agent only. Its frontmatter pre-approves these tools: Bash(opencli:*), Read, Edit, Write.

Does Qiaomu Opencli Autofix access the network?

SKILL.md names 1 domain. In commands or code: zhihu.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Qiaomu Opencli Autofix safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Qiaomu Opencli Autofix use?

Qiaomu Opencli Autofix is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Qiaomu Opencli Autofix use?

About 2.4k tokens (SKILL.md is roughly 9.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Qiaomu Opencli Autofix?

Skills that share tags, products or a category with Qiaomu Opencli Autofix: Configuring Horizon (coollabsio/coolify, 63k stars), Nestjs Best Practices (rolling-scopes/rsschool-app, 10k stars), Sub2API Admin (Wei-Shaw/sub2api, 44k stars) and Firecrawl Build Onboarding (firecrawl/firecrawl, 190k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Qiaomu Opencli Autofix?

joeseesun (a GitHub user) maintains it in joeseesun/qiaomu-opencli-skills, which has 993 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on April 9, 2026.

Source: joeseesun/qiaomu-opencli-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.