Get the FREE Ultimate OpenClaw Setup Guide →

gh-issue-close

Scanned
npx machina-cli add skill dceoy/github-cli-agent-skills/gh-issue-close --openclaw
Files (1)
SKILL.md
1.6 KB

GitHub Issue Close

When to use

  • The user asks to close or resolve an issue.
  • Work is finished, or the issue is duplicate/invalid/out of scope.

Inputs to confirm

  • Issue number or URL.
  • Target repo if not the current repo (--repo OWNER/REPO).
  • Close reason: completed or not planned.
  • Optional closing comment text.

Workflow

  1. Verify auth and access:
    gh --version
    gh auth status
    
  2. Check current state:
    gh issue view 123 --json number,title,state,stateReason
    
  3. Close with the right reason and optional comment:
    gh issue close 123 --reason "completed"
    gh issue close 123 --reason "not planned" --comment "Duplicate of #45"
    
  4. Verify closure:
    gh issue view 123 --json state,stateReason,closedAt --jq '"\(.state) \(.stateReason) \(.closedAt)"'
    

Examples

# Close as completed
~ gh issue close 123 --reason "completed"

# Close as not planned with a reason
~ gh issue close 123 --reason "not planned" --comment "Out of scope for current roadmap."

Notes

  • Arguments accept number or URL (gh issue close --help).
  • Close reasons are exactly completed or not planned.

References

Source

git clone https://github.com/dceoy/github-cli-agent-skills/blob/main/skills/gh-issue-close/SKILL.mdView on GitHub

Overview

gh-issue-close lets you close a GitHub issue from the gh CLI by specifying a closing reason (completed or not planned) and an optional closing comment. It validates authentication, checks the current issue state, and then closes the issue, followed by a verification view to confirm the closure.

How This Skill Works

It authenticates and queries the issue state using gh issue view, then executes gh issue close with --reason and optional --comment, and finally re-views the issue to confirm state and closedAt.

When to Use It

  • The user asks to close or resolve an issue.
  • Work is finished, or the issue is a duplicate/invalid/out of scope.
  • You need to close with a specific reason: completed or not planned.
  • You want to attach an optional closing comment for context.
  • You want to verify closure after the command runs.

Quick Start

  1. Step 1: Verify auth and access: gh --version; gh auth status
  2. Step 2: View the issue to confirm it can be closed: gh issue view 123 --json number,title,state,stateReason
  3. Step 3: Close the issue with a reason and optional comment, then verify: gh issue close 123 --reason "completed" --comment "Done"; gh issue view 123 --json state,stateReason,closedAt

Best Practices

  • Ensure you have the correct repo and issue number or URL before running the command.
  • Use the exact close reason values: "completed" or "not planned".
  • Include a concise closing comment to provide context if needed.
  • Verify closure with gh issue view to confirm state and closedAt.
  • If you closed the wrong issue, reopen it with gh issue edit and then proceed correctly.

Example Use Cases

  • Close as completed for issue 123 in the current repo.
  • Close as not planned for issue 123 with a note: 'Out of scope for the current roadmap.'
  • Close issue at URL https://github.com/OWNER/REPO/issues/123 as completed.
  • After closing, verify with gh issue view 123 to confirm state and closedAt.
  • If you closed the wrong issue, reopen it with gh issue edit.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers