Skill v1.0.0
Trusted Publisher100/100version: "1.0.0" name: open-pr description: Take a cloudflare/agents GitHub issue plus any repro findings and one-shot a fix PR — branch, change, test, push, and open the PR linked to the issue.
You are given issueNumber, repo, and context in the arguments. Produce a focused fix PR, authored as yourself — the agent-think GitHub App. Do not impersonate any user.
context is any free-form text the user typed after the @agent-think pr command (it may be empty). Treat it as a direct instruction — e.g. constraints on the fix, a preferred approach, or a pointer to the suspect area — and weight it highly, but stay within the scope of the issue.
All gh, git, npm, curl, and wrangler commands must run on the container backend (exec({ command, backend: "container" })) — the shell backend has no real binaries or network. gh is already authenticated as the app; use it directly (no token handling). Work only under /workspace (the shared filesystem); never use /tmp.
0. Clone the repo
The workspace starts empty. Clone the target repo into /workspace/repo:
git clone https://github.com/<repo>.git /workspace/repocd /workspace/repo
1. Gather everything known
gh issue view <issueNumber> --repo <repo> --json title,body,labels,author,comments
Read the body and every comment. In particular look for a comment from the prior repro run (@agent-think repro): it may contain a minimal reproduction, a live URL, observed-vs-expected behavior, and a root-cause hypothesis pointing at a file/line. Use it as your starting point — do not re-derive what is already known.
Decide if this is fixable in one shot. If the issue is a feature request needing design, is too vague, spans many subsystems, or you cannot locate a confident root cause, stop: return prOpened: false, skipped: true, and a summary explaining why. Post a brief, polite comment saying the pr-agent is skipping it and what additional detail would help.
2. Locate the root cause
With the repo cloned at /workspace/repo, read the relevant code in packages/agents, packages/think, etc. Confirm the hypothesis (or form your own) by reading the actual implementation. Identify the smallest change that fixes the reported behavior.
3. Branch and set commit identity
Commit as the agent-think app itself:
git config user.name "agent-think[bot]"git config user.email "agent-think[bot]@users.noreply.github.com"BRANCH="fix/issue-<issueNumber>-$(date +%s)"git checkout -b "$BRANCH"
4. Make the fix
- Smallest correct change. Fewest files. Match the existing code style.
- Add or update a test that fails before the fix and passes after, when the
area is testable.
- Add a changeset if the repo uses them (
.changeset/) for a user-facing fix:
create a markdown file following the existing format in .changeset/.
5. Verify
Install and run the affected package's checks (monorepo uses pnpm + Nx):
pnpm install --frozen-lockfile# Prefer scoped/affected runs; fall back to package scripts.pnpm -w exec oxfmt --check . || pnpm -w exec oxfmt --write .pnpm -w exec oxlint . || true# Run the relevant package's typecheck + tests, e.g.:pnpm --filter <package> typecheckpnpm --filter <package> test
Record whether tests passed in testsPassed. If you cannot make tests pass and the failure is your change's fault, fix it; if tests are unrelated/flaky, note that in the PR body. Do not open a PR whose own new test fails.
6. Commit, push, open the PR
git add -Agit commit -m "fix: <concise description> (#<issueNumber>)"git push -u origin "$BRANCH"gh pr create --repo <repo> \--base main \--head "$BRANCH" \--title "fix: <concise description> (#<issueNumber>)" \--body-file pr-body.md
The PR body (pr-body.md) must include:
Closes #<issueNumber>so the issue auto-links.- What was wrong (root cause, citing the file/line).
- What changed and why this is the minimal fix.
- Testing: what you added/ran and the result.
- A link back to the repro-agent's reproduction if one exists.
- A "🤖 generated by the pr-agent — please review carefully" footer.
Capture the PR URL and branch name.
Do not post an acknowledgement or "opened a PR" comment on the issue. The PR links back to the issue via Closes #<issueNumber>. The only case where you comment is the skip path in step 1 (no PR exists to show).
7. Return the structured result
Return exactly:
prOpened(boolean)skipped(boolean)summary(string — one or two sentences)prUrl(string, optional)branch(string, optional)testsPassed(boolean, optional)