Skip to content

Commit 6481c00

Browse files
committed
Add CI, MIT license, and Claude Code usage docs
1 parent bee0f38 commit 6481c00

6 files changed

Lines changed: 272 additions & 1 deletion

File tree

.github/workflows/validate.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Validate Skill
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Install dependencies
22+
run: python3 -m pip install pyyaml
23+
24+
- name: Validate skill
25+
run: python3 scripts/validate_skill.py

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 GloriaGuo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This skill gives Codex a read-first, agent-safe operating path so it can:
4444
- [references/practical-scenarios.md](./references/practical-scenarios.md): detailed scenario manual
4545
- [references/troubleshooting.md](./references/troubleshooting.md): common failures and fixes
4646
- [examples/README.md](./examples/README.md): example prompts and command recipes
47+
- [examples/claude-code.md](./examples/claude-code.md): Claude Code installation and prompt examples
48+
- [scripts/validate_skill.py](./scripts/validate_skill.py): portable validation script for CI and local checks
4749

4850
## Install
4951

@@ -59,6 +61,44 @@ Or copy the folder contents manually into:
5961
${CODEX_HOME:-$HOME/.codex}/skills/opencli
6062
```
6163

64+
## Use In Codex
65+
66+
Once installed, ask Codex naturally or invoke the skill explicitly:
67+
68+
```text
69+
Use $opencli to inspect the installed OpenCLI surface and fetch the Bilibili hot list.
70+
```
71+
72+
```text
73+
Use $opencli to troubleshoot why my Zhihu command returns empty data.
74+
```
75+
76+
Codex-oriented installation path:
77+
78+
```bash
79+
git clone git@github.com:GloriaGuo/opencli-skill.git "${CODEX_HOME:-$HOME/.codex}/skills/opencli"
80+
```
81+
82+
## Use In Claude Code
83+
84+
Claude Code skills typically live under `~/.claude/skills`. Copy or clone this repository there:
85+
86+
```bash
87+
git clone git@github.com:GloriaGuo/opencli-skill.git ~/.claude/skills/opencli
88+
```
89+
90+
Then ask Claude Code in natural language or reference the skill explicitly:
91+
92+
```text
93+
Use $opencli to run a safe read-first OpenCLI workflow for this task.
94+
```
95+
96+
```text
97+
Use $opencli to inspect the local OpenCLI setup and tell me whether the Codex and Cursor adapters are available.
98+
```
99+
100+
Claude Code usage examples are collected in [examples/claude-code.md](./examples/claude-code.md).
101+
62102
## Recommended OpenCLI Setup
63103

64104
```bash
@@ -115,7 +155,7 @@ opencli bilibili download BV1xxx --output ./bilibili
115155
## Validation
116156

117157
```bash
118-
python3 /Users/ruiguo/.codex/skills/.system/skill-creator/scripts/quick_validate.py .
158+
python3 scripts/validate_skill.py
119159
```
120160

121161
## 中文说明
@@ -145,6 +185,8 @@ python3 /Users/ruiguo/.codex/skills/.system/skill-creator/scripts/quick_validate
145185
- [references/practical-scenarios.md](./references/practical-scenarios.md):详细实用场景手册
146186
- [references/troubleshooting.md](./references/troubleshooting.md):常见故障排查
147187
- [examples/README.md](./examples/README.md):可直接照抄的 prompt 和命令示例
188+
- [examples/claude-code.md](./examples/claude-code.md):Claude Code 安装与调用示例
189+
- [scripts/validate_skill.py](./scripts/validate_skill.py):本地与 CI 通用的校验脚本
148190

149191
## 安装方式
150192

@@ -158,6 +200,44 @@ git clone git@github.com:GloriaGuo/opencli-skill.git "${CODEX_HOME:-$HOME/.codex
158200
${CODEX_HOME:-$HOME/.codex}/skills/opencli
159201
```
160202

203+
## 在 Codex 里怎么用
204+
205+
安装后,可以自然描述任务,也可以显式提到 `$opencli`
206+
207+
```text
208+
Use $opencli to inspect the installed OpenCLI surface and fetch the Bilibili hot list.
209+
```
210+
211+
```text
212+
Use $opencli to troubleshoot why my Zhihu command returns empty data.
213+
```
214+
215+
Codex 默认安装路径:
216+
217+
```bash
218+
git clone git@github.com:GloriaGuo/opencli-skill.git "${CODEX_HOME:-$HOME/.codex}/skills/opencli"
219+
```
220+
221+
## 在 Claude Code 里怎么用
222+
223+
Claude Code 的 skill 通常放在 `~/.claude/skills` 下,可以这样安装:
224+
225+
```bash
226+
git clone git@github.com:GloriaGuo/opencli-skill.git ~/.claude/skills/opencli
227+
```
228+
229+
然后直接用自然语言,或者显式提到 `$opencli`
230+
231+
```text
232+
Use $opencli to run a safe read-first OpenCLI workflow for this task.
233+
```
234+
235+
```text
236+
Use $opencli to inspect the local OpenCLI setup and tell me whether the Codex and Cursor adapters are available.
237+
```
238+
239+
更完整的 Claude Code 示例见 [examples/claude-code.md](./examples/claude-code.md)
240+
161241
## 推荐的 OpenCLI 环境准备
162242

163243
```bash
@@ -210,3 +290,9 @@ opencli bilibili download BV1xxx --output ./bilibili
210290
- 以本机安装版本的命令面为准,不盲信旧文档
211291
- agent 消费优先 `json`,人工查看优先 `yaml`
212292
- 浏览器登录态是第一优先级依赖
293+
294+
## 校验
295+
296+
```bash
297+
python3 scripts/validate_skill.py
298+
```

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
This folder contains practical prompts and command recipes you can copy into Codex or run directly.
44

55
- [agent-prompts.md](./agent-prompts.md): user-style prompts that should trigger the skill
6+
- [claude-code.md](./claude-code.md): Claude Code installation and invocation examples
67
- [command-recipes.md](./command-recipes.md): reusable command recipes grouped by workflow

examples/claude-code.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Claude Code Usage
2+
3+
This document shows how to install and use the OpenCLI skill in Claude Code.
4+
5+
## Install
6+
7+
Clone this repository into Claude Code's skills directory:
8+
9+
```bash
10+
git clone git@github.com:GloriaGuo/opencli-skill.git ~/.claude/skills/opencli
11+
```
12+
13+
If the folder already exists, update it:
14+
15+
```bash
16+
cd ~/.claude/skills/opencli
17+
git pull
18+
```
19+
20+
## Triggering The Skill
21+
22+
Claude Code can often pick the skill from context, but explicit invocation is more reliable:
23+
24+
```text
25+
Use $opencli to inspect the local OpenCLI setup and run the correct command.
26+
```
27+
28+
## Example Prompts
29+
30+
### Browser-backed sites
31+
32+
```text
33+
Use $opencli to fetch the top 10 Bilibili hot videos as JSON.
34+
```
35+
36+
```text
37+
Use $opencli to search Zhihu for "Android 性能优化" and summarize the top results.
38+
```
39+
40+
### Desktop adapters
41+
42+
```text
43+
Use $opencli to inspect the local OpenCLI setup and tell me whether Codex and Cursor adapters are available.
44+
```
45+
46+
```text
47+
Use $opencli to read the current Codex desktop conversation and summarize the latest progress.
48+
```
49+
50+
### Troubleshooting
51+
52+
```text
53+
Use $opencli to diagnose why my browser-backed command is returning empty data.
54+
```
55+
56+
```text
57+
Use $opencli to compare the installed OpenCLI command surface with the README and tell me what is actually available.
58+
```
59+
60+
## Recommended Prompt Pattern
61+
62+
The most reliable structure is:
63+
64+
1. mention `$opencli`
65+
2. describe the target site or app
66+
3. state the expected output format or outcome
67+
4. ask for read-first behavior if the task could become write-capable
68+
69+
Example:
70+
71+
```text
72+
Use $opencli to inspect the installed command surface, then run a read-first workflow against Zhihu and return JSON only.
73+
```

scripts/validate_skill.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env python3
2+
"""Portable validator for this skill repository."""
3+
4+
from __future__ import annotations
5+
6+
from pathlib import Path
7+
import sys
8+
9+
try:
10+
import yaml
11+
except ImportError as exc: # pragma: no cover
12+
print(f"Missing dependency: {exc}. Install with `python3 -m pip install pyyaml`.")
13+
sys.exit(1)
14+
15+
16+
ROOT = Path(__file__).resolve().parent.parent
17+
SKILL = ROOT / "SKILL.md"
18+
OPENAI_YAML = ROOT / "agents" / "openai.yaml"
19+
20+
21+
def fail(message: str) -> None:
22+
print(f"ERROR: {message}")
23+
sys.exit(1)
24+
25+
26+
def load_frontmatter(text: str) -> dict:
27+
if not text.startswith("---\n"):
28+
fail("SKILL.md is missing YAML frontmatter.")
29+
parts = text.split("---\n", 2)
30+
if len(parts) < 3:
31+
fail("SKILL.md frontmatter is malformed.")
32+
return yaml.safe_load(parts[1]) or {}
33+
34+
35+
def main() -> None:
36+
if not SKILL.exists():
37+
fail("SKILL.md not found.")
38+
if not OPENAI_YAML.exists():
39+
fail("agents/openai.yaml not found.")
40+
41+
frontmatter = load_frontmatter(SKILL.read_text())
42+
allowed_keys = {"name", "description"}
43+
extra = set(frontmatter) - allowed_keys
44+
if extra:
45+
fail(f"Unexpected frontmatter keys: {sorted(extra)}")
46+
47+
if not frontmatter.get("name"):
48+
fail("Frontmatter `name` is required.")
49+
if not frontmatter.get("description"):
50+
fail("Frontmatter `description` is required.")
51+
52+
if not str(frontmatter["name"]).replace("-", "").isalnum():
53+
fail("Frontmatter `name` must use letters, digits, and hyphens only.")
54+
55+
openai = yaml.safe_load(OPENAI_YAML.read_text()) or {}
56+
interface = openai.get("interface", {})
57+
for key in ("display_name", "short_description", "default_prompt"):
58+
if not interface.get(key):
59+
fail(f"`agents/openai.yaml` is missing interface.{key}")
60+
61+
print("Skill is valid!")
62+
63+
64+
if __name__ == "__main__":
65+
main()

0 commit comments

Comments
 (0)