Fix github issue

From drvoss/everything-copilot-cli · View interactive version

Fix github issue is an AI agent skill from the GitHub repository drvoss/everything-copilot-cli. Use when you have a GitHub Issue number or link and want it resolved end-to-end — reads the issue, locates the bug, applies a fix, writes tests, and opens a PR from the terminal.

How to use this skill

Skill file

Fix GitHub Issue

When to Use

Differentiation from github-issue-triage: This skill fixes issues (code changes, tests,

PR). github-issue-triage is for organizing and classifying issues in bulk.

Prerequisites

gh issue view <n> --comments, gh search issues "<error text>"). To call the MCP tools, start the session with --add-github-mcp-tool=<name> for every

GitHub MCP tool you need (it replaces the default set, so include default ones you still use), or

--enable-all-github-mcp-tools, which also enables write tools

Workflow

1. Read the Issue

# Default with gh on PATH:
gh issue view 123 --repo my-org/my-app --comments

# When the MCP tools are exposed (no gh on PATH, or --add-github-mcp-tool=<name> for every GitHub MCP
# tool you need -- it replaces the default set -- or --enable-all-github-mcp-tools, which also enables write tools):
# Tool: github-mcp-server-issue_read
#   method: "get"
#   owner: "my-org"
#   repo: "my-app"
#   issue_number: 123

# Also read any existing comments for additional context:
# Tool: github-mcp-server-issue_read
#   method: "get_comments"
#   owner: "my-org"
#   repo: "my-app"
#   issue_number: 123

Extract:

2. Search for the Root Cause

# Search for the symbol, function, or error message mentioned in the issue
git --no-pager grep -n "functionNameFromIssue" -- "*.ts" "*.js"

# If it's an error message, search for where it's generated
git --no-pager grep -rn "the exact error string"

# Recent changes to the affected file
git --no-pager log --oneline -10 -- path/to/file.ts

3. Create a Dedicated Branch

$issueNumber = 123
$shortDesc = "fix-null-check-users-api"
git checkout -b "fix/issue-$issueNumber-$shortDesc"

4. Reproduce the Issue (Write a Failing Test First)

If the project has tests, write the test before fixing:

# Run existing tests to confirm baseline
npm test -- --testPathPattern="users"

# Write a failing test that demonstrates the bug
# (Edit the appropriate test file)

# Confirm test fails
npm test -- --testPathPattern="users" 2>&1 | Select-Object -Last 20

5. Implement the Fix

Make the minimal change to fix the root cause. Avoid unrelated cleanup in this commit.

# Verify tests pass after fix
npm test -- --testPathPattern="users"

# Run broader test suite
npm test

6. Commit with Issue Reference

git add -A
git commit -m "🐛 fix(users): handle null response when user not found

Fixes #123. The /api/users/:id endpoint was throwing a 500 error when the
user ID did not exist instead of returning 404. Added null check before
accessing user.profile."

7. Push and Open a PR

git push -u origin HEAD

# Open PR via gh CLI
gh pr create `
  --title "fix: handle null user in /api/users/:id (closes #123)" `
  --body "## Summary
Fixes #123

## Root Cause
The handler called \`user.profile.name\` without checking if \`user\` existed.

## Fix
Added early return with 404 response when user is not found.

## Testing
- Added unit test \`should return 404 when user not found\`
- All existing tests pass" `
  --base main

Examples

Bug: API Returns 500 Instead of 404

Issue #89: GET /api/posts/999 returns 500 Internal Server Error
Expected: 404 Not Found
Actual: TypeError: Cannot read property 'title' of null

Copilot workflow:

  1. gh issue view 89 --comments (when exposed: issue_read) → get full issue context
  2. grep -n "Cannot read property" → find where null is accessed
  3. Create branch fix/issue-89-null-post
  4. Write test: expect(response.status).toBe(404)
  5. Fix: add if (!post) return res.status(404).json({ error: 'Post not found' })
  6. Commit with Fixes #89
  7. Open PR

Enhancement: Add Missing Field to API Response

Issue #102: Missing 'updatedAt' field in /api/users response
Expected: response includes updatedAt timestamp
Actual: field not present

Copilot workflow:

  1. gh issue view 102 --comments (when exposed: issue_read + get_comments) → clarify which endpoint and format
  2. Search for the serializer/transformer function
  3. Add updatedAt field
  4. Update API docs/types
  5. Commit with Fixes #102

Tips

See Also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.