Implement Issue
Analyze a GitHub issue and create a pull request that implements the fix
Claude CodeGeneric
---
description: Analyze a GitHub issue and create a pull request that implements the fix
---
# Implement Issue
Automatically analyze a GitHub issue, implement the required changes, and create a pull request with the fix.
## Usage
/implement-issue
**Example**: `/implement-issue 72`
## Workflow
1. **Validate issue number argument**
- If no issue number provided, prompt user: "Please provide an issue number: /implement-issue <number>"
- If issue number is not a valid integer, show error and exit
2. **Fetch issue details from GitHub**
```bash
gh issue view <issue-number>
- If issue doesn't exist, show error and exit
- If issue is closed, ask user if they still want to proceed
- Display issue title, description, and labels for context
Analyze the issue
- Read the issue description carefully
- Identify what type of change is needed:
- Bug fix
- New feature
- Test addition
- Documentation update
- Workflow/CI fix
- Refactoring
- Determine affected files by:
- Reading issue description for file/path mentions
- Searching codebase for relevant code patterns
- Using Grep/Glob tools to find related files
- Check CLAUDE.md for repository-specific patterns and guidelines
- Create a mental implementation plan
Check current git status
git status- If there are uncommitted changes, ask user:
- "You have uncommitted changes. What would you like to do?"
- Option 1: Stash changes and continue
- Option 2: Commit changes first
- Option 3: Cancel operation
- "You have uncommitted changes. What would you like to do?"
- Handle user's choice before proceeding
- If there are uncommitted changes, ask user:
Ensure main branch is up to date
git checkout main git pull origin main- If pull fails, explain error and exit
Create feature branch
- Generate branch name from issue:
- Format:
fix-issue-<number>-<brief-description> - Example:
fix-issue-72-add-logging-function - Keep description under 50 chars, use kebab-case
- Format:
- Create and checkout branch:
git checkout -b <branch-name>
- Generate branch name from issue:
Use TodoWrite tool to create implementation plan
- Break down the implementation into specific tasks
- Examples:
- "Read current implementation of X"
- "Create new function Y in file Z"
- "Add tests for feature X"
- "Update documentation"
- "Run tests to verify changes"
- "Commit changes"
- "Create pull request"
- Mark first task as in_progress
Implement the fix
- Follow repository patterns from CLAUDE.md
- Read existing code before making changes
- Implement changes step-by-step, updating TodoWrite as you progress
- For code changes:
- Use Read tool to understand existing code
- Use Edit/Write tools to make changes
- Follow existing code style and patterns
- Add comments where logic isn't self-evident
- For test changes:
- Follow existing test patterns (see helpers_test.go)
- Add comprehensive test coverage
- Ensure tests are idempotent and can run in sequence
Run relevant tests
- Determine which tests to run based on changes:
- If config changed:
go test -v ./test -run TestConfig - If helpers changed:
go test -v ./test -run TestHelpers - For general changes:
make test-prereq
- If config changed:
- If tests fail:
- Analyze failure
- Fix implementation
- Re-run tests
- Repeat until tests pass
- Determine which tests to run based on changes:
Format code
go fmt ./...Commit changes
- Create descriptive commit message following this format:
<Brief summary> (fixes #<issue-number>) <Detailed description of what changed and why> **Changes**: - <Change 1> - <Change 2> **Testing**: - <Test 1 passed> - <Test 2 passed> Fixes #<issue-number> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> - Commit using:
git add . git commit -m "$(cat <<'EOF' <commit message here> EOF )"
- Create descriptive commit message following this format:
Push branch to remote
git push -u origin <branch-name>Create pull request
- Use
gh pr createwith detailed PR description - PR title:
<Brief summary> (fixes #<issue-number>) - PR body should include:
Summary
Problem (reference original issue)
Solution
Changes
Testing
- Fixes #
- 🤖 Generated with Claude Code
- Example:
gh pr create --title "Add logging function (fixes #72)" --body "$(cat <<'EOF' ## Summary Implements logging function as requested in #72 ## Problem <Describe the problem from the issue> ## Solution <Describe how you fixed it> ## Changes - <Change 1> - <Change 2> ## Testing - [x] Tests pass - [x] Code formatted Fixes #72 🤖 Generated with [Claude Code](https://claude.com/claude-code) EOF )"
- Use
Provide summary to user
- Display PR URL
- List files changed
- Show test results
- Remind user that CI will run automatically
Important Guidelines
Code Quality
- Read before writing: Always use Read tool to understand existing code before making changes
- Follow patterns: Adhere to CLAUDE.md guidelines and existing code patterns
- Test coverage: Add tests for new functionality
- No over-engineering: Only implement what's requested in the issue
- Security: Check for common vulnerabilities (SQL injection, XSS, command injection, etc.)
Repository-Specific Patterns
- Configuration: Use
config := NewTestConfig()pattern - Helpers: Reuse functions from
helpers.go - Tests: Follow sequential test pattern, use
testing.Short()for lo
Maintain Implement Issue?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Implement Issue on getagentictools](https://getagentictools.com/loops/radekcap-implement-issue?ref=badge) npx agentictools info loops/radekcap-implement-issue The second line is the CLI lookup for this page — handy in READMEs and docs.