[Coding Agent] Update API Compatibility Claude Code Skills#7906
Open
zhwesky2010 wants to merge 1 commit into
Open
[Coding Agent] Update API Compatibility Claude Code Skills#7906zhwesky2010 wants to merge 1 commit into
zhwesky2010 wants to merge 1 commit into
Conversation
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7906.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
📚 本次 PR 文档预览链接(点击展开)
|
Contributor
There was a problem hiding this comment.
Pull request overview
本 PR 对《Paddle API 对齐 PyTorch 项目》的 Claude Coding Agent Skill 体系进行重构与补全:新增多个缺失的 Step2/Step3 技能与参考文档,并调整总控流程与若干存量 skill 的步骤描述,同时加入批量执行脚本以支持端到端自动化。
Changes:
- 新增 Step2「修改原有 API / 新增 API」与 Step3「兼容性测试」等技能文档及配套参考资料,补全工作流覆盖面。
- 重写/精简多个存量 skill 的步骤与注意事项(api-compatibility、api-change-decider、cpp-sink、python-decorator、pytorch-alignment-validator、api-docs-updater、create-pr)。
- 新增
batch_api_compat.sh支持按 batch 批量调用总控 skill,并在全部完成后触发 PR 创建。
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/dev_guides/coding_agent/api_compatibility/batch_api_compat.sh | 新增批量执行脚本,分批调用 /api-compatibility 并触发 /create-pr |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/pytorch-alignment-validator/SKILL.md | 调整对齐验证步骤结构、回退原则与常见问题处理说明 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/python-decorator/SKILL.md | 重整 Python 装饰器方案流程与决策表,并收敛职责边界(不再新增 out 参数) |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/modify-origin-api/SKILL.md | 新增“修改原有 API”方案的完整实现指南与常见参数模板 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/create-pr/SKILL.md | 强化三仓库提交/推送/建 PR 流程与命令模板(含 gh 操作) |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/cpp-sink/SKILL.md | 精简并补全 C++ 下沉方案步骤描述与关键要点 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-docs-updater/SKILL.md | 调整中文文档更新流程与常见修改模式示例 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-compatibility/SKILL.md | 更新总控流程编排(引入兼容测试 Step)、补充子 skill 总览与约束 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/api-change-decider/SKILL.md | 重写差异获取优先级策略与 13 类差异决策流程,并扩展方案说明 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/add-new-api/SKILL.md | 新增“新增 API”方案 skill,覆盖别名/Python API/C++ OP 三类场景 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/add-new-api/references/new_python_api.md | 新增 Python API 开发参考文档 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/add-new-api/references/new_cpp_op.md | 新增 C++ 算子全流程参考文档 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/add-new-api/references/api_docs_guidelines.md | 新增 API 文档书写规范参考文档 |
| docs/dev_guides/coding_agent/api_compatibility/.claude/skills/add-compatibility-test/SKILL.md | 新增兼容性测试 skill,提供测试模板/覆盖要求/回退原则 |
Comments suppressed due to low confidence (2)
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/create-pr/SKILL.md:134
- Step 4 的推送命令
git -C ... push upstream develop:claude -f/master:claude看起来会把本地 develop/master 分支强制推到远端 claude,而不是推送当前工作分支/当前提交。这样容易把 claude 分支覆盖成基线分支内容,导致 PR 丢失改动。建议改为推送当前 HEAD(例如HEAD:claude或确保本地在 claude 分支后push upstream claude),并避免硬编码 develop/master。
```bash
# Paddle 仓库
git -C ${ROOT_DIR}/Paddle push upstream develop:claude -f
# docs 仓库
git -C ${ROOT_DIR}/docs push upstream develop:claude -f
# PaConvert 仓库
git -C ${ROOT_DIR}/PaConvert push upstream master:claude -f
docs/dev_guides/coding_agent/api_compatibility/.claude/skills/create-pr/SKILL.md:262
gh pr create的--head zhwesky2010:claude在 skill 文档中被硬编码为特定用户名,这会导致其他开发者复用该流程时直接失败或创建到错误的 fork。建议改为占位符(如{github_user}:claude)或说明应使用当前执行者的 fork/远端分支名,并与 Step 4 的 push 目标保持一致。
```bash
# Paddle PR 创建
gh pr create --repo PaddlePaddle/Paddle --base develop --head zhwesky2010:claude \
--title "[API Compatibility] api_name_1/api_name_2/api_name_3/... Edit By AI Agent" \
--body "$(cat <<'EOF'
### PR Category
User Experience
### PR Types
Improvements
### Description
**API Compatibility Edit By AI Agent:**
torch.api_name_1
torch.api_name_2
...
### 是否引起精度变化
否
EOF
)"
# Docs PR 创建
gh pr create --repo PaddlePaddle/docs --base develop --head zhwesky2010:claude \
--title "[API Compatibility] api_name_1/api_name_2/api_name_3/... Edit By AI Agent" \
--body "$(cat <<'EOF'
**API Compatibility Edit By AI Agent:**
torch.api_name_1
torch.api_name_2
...
- https://github.com/PaddlePaddle/Paddle/pull/{paddle_pr_number}
EOF
)"
# PaConvert PR 创建
gh pr create --repo PaddlePaddle/PaConvert --base master --head zhwesky2010:claude \
--title "[API Compatibility] api_name_1/api_name_2/api_name_3/... Edit By AI Agent" \
| name: create-pr | ||
| description: 负责《Paddle API 对齐 PyTorch 项目》中 Step5:代码提交,分别对 Paddle、PaConvert、Docs 三个仓库创建或更新 Pull Request | ||
| description: 负责《Paddle API 对齐 PyTorch 项目》中代码提交,分别对 Paddle、PaConvert、Docs 三个仓库创建或更新 Pull Request | ||
| allowed-tools: Bash(git *) |
Comment on lines
+122
to
+125
| 1. ``paddle.broadcast_tensors(input, name=None)`` (Paddle 风格): | ||
| 接收一个 Tensor 序列作为参数 | ||
| 2. ``paddle.broadcast_tensors(*tensors)`` (PyTorch 风格): | ||
| 接收可变个 Tensor 参数 |
|
|
||
| 以下给出了几个常用参数的实现方式: | ||
|
|
||
| ### 3.1 新增 `out` 参数 |
| **修改模式**: | ||
| 1. **新增 API 别名** | ||
| - 适用:PyTorch API 与 Paddle API 功能完全一致,仅路径/名称不同 | ||
| - 示例:`torch.nn.functional.relu` → 新增 `paddle.nn.functional.relu` 别名指向 `paddle.nn.functional.relu` |
Comment on lines
21
to
+25
| torch.logsumexp | ||
| ``` | ||
|
|
||
| 本轮用户输入的 Pytorch API 为$ARGUMENTS,需对其完成对齐工作。 | ||
|
|
Comment on lines
+3
to
+5
| # Usage: ./batch_api_compat.sh api1 api2 api3 ... | ||
| # Or pipe from file: ./batch_api_compat.sh $(cat api_list.txt) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
调优《Paddle API 对齐 PyTorch 项目》 Skill(Part2)
关联 PR
本 PR 在 #7899 基础上,对《Paddle API 对齐 PyTorch 项目》下的 Coding Agent Skill 体系进行全面重构与增强,补全缺失 Skill、优化现有 Skill 质量,进一步提升 Agent 执行准确率与可维护性。
主要变更
新增 Skill(全新文件)
/add-new-api(新增 SKILL.md + 3 个参考文档)references/api_docs_guidelines.md:API 文档规范指南references/new_cpp_op.md:新增 C++ 算子全流程参考(521 行)references/new_python_api.md:新增 Python 层 API 参考/add-compatibility-test(新增 SKILL.md)out参数、Tensor 方法等多种调用路径/modify-origin-api(新增 SKILL.md)out、device、requires_grad等常见参数的标准实现模板存量 Skill 优化
/api-change-decider(改动最大,-232/+286)/api-compatibility(整体统筹,-163/+87)allowed-tools字段,引入${ROOT_DIR}变量统一路径表示/cpp-sink(大幅精简,-450/+122)allowed-tools中的不可见字符,补充context/background/verbose字段/python-decorator(-208/+29)/api-docs-updater、/pytorch-alignment-validator${ROOT_DIR}/.../create-prgit add -A改为git add -u,避免意外提交未跟踪文件新增批量执行脚本
batch_api_compat.sh/api-compatibilitySkill/create-pr,实现端到端自动化变更统计