A sprint is the list of work a team plans for a period of a few weeks. If you hand a task from that list to an AI agent and don't sit with it, the agent has nothing left but the issue. In an interactive session the agent suggests a plan and you correct it. In CI, the system that runs the code automatically on every change, that conversation never happens, and a misunderstood task only shows up in the diff. On this page you write the issue with that in mind and run the work first on your own machine, then in GitHub Actions. Turning the resulting change into a PR and merging it is still a person's job.
The examples are from Claude Code, Anthropic's coding agent, and the command and setting names come from its official docs.
Pick the work to give the agent
The work that goes to the agent is work whose result can be checked with a command or a test. To find which of your work fits that description, put your team's work into one table as in the guide on which work to hand to an agent.
Writing an issue for every task has a cost too. For a small fix, or exploratory work where it isn't clear yet what needs doing, writing the issue can take longer than the work itself. Vague work that spreads across many files may not suit the agent even with a good issue. Do your first tries with small tasks that finish in a few files.
Write the issue for the agent
An issue is a work item in your team's tracking tool (in the glossary). When you write one for the agent, think of the questions it would ask you in plan mode, the mode where it explains what it will do and waits for your approval before touching any file, and put the answers in the issue. The sections below are my suggestion.
## Context
The order list returns every order in a single request. It needs pagination.
## Where to make changes
- src/orders/list.ts
- src/orders/list.test.ts
## Out of scope
- Database schema
- UI
## Verification
pnpm test src/orders must pass.
## Acceptance criteria
Given 120 orders, when the first page is requested, then 50 orders and the cursor for the next page are returned.
Don't skip the Out of scope section. In an unattended run it's the clearest place that tells the agent where to stop. The agent checks its own work with the command in the Verification section, and whoever reviews the PR can start the review with the same command.
An acceptance criterion is the sentence that has to be true for the work to count as done (in the glossary). Why to write it as given, when, then, and why to start with a small task whose plan gets approved, are in the article Where to start with Claude Code in a team.
Try it with claude -p on your own machine first
claude -p runs Claude Code non-interactively, writes the answer and exits. Before you connect the issue to GitHub, run the same work this way on your own machine, and you'll see there what the agent understood from the issue. The numbers below are examples.
cat issue.md | claude -p "Do the work in this issue, then run pnpm test src/orders." --allowedTools "Read,Edit,Bash(pnpm test *)" --max-turns 10 --max-budget-usd 2 --output-format json
--allowedTools lists the tools that run without asking. In a rule like Bash(git diff *), the star after a space means a prefix match, while Bash(git diff*) with no space also catches git diff-index. --max-turns limits how many turns the agent works. It only works in this mode, and when the run hits the limit it ends with an error. There's no default limit. --max-budget-usd puts a ceiling on spending.
In v2.1.302 and later, if no other setting decides the permission mode, claude -p starts in Manual mode, the mode that asks for approval on every call not on the allow list. In a non-interactive run there's nobody to approve, so those calls are rejected. --permission-mode dontAsk does the same thing explicitly, and the docs recommend it for locked-down CI runs. Rejected calls show up in the permission_denials field of the output.
The total_cost_usd field in the --output-format json output shows the cost, but the docs treat it as an estimate made on the client side, and the real bill can differ.
Running with --bare
A run opened with --bare doesn't load hooks, skills, subagents, plugins, MCP servers, auto memory or CLAUDE.md by itself. The docs recommend it for CI and say it will become the default for -p later. In this mode you sign in only with ANTHROPIC_API_KEY or a cloud provider's credentials, and subscription sign-in isn't used.
For work in your team's own repo, my suggestion is the opposite of what the docs recommend here, to run without --bare. Only then does the agent see the team's skills and the rules in CLAUDE.md. The cost is clear too. A -p run without --bare runs the hooks in the project's .claude/settings.json and connects to the servers in .mcp.json, even in an untrusted folder and without asking anything. Pay that cost only in a repo whose contents you trust. In a repo that comes from outside, use --bare, or run with --setting-sources user, which loads only your own settings. To turn off hooks there's --settings '{"disableAllHooks": true}', and for the MCP side there's disabledMcpjsonServers from the MCP guide.
Run it with GitHub Actions
GitHub Actions is GitHub's system that runs workflows triggered by an event in the repo. The shortest setup for Claude Code is to type /install-github-app in a session (GitHub Actions docs). This only works for github.com repos. You need to have run gh auth login in the GitHub CLI first, and you need admin rights on the repo. If you want to set it up by hand, install the app and add the secret to the repo, then copy the examples/claude.yml file from the action's repo into .github/workflows/.
The secret is named ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN. The second one is generated by claude setup-token, and the token is tied to the subscription of whoever ran that command. For a secret the team will share, use an API key. The key sits in GitHub Secrets, and the docs' warning is short, "Never commit API keys".
The workflow below runs when @claude appears in an issue or PR comment. The turn ceiling is the same as in the local try.
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: "--max-turns 10"
The action runs in two modes. Without a prompt input, it's called with @claude and does what the comment asks. Give it a prompt and it runs on its own like an automation, writing the result to the workflow log by default. Command line options like --max-turns, --model, --mcp-config and --allowedTools go through claude_args. To run one of your team's skills, write prompt: "/skill-name". For the skill in the repo to be found, an actions/checkout step has to come first.
Only someone with write access to the repo can run it with @claude. Bots are rejected without the allowed_bots input, and the docs consider the allowed_non_write_users input, which opens the door to people without write access, very risky. Every run costs Actions minutes plus tokens. To limit the cost, the docs recommend clearly written @claude requests, --max-turns, a timeout on the workflow, and the concurrency setting that limits how many runs GitHub executes at once.
Who opens the PR and who merges it
The opening sentence of the docs says the action turns issues into PRs. The action's own security note is narrower, "Claude does not create pull requests automatically." Claude commits to a new branch and leaves a prefilled link to the PR page, and a person opens the PR from that link. The note's reason is human oversight ("intentional for human oversight"). The FAQ page doesn't describe any setting that makes it open the PR by itself.
Every run that starts from an issue opens a new branch with a timestamp. Working on an open PR, it pushes to that PR's branch, and on a closed or merged PR it starts with a new branch again. It also stays out of git operations that are hard to undo, like rebase and force push. The action doesn't merge. A person does the merge.
On PRs, the .claude/ folder and CLAUDE.md are restored from the base branch, the branch the PR will merge into. A PR can't change the rules of its own review. package.json and the lock file, though, stay as they are in the PR, so look at any change to those two separately in the review.
If the workflow gives the action Actions' default GITHUB_TOKEN through the github_token input, the commits Claude makes don't trigger CI workflows. If tests never run on Claude's commits, the docs' fix is to delete that input, and the example above doesn't have it. PRs from a fork don't get secrets, and don't check out untrusted code with pull_request_target.
Who approves the agent's work, and from which queue, is covered in the approval gate guide. For what a PR is, see the glossary.
Work that touches more than one repo
The action's token is limited to the repo it runs in ("sandboxed to the current repository only"), and it can't push to another repo.
If a new endpoint touches both the service and the gateway in front of it, my suggestion is to open a separate issue for each repo and put the link to the other one in the title of each issue. Each repo produces its own PR, and a person decides which one gets merged first.
The GitLab CI equivalent
On GitLab the same work runs with claude -p inside a .gitlab-ci.yml job. According to the docs, the integration is in beta and GitLab maintains it.
Common mistakes
If a comment with @claude gets no reply, first check that the app is installed on that repo, then check whether the person who wrote the comment has write access. The word also has to be written exactly as @claude.
From here
None of the sources this page relies on gives a number for how long the agent takes to finish a task or what share of tasks it finishes. The measure you have is your own runs. Keep how many turns each PR took and the total_cost_usd estimate in a table over a few tasks, and it shows which kind of issue gets stuck with the agent.
In TeamHandbook Orchestrator, a task goes from the board to the agent along with your team's skills, and the change waits for your review. In a Git repo the task ends on its own branch. You open the merge request (or pull request) yourself by pressing the Open a merge request (or pull request) button, and until then nothing is pushed to GitLab or GitHub. In a folder that holds more than one repo, each repo that changed gets its own branch and merge request, and none reaches its repo until you merge it. The details are on the TeamHandbook Orchestrator page.