同步检测 skill

仓库地址

  1. fork 仓库 : https://gitcode.com/XieQianyi/cannbot-skills/tree/ascendc-sync-audit-v8/ops/ascendc-sync-audit

  2. 源仓库 (预计合入后) : https://gitcode.com/cann/cannbot-skills/tree/master/ops/ascendc-sync-audit


安装 skill

前置条件

条件 说明
AI 编程工具 OpenCode / Claude Code / Trae / Cursor / Copilot / CodeArts 任选其一
Python 3 skill 脚本依赖 Python3,零第三方 pip 包(纯正则实现,无需 pip install)
Node.js 18+ 仅使用 install-helper 时需要;npx skills 方式同样需要

方式一:install-helper(合并后推荐)

安装 install-helper 工具:

# Linux / macOS
curl -fsSL https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.sh | bash

# 或通过 npm(全平台)
npm install -g @cannbot-ai/install-helper

安装 ascendc-sync-audit skill:

# 交互式向导(推荐首次使用)
install-helper

# 或直接指定
install-helper install ascendc-sync-audit --tool opencode

# 全局安装(跨项目复用)
install-helper install ascendc-sync-audit --tool opencode --level global

--tool 可替换为 claude / trae / cursor / copilot / codearts

方式二:Agent Skills 标准安装(合并后)

本仓库 Skills 遵循 Agent Skills 开放标准,支持 70+ 种 AI 编程工具:

# 浏览可用 Skills
npx skills add https://gitcode.com/cann/cannbot-skills.git --list

# 安装单个 Skill
npx skills add https://gitcode.com/cann/cannbot-skills.git --skill ascendc-sync-audit --agent opencode

# 查看已安装
npx skills list

方式三:从 Fork 分支手动安装(合并前体验)

skill 尚在 PR 审阅中,想提前体验可以从 fork 分支安装:

# 1. 克隆 fork 仓库
git clone -b ascendc-sync-audit-v8 https://gitcode.com/XieQianyi/cannbot-skills.git
cd cannbot-skills

# 2. 用 install-helper 从本地路径安装
install-helper install ascendc-sync-audit --tool opencode

# 或用 npx skills 从本地路径安装
npx skills add . --skill ascendc-sync-audit --agent opencode

方式三 a:opencode.json 声明路径(推荐,无需 Node.js)

如果你用 OpenCode,最简单的方式是在项目根目录的 opencode.json 中声明 skill 路径,无需 install-helper 或 symlink:

{
  "$schema": "https://opencode.ai/config.json",
  "skills": {
    "paths": [
      "/你的克隆路径/cannbot-skills/ops/ascendc-sync-audit"
    ]
  }
}

OpenCode 启动时会自动加载 skills.paths 指向的 skill 文件夹。该字段是 OpenCode 官方配置项,支持声明多个路径。

方式三 b:手动符号链接

如果没有 Node.js 且不使用 opencode.json,也可以手动创建符号链接:

# OpenCode 示例(项目级)
mkdir -p .opencode/skills
ln -s $(pwd)/ops/ascendc-sync-audit .opencode/skills/ascendc-sync-audit

# Claude Code 示例(项目级)
mkdir -p .claude/skills
ln -s $(pwd)/ops/ascendc-sync-audit .claude/skills/ascendc-sync-audit

OpenCode 会自动扫描 .opencode/skills/<name>/SKILL.md~/.config/opencode/skills/<name>/SKILL.md.claude/skills/<name>/SKILL.md 等目录。符号链接和 opencode.json skills.paths 两种方式择一即可,不需要同时使用。

验证安装

# install-helper 方式
install-helper list          # 应显示 ascendc-sync-audit 已安装

# npx skills 方式
npx skills list              # 应显示 ascendc-sync-audit

# 手动方式
ls -la .opencode/skills/ascendc-sync-audit   # symlink 方式
# 或检查 opencode.json 中 skills.paths 是否指向正确路径

使用

安装完成后,在 AI 编程工具中直接用自然语言触发:

/ascendc-sync-audit 检视 kernel.cpp 的同步有没有问题
  1. skill 会列举可能存在的同步错误 (1)(2)(3)... 序号列出。

alt text

  1. 人为检查后可选择修复的同步问题

alt text


例子展示

  1. https://gitcode.com/cann/ops-transformer/pull/4438/diffs

alt text

alt text

  1. https://gitcode.com/cann/ops-transformer/pull/3293/diffs

alt text

alt text

  1. https://gitcode.com/cann/ops-nn/pull/2502/diffs

alt text

alt text

alt text

alt text

  1. https://gitcode.com/cann/ops-nn/pull/2651/diffs

alt text

alt text


待改进

  • skill 运行检查时间不稳定,平均等待时间过长。

  • 复杂的同步问题无法处理


posted @ 2026-08-24 16:42  xqy2003  阅读(4)  评论(0)    收藏  举报