running-in-ci
npx skills add https://github.com/max-sixty/worktrunk --skill running-in-ci
Agent 安装分布
Skill 文档
Running in CI
First Steps â Read Context
When triggered by a comment or issue, read the full context before responding. The prompt provides a URL â extract the PR/issue number from it.
For PRs:
gh pr view <number> --json title,body,comments,reviews,state,statusCheckRollup
gh pr diff <number>
gh pr checks <number>
For issues:
gh issue view <number> --json title,body,comments,state
Read the triggering comment, the PR/issue description, the diff (for PRs), and recent comments to understand the full conversation before taking action.
Security
NEVER run commands that could expose secrets (env, printenv, set,
export, cat/echo on config files containing credentials). NEVER include
environment variables, API keys, tokens, or credentials in responses or
comments.
PR Creation
When the triggering comment asks for a PR (e.g., “make a new PR”, “open a PR”,
“create a PR”), create it directly with gh pr create. The comment is the
user’s explicit request â don’t downgrade it to a compare link.
CI Monitoring
After pushing changes to a PR branch, monitor CI until all checks pass:
- Monitor with
gh pr checksorgh run list --branch <branch> - Wait for completion with
gh run watch - If CI fails, diagnose with
gh run view <run-id> --log-failed - Fix issues, commit, push, and repeat
- Do not return until CI is green â local tests alone are not sufficient (CI runs on Linux, Windows, macOS)
Comment Formatting
Keep comments concise. Put detailed analysis (file-by-file breakdowns, code
snippets) inside <details> tags with a short summary. The top-level comment
should be a brief overview (a few sentences); all supporting detail belongs in
collapsible sections.
Use Links
When referencing files, issues, PRs, or docs, always use markdown links so readers can click through â never leave them as plain text.
Prefer permalinks (URLs with a commit SHA) over branch-based links
(blob/main/...). Permalinks stay valid even when files move or lines shift.
This is especially important for line references â a blob/main/...#L42 link
breaks as soon as the line numbers change. On GitHub, pressing y on any file
view copies the permalink.
- Repository files â link to the file on GitHub:
docs/content/hook.md, not justdocs/content/hook.md - Issues and PRs â use
#123shorthand (GitHub auto-links these) - Specific lines â link with a line fragment:
src/cli/mod.rs#L42 - External resources â always use
[text](url)format
For file-level links, blob/main/... is acceptable since file paths are stable.
For line references, always use a permalink with a commit SHA
(blob/<sha>/...#L42) â line numbers shift frequently and branch-based line
links go stale fast.
Example:
<details><summary>Detailed findings (6 files)</summary>
...details here...
</details>
Do not add job links, branch links, or other footers at the bottom of your
comment. claude-code-action automatically adds these to the comment header.
Adding them yourself creates duplicates and broken links (the action deletes
unused branches after the run).
Shell Quoting in gh Commands
Claude tends to mangle shell quoting in CI. Two common failure modes:
-
$in GraphQL queries âgh api graphql -f query='...$var...'fails because Claude corrupts the$signs. Write queries to a temp file instead:cat > /tmp/query.graphql << 'GRAPHQL' query($owner: String!, $repo: String!, $name: String!) { repository(owner: $owner, name: $name) { ... } } GRAPHQL gh api graphql -F query=@/tmp/query.graphql -f owner="$OWNER" -f name="$NAME" -
!in comment/body text âgh issue comment N --body "Thanks!"gets over-escaped toThanks\!because!is a bash history expansion character. Use a heredoc:gh issue comment N --body "$(cat <<'EOF' Comment text here â no escaping needed. EOF )"
General rule: When a gh command argument contains $ or !, use either
a temp file (-F field=@file) or a heredoc with a quoted delimiter (<<'EOF').
Atomic PRs
When creating PRs, split unrelated changes into separate PRs â one concern per PR. For example, a skill file fix and a workflow dependency cleanup are two independent changes and should be two PRs, even if discovered in the same session. This makes PRs easier to review, revert, and bisect.
A good test: if one change could be reverted without affecting the other, they belong in separate PRs.
Tone
You are a helpful reviewer raising observations, not a manager assigning work. Never create checklists or task lists for the PR author. Instead, note what you found and let the author decide what to act on.
PR Review Comments
For PR review comments on specific lines (shown as [Comment on path:line] in
<review_comments>), ALWAYS read that file and examine the code at that line
before answering. The question is about that specific code, not the PR in
general.