new-issue
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNew Issue Skill
New Issue Skill
Create a GitHub issue based on the current conversation context.
基于当前对话上下文创建GitHub issue。
Prerequisites Check (MUST verify first)
前置条件检查(必须首先验证)
Mode Detection: Check if user specified a target repository.
| User Input | Mode | Git Repo Required |
|---|---|---|
| Explicit | No |
| Explicit | No |
| No repo specified | Auto-detect | Yes |
模式检测:检查用户是否指定了目标仓库。
| 用户输入 | 模式 | 是否需要Git仓库 |
|---|---|---|
| 显式指定 | 否 |
| 显式指定 | 否 |
| 未指定仓库 | 自动检测 | 是 |
Always Required:
始终需要:
bash
undefinedbash
undefinedCheck if gh CLI is available and authenticated
Check if gh CLI is available and authenticated
gh auth status
If gh not authenticated → "Please run `gh auth login` first."gh auth status
如果gh未完成认证 → "请先运行`gh auth login`。"Only for Auto-detect Mode (no repo specified):
仅适用于自动检测模式(未指定仓库时):
bash
undefinedbash
undefinedCheck if in a git repository
Check if in a git repository
git rev-parse --is-inside-work-tree
git rev-parse --is-inside-work-tree
Get repository info
Get repository info
gh repo view --json owner,name,url
If not in git repo and no target specified → "Please specify a target repository (e.g., `owner/repo` or GitHub URL), or navigate to a git project."gh repo view --json owner,name,url
如果当前不在Git仓库中且未指定目标仓库 → "请指定目标仓库(例如:`owner/repo`或GitHub URL),或导航到一个Git项目中。"Input
输入
The user triggers this skill with phrases like:
- "new issue"
- "create issue"
- "file an issue"
- "report this bug"
- "submit feature request"
Optional: User may specify target repository:
- Full URL:
https://github.com/owner/repo - Short form:
owner/repo
Context for the issue comes from:
- Current conversation history
- User's description of the problem/feature
- Code snippets or error messages discussed
- Any relevant file paths mentioned
用户可通过以下短语触发此技能:
- "new issue"(新建issue)
- "create issue"(创建issue)
- "file an issue"(提交issue)
- "report this bug"(报告此bug)
- "submit feature request"(提交功能请求)
可选:用户可指定目标仓库:
- 完整URL:
https://github.com/owner/repo - 简写格式:
owner/repo
Issue的上下文来源于:
- 当前对话历史
- 用户对问题/功能的描述
- 讨论过的代码片段或错误信息
- 提到的任何相关文件路径
Workflow
工作流
Step 1: Determine Target Repository
步骤1:确定目标仓库
Case A: User specified a repository
Parse the user input to extract owner/repo:
bash
undefined场景A:用户指定了仓库
解析用户输入以提取owner/repo:
bash
undefinedFrom URL: https://github.com/owner/repo or https://github.com/owner/repo/...
From URL: https://github.com/owner/repo or https://github.com/owner/repo/...
Extract: owner/repo
Extract: owner/repo
From short form: owner/repo
From short form: owner/repo
Use directly
Use directly
Validate the repository exists and is accessible
Validate the repository exists and is accessible
gh repo view "$TARGET_REPO" --json owner,name,url
If repo not found or inaccessible → "Repository '$TARGET_REPO' not found or you don't have access."
**Case B: Auto-detect from current git repo**
```bashgh repo view "$TARGET_REPO" --json owner,name,url
如果仓库未找到或无法访问 → "仓库'$TARGET_REPO'未找到或您无访问权限。"
**场景B:从当前Git仓库自动检测**
```bashGet repository info and check if it's a fork
Get repository info and check if it's a fork
gh repo view --json owner,name,isFork,parent,url
gh repo view --json owner,name,isFork,parent,url
If it's a fork, get parent (upstream) info
If it's a fork, get parent (upstream) info
IS_FORK=$(gh repo view --json isFork -q '.isFork')
if [ "$IS_FORK" = "true" ]; then
UPSTREAM_OWNER=$(gh repo view --json parent -q '.parent.owner.login')
UPSTREAM_NAME=$(gh repo view --json parent -q '.parent.name')
TARGET_REPO="$UPSTREAM_OWNER/$UPSTREAM_NAME"
else
Use current repo as target
TARGET_REPO=$(gh repo view --json owner,name -q '.owner.login + "/" + .name')
fi
undefinedIS_FORK=$(gh repo view --json isFork -q '.isFork')
if [ "$IS_FORK" = "true" ]; then
UPSTREAM_OWNER=$(gh repo view --json parent -q '.parent.owner.login')
UPSTREAM_NAME=$(gh repo view --json parent -q '.parent.name')
TARGET_REPO="$UPSTREAM_OWNER/$UPSTREAM_NAME"
else
Use current repo as target
TARGET_REPO=$(gh repo view --json owner,name -q '.owner.login + "/" + .name')
fi
undefinedStep 2: Analyze Context and Generate Issue Content
步骤2:分析上下文并生成Issue内容
Based on the conversation context, generate:
Language Requirement:
- The issue title and all description content MUST be in English.
- If the conversation is in another language, translate/summarize into English.
Title Generation Rules:
- Keep concise (under 80 characters)
- Start with issue type prefix if clear: ,
[Bug],[Feature],[Enhancement][Question] - Describe the core problem/request clearly
- Use imperative mood when appropriate
- Use English only
Description Generation:
Structure the description with these sections as applicable:
markdown
undefined基于对话上下文,生成:
语言要求:
- Issue标题和所有描述内容必须使用英文。
- 如果对话使用其他语言,需翻译/总结为英文。
标题生成规则:
- 保持简洁(不超过80字符)
- 如果明确类型,开头添加前缀:、
[Bug]、[Feature]、[Enhancement][Question] - 清晰描述核心问题/请求
- 适当使用祈使语气
- 仅使用英文
描述生成:
根据情况,按以下结构组织描述:
markdown
undefinedDescription
描述
[Clear explanation of the issue/feature request]
[对问题/功能请求的清晰说明]
Context
上下文
[Relevant background information from the conversation]
[对话中的相关背景信息]
Steps to Reproduce (for bugs)
复现步骤(针对bug)
- [Step 1]
- [Step 2]
- [Expected vs Actual behavior]
- [步骤1]
- [步骤2]
- [预期与实际行为]
Proposed Solution (if discussed)
提议的解决方案(如有讨论)
[Any solutions discussed in the conversation]
[对话中讨论过的解决方案]
Additional Information
附加信息
- [Relevant code snippets]
- [Error messages]
- [Environment details if relevant]
undefined- [相关代码片段]
- [错误信息]
- [相关环境细节(如适用)]
undefinedStep 3: Present Draft for User Review (CRITICAL)
步骤3:展示草稿供用户审核(至关重要)
MUST use the tool to present the draft and get user confirmation.
questionPresent the generated issue to the user:
undefined必须使用工具展示草稿并获取用户确认。
question向用户展示生成的issue:
undefinedIssue Draft
Issue草稿
Target Repository: [TARGET_REPO]
Title: [Generated Title]
Description:
[Generated Description]
Please review the above issue draft.
Use the `question` tool to ask:
Options:
- "Submit as-is" - Create the issue with current content
- "Modify title" - Change the issue title
- "Modify description" - Change the issue description
- "Cancel" - Do not create the issue
undefined目标仓库:[TARGET_REPO]
标题:[生成的标题]
描述:
[生成的描述]
请审核以上issue草稿。
使用`question`工具询问:
选项:
- "直接提交" - 使用当前内容创建issue
- "修改标题" - 更改issue标题
- "修改描述" - 更改issue描述
- "取消" - 不创建issue
undefinedStep 4: Handle User Modifications
步骤4:处理用户修改
If user chooses to modify:
For title modification:
- Ask user for the new title
- Update and show the revised draft
- Return to Step 3 for confirmation
For description modification:
- Ask user what changes they want
- User can provide:
- Specific text to add/remove/change
- General instructions like "make it shorter" or "add more detail about X"
- Update and show the revised draft
- Return to Step 3 for confirmation
Loop until user confirms or cancels.
如果用户选择修改:
修改标题:
- 询问用户新标题
- 更新并展示修订后的草稿
- 返回步骤3等待确认
修改描述:
- 询问用户想要的更改内容
- 用户可提供:
- 要添加/删除/修改的具体文本
- 通用指令,如“缩短内容”或“添加更多关于X的细节”
- 更新并展示修订后的草稿
- 返回步骤3等待确认
循环直到用户确认或取消。
Step 5: Create the Issue
步骤5:创建Issue
Once user confirms, create the issue:
bash
undefined用户确认后,创建issue:
bash
undefinedCreate issue on the target repository
Create issue on the target repository
gh issue create
--repo "$TARGET_REPO"
--title "$ISSUE_TITLE"
--body "$ISSUE_BODY"
--repo "$TARGET_REPO"
--title "$ISSUE_TITLE"
--body "$ISSUE_BODY"
**Use HEREDOC for body to preserve formatting**:
```bash
gh issue create --repo "$TARGET_REPO" --title "$ISSUE_TITLE" --body "$(cat <<'EOF'gh issue create
--repo "$TARGET_REPO"
--title "$ISSUE_TITLE"
--body "$ISSUE_BODY"
--repo "$TARGET_REPO"
--title "$ISSUE_TITLE"
--body "$ISSUE_BODY"
**使用HEREDOC编写正文以保留格式**:
```bash
gh issue create --repo "$TARGET_REPO" --title "$ISSUE_TITLE" --body "$(cat <<'EOF'Description
Description
[Description content here]
[Description content here]
Context
Context
[Context content here]
EOF
)"
undefined[Context content here]
EOF
)"
undefinedStep 6: Report Results
步骤6:报告结果
After issue creation, provide:
bash
undefined创建issue后,提供以下信息:
bash
undefinedGet the created issue details
Get the created issue details
gh issue view --repo "$TARGET_REPO" <ISSUE_NUMBER> --json number,title,url,state
undefinedgh issue view --repo "$TARGET_REPO" <ISSUE_NUMBER> --json number,title,url,state
undefinedOutput Format
输出格式
Issue Created Successfully
Issue创建成功
Issue: #[NUMBER] - [TITLE]
Repository: [TARGET_REPO]
URL: [ISSUE_URL]
Issue:#[编号] - [标题]
仓库:[目标仓库]
URL:[Issue链接]
Summary
摘要
[Brief confirmation of what was submitted]
[提交内容的简要确认]
Error Handling
错误处理
| Situation | Action |
|---|---|
| No context provided | Ask user to describe the issue they want to create |
| User cancels | "Issue creation cancelled. No issue was created." |
| API error | Report the error and suggest checking permissions |
| Rate limited | Inform user and suggest waiting |
| No write access | "You don't have permission to create issues on [REPO]. Consider forking first." |
| Repo not specified + not in git repo | Ask user to specify target repo or navigate to a git project |
| Invalid repo format | "Invalid repository format. Use 'owner/repo' or full GitHub URL." |
| 场景 | 操作 |
|---|---|
| 未提供上下文 | 请用户描述想要创建的issue内容 |
| 用户取消 | "Issue创建已取消,未创建任何issue。" |
| API错误 | 报告错误并建议检查权限 |
| 速率限制 | 通知用户并建议稍后再试 |
| 无写入权限 | "您无权限在[仓库]创建issue,请考虑先fork仓库。" |
| 未指定仓库且不在Git仓库中 | 请用户指定目标仓库或导航到Git项目中 |
| 无效的仓库格式 | "无效的仓库格式,请使用'owner/repo'或完整GitHub URL。" |
Common Mistakes
常见错误
- Generating a title or description in a non-English language
- Skipping explicit user confirmation before issue creation
- Including secrets or sensitive data in the issue body
- 生成非英文的标题或描述
- 在创建issue前跳过明确的用户确认步骤
- 在正文中包含机密或敏感数据
Important Notes
重要说明
- Always Confirm: NEVER create an issue without explicit user confirmation
- Preserve Context: Include relevant conversation context in the issue
- Flexible Targeting: Accept explicit repo (URL or owner/repo) OR auto-detect from git
- Fork Awareness: When auto-detecting, target upstream repository for forks
- Formatting: Use proper Markdown formatting in issue body
- Privacy: Do not include sensitive information (API keys, passwords, etc.) in issues
- Iteration: Allow multiple rounds of modification before submission
- 始终确认:未经用户明确确认,绝不要创建issue
- 保留上下文:在issue中包含相关对话上下文
- 灵活定位:接受显式指定仓库(URL或owner/repo)或从Git仓库自动检测
- Fork感知:自动检测时,针对fork仓库的上游仓库
- 格式规范:在issue正文中使用正确的Markdown格式
- 隐私保护:不要在issue中包含敏感信息(如API密钥、密码等)
- 迭代修改:允许在提交前进行多轮修改