en un clic
implement-story
// Implements a GitHub user story from planning through PR creation, with research, codebase analysis, and structured commits.
// Implements a GitHub user story from planning through PR creation, with research, codebase analysis, and structured commits.
| name | implement-story |
| description | Implements a GitHub user story from planning through PR creation, with research, codebase analysis, and structured commits. |
Takes a GitHub user story issue and produces well-organized PR(s) that reliably meet the acceptance criteria.
The user provides a GitHub issue number or URL. Example:
/implement-story #4550
/implement-story https://github.com/stacklok/toolhive/issues/4550
Fetch the issue body using GitHub tools. Extract:
If the issue links to an RFC (look for THV-XXXX references or links to toolhive-rfcs):
../toolhive-rfcs/ first)If no RFC is linked, skip this step.
Search for sibling stories that share context with this one. These inform how to factor the code for extensibility:
# Search by keywords from the issue title
gh search issues "<keywords>" --repo stacklok/toolhive --state open --limit 10
# Search for issues linking to the same RFC
gh search issues "THV-XXXX" --repo stacklok/toolhive --limit 10
For each related story, read its acceptance criteria. Ask:
Do not implement sibling stories. Design internal interfaces so they can be extended without refactoring, but do not add config fields, CRD types, or user-facing API surface for functionality that isn't implemented in this PR. Unused config confuses users and reviewers.
Use the Explore agent or direct search to understand:
Document your findings before writing any code.
For each acceptance criterion, identify:
Evaluate the total scope against the project's PR guidelines:
If the story fits in one PR, use a single PR. If not, split into multiple PRs following these patterns:
task operator-manifests operator-generate output in the same PRFirst, show the user a high-level plan covering PR boundaries and what each PR delivers. Do NOT include commit-level details yet — get alignment on the split first.
## Implementation Plan
**Story**: #XXXX — [title]
**PRs**: [1 or N]
### PR 1: [title]
- [what this PR introduces and why]
- **AC covered**: [which acceptance criteria]
### PR 2: [title] (if needed)
- [what this PR introduces and why]
- **AC covered**: [which acceptance criteria]
Wait for user approval on the PR split. Adjust if the user has feedback.
Once the user approves the high-level split, enter plan mode for the first PR. In plan mode, explore the codebase and design commit boundaries, file changes, and test strategy. Present the detailed plan for user approval before writing code.
For subsequent PRs, enter plan mode again once CI is green for the previous PR.
git checkout -b <user>/<short-description> main
Implement the changes from the plan. Follow these principles:
Follow the commit boundaries from the plan. Each commit should:
go build ./... passes)After changes that affect generated artifacts, run the appropriate tasks:
| Change Type | Regeneration Command |
|---|---|
CRD type definitions (api/v1beta1/*_types.go) | task operator-manifests operator-generate |
| Mock interfaces | task gen |
| CLI commands or API endpoints | task docs |
| Helm chart values | task helm-docs |
| Any Go file | task license-fix |
Run these before committing the related changes. Include the generated output in the same commit as the trigger.
Follow the PR template at .github/pull_request_template.md and the rules in .claude/rules/pr-creation.md:
Closes #XXXXBefore submitting, review each acceptance criterion from the issue:
If any AC is not covered, either implement it or flag it to the user with a reason.
After pushing, monitor CI status:
gh pr checks <pr-number> --repo stacklok/toolhive --watch
If CI fails:
If the story spans multiple PRs:
mainmainPart of #XXXX)Closes #XXXXGuide for using ToolHive CLI (thv) to run and manage MCP servers and skills. Use when running, listing, stopping, building, or configuring MCP servers locally. Covers server lifecycle, registry browsing, secrets management, client registration, groups, container builds, exports, permissions, network isolation, authentication, and skill management (install, uninstall, list, info, build, push, validate). NOT for Kubernetes operator usage or ToolHive development/contributing.
Validates operator chart contribution practices (helm template, ct lint, docs generation) before committing changes.
Creates ToolHive release PRs by analyzing commits since the last release, categorizing changes, recommending semantic version bump type (major/minor/patch), and triggering the release workflow. Use when cutting a release, preparing a new version, checking what changed since last release, or when the user mentions "release", "version bump", or "cut a release".
Generates polished GitHub release notes for a ToolHive release by analyzing every merged PR, cross-referencing linked issues, dispatching expert agents to assess breaking changes, and producing a formatted release body. Use when the user provides a GitHub release URL, tag name, or says "release notes".
Finds flaky tests on the main branch by analyzing GitHub Actions failures, ranks them by frequency, and enters parallel plan mode to design deflake strategies. Use when you want to find and fix the flakiest tests.
Augments human code review by summarizing changes, surfacing key review questions, assessing test coverage, and identifying low-risk sections. Use when reviewing a diff, PR, or code snippet as a senior review partner.