Stacks for AI Agents
One-page bootstrap for AI coding agents to install the Mergify CLI and the Stacks skill.
You are an AI coding agent. Follow these four steps to enable stacked pull request support. After step 2, your skill system will contain the full Stacks workflow. Consult it for any stack-related task.
1. Install the Mergify CLI
Section titled 1. Install the Mergify CLIInstall mergify-cli with the install script:
curl -fsSL https://raw.githubusercontent.com/Mergifyio/mergify-cli/main/install.sh | shVerify:
mergify --version2. Install the Stacks skill
Section titled 2. Install the Stacks skillPick the command that matches your runtime.
Claude Code:
/plugin install mergify@claude-plugins-officialThis installs the unified mergify plugin, which includes the Stacks skill
(along with skills for the merge queue, CI Insights, and more).
Codex, Cursor, and any other agent supporting skills.sh:
npx skills add Mergifyio/mergify-cliThe skill contains the full Stacks workflow (commands, rules, and common scenarios). Load it before performing any stack work.
3. Initialize the repository
Section titled 3. Initialize the repositoryRun in the repository root:
mergify stack setupThis installs a commit-msg Git hook that generates a Change-Id for every
new commit, and a pre-push hook that warns if git push is used instead of
mergify stack push.
4. Make sure a GitHub token is available
Section titled 4. Make sure a GitHub token is availableStacks creates and updates pull requests through the GitHub API, so
mergify stack push needs a GitHub token. It reads --token first, then
MERGIFY_TOKEN, then GITHUB_TOKEN, then the token of an authenticated
GitHub CLI (gh auth token). If none of those is
set, run gh auth login or export a token:
export GITHUB_TOKEN=your_token_hereA Mergify application key is not a GitHub
token. If MERGIFY_TOKEN holds one, pass the GitHub token as --token
instead, or the push fails. See
GitHub token for Stacks.
You are ready
Section titled You are readyThe skill installed in step 2 contains the workflow. Follow it for any stack-related task.
Was this page helpful?
Thanks for your feedback!