Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/wopal-cn-cnb-pr-diff
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/cnb-pr-diff
What's inside
- Skill name
cnb-pr-diff- Description
- 获取 PR 的 diff 变更信息。
- License
- MIT
- Instructions
- 93 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (2)
- README.md
- SKILL.md
SKILL.md (first lines)
# 获取 PR Diff
获取 PR 的代码变更差异信息,用于代码评审、变更总结等场景。
## 1. 判断场景并获取 SHA
### 场景 A:PR 评论触发(`CNB_PULL_REQUEST_IID` 存在)
直接从环境变量获取:
- head SHA:`CNB_PULL_REQUEST_SHA`
- target SHA:`CNB_PULL_REQUEST_TARGET_SHA`
若环境变量不存在,通过 API 查询当前 PR 详情。
### 场景 B:Issue 或其他场景引用 PR
用户输入中提及了 PR 编号(如 `!45`),需要:
1. 从用户输入中解析 PR 编号
2. 通过 API 查询该 PR 详情获取 SHA
3. fetch 对应的 commit(本地可能没有)
### API 查询 PR 详情
```bash
# 将 ${pr_iid} 替换为实际 PR 编号
pr_info=$(curl -s \
"${CNB_API_ENDPOINT:-https://api.cnb.cool}/${CNB_REPO_SLUG}/-/pulls/${pr_iid}" \
-H "Accept: application/vnd.cnb.api+json" \
-H "Authorization: Bearer $CNB_TOKEN")
head_sha=$(echo "$pr_info" | jq -r '.head.sha')
target_sha=$(echo "$pr_info" | jq -r '.base.sha')
# 场景 B 需要确保本地有这些 commit
git fetch origin "$head_sha" "$target_sha" 2>/dev/null || git fetch origin
```
## 2. 获取 Diff
### 获取变更文件列表
```bash
git diff --name-only "${target_sha}...${head_sha}"
```
### 获取变更统计
```bash
git diff --stat "${target_sha}...${head_sha}"
```
### 获取完整 Diff
```bash
git diff -U5 "${target_sha}...${head_sha}"
```
### 获取特定文件的 Diff
```bash
git diff -U5 "${target_sha}...${head_sha}" -- path/to/file.ts
```
## 3. 过滤文件
根据使用场景,可排除无需关注的文件:
```bash
# 常见排除模式
git diff -U5 "${target_sha}...${head_sha}" -- . \
':!package-lock.json' ':!yarn.lock' ':!pnpm-lock.yaml' ':!go.sum' ':!*.lock' \
':!*.png' ':!*.jpg' ':!*.gif' ':!*.svg' ':!*.ico' \
':!*.min.js' ':!*.min.css' ':!*.map' \
':!dist/*' ':!build/*' ':!node_modules/*'
```
**可排除的文件类型**:
- 锁文件:`package-lock.json`、`yarn.lock`、`pnpm-lock.yaml`、`go.sum`、`Cargo.lock`
- 图片/字体:`*.png`、`*.jpg`、`*.gif`、`*.svg`、`*.woff`、`*.ttf`
- 二进制:`*.exe`、`*.dll`、`*.so`、`*.jar`、`*.pyc`
- 压缩包:`*.zip`、`*.tar.gz`、`*.rar`
- 构建产物:`dist/`、`build/`、`out/`、`target/`、`.next/`
- 依赖目录:`node_modules/`、`vendor/`、`.venv/`
- 压缩文件:`*.min.js`、`*.min.css`、`*.map`
## 4. 使用建议
1. **diff 过大时**:先用 `--name-only` 查看文件列表,再按需获取具体文件
2. **代码评审**:建议排除锁文件、图片、构建产物
3. **变更总结**:可保留更多文件,但排除二进制和依赖目录
4. **上下文行数**:`-U5` 提供 5 行上下文,可按需调整From wopal-cn/wopal-space-ontology, MIT.
More from wopal-cn/wopal-space-ontology
- 0.609score
cordis-composition-reference
wopal-cn
Use when writing or reading a Cordis bundle patch or agent preset for this harness and you need the Loader YAML dialect (insert, override by id, group…
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
agents-collab
wopal-cn
Foundation rules for how Wopal collaborates with sub-agents such as fae and rook.
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
cordis-plugin-development
wopal-cn
Use when designing, reviewing, adding, enabling, disabling, installing, configuring, or debugging a plugin, bundle, feature, page, panel, tool, or MCP…
SkillAFreshness: A★ 3Claude Code +9 - 0.605score
automating-mail
wopal-cn
Automates Apple Mail via JXA with AppleScript dictionary discovery.
SkillAFreshness: A★ 3Claude Code +9 - 0.604score
editing-cordis-compositions
wopal-cn
Use when creating, changing, or validating an agent preset or other Cordis composition for this harness, including deciding host versus preset placement and…
SkillAFreshness: A★ 3Claude Code +9 - 0.600score
cnb-pipeline
wopal-cn
编写、修改、审查 .cnb.yml 流水线配置,诊断构建失败原因并优化性能。
SkillAFreshness: A★ 3Claude Code +9 - 0.599score
agent-experience
wopal-cn
Use when writing or changing a model-facing tool definition (name, description, parameter schema, or its system-prompt section), and when designing skills…
SkillAFreshness: A★ 3Claude Code +9 - 0.595score
cnb-docs
wopal-cn
查询 CNB 平台官方文档,覆盖代码托管、制品库、AI 助手、云原生构建等。
SkillAFreshness: A★ 3Claude Code +9 - 0.595score
cnb-api
wopal-cn
CNB 平台交互命令,支持代码仓库、Issue、PR、CI、制品库读写等操作。
SkillAFreshness: A★ 3Claude Code +9 - 0.595score
cnb-npc-delegate
wopal-cn
当任务复杂或需要特定专长时,主动召唤其他 NPC 协同工作。
SkillAFreshness: A★ 3Claude Code +9 - 0.595score
cnb-tapd-resource-fetcher
wopal-cn
获取 TAPD 资源(需求/缺陷/任务/迭代),支持从 TAPD 链接自动解析。
SkillAFreshness: A★ 3Claude Code +9 - 0.592score
cnb-code-review
wopal-cn
PR 代码评审,检查安全漏洞、Bug 和代码质量。
SkillAFreshness: A★ 3Claude Code +9
Signals
- Stars
- 3
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Sep 15, 2026 (1 month ago)
- Last release
- Oct 24, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/wopal-cn/wopal-space-ontology
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from wopal-cn
- 0.609score
cordis-plugin-development
wopal-cn
Use when designing, reviewing, adding, enabling, disabling, installing, configuring, or debugging a plugin, bundle, feature, page, panel, tool, or MCP…
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
agents-collab
wopal-cn
Foundation rules for how Wopal collaborates with sub-agents such as fae and rook.
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
cordis-composition-reference
wopal-cn
Use when writing or reading a Cordis bundle patch or agent preset for this harness and you need the Loader YAML dialect (insert, override by id, group…
SkillAFreshness: A★ 3Claude Code +9 - 0.605score
automating-mail
wopal-cn
Automates Apple Mail via JXA with AppleScript dictionary discovery.
SkillAFreshness: A★ 3Claude Code +9 - 0.604score
editing-cordis-compositions
wopal-cn
Use when creating, changing, or validating an agent preset or other Cordis composition for this harness, including deciding host versus preset placement and…
SkillAFreshness: A★ 3Claude Code +9 - 0.600score
cnb-pipeline
wopal-cn
编写、修改、审查 .cnb.yml 流水线配置,诊断构建失败原因并优化性能。
SkillAFreshness: A★ 3Claude Code +9
Cite this page
cnb-pr-diff skill. Agent Mart. https://agentmart.dev/skills/wopal-cn-cnb-pr-diff (last updated 2026-10-24)