发送
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- Python
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第一阶段:精简版代码审查
快速健全性检查——在明显问题成为评论意见之前发现它们。查看完整差异: 扫描更改: 硬编码机密、凭证、API 密钥、`.env` 文件 不应提交的文件:二进制文件、`.tfstate`、`.env`、凭证文件
第 2 阶段:质量检查
根据更改的文件类型运行检查 - 跳过不适用的检查。仅运行检查相关工具是否可用。 Terraform(`.tf`文件已更改):YAML(`.yaml`或`.yml`文件已更改):JSON(`.json`文件已更改):
第三阶段:提交
阶段更改并创建常规提交。该方法取决于可用的工具(在阶段 0b 中检测到)。如果 INTENT 可用并且已经遵循传统的提交格式,则更喜欢将其用作提交消息而不是自动生成 - 用户告诉您此更改是什么。
第四阶段:推送
将分支推送到远程:
# Send: Review, Commit, Push, and Merge/Pull Request
A workflow that takes local changes from working directory to merge/pull request. Each phase gates
the next -- if something fails, stop and report rather than pushing broken code upstream.
**IMPORTANT:** All `git` commands in this skill MUST use `--no-pager` to prevent interactive
paging from hanging the shell.
## Argument Handling
Parse `$ARGUMENTS` (appended at the bottom of this skill) to extract the user's **intent**.
- **No arguments**: Proceed normally -- auto-generate everything.
- **Arguments provided** (e.g., `feat: add repo argument support to prime command`):
Store as `INTENT` and use it throughout:
- **Branch name** (Phase 0d): derive a slug from the intent
- **Commit message** (Phase 3): use as the commit subject if it follows conventional
commit format (`type: description` or `type(scope): description`), otherwise use it
as input to the commit tool
- **PR/MR title** (Phase 5): use as the title
**Deriving a branch slug from intent:**
Strip conventional commit prefix if present (`feat: `, `fix(scope): `, etc.), lowercase,
replace spaces and special characters with hyphens, collapse consecutive hyphens, truncate
to 50 characters, strip leading/trailing hyphens.
Example: `feat: add repo argument support to prime command` → `add-repo-argument-support-to-prime`
## Prerequisites
- `git` -- version control
- **Remote CLI** (auto-detected from remote URL):
- GitLab remotes (`opengroup.org`, `gitlab`): requires `glab`
- GitHub remotes (`github.com`): requires `gh`
- **Optional** (graceful degradation if absent):
- `wt` ([worktrunk](https://worktrunk.dev)) -- worktree-based branching and commits
- `aipr` -- AI-powered commit message generation
**Sandbox note:** In bare repo worktree layouts (`.bare/` directory), branch creation writes
to `.bare/refs/heads/`. This may require sandbox write access to the repo's `.bare/` path.
## Phase 0: Preflight
### 0a. Check for changes (bail early if nothing to send)
```bash
git --no-pager status --short
```
If clean, also check for unpushed commits:
```bash
git --no-pager log --oneline @{upstream}..HEAD 2>/dev/null
```
If both are clean, **STOP** -- nothing to send. If there are unpushed commits but no local
changes, skip to Phase 4 (Push).
### 0b. Detect environment
Run these checks. The results gate all later phases.
**Remote platform:**
```bash
REMOTE_URL=$(git remote get-url origin 2>/dev/null)
if echo "$REMOTE_URL" | grep -q "github\.com"; then
PLATFORM=github
elif echo "$REMOTE_URL" | grep -qE "opengroup\.org|gitlab"; then
PLATFORM=gitlab
else
PLATFORM=unknown
fi
```
**Bare repo / worktree layout:**
```bash
IS_BARE_WORKTREE=false
if [ -f .git ]; then
IS_BARE_WORKTREE=true
fi
```
This matters for branch naming -- bare repos cannot use slashes in branch names because
they create subdirectories under `.bare/refs/heads/` which may conflict or fail.
**Worktree tool:**
```bash
if command -v wt >/dev/null 2>&1 || command -v git-wt >/dev/null 2>&1; then
HAS_WT=true
else
HAS_WT=false
fi
```
**Commit tool** (prefer `wt step commit` > `aipr` > manual):
```bash
if [ "$HAS_WT" = true ]; then
COMMIT_TOOL=wt
elif command -v aipr >/dev/null 2>&1; then
COMMIT_TOOL=aipr
else
COMMIT_TOOL=manual
fi
```
### 0c. Get the current branch
```bash
git branch --show-current
```
### 0d. Branch safety
**Branch naming rules** (gated by `IS_BARE_WORKTREE`):
- `IS_BARE_WORKTREE=true`: use **flat names** with hyphens (e.g., `add-repo-argument-support`)
- `IS_BARE_WORKTREE=false`: use **slashed names** (e.g., `feature/add-repo-argument-support`)
**On `main` or `master`:**
These are release branches -- changes must go on a feature branch.
If `INTENT` is available (from ARGUMENTS), auto-derive a branch name from the slug and
create the branch without asking the user:
```bash
# Example for bare worktree with INTENT slug "add-repo-argument-support"
git checkout -b add-repo-argument-support
# Example for standard clone
git checkout -b feature/add-repo-argument-support
```
If no INTENT, ask the user for a feature name, then create the branch.
**On `dev`:**
The user is on the integration branch -- cannot merge from `dev` to `dev`. Same logic as
above: auto-derive from INTENT if available, otherwise ask.
When using `wt` for branch creation:
```bash
# wt always uses flat names for worktree directory names
wt switch --create <slug> --base dev
```
> This changes the working directory to a new worktree path. All subsequent
> commands run from the new directory.
**On `feature/*` or any other name:** proceed normally.
### 0e. Contribution check -- am I on someone else's branch?
**GitLab:**
```bash
glab api "projects/:id/merge_requests?source_branch=$(git branch --show-current)&state=opened" \
--hostname community.opengroup.org 2>/dev/null
```
**GitHub:**
```bash
gh pr list --head "$(git branch --show-current)" --state open --json number,author 2>/dev/null
```
If an open MR/PR exists and the author is not the current user, ask: "You're on the
`<branch>` branch from MR/PR #X by `<author>`. Do you want to contribute these changes
to that MR/PR, or create a separate one?" If they want to contribute, hand off to the
`contribute` skill.
## Phase 1: Lite Code Review
A quick sanity check -- catch obvious problems before they become review comments.
1. View the full diff:
```bash
git --no-pager diff --stat
git --no-pager diff
```
2. Scan the changes for:
- Hardcoded secrets, credentials, API keys, `.env` files
- Files that should not be committed: binaries, `.tfstate`, `.env`, credential files
- Obvious bugs or logic errors
3. Present a brief review summary listing changed files and any concerns.
4. If there are blocking concerns (secrets, dangerous files), **STOP** and ask the user to fix
them before continuing.
## Phase 2: Quality Checks
Run checks based on which file types changed -- skip checks that don't apply. Only run a
check if the relevant tool is available.
- **Terraform** (`.tf` files changed):
```bash
terraform fmt -check -recursive ./infra 2>/dev/null
terraform fmt -check -recursive ./platform 2>/dev/null
```
- **YAML** (`.yaml` or `.yml` files changed):
```bash
git --no-pager diff --name-only --diff-filter=ACM -- '*.yaml' '*.yml' | xargs -I{} python3 -c "import yaml, sys; yaml.safe_load(open(sys.argv[1]))" {}
```
- **JSON** (`.json` files changed):
```bash
git --no-pager diff --name-only --diff-filter=ACM -- '*.json' | xargs -I{} python3 -c "import json, sys; json.load(open(sys.argv[1]))" {}
```
- **Python** (`.py` files changed) -- syntax check only:
```bash
git --no-pager diff --name-only --diff-filter=ACM -- '*.py' | xargs -I{} python3 -m py_compile {}
```
- **Java** (`pom.xml` exists and `.java` files changed) -- compile check only:
```bash
mvn compile -q 2>/dev/null
```
If any check fails, **STOP** and report. Do not proceed to commit.
## Phase 3: Commit
Stage changes and create a conventional commit. The method depends on which tools
are available (detected in Phase 0b). If INTENT is available and already follows
conventional commit format, prefer using it as the commit message rather than
auto-generating -- the user told you what this change is.
### Option A: `wt step commit` (if `HAS_WT=true`)
worktrunk handles staging, diff analysis, and message generation:
```bash
wt step commit
```
Review the generated message -- if it doesn't follow the commit rules below, amend.
**If `wt step commit` fails** (non-zero exit), fall through to Option B or C. Don't stop
the workflow because of a tool failure when alternatives exist.
### Option B: `aipr commit -s` (if `aipr` is available)
```bash
git add -A
git commit -m "$(aipr commit -s)"
```
### Option C: Manual commit (fallback)
```bash
git add -A
```
If INTENT is available and matches conventional commit format (`type: ...` or
`type(scope): ...`), use it directly as the commit message. Otherwise, generate
the message from the staged diff using the
[Commit Prompt Reference](references/commit-prompt.md).
```bash
git commit -m "<message>"
```
### Commit rules -- hard requirements (apply to ALL options)
- **One-line summary** under 72 characters: `type(scope): description`
- Types: feat fix docs refactor chore ci style test build perf
- Use imperative mood (add, implement, fix -- not adds, added, adding)
- Add 1-2 detail lines only for large changes (15+ files). Max 3 lines total.
- **NEVER** add `Co-Authored-By` trailers -- not for any AI or agent
- **NEVER** add "Generated with", "Built by", or any agent/AI attribution
- **NEVER** add `Signed-off-by` unless the user explicitly requests DCO sign-off
## Phase 4: Push
Push the branch to the remote:
```bash
git push -u origin $(git branch --show-current)
```
## Phase 5: Merge / Pull Request
### 5a. Check for an existing MR/PR
**GitLab:**
```bash
glab mr list --source-branch="$(git branch --show-current)"
```
**GitHub:**
```bash
gh pr list --head "$(git branch --show-current)" --state open
```
If one already exists, report its URL and skip creation.
### 5b. Determine the target branch
Default target: `dev` (OSDU convention). If no `dev` branch exists on the remote, fall
back to `main` or `master`:
```bash
git --no-pager ls-remote --heads origin dev main master 2>/dev/null
```
Use the first branch that exists, in order: `dev`, `main`, `master`.
### 5c. Determine the title
If INTENT is available and follows conventional commit format, use it as the title.
Otherwise, derive from the most recent commit (or summarize if multiple commits):
```bash
TITLE=$(git --no-pager log -1 --format='%s')
```
### 5d. Generate the description
Analyze the commit log and diff stats to produce a description:
```bash
DIFF_STATS=$(git --no-pager diff --stat origin/$TARGET_BRANCH..HEAD)
COMMITS=$(git --no-pager log origin/$TARGET_BRANCH..HEAD --format='%s%n%b')
```
Use the [MR Description Prompt Reference](references/mr-description-prompt.md) as a guide
for the description structure. When INTENT is available, incorporate the user's stated
purpose into the Summary section as the "why" -- don't just describe the diff mechanically.
### 5e. Create the MR/PR
**GitLab:**
```bash
ASSIGNEE=$(glab auth status 2>&1 | grep 'Logged in' | sed 's/.* as \([^ ]*\).*/\1/')
glab mr create \
--title "$TITLE" \
--description "$BODY" \
--target-branch "$TARGET_BRANCH" \
--assignee "$ASSIGNEE" \
--remove-source-branch
```
**GitHub:**
```bash
gh pr create \
--title "$TITLE" \
--body "$BODY" \
--base "$TARGET_BRANCH"
```
### 5f. Report the MR/PR URL to the user.
## Final Summary
After all phases complete, present a compact summary:
```
Review: <clean or list of concerns addressed>
Commit: <short-hash> <commit message>
Branch: <branch-name> -> pushed to origin
MR/PR: <URL>
```
---
> Source: [danielscholl/claude-osdu](https://github.com/danielscholl/claude-osdu) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
章节与文件索引
按说明文件中的顺序排列。
参数处理
先决条件
0a。检查更改(如果没有要发送的内容,请提前保释)
0b。检测环境
0d。分行安全
文件/命令 -> git · --no-pager · $ARGUMENTS · feat: add repo argument support to prime command · INTENT · type: description · type(scope): description · feat:
内容校验值 -> d74ef11817b0
当前原文的自动摘译,尚未人工审校。
参数处理
解析
$ARGUMENTS(附加在该技能的底部)以提取用户的意图。无参数:正常进行——自动生成所有内容。提供的参数(例如,feat: add repo argument support to prime command):存储为INTENT并在整个过程中使用它:分支名称(阶段0d):从意图派生一个slug先决条件
git——版本控制远程CLI(从远程URL自动检测):GitLab遥控器(opengroup.org,gitlab):需要glabGitHub遥控器(github.com):需要gh可选(如果不存在则优雅降级):0a。检查更改(如果没有要发送的内容,请提前保释)
如果干净,还检查未推送的提交:如果两者都是干净的,则停止 - 没有可发送的内容。如果有未推送的提交但没有本地更改,请跳到阶段 4(推送)。
0b。检测环境
运行这些检查。结果将控制所有后续阶段。远程平台:裸仓库/工作树布局:这对于分支命名很重要——裸仓库不能在分支名称中使用斜杠,因为它们在
.bare/refs/heads/下创建子目录,这可能会发生冲突或失败。0d。分行安全
分支命名规则(由
IS_BARE_WORKTREE控制):IS_BARE_WORKTREE=true:使用带有连字符的平面名称(例如,add-repo-argument-support)IS_BARE_WORKTREE=false:使用斜线名称(例如,feature/add-repo-argument-support) 在main或master上:这些是发布分支 - 必须进行更改在功能分支上。