pr-to-spec
The flight envelope for agentic coding — convert PRs and local diffs into structured, agent-consumable specs with intent drift detection
Installation
Open Claude Code and run this command:
/plugin install pr-to-spec@claude-code-plugins-plus
Use --global to install for all projects, or --project for current project only.
What It Does
declare intent → make changes → pr-to-spec check → agent sees clean/drift/high-risk
- Declare intent: Tell
pr-to-specwhat you're building, what scope is allowed, and your risk ceiling - Make changes: Work normally in your branch
- Check drift:
pr-to-spec check --jsonproduces a structured spec + drift signals - Agent consumes: Any agent reads the envelope and acts accordingly
How It Works
Local Diff (no GitHub needed)
pr-to-spec scan --branch main --json
pr-to-spec scan --staged --json
pr-to-spec scan --diff 3 --json
Intent + Drift Detection
pr-to-spec intent set \
--goal "Add rate limiting to API" \
--scope "src/middleware/**" \
--forbid "src/db/**" \
--max-risk medium \
--type feature
pr-to-spec check --json
pr-to-spec intent show
GitHub PR Analysis
pr-to-spec --repo owner/repo --pr 42 --json | your-agent review
pr-to-spec --repo owner/repo --pr 42 --json | jq '.spec.risk_flags'
pr-to-spec --repo owner/repo --pr 42 --json \
| claude --print "Review this spec and decide: approve, request changes, or needs info"
FAQ
Your GITHUB_TOKEN has expired or is malformed. Generate a new one with repo scope (or fine-grained: pull requests read access).
"PR #N not found in owner/repo"
The PR doesn't exist, or your token doesn't have access to this repo. Check the repo name (owner/name) and PR number.
"GitHub API rate limit exceeded"
You've hit the GitHub API rate limit. Wait for the reset time shown in the error, or use a token with higher limits.
"Not a git repository"
Run pr-to-spec scan or pr-to-spec check from inside a git repository. For GitHub PRs, use --repo and --pr instead.
"Branch or ref 'X' not found"
The branch you specified with --branch doesn't exist locally. Check with git branch -a.
"PR has 300+ files; results may be incomplete"
GitHub's API returns at most 300 files per page. Very large PRs may have truncated file lists.