Skip to content

Commit 9fec925

Browse files
authored
Merge pull request #18 from shakacode/jg/sync-address-review-cmd
Add sync-commands script and shared-command docs for consuming repos
2 parents f15252a + 6254e15 commit 9fec925

5 files changed

Lines changed: 145 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ This repository stores reusable AI workflows and supporting documentation.
1717
- Treat `prompts/` as the canonical place for workflows meant to be pasted into Codex, GPT, or other tools without Claude slash commands.
1818
- When the user asks to address PR review comments outside Claude slash commands, follow `prompts/address-review.md`.
1919
- README is the human discovery surface. Update it whenever you add or rename a reusable asset.
20+
21+
## Canonical Source for Shared Commands
22+
23+
This repo is the single source of truth for shared commands (especially `/address-review`). Other repos copy these commands into their `.claude/commands/` directory.
24+
25+
**For agents working in consuming repos:** If you need to update a shared command like `/address-review`, do NOT edit the local copy. Instead, update the canonical version in this repo and re-sync using `bin/sync-commands`.
26+
27+
**For agents working in this repo:** When updating a shared command, keep it generic — no project-specific logic. Project-specific behavior belongs in the consuming repo's `CLAUDE.md` or `AGENTS.md`.

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ For project-level sharing, copy to your project's `.claude/commands/` or `.claud
3030

3131
| Command | Description |
3232
|---------|-------------|
33-
| [`/address-review`](commands/address-review.md) | Fetch GitHub PR review comments and create todos to address them |
33+
| [`/address-review`](commands/address-review.md) | Fetch GitHub PR review comments, triage them, create todos for must-fix items, reply to comments, and resolve addressed threads |
3434
| [`/review-all-prs`](commands/review-all-prs.md) | Review all open PRs or a specific PR, post reviews to GitHub |
3535
| [`/self-review`](commands/self-review.md) | Comprehensive self-review of uncommitted changes before creating a PR |
3636
| [`/merge-commit-msg`](commands/merge-commit-msg.md) | Generate a structured merge commit message from PR changes |
@@ -79,6 +79,7 @@ Starter templates for new projects:
7979

8080
| Script | Description |
8181
|--------|-------------|
82+
| [`bin/sync-commands`](bin/sync-commands) | Sync commands from this repo into a target project's `.claude/commands/` |
8283
| [`bin/chrome-mcp`](bin/chrome-mcp) | Launch Chrome with a separate profile for MCP browser debugging |
8384
| `bin/set-review-instructions` | Initialize file-by-file review with instructions and changed file list |
8485
| `bin/print-git-diff` | Print diff, before/after, and review instructions for a single file |
@@ -95,6 +96,55 @@ Starter templates for new projects:
9596
| [Claude Code Review](.github/workflows/claude-code-review.yml) | Automatic PR review on open/sync |
9697
| [Claude Code](.github/workflows/claude.yml) | Respond to `@claude` mentions in issues/PRs |
9798

99+
## Syncing Commands to Your Project
100+
101+
This repo is the canonical source for shared commands like `/address-review`. To keep a project in sync:
102+
103+
### One-Time Setup
104+
105+
```bash
106+
# From your project root
107+
BOOSTERS=~/.claude/claude-code-commands-skills-agents
108+
109+
# Clone (or pull if already cloned)
110+
if [ -d "$BOOSTERS" ]; then
111+
git -C "$BOOSTERS" pull --rebase
112+
else
113+
git clone https://github.com/shakacode/claude-code-commands-skills-agents.git "$BOOSTERS"
114+
fi
115+
116+
# Copy the commands you want into your project
117+
mkdir -p .claude/commands
118+
cp "$BOOSTERS/commands/address-review.md" .claude/commands/
119+
```
120+
121+
### Keeping Up to Date
122+
123+
Run `bin/sync-commands` from this repo to pull the latest commands into a target project:
124+
125+
```bash
126+
# Sync all commands to a project
127+
./bin/sync-commands ~/projects/my-app
128+
129+
# Sync a specific command
130+
./bin/sync-commands ~/projects/my-app address-review
131+
```
132+
133+
### For AI Agents in Consuming Repos
134+
135+
Add this to your project's `CLAUDE.md` or `AGENTS.md` so agents know where shared commands come from:
136+
137+
```markdown
138+
## Shared Commands
139+
140+
The `/address-review` command is synced from
141+
[claude-code-commands-skills-agents](https://github.com/shakacode/claude-code-commands-skills-agents).
142+
Do not edit `.claude/commands/address-review.md` directly — update the
143+
canonical copy in the boosters repo and re-sync.
144+
```
145+
146+
See the [templates/](templates/) directory for starter `CLAUDE.md` and `AGENTS.md` files that include this pattern.
147+
98148
## Contributing
99149

100150
1. Add new commands to `commands/`

bin/sync-commands

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Sync commands from this repo into a target project's .claude/commands/ directory.
4+
#
5+
# Usage:
6+
# ./bin/sync-commands <target-project-path> [command-name]
7+
#
8+
# Examples:
9+
# ./bin/sync-commands ~/projects/my-app # Sync all commands
10+
# ./bin/sync-commands ~/projects/my-app address-review # Sync one command
11+
12+
set -euo pipefail
13+
14+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
15+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
16+
COMMANDS_DIR="$REPO_ROOT/commands"
17+
18+
if [ $# -lt 1 ]; then
19+
echo "Usage: $(basename "$0") <target-project-path> [command-name]"
20+
echo ""
21+
echo "Syncs commands from claude-code-commands-skills-agents into a project."
22+
echo ""
23+
echo "Examples:"
24+
echo " $(basename "$0") ~/projects/my-app"
25+
echo " $(basename "$0") ~/projects/my-app address-review"
26+
exit 1
27+
fi
28+
29+
TARGET="$1"
30+
COMMAND="${2:-}"
31+
32+
if [ ! -d "$TARGET" ]; then
33+
echo "Error: target directory does not exist: $TARGET"
34+
exit 1
35+
fi
36+
37+
TARGET_DIR="$TARGET/.claude/commands"
38+
mkdir -p "$TARGET_DIR"
39+
40+
if [ -n "$COMMAND" ]; then
41+
COMMAND="${COMMAND%.md}" # strip accidental .md suffix
42+
SOURCE="$COMMANDS_DIR/${COMMAND}.md"
43+
if [ ! -f "$SOURCE" ]; then
44+
echo "Error: command not found: $SOURCE"
45+
echo "Available commands:"
46+
ls "$COMMANDS_DIR"/*.md | xargs -I{} basename {} .md | sed 's/^/ /'
47+
exit 1
48+
fi
49+
cp "$SOURCE" "$TARGET_DIR/"
50+
echo "Synced $COMMAND -> $TARGET_DIR/${COMMAND}.md"
51+
else
52+
for f in "$COMMANDS_DIR"/*.md; do
53+
cp "$f" "$TARGET_DIR/"
54+
echo "Synced $(basename "$f" .md) -> $TARGET_DIR/$(basename "$f")"
55+
done
56+
fi
57+
58+
echo ""
59+
echo "Done. Commands are now in $TARGET_DIR/"

templates/AGENTS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,23 @@ test/
6868
- Use parameterized queries for database access
6969
- Never log sensitive data (passwords, tokens, PII)
7070

71+
## Review Workflow
72+
73+
When addressing PR review comments (using `/address-review` or equivalent):
74+
75+
- Wait for the first full review pass to finish before pushing follow-up commits
76+
- Batch review fixes into one follow-up push when practical -- do not create a new commit for each minor comment
77+
- Treat as blocking only: correctness bugs, failing tests, regressions, and clear inconsistencies with adjacent code
78+
- Verify reviewer claims locally before changing code in response to review comments
79+
- Deduplicate repeated bot comments before acting on them -- fix the underlying issue once, then resolve the duplicates
80+
81+
## Shared Commands
82+
83+
The `/address-review` command and other shared commands are synced from
84+
[claude-code-commands-skills-agents](https://github.com/shakacode/claude-code-commands-skills-agents).
85+
Do not edit `.claude/commands/address-review.md` directly in this project.
86+
Update the canonical copy in the boosters repo and re-sync.
87+
7188
## Common Mistakes to Avoid
7289

7390
- [Things that AI agents frequently get wrong in this project]

templates/CLAUDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ Always lint changed files before committing.
6666
- [e.g., "Use factories from test/factories/, not inline data"]
6767
- [e.g., "When changing source files, run corresponding test files"]
6868

69+
## Shared Commands
70+
71+
The following commands are synced from
72+
[claude-code-commands-skills-agents](https://github.com/shakacode/claude-code-commands-skills-agents):
73+
74+
- `/address-review` -- Fetch PR review comments, triage, create todos, reply, and resolve threads
75+
76+
Do not edit `.claude/commands/address-review.md` directly. Update the canonical
77+
copy in the boosters repo and re-sync with `bin/sync-commands`.
78+
6979
## Common Gotchas
7080

7181
- [Things that trip up new developers or AI assistants]

0 commit comments

Comments
 (0)