skills/opencli-sitemap-author/SKILL.md
--- name: opencli-sitemap-author description: Use when creating or maintaining OpenCLI site sitemaps: agent-facing navigation, page-state, action, workflow, API-reference, pitfall, and fallback knowledge for a website. Use after browser exploration discovers durable site context, when a sitemap is stale, or when promoting local site knowledge into the repo. allowed-tools: Bash(opencli:*), Read, Edit, Write, Grep --- # opencli-sitemap-author You are authoring a **task execution graph for agents
npx skillsauth add jackwener/opencli skills/opencli-sitemap-authorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are authoring a task execution graph for agents, not an SEO sitemap. The artifact should help an agent using opencli browser decide where it is, what path to take next, which OpenCLI adapter to prefer, and how to recover when the page disagrees with memory.
Keep the sitemap small and verified. Do not crawl a whole site. Capture only task-relevant paths that you actually observed.
Two layers:
sitemaps/<site>/ (top-level)~/.opencli/sites/<site>/sitemap/Local overlay wins by stable id. Write new discoveries to local first. Promote to global only after review.
Recommended layout:
sitemap/
SITE.md # site purpose, auth assumptions, stable page ids
pages/<page-id>.md # page state signatures, actions, linked APIs
pages/_<partial>.md # cross-page UI partial (e.g. _tweet_card.md)
workflows/<task-id>.md # best path, fallback path, avoid list
pitfalls.md # durable failure modes and stale areas
references/sitemap-schema.md §1.1 spec 硬 800 token,但 PoC 实测简单站单 page 1-2 action 自然落到 800-2000 token。强拆反碎,author 用下表决策:
spec 800 是 lazy-load 优化目标 + Phase 2 audit 阈值;下表是 author 实战决策辅助,不替代 spec hard 限制。超 800 的文件 audit 会 flag,author 解释("5 个 cohesive UI primitive 一起放")或拆。
| 文件 token | 决策 | |---|---| | < 1500 | 自然 size,不动 | | 1500-3000 | 看 cohesion — 5 个 cohesive UI primitive 一起放 OK;mixed 内容拆 | | > 3000 | 必拆 sub-file 或 partial(agent lazy load budget 真有限制) |
Phase 2 cron audit 按 token count 不按 byte count(CJK 中文 token-per-char 比 English 高 30-50%)。
opencli browser <session> state, find, network, and analyze; browser state is truth. If you just completed an opencli-adapter-author session for this site, start from the retained browse trace under ~/.opencli/sites/<site>/traces/ as seed evidence instead of re-discovering the path from zero.~/.opencli/sites/<site>/sitemap/... unless explicitly promoting to repo.Every action edge must include:
### action:<stable-id>
pre: <current page / state / auth requirements>
do: <agent action, adapter command, or semantic browser command>
post: <URL / state / output that proves success>
fail: <failure signal 1> | <signal 2>
recover: <fallback instruction>; adapter_health_update: <adapter> -> suspect
evidence: opencli browser <cmd> or trace:<path>
Use this compact form by default. Use the longer Markdown form from references/sitemap-schema.md only when an action genuinely needs long explanation. verified_at and source are inherited from file frontmatter; do not repeat them per action.
Do not promote an action without evidence. If a recovery path marks adapter_health_update, the browser-sitemap consumer must write that health update to the local overlay so the next agent does not retry a known-suspect adapter.
partial 文件 (_<name>.md,url_patterns: []) 装跨页 UI 原语(如 _tweet_card.md 的 like/reply/repost/bookmark)。被多 page 通过 action:<id> in pages/_<name>.md 引用。
Partial scope rule:partial 内所有 selector(testid / a11y / structural)必须 scoped 到 partial root,不能是 page-level first match。例如 _tweet_card.md:
# ❌ 错:page-level first match,会点到 timeline 首条非 target card
do: click [data-testid="like"]
# ✅ 对:scoped 到 article root
do: click [data-testid="like"] in article[role="article"] (card scope)
partial 文件顶部写明 scope root 一行:
## Card scope rule
所有 testid selector 必须 scoped 到 `article[role="article"]`,不能用 page-level first match。
Each workflow should answer:
opencli <site> <command> adapter if it covers the goal.Endpoint/API knowledge should reference ids from endpoints.json when available. Do not duplicate full endpoint schemas inside sitemap files.
on_adapter_fail: convention(推荐)Fallback path 第一行声明触发条件 + adapter_health_update directive,把"为什么走 fallback"和"标 adapter suspect"放一起:
on_adapter_fail:
- adapter_health_update: opencli twitter post -> suspect
- opencli browser state (verify current page)
- if not on /home: goto /home
- action:open_compose in pages/home.md
- ...
比纯 step list 清晰:consumption skill 看到 on_adapter_fail: key 知道这是 adapter-trigger 而非 entry-point fallback,directive 先执行后续才走 steps。schema v1.2 candidate,目前作为 SKILL guideline 推荐。
Top-level routes — 标 uncovered routesSITE.md 的 Top-level routes 不仅列已覆盖的 page,也应显式标存在但 sitemap 不导航的 route,避免 agent 默认"sitemap 没列 → 不存在":
## Top-level routes
- /home → pages/home.md
- /search → pages/search.md
- /messages → pages/messages.md(DM,本 PoC v1 不覆盖) # ← 显式 uncovered marker
- /settings → 不在 sitemap scope,agent 自探 # ← 同上
不写 = agent 不知该 route 存在;写 + 标 uncovered = agent 知道存在但 sitemap 帮不上忙,自己探。
[17] as durable targets. Store semantic anchors and recovery instructions.draft or stale labels.sitemap/draft-<topic>.md, not ~/.opencli/sites/<site>/sitemap.draft.md at the parent level — the latter is invisible to opencli browser sitemap availability detection.See references/sitemap-schema.md for the full field-level spec — SITE.md / pages/<id>.md / workflows/<id>.md / apis.md / pitfalls.md schemas, action-level state signatures, adapter_health enum (healthy / suspect / broken), endpoint reference rules, two-layer overlay semantics, draft placement, and Phase 2 validation rules.
tools
Use when driving a website with opencli browser and sitemap context is available, requested, or needed to avoid blind navigation. Guides agents to consume site sitemap files lazily, choose adapter/browser fallback paths, resume from state signatures, and mark stale sitemap entries without trusting them over live browser state.
tools
Use when writing an OpenCLI adapter for a new site or adding a new command to an existing site. Guides end-to-end from first recon through field decoding, adapter coding, and verify. Replaces opencli-oneshot / opencli-explorer. For ad-hoc browser driving (no adapter), see opencli-browser instead; for a top-level orientation to opencli, see opencli-usage.
tools
Use at the start of any OpenCLI session — this is the top-level map of what `opencli` can do, how to discover adapters, what flags and output formats are universal, and which specialized skill to load next. Point here when an agent asks "what can opencli do?" or "how do I find the right command?".
tools
Use when an agent needs to drive a real Chrome window via opencli — inspect a page, fill forms, click through logged-in flows, or extract data ad-hoc. Covers the selector-first target contract, compound form fields, stale-ref handling, network capture, and the agent-native envelopes the CLI returns. Not for writing adapters — see opencli-adapter-author for that.