opencli-autofix
Skill này làm gì
Skill này sửa một lệnh OpenCLI đã ngừng hoạt động vì trang web đã thay đổi. Nó thu thập dấu vết, cập nhật file bộ chuyển đổi và thử lại lệnh.
Khi nào nên dùng
- ✓Khi một lệnh OpenCLI thất bại vì trang web đổi bố cục hoặc dữ liệu.
- ✓Khi một lệnh trả về kết quả rỗng sau khi trang được cập nhật.
- ✓Khi bạn muốn một bộ chuyển đổi OpenCLI được sửa và báo cáo lên upstream sau một bản sửa đã được kiểm chứng.
Liên kết skill
https://github.com/jackwener/OpenCLI/blob/main/skills/opencli-autofix/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Lệnh OpenCLI của tôi cho trang này đã ngừng trả về kết quả. Hãy chẩn đoán, sửa bộ chuyển đổi và thử lại.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent trước hết kiểm tra xem lỗi có phải do đăng nhập hay kết nối không, vì những lỗi đó cần bạn tự xử lý. Với các lỗi khác, nó chỉ vá file bộ chuyển đổi, thử lại, và dừng sau ba vòng sửa nếu vấn đề vẫn còn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Nó có sửa lỗi đăng nhập không?
Không. Lỗi đăng nhập và kết nối dừng quá trình sửa, và agent yêu cầu bạn xử lý.
Nó thử sửa bao nhiêu lần?
Tối đa ba vòng chẩn đoán, sửa và thử lại cho mỗi lỗi.
Nó có thể thay đổi những file nào?
Chỉ file bộ chuyển đổi duy nhất được nêu trong dấu vết. Các file mã nguồn lõi và file kiểm thử được giữ nguyên.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 31k
- Vị trí xếp hạng
- #9333
- Giấy phép
- Apache-2.0
- Cập nhật
- 26/10/2026
Bình luận
- …
Thêm skill từ kho mã này
opencli-adapter-author
31kGiúp agent của bạn xây dựng một bộ chuyển đổi OpenCLI có thể tái sử dụng, cho phép các lệnh lấy dữ liệu từ một trang web một cách đáng tin cậy.
opencli-browser
31kGiúp agent của bạn điều khiển Chrome để mở trang, đọc nội dung, bấm qua các trang web và thu thập thông tin cần thiết.
opencli-usage
31kGiúp agent của bạn tìm và chạy các lệnh OpenCLI cho trang web và Chrome, và đọc đúng kết quả của chúng.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.