close-stale-issues
Audit and close issues resolved by merged PRs
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-21
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- args
- repo (optional, defaults to current repo)
- name
- close-stale-issues
- description
- Audit and close issues resolved by merged PRs
02 资源文件 8
- 参考文档research.template.md581 B
- 参考文档technical-steps/step-01-init.md5.5 KB
- 参考文档technical-steps/step-02-technical-overview.md9.2 KB
- 参考文档technical-steps/step-03-integration-patterns.md9.8 KB
- 参考文档technical-steps/step-04-architectural-patterns.md7.0 KB
- 参考文档technical-steps/step-05-implementation-research.md7.6 KB
- 参考文档technical-steps/step-06-research-synthesis.md20.6 KB
- 参考文档workflow.md2.4 KB
03 SKILL.md 正文
Audit all open GitHub issues against merged PRs and close orphans that were resolved but not auto-closed.
Instructions
1. List all open issues
gh issue list --state open --limit 500 --json number,title,labels,body,createdAt
2. List all merged PRs (last 90 days)
gh pr list --state merged --limit 500 --json number,title,body,headRefName,mergedAt
3. Build the resolution map
For each merged PR, extract issue references from the body:
Closes #N,Fixes #N,Resolves #N(case-insensitive)- Also match branch name patterns:
{FirstInitial}.{LastName}/{ISSUE_NUMBER}-*
Build a map: {issue_number → [{pr_number, pr_title, mergedAt}]}.
4. Cross-reference open issues
For each open issue, check:
- Directly referenced: A merged PR body contains
Closes #N/Fixes #N/Resolves #Nfor this issue - Branch-matched: A merged PR branch name starts with
*/{ISSUE_NUMBER}- - Label-matched: The issue has a wave label (
p*-wave-*orwave-*) and the corresponding deployment branch has been merged to main
Classify each open issue as:
| Category | Criteria | Action |
|---|---|---|
| Resolved (direct) | Referenced by merged PR body | Close with comment |
| Resolved (branch) | Matched by branch name | Close with comment (note: inferred match) |
| Stale tracker | All sub-issues/checkboxes are closed | Close with comment |
| No match | No implementing PR found | Keep open |
5. Check tech-debt tracker issues
For issues labeled tech-debt that contain a task list (checkboxes), check if all referenced sub-issues are closed:
gh issue view {NUMBER} --json body
Parse - [x] #N and - [ ] #N patterns. If all checkboxes are checked or all referenced issues are closed, mark the tracker as a candidate for closure.
6. Present findings for approval
Do NOT close any issues until the user confirms. Present:
**Stale Issue Audit**
| Issue | Title | Category | Implementing PR | Proposed Action |
|-------|-------|----------|-----------------|-----------------|
| #123 | ... | Resolved (direct) | PR #456 (merged 2026-04-01) | Close |
| #789 | ... | Resolved (branch) | PR #790 (branch matched) | Close |
| #100 | ... | Stale tracker | All 3/3 sub-issues closed | Close |
| #200 | ... | No match | — | Keep open |
**Summary:** {resolved_count} issues to close, {no_match_count} issues to keep open
Wait for user approval before proceeding.
7. Close confirmed issues
For each approved closure:
gh issue close {NUMBER} --comment "$(cat <<'COMMENT'
Closed by stale-issue audit. Resolved by PR #{PR_NUMBER} ({PR_TITLE}), merged {MERGED_DATE}.
If this issue is not actually resolved, please reopen it.
COMMENT
)"
For tracker issues:
gh issue close {NUMBER} --comment "$(cat <<'COMMENT'
Closed by stale-issue audit. All tracked sub-issues have been resolved.
COMMENT
)"
8. Report summary
**Audit complete:**
- Issues closed: {count}
- Issues remaining open (no implementing PR): {count}
- Tracker issues closed: {count}
- Total open issues after audit: {count}
Differences from wave-audit
- wave-audit operates on a specific wave's deployment branch and uses wave labels
- close-stale-issues operates repo-wide across all open issues regardless of wave
- Use
wave-auditduring wave wrapup; useclose-stale-issuesfor periodic repo hygiene
What remains manual
- User must approve all closures before they execute
- Issues with no implementing PR require manual triage
- The skill does not verify that a PR actually implemented the issue — it relies on references and branch naming
04 同仓库更多 Skills
wave-wrapup
Finalize a wave — PR review, merge sequencing, issue cleanup, worktree cleanup, and handoff to retro
wave-start
Initialize a new wave — worktree cleanup, branch creation, label setup, status file update
wave-scope
Reconcile declared-vs-labeled wave scope between /wave-retro and /wave-kickoff — collect dispositions, fold in retro carry-forwards and memory must-includes, and refresh the meta-issue
wave-retro
Automated wave retrospective — PR analysis, assessments, trust matrix updates, feedback log, charter change proposals
wave-kickoff
Automated wave planning — branch creation, label management, issue labeling, kickoff comments, and execution plan
wave-audit
Audit open issues against merged PRs — find and close orphaned issues with proper comments