* feat(pages): add Docs page with search, markdown rendering, and i18n support - Add DocsPage with full-text search modal (⌘K trigger) - Add MarkdownRenderer with DOMPurify sanitization - Add bilingual docs content (en/zh) for all sections - Add shared headingId utility for consistent TOC anchors - Add search keyboard hints with i18n support - Update Navbar with Docs navigation link - Add icon-search.svg asset - Configure webpack for markdown imports * fix(pages): address PR #273 code review feedback - Replace marked.setOptions() with new Marked instance (no global mutation) - Escape heading ID attribute value to prevent XSS - Use crypto.randomUUID() for mermaid diagram IDs (no collisions) - Add cancellation flag for async mermaid renders on unmount - Move inline <pre> styles to CSS class (only dynamic align-items inline) - Move @types/dompurify to devDependencies - Remove @ts-nocheck from docs/index.ts - Extract getRawContent helper to reduce duplication - Fix searchDocs fallback consistency (add enDocs fallback) - Fix heading ID mismatch by stripping markdown links before ID generation - Separate sidebar chevron (expand) from label (navigate) - Guard ⌘K shortcut against input/textarea focus interception
4.6 KiB
| title | sidebar | ||
|---|---|---|---|
| Agent Skill |
|
Register OCR as a callable skill so an agent framework can invoke it with the right flags, prerequisite checks, and triage rubric — without you re-deriving any of that on the calling side.
What ships in the repo
The repo ships a SKILL manifest at
skills/open-code-review/SKILL.md.
It declares OCR as a callable skill, with prerequisite checks, an
invocation workflow, and a comment-triage rubric (High/Medium/Low).
Install
Option 1: npx skills add (recommended)
Run from inside the project where you want the skill available:
npx skills add alibaba/open-code-review --skill open-code-review
This pulls the manifest from the skills registry and drops it into the project so any coding agent that respects the skills convention picks it up on the next invocation. Re-run the command to update the skill to the latest version.
Prerequisite: the skill will install the
ocrCLI itself the first time it runs (vianpm install -g @alibaba-group/open-code-review) if the binary isn't onPATH— see What the skill does below. You do need an LLM configured up front; the skill cannot do that for you and will stop and ask. See Configuration.
Option 2: Manual copy (system-wide)
If you'd rather install the skill globally instead of per-project, copy the folder into your skills directory:
mkdir -p ~/.claude/skills
cp -R /path/to/open-code-review/skills/open-code-review ~/.claude/skills/
This makes the skill available to every project on the machine.
What the skill does
The SKILL.md is a prompt: when the calling agent loads it, the agent
itself executes the steps. End-to-end, a single /open-code-review
(or equivalent) request unfolds like this:
- Prerequisite check. Run
which ocrto confirm the CLI is onPATH, thenocr llm testto confirm an LLM is reachable. - Auto-install the CLI if missing. If
which ocrreports "NOT INSTALLED", the agent runsnpm install -g @alibaba-group/open-code-reviewand continues. No user prompt — this is treated as a routine setup step. - Stop and ask if no LLM is configured. If
ocr llm testfails, the agent will not invent credentials. It shows the user the two supported options (environment variables orocr config set …) and waits for the user to provide an API key. - Extract business context. Inspect the review target (commits,
branch, working copy) and synthesise a short
--backgroundstring. - Run the review. Invoke
ocr review --audience agent --background "…" [--commit | --from/--to], picking flags based on whether the user asked to review the working copy, a specific commit, or a branch range. - Classify and report. Group the JSON comments into High / Medium / Low using the rubric in SKILL.md (bugs and security issues are High; nitpicks and likely false positives are silently dropped), then render a Markdown summary.
- Fix on request. If the user said "review and fix" (or similar), apply safe fixes to High/Medium items inline; otherwise ask before touching the code.
The full prompt — including the exact triage rubric, output template,
and gotchas — lives in
skills/open-code-review/SKILL.md.
Edit your local copy if you want to tighten any of the above (e.g.,
flip the default to always-ask before fixing).
Anthropic Agent SDK
Point your SDK init at the installed skill path:
from anthropic_agent_sdk import Agent
agent = Agent(
skill_paths=["/path/to/open-code-review/skills/open-code-review"],
)
agent.run("Review my staged changes — focus on race conditions.")
The SDK loads the SKILL.md prompt and the agent executes the workflow
described in What the skill does — including
the npm install fallback and the prompt-for-credentials step if no
LLM is configured.
Other agent frameworks
Any framework with a "register external skill" surface can ingest the SKILL.md — it's just markdown with frontmatter. If your framework expects a different schema, the markdown body is still useful as a prompt template.
See Also
- Command(Claude Code Plugin) — the slash-command flavor of the same skill.
- Direct Subprocess — bypass the manifest and call the CLI yourself.