用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Morrison-Lab/ai-config --skill migrate-discussion命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | migrate-discussion |
| description | Move items between Issues and Discussions. |
| user-invocable | true |
| allowed-tools | ["Bash","Read"] |
Move a topic to the tracker where it belongs: a discussion that turned into a concrete bug/task should become an Issue; an issue that's really a question, idea, or support request should become a Discussion. Migration is a judgement call — the "when helpful" part matters as much as the mechanics.
Don't migrate just because a thread is long. Migrate only when the item is clearly in the wrong tracker.
| Move it discussion → issue when… | Move it issue → discussion when… |
|---|---|
| It's a concrete, reproducible bug | It's an open-ended question or support request |
| It's an actionable task with a clear "done" | It's brainstorming / a feature idea with no decision |
| Maintainers have decided to act on it | It needs community input before any work |
| It needs an assignee, label, milestone, or board | It has no actionable scope and no owner |
Leave it where it is when it's borderline, when both trackers fit, or when the thread is active and a move would disrupt it. When unsure, ask the user — don't migrate on a hunch.
GitHub has built-in one-click conversions, and they're the best path because they preserve the original author, the full comment thread, and post an automatic cross-reference:
... menu), pick a category.... menu).There is no GraphQL mutation or gh subcommand for either conversion — they
are UI-only. So when you (or the user) can reach the web UI, that's the move:
point the user at the button, or walk them through it, and you're done.
Use the recreate procedure below only when the native UI path isn't usable (scripted/headless context, or the user explicitly wants it rebuilt).
When you can't use the native convert feature, create the new item by hand, preserve attribution, cross-link both ways, and close the original with a pointer. Get the user's approval on the drafted new item before creating it — this is outward-facing and hard to reverse.
Read the source discussion (see the discussions skill's read query) to capture its title, body, author, URL, and key comments.
Create the issue, quoting the original and linking back so authorship and context aren't lost:
gh issue create \
--title '<original title>' \
--body 'Migrated from discussion <url> (opened by @<author>).
<original body, quoted>
Key points from the discussion thread:
- @<login>: <summary>' # CREATE_ISSUE
In a remote/web session, use mcp__github__issue_write (method: create)
with the same body instead of gh.
Comment on the discussion pointing at the new issue, then close it:
gh api graphql -f discussionId='<discussion-id>' -f body='Moved to <issue-url> to track the actionable work.
_Posted by Claude Code (AI agent) --- not written by a human._' -f query='
mutation($discussionId: ID!, $body: String!) {
addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
comment { url }
}
}' # COMMENT_DISCUSSION
gh api graphql -f discussionId='<discussion-id>' -f query='
mutation($discussionId: ID!) {
closeDiscussion(input: {discussionId: $discussionId, reason: OUTDATED}) {
discussion { url closed }
}
}' # CLOSE_DISCUSSION
closeDiscussion reasons are RESOLVED, OUTDATED, or DUPLICATE; use
OUTDATED for a plain move.
Read the source issue (gh issue view <N> — VIEW_ISSUE — or
mcp__github__issue_read) for its title, body, author, URL, and comments.
Look up the repository node ID and the target category ID (only certain categories exist per repo):
gh api graphql -f owner='<owner>' -f repo='<repo>' -f query='
query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
id
discussionCategories(first: 20) { nodes { id name isAnswerable } }
}
}'
Create the discussion, quoting the original and linking back:
gh api graphql -f repositoryId='<repo-id>' -f categoryId='<category-id>' -f title='<original title>' -f body='Migrated from issue <url> (opened by @<author>).
<original body, quoted>' -f query='
mutation($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) {
discussion { number url }
}
}' # CREATE_DISCUSSION
Comment on the issue pointing at the new discussion, then close the issue as not planned:
gh issue comment <N> --body 'Moved to <discussion-url> — this is better suited to Discussions.
_Posted by Claude Code (AI agent) --- not written by a human._' # COMMENT_ISSUE
gh issue close <N> --reason 'not planned' # CLOSE_ISSUE
In a remote/web session, use mcp__github__add_issue_comment and
mcp__github__issue_write (method: update, state: closed,
state_reason: not_planned).
Give the user both links (old and new) as clickable markdown links, say which direction the migration went, and confirm the original was closed with a pointer.