|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## WHY — What this repo is |
| 4 | + |
| 5 | +Central GitHub Actions workflow host for **Claude PR agents** — reusable, prompt-driven automation that attaches to pull requests. Instead of duplicating workflow logic across repos, any target repo references this one with a single `uses:` line and gets automated code review, context file generation, or any other Claude-powered task. |
| 6 | + |
| 7 | +The repo is intentionally minimal: workflow YAML, prompt files, and documentation. No build system, no runtime dependencies. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## WHAT — Repo map |
| 12 | + |
| 13 | +``` |
| 14 | +.github/workflows/ |
| 15 | + claude_pr_review.yml # Reusable: code review agent (workflow_call) |
| 16 | + context_files_agent.yml # Reusable: AGENTS.md / CLAUDE.md generator (workflow_call) |
| 17 | + ai_pr_review.yml # Caller example: code review for this repo |
| 18 | + context_files_pr.yml # Caller example: context files agent for this repo |
| 19 | + docs.yml # MkDocs build + GitHub Pages deploy |
| 20 | +
|
| 21 | +prompts/ |
| 22 | + codex_code_review_prompt.md # Verbatim Codex Code Review prompt (OpenAI cookbook) |
| 23 | + context_files_prompt.md # Context files generator/updater prompt |
| 24 | +
|
| 25 | +docs/ # MkDocs documentation site source |
| 26 | + index.md # Overview and architecture |
| 27 | + user-stories.md # Who uses this and why |
| 28 | + using.md # Step-by-step setup for target repos |
| 29 | + contributing.md # How to add a new agent |
| 30 | + agents/ |
| 31 | + index.md # Agent catalog |
| 32 | + pr-review.md # Code review agent docs |
| 33 | + context-files.md # Context files agent docs |
| 34 | +``` |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## HOW — How to work here |
| 39 | + |
| 40 | +### Adding a new agent |
| 41 | + |
| 42 | +1. Create `prompts/<name>.md` — the Claude instruction text |
| 43 | +2. Create `.github/workflows/<name>.yml` — copy an existing reusable workflow, swap the prompt filename, adjust permissions if the agent writes files |
| 44 | +3. Create `docs/agents/<name>.md` — trigger table, caller snippet, customization options |
| 45 | +4. Add entry to `docs/agents/index.md` and `mkdocs.yml` nav |
| 46 | +5. Tag a new release: `git tag vX.Y && git push origin vX.Y` |
| 47 | + |
| 48 | +See `docs/contributing.md` for the full checklist. |
| 49 | + |
| 50 | +### Updating a prompt |
| 51 | + |
| 52 | +Edit the file in `prompts/`. Bump the version tag so target repos can opt in to the updated prompt on their own schedule. |
| 53 | + |
| 54 | +### Working on docs |
| 55 | + |
| 56 | +```bash |
| 57 | +# Preview locally (requires mkdocs-material) |
| 58 | +pip install mkdocs-material |
| 59 | +mkdocs serve |
| 60 | +``` |
| 61 | +⏸️ Not executed — requires network install. Confirm `mkdocs.yml` exists: ✅ |
| 62 | + |
| 63 | +```bash |
| 64 | +# Strict build (catches broken links, missing pages) |
| 65 | +mkdocs build --strict |
| 66 | +``` |
| 67 | +⏸️ Not executed — same prerequisite. |
| 68 | + |
| 69 | +### Validating workflow YAML |
| 70 | + |
| 71 | +```bash |
| 72 | +yamllint .github/workflows/ |
| 73 | +``` |
| 74 | +⏸️ Not executed — `yamllint` not confirmed in this environment. Workflows are validated by GitHub Actions on push. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Common commands (validated) |
| 79 | + |
| 80 | +| Command | Status | Notes | |
| 81 | +|---|---|---| |
| 82 | +| `mkdocs serve` | ⏸️ not executed | Requires `pip install mkdocs-material`; run from repo root | |
| 83 | +| `mkdocs build --strict` | ⏸️ not executed | Same prerequisite; used in CI (`docs.yml`) | |
| 84 | +| `git tag vX.Y && git push origin vX.Y` | ⏸️ not executed | Release process; target repos pin to these tags | |
| 85 | + |
| 86 | +No test suite, linter, or build step for the workflows themselves — validation happens when GitHub Actions parses them on push. |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## Progressive disclosure |
| 91 | + |
| 92 | +- `docs/using.md` — full setup walkthrough for target repos |
| 93 | +- `docs/contributing.md` — step-by-step agent contribution guide |
| 94 | +- `docs/agents/pr-review.md` — code review agent: triggers, prompt override, permissions |
| 95 | +- `docs/agents/context-files.md` — context files agent: modes, `agent_args`, permissions |
| 96 | +- `.github/workflows/claude_pr_review.yml` — canonical source for reusable workflow structure |
| 97 | +- `prompts/context_files_prompt.md` — canonical source for context files prompt spec |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Gotchas |
| 102 | + |
| 103 | +- **Repo rename breaks callers**: the reusable workflows hard-code `repository: safurrier/python-collab-template` to check out the prompt files. If this repo is renamed, update that field in every reusable workflow. |
| 104 | +- **Private repo access**: if this repo is private, target repos must be granted access via Settings → Actions → Access → "Accessible from repositories in your account". |
| 105 | +- **Tag before using**: target repos reference `@v1` (or another tag). Push a tag before pointing any repo at this one. |
| 106 | +- **`contents: write` scope**: the context files agent needs `contents: write` to commit `AGENTS.md` / `CLAUDE.md`. The review agent only needs `read`. |
| 107 | +- **`$ARGUMENTS` substitution**: the context files prompt uses a `$ARGUMENTS` placeholder that the workflow substitutes via `sed` at runtime. Do not treat it as a shell variable in the prompt file itself. |
0 commit comments