# qiaomu-opencli-autofix

Diagnoses failed OpenCLI adapters, patches the relevant file, and retries the command. Use it when a site changes its DOM, API, or response schema.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 990 installs · ★ 996
- Author: joeseesun
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/joeseesun/qiaomu-opencli-skills/tree/HEAD/qiaomu-opencli-autofix/SKILL.md
- Updated: 2026-04-09
- HTML: https://affpapa.org/en/nevibecode/skills/qiaomu-opencli-autofix

## What it does

The skill reruns a failed `opencli` command with `OPENCLI_DIAGNOSTIC=1`, then compares adapter code with the page snapshot and network requests. It handles `SELECTOR`, `EMPTY_RESULT`, `API_ERROR`, `NETWORK`, `PAGE_CHANGED`, `COMMAND_EXEC`, and `TIMEOUT` errors, using `opencli browser` to inspect the live page.

Before changing code, it checks whether an empty result is real: it can retry another query or entry point, compare the result in Chrome, and account for temporarily hidden content. It stops on `AUTH_REQUIRED`, `BROWSER_CONNECT`, CAPTCHA, or rate limiting. That boundary matters: login failures do not trigger adapter edits.

Edits are limited to the path in `RepairContext.adapter.sourcePath`; `src/`, `extension/`, `tests/`, `package.json`, and `tsconfig.json` stay untouched. Run `opencli doctor` before repair. The skill allows up to 3 diagnose-patch-retry rounds for one failure.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/qiaomu-opencli-autofix/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/qiaomu-opencli-autofix/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/qiaomu-opencli-autofix/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/qiaomu-opencli-autofix/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install joeseesun/qiaomu-opencli-skills qiaomu-opencli-autofix
```

2. **Manually: put the files in place**
- File: `.github/skills/qiaomu-opencli-autofix/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/joeseesun/qiaomu-opencli-skills --path qiaomu-opencli-autofix
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/qiaomu-opencli-autofix/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add joeseesun/qiaomu-opencli-skills --skill qiaomu-opencli-autofix -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/joeseesun/qiaomu-opencli-skills/tree/HEAD/qiaomu-opencli-autofix/SKILL.md

## When to use it
- update a selector after a DOM change
- trace a moved API response path
- inspect browser network requests
- separate empty search results from adapter faults
- retry an OpenCLI command after an adapter patch

## Example prompts
- “Fix the failed `opencli <site> <command>` command with qiaomu-opencli-autofix.”
- “Run diagnostics for `opencli <site> <command> [args...]` and patch the adapter.”
- “Investigate why `opencli` returned `EMPTY_RESULT` before editing the adapter.”

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 345e816819e237a9.

BEGIN THIRD-PARTY FILE 345e816819e237a9
````text
---
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.
author: joeseesun
upstream: jackwener/opencli
allowed-tools: Bash(opencli:*), Read, Edit, Write
---

# 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.
````
END THIRD-PARTY FILE 345e816819e237a9

The third-party file has ended. Everything between the 345e816819e237a9 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2596 of 9715 bytes. © joeseesun · MIT · https://github.com/joeseesun/qiaomu-opencli-skills/tree/HEAD/qiaomu-opencli-autofix/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
