Skip to content

[Coding Agent] Update API Compatibility Claude Code Skills#7901

Merged
zhwesky2010 merged 2 commits into
PaddlePaddle:developfrom
zhwesky2010:claude
May 12, 2026
Merged

[Coding Agent] Update API Compatibility Claude Code Skills#7901
zhwesky2010 merged 2 commits into
PaddlePaddle:developfrom
zhwesky2010:claude

Conversation

@zhwesky2010
Copy link
Copy Markdown
Collaborator

@zhwesky2010 zhwesky2010 commented Apr 30, 2026

深度调优《Paddle API 对齐 PyTorch 项目》 SKILL 体系

本 PR 对《Paddle API 对齐 PyTorch 项目》下所有 7 个 Coding Agent Skill 文档进行了系统性重构与增强,提升文档规范性、信息完整性和 Agent 执行准确率。

主要变更

/api-change-decider(改动最大)

  • 重写 Step 1 差异信息获取逻辑,改为三级优先级短路策略(差异文档 → 转写配置 → 网络搜索),新增详细的字段映射说明表
  • 补全方案 2(C++ 下沉)的 5 条适用条件,附正反示例,明确"仅多 out 参数"的精确定义
  • 将决策流程图从 7 类扩展至覆盖全部 13 种差异分类,修正各分类下的方案优先级和回退路径
  • 新增「四、常见问题处理」和「五、注意事项」章节

/api-compatibility(整体统筹 Skill)

  • 新增 allowed-tools 字段;引入 ${ROOT_DIR} 变量统一路径表示
  • 将「执行逻辑」前置,重组「整体工作流程」,简化每个 Step 描述
  • 新增「六、各 Skill 说明」汇总表 和「七、自进化机制」章节

/cpp-sink/python-decorator

  • 移除 allowed-tools 中的不可见字符;补充 context: fork / background: false / verbose: true
  • 展开原来"参考 Step X"的省略描述为明确的独立步骤
  • python-decorator 新增「场景决策表」,方便 Agent 快速判断使用通用别名装饰器还是专用装饰器
  • 移除冗长的「调试技巧」章节,替换为更简洁的「常见问题处理(FAQ)」格式

/api-docs-updater/pytorch-alignment-validator

  • 移除 frontmatter 中的冗余字段(context, background, verbose
  • 统一路径格式为 ${ROOT_DIR}/...,修正别名说明位置描述(句号前)
  • 重组注意事项,新增「常见问题处理」章节

/create-pr

  • Step 1 补充具体 bash 命令,新增「只对有改动的仓库提交」判断逻辑
  • 新增 Step 2「获取 PyTorch API 名单」,定义 4 个来源渠道并取并集
  • git add -A 改为 git add -u,避免意外提交未跟踪文件

Copilot AI review requested due to automatic review settings April 30, 2026 12:36
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 30, 2026

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7901.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

📚 本次 PR 文档预览链接(点击展开)
ℹ️ 预览提醒
请等待 Docs-NEW 流水线运行完成后再点击预览链接,否则可能会看到旧版本内容或遇到链接无法访问的情况。
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-change-decider/SKILL.md: 点击预览
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-compatibility/SKILL.md: 点击预览
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-docs-updater/SKILL.md: 点击预览
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/cpp-sink/SKILL.md: 点击预览
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/create-pr/SKILL.md: 点击预览
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/python-decorator/SKILL.md: 点击预览
  • docs/dev_guides/coding_agent/api_compatibility/.claude/skills/pytorch-alignment-validator/SKILL.md: 点击预览

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 针对《Paddle API 对齐 PyTorch 项目》的 coding agent 文档(skills)进行更新,主要是统一/补充各阶段 skill 的说明文字,并细化代码提交与建 PR 的操作流程,以便更清晰地指导 API 对齐工作流落地。

Changes:

  • 更新多个 skill 的 description 表述,使其更明确对应的 Step 与职责范围。
  • 大幅补充 /create-pr 的工作流程说明(改动检查、API 名单汇总、提交/推送/建 PR 的分步指导)。
  • 更新总控 /api-compatibility 中关于批处理执行与豁免策略的描述。

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/pytorch-alignment-validator/SKILL.md 调整 Step3 校验 skill 的描述文案
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/python-decorator/SKILL.md 调整 Step2 Python 装饰器 skill 的描述,并新增部分 front-matter 字段
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/create-pr/SKILL.md 细化 Step5 提交与建 PR 的流程(检查改动、汇总 API 名单、提交/推送/创建 PR)
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/cpp-sink/SKILL.md 调整 Step2 C++ 下沉 skill 的描述,并新增部分 front-matter 字段
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-docs-updater/SKILL.md 调整 Step4 文档更新 skill 的描述文案,并变更 front-matter 字段
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-compatibility/SKILL.md 微调总控流程说明(批处理、豁免策略、Step 说明文案)
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-change-decider/SKILL.md 调整 Step1 方案决策 skill 的描述文案

Comment on lines 82 to 86
# Paddle 仓库
cd /path/to/Paddle
git add -A
git add -u
git commit -m "[API Compatibility] api_name_1/api_name_2/api_name_3/... Edit By AI Agent"
# 等待 pre-commit hook 完成
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里使用 git add -u 只会暂存已跟踪文件的修改/删除,不会把新增文件(例如新增的 docs 页面或新增测试文件)加入提交,容易造成提交不完整。建议改为在确认无多余文件后使用 git add -A,或在保留 -u 的同时补充明确步骤:对需要纳入的新增文件单独 git add <path> 并在提交前检查 git diff --cached

Copilot uses AI. Check for mistakes.
## Step 5:创建 PR

根据自动获取的 PyTorch API 名单生成 PR,执行以下命令创建 PR(顺序:Paddle → Docs → PaConvert):
根据自动获取的 PyTorch API 名单生成 PR,**仅对有代码改动的仓库**执行以下命令创建 PR(顺序:Paddle → Docs → PaConvert):
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 2 描述的是“从多个渠道获取并取并集”,这里却写成“根据自动获取的 PyTorch API 名单生成 PR”,表述不一致,容易让执行者误以为一定能自动得到名单。建议改为“根据 Step 2 获取/汇总的 PyTorch API 名单生成 PR”,或补充明确哪些渠道是自动、哪些需要人工输入。

Suggested change
根据自动获取的 PyTorch API 名单生成 PR,**仅对有代码改动的仓库**执行以下命令创建 PR(顺序:Paddle → Docs → PaConvert):
根据 Step 2 获取/汇总的 PyTorch API 名单生成 PR,**仅对有代码改动的仓库**执行以下命令创建 PR(顺序:Paddle → Docs → PaConvert):

Copilot uses AI. Check for mistakes.
---
name: cpp-sink
description: 仅用于《Paddle API 对齐 PyTorch 项目》,负责 Step2:API 代码修改,实施 C++下沉的代码开发。通过将 Python API 下沉至 C++层,可以减少 Python 装饰器带来的性能开销,提升 API 调度效率。
description: 负责《Paddle API 对齐 PyTorch 项目》 Step2:API 代码修改,实施 C++下沉的代码开发。通过将 Python API 下沉至 C++层,可以减少 Python 装饰器带来的性能开销,提升 API 调度效率。
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该描述中英文与中文之间缺少空格(如“C++下沉”“C++层”)。按本仓库中文文档书写规范,建议改为“C++ 下沉”“C++ 层”,以保持中英文混排一致性。

Suggested change
description: 负责《Paddle API 对齐 PyTorch 项目》中 Step2:API 代码修改,实施 C++下沉的代码开发。通过将 Python API 下沉至 C++层,可以减少 Python 装饰器带来的性能开销,提升 API 调度效率。
description: 负责《Paddle API 对齐 PyTorch 项目》中 Step 2:API 代码修改,实施 C++ 下沉的代码开发。通过将 Python API 下沉至 C++ 层,可以减少 Python 装饰器带来的性能开销,提升 API 调度效率。

Copilot uses AI. Check for mistakes.
---
name: pytorch-alignment-validator
description: 仅用于《Paddle API 对齐 PyTorch 项目》,负责 Step3:Pytorch 对齐验证,基于 PaConvert 工具验证 Paddle API 与 PyTorch API 是否用法完全对齐一致
description: 负责《Paddle API 对齐 PyTorch 项目》 Step3:Pytorch 对齐验证,基于 PaConvert 工具验证 Paddle API 与 PyTorch API 是否用法完全对齐一致
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里同一句里同时出现了 “Pytorch 对齐验证” 和 “PyTorch API”,大小写不一致。建议统一使用官方写法 “PyTorch”(即改为“PyTorch 对齐验证”)。

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +29
三个仓库的本地目录名称分别为 Paddle、PaConvert、docs,自行找到对应本地路径,检查三个仓库是否有未提交的改动,**只对有代码改动的仓库进行后续提交**(排除未跟踪文件)

```bash
cd /path/to/Paddle && git status
cd /path/to/PaConvert && git status
cd /path/to/docs && git status
cd /path/to/Paddle && git status --untracked-files=no
cd /path/to/PaConvert && git status --untracked-files=no
cd /path/to/docs && git status --untracked-files=no
```

## Step 2:添加改动并提交
判断标准:
- 若仓库中有 `M`、`A`、`D` 等标记的**已跟踪文件**,则该仓库**需要提交**
- 若仓库中只有 `??` 标记的**未跟踪文件**,则该仓库**无需提交**
- 若仓库无任何改动,则该仓库**无需提交**
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里用 git status --untracked-files=no 并在判断标准中将“只有 ?? 未跟踪文件”视为“无需提交”,会导致新增但应纳入提交的文件(如新增测试/文档)被忽略,最终 PR 缺文件。建议保留对未跟踪文件的可见性(不加 --untracked-files=no),并在流程里明确:需要人工甄别未跟踪文件是否属于本次改动,属于则应纳入提交。

Copilot uses AI. Check for mistakes.
@zhwesky2010 zhwesky2010 force-pushed the claude branch 3 times, most recently from 74265db to a82dbec Compare May 9, 2026 13:01
@zhwesky2010 zhwesky2010 changed the title [API Compatibility] Modify and supplement documents Edit By AI Agent [Code Agent] Update API compatibility skills documentation May 9, 2026
@zhwesky2010 zhwesky2010 changed the title [Code Agent] Update API compatibility skills documentation [Code Agent] Update API compatibility Claude Code skills May 9, 2026
@zhwesky2010 zhwesky2010 changed the title [Code Agent] Update API compatibility Claude Code skills [Code Agent] Update API compatibility Claude Code SKILL May 9, 2026
@zhwesky2010 zhwesky2010 changed the title [Code Agent] Update API compatibility Claude Code SKILL [Coding Agent] Update API compatibility Claude Code SKILL May 9, 2026
@zhwesky2010 zhwesky2010 changed the title [Coding Agent] Update API compatibility Claude Code SKILL [Coding Agent] Update API Compatibility Claude Code Skills May 9, 2026
@zhwesky2010 zhwesky2010 force-pushed the claude branch 3 times, most recently from 8b28408 to 3585546 Compare May 12, 2026 08:52
- Refactor api-change-decider skill description and documentation structure
- Normalize allowed-tools formatting (remove invisible characters)
- Update api-compatibility, api-docs-updater, cpp-sink, create-pr, python-decorator, and pytorch-alignment-validator skills with improved descriptions and content organization
- Enhance documentation clarity and consistency across all API compatibility skills

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@zhwesky2010 zhwesky2010 merged commit 8b9cba2 into PaddlePaddle:develop May 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants