Skip to content

Commit 8fda35a

Browse files
cpcloudclaude
andauthored
docs(agents): add /rev and /fix-ci skills (#751)
## Summary - Add `/rev` skill: rebase onto main, address unresolved PR review feedback (GraphQL thread fetching with `databaseId` for REST replies, auto-resolve when confident), and delegate CI fixes to `/fix-ci` - Add `/fix-ci` skill: standalone skill to diagnose failing CI from `link` URLs, fetch logs, fix, verify locally, and push - Register both skill triggers in AGENTS.md --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 30e72fa commit 8fda35a

3 files changed

Lines changed: 110 additions & 0 deletions

File tree

.claude/commands/fix-ci.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!-- Copyright 2026 Phillip Cloud -->
2+
<!-- Licensed under the Apache License, Version 2.0 -->
3+
4+
Diagnose and fix failing CI jobs on the current branch's PR.
5+
6+
## 1. Identify failures
7+
8+
1. List check runs: `gh pr checks --json name,state,link`
9+
2. If all checks pass, report that and stop.
10+
11+
## 2. Diagnose each failure
12+
13+
For each failing job:
14+
15+
1. Extract the run ID from the `link` URL returned in step 1.
16+
2. Fetch failed logs: `gh run view <run_id> --log-failed`
17+
3. Read the relevant source files to understand the root cause.
18+
4. Common failure categories:
19+
- **Compile errors**: Fix the Go code.
20+
- **Test failures**: Read the failing test, understand the assertion,
21+
fix the code (not the test) unless the test itself is wrong.
22+
- **Lint/format**: Run the linter locally, apply fixes.
23+
- **Nix build**: Hash mismatches need `/update-vendor-hash`. Eval
24+
errors need Nix expression fixes.
25+
- **OSV scanner**: Use `/fix-osv-finding`.
26+
- **Cross-platform (Windows/PowerShell)**: No `&&` in commands, no
27+
bash-isms, use `-bench .` not `-bench=.`.
28+
29+
## 3. Verify locally
30+
31+
Run `/pre-commit-check` to confirm the fixes work before pushing.
32+
33+
## 4. Push and watch
34+
35+
1. `git push` (or `git push --force-with-lease` if you rebased)
36+
2. Watch checks: `gh pr checks --watch --fail-fast`
37+
3. If new failures appear, loop back to step 2.

.claude/commands/rev.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!-- Copyright 2026 Phillip Cloud -->
2+
<!-- Licensed under the Apache License, Version 2.0 -->
3+
4+
Rebase onto the latest main, address PR review feedback, and fix failing CI.
5+
6+
## 1. Rebase onto main
7+
8+
1. `git fetch origin main`
9+
2. `git rebase origin/main`
10+
3. If there are conflicts, resolve them, `git add` the resolved files, and
11+
`git rebase --continue`. Repeat until the rebase completes.
12+
13+
## 2. Address PR review feedback and fix CI (parallel)
14+
15+
These two steps are independent -- start both in parallel.
16+
17+
### 2a. PR review feedback
18+
19+
1. Fetch unresolved review threads (use the GraphQL API for threaded context):
20+
```
21+
gh api graphql -f query='
22+
query($owner:String!, $repo:String!, $pr:Int!) {
23+
repository(owner:$owner, name:$repo) {
24+
pullRequest(number:$pr) {
25+
reviewThreads(first:100) {
26+
nodes {
27+
id
28+
isResolved
29+
comments(first:50) {
30+
nodes { id databaseId author{login} body path line }
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}' -f owner=cpcloud -f repo=micasa \
37+
-F pr="$(gh pr view --json number --jq '.number')"
38+
```
39+
2. For each **unresolved** thread:
40+
- Read the referenced file and line to understand the context
41+
- Make the requested change (or explain in a reply why not)
42+
- After pushing the fix, reply to the review comment using its
43+
`databaseId` from the query:
44+
`gh api repos/cpcloud/micasa/pulls/<pr>/comments/<databaseId>/replies -f body='...'`
45+
Explain how it was addressed (commit hash, what changed).
46+
- **Resolve the thread** if you are extremely confident the feedback
47+
has been fully addressed. Use the GraphQL mutation:
48+
```
49+
gh api graphql -f query='
50+
mutation($id:ID!) { resolveReviewThread(input:{threadId:$id}) {
51+
thread { isResolved }
52+
}}' -f id=<thread_node_id>
53+
```
54+
If there is any doubt the comment hasn't been fully addressed, leave
55+
the thread open for the reviewer.
56+
3. Skip resolved threads -- they need no action.
57+
58+
### 2b. Fix failing CI
59+
60+
Use `/fix-ci` to diagnose and fix each failing job.
61+
62+
## 3. Push and verify
63+
64+
1. `git push --force-with-lease` (safe force push since we rebased)
65+
2. Wait for CI to start: `gh pr checks --watch --fail-fast`
66+
3. If new failures appear, loop back to step 2b.
67+
68+
## 4. Update PR description
69+
70+
After all changes are pushed, re-read the PR title and body
71+
(`gh pr view`) and update them if they no longer match the actual changes.

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ details; do not duplicate that detail here.
170170
- `/pre-commit-check` -- before committing, to verify code compiles and tests pass
171171
- `/blog-post` -- when writing or updating Hugo blog content in `docs/`
172172
- `/debug-dump` -- when diagnosing rendering bugs (VHS or live TUI)
173+
- `/rev` -- rebase onto main, address PR review feedback, fix failing CI
174+
- `/fix-ci` -- diagnose and fix failing CI jobs on the current PR
173175

174176
### Shell and tools
175177

0 commit comments

Comments
 (0)