fora single Generate a reply draft for a GitCode Issue, for maintainers to review before sending.
When to use (all must be satisfied)
- The user expresses the intent to **"reply to the issue"** (such as "reply to this issue" or "help reply to issue #123").
- The user provideduniqueGitCode Issue link or
owner/repo#number。
When only a link is provided but there is no reply intent, do not use this skill.
Authentication
- Token acquisition methods(in priority order):
- Provided directly by the user: the user can provide the token directly in the question
- Environment variables: read from
GITCODE_TOKENread from
- Request header: use
PRIVATE-TOKEN: {token} - When not configured: prompt the user to go to GitCode personal access token to create a token
Dependencies
- Python 3.7+ standard library (required, no external dependencies).
First round: generate draft
1. Parse and call the script
- Parse the Issue from the user message: link (
gitcode.com/.../issues/123) orowner/repo#number. If it is the latter, concatenate it into a complete URL:https://gitcode.com/owner/repo/issues/number。 - SKILL_ROOT: the directory where this SKILL.md is located.
- Execute (using the scriptabsolute path):
python <SKILL_ROOT>/scripts/prepare_issue_reply.py --issue-url "<完整 Issue URL>" - Script execution time is about 30 seconds–2 minutes(DeepWiki queries and API calls are executed in parallel).
- If the exit code is non-zero or in the JSON
status == "error", prompt the user with the error message and end.
2. Read the script output
The script saves the JSON output to the file <SKILL_ROOT>/output_{owner}_{repo}_{number}.json(for example output_Ascend_RecSDK_1079.json), and also outputs execution progress and reminder information to stderr. Use the Read tool to read and parse the JSON file.
3. If someone has already replied
If status == "already_replied": prompt "This Issue has already been replied to by someone else, skipped", and the process ends.
4. Send Label (optional)
If in the JSON label_needed == true:
python <SKILL_ROOT>/scripts/post_comment.py --issue-url "<Issue URL>" --body "/label add triage-review"
If it fails, it can be ignored and will not affect the subsequent process.
5. Generate reply draft
In the JSON prompt_draft_partial is the prompt for generating the draft.
Execution order (must be executed in the following steps):
-
Check key fields
- status: must be "ok", otherwise prompt an error and end
- image_urls: check whether it is non-empty
- deepwiki_status: record the status
- security_warnings: check whether any exist
-
Process image content(if image_urls is non-empty, this step is mandatory)
- Use the Read tool to view each image (prefer image_local_paths)
- Record key image information (errors, configuration, logs, etc.)
- Incorporate the image analysis results into reply generation
- ⚠️ Warning: this step cannot be skipped! Image information is crucial for understanding the Issue!
-
Generate draft
Detailed step instructions:
-
Check key fields
status: must be"ok", otherwise prompt an error and endimage_urls: check whether it is non-empty,When non-empty, images must be viewed before generating the draftdeepwiki_status: if it is not"ok", inform the user that the knowledge base query was unsuccessfulsecurity_warnings: if non-empty, prompt that sensitive information has been detected
-
Process image content (e.g.,
image_urlsif non-empty)- mustuse multimodal capabilities to view each image (URLs in
image_urls, local paths inimage_local_pathsor base64 inimage_base64_list) - Record key information from the images (such as error screenshots, configuration interfaces, logs, etc.)
- Image information is often crucial for understanding the Issue problem; do not ignore it
- Incorporate the image analysis results into the process of generating the reply draft
- mustuse multimodal capabilities to view each image (URLs in
-
Generate the draft
- Use
prompt_draft_partialas the prompt - Combine: Issue content + DeepWiki content + image analysis results (if there are images)
- Remove leading and trailing whitespace and the “Reply:” prefix, which is the draft_reply
- Use
-
shown to the maintainer
- proposed reply content (draft): show draft_reply(for review and modification only, not yet sent; can be maintained in the conversation and updated after the user modifies it)
- Image analysis summary(if
image_urlsis non-empty): briefly explain the image content and confirm that it has been taken into consideration for the reply - DeepWiki status: if
deepwiki_statusis not"ok", inform the user that the knowledge base query was unsuccessful and the draft may lack project background information - Security warning: if
security_warningsis non-empty, prompt the user that sensitive information has been detected (such as a key leak) - must display the reminder: “After reviewing, say ‘send’ or ‘reply’ to post the comment; say ‘cancel’ to end this operation.”
- Conversation state: after the first round ends, it is consideredsend not confirmed(send_confirmed=false);Only whenthe userfollow-up messageexplicitly says “send,” “reply,” “post it,” etc., may post_comment be called to send the reply body
- The first roundmust end here:must notcall post_comment to send the reply body in this round; in this rounddo notsend the reply comment
Second round: confirm sending
Only whenthe user, in the same conversation’sfollow-up messageexplicitly expresses “send,” “reply,” “post it,” “just reply with this,” etc.send intent, may post_comment.py be called to send the reply body. Before any of the above expressions is received,forbiddento send the reply comment.
The user says “cancel”
If, after the first round displays the draft, the user in afollow-up messagesays “cancel,” “don’t send it,” “never mind,” etc.: prompt “This Issue reply operation has been canceled,” the process ends,do notcall post_comment to send any reply content.
Determine the content to send
- If the userThis messagecontains an explicit reply body (code block, long text); use that content.
- If the user previously modified the draft in the conversation, usethe version after the last modification。
- otherwise use the one generated in the first round draft_reply。
Send
After determining the Issue URL and body:
- Short text(no line breaks, no quotes):
python <SKILL_ROOT>/scripts/post_comment.py --issue-url "<URL>" --body "<正文>" - Long text or contains special characters: first write the body to a temporary file using the Write tool (write to the system temporary directory or workspace directory, do not write to SKILL_ROOT), then:
python <SKILL_ROOT>/scripts/post_comment.py --issue-url "<URL>" --body-file "<临时文件路径>"
Process example
Complete normal process
用户:回复这个 issue https://gitcode.com/owner/repo/issues/42
→ 解析 Issue URL → 执行 prepare_issue_reply.py
→ 读取 JSON → status=ok, label_needed=true
→ 执行 post_comment.py 打 triage-review 标签
→ 生成 draft_reply → 会话状态 send_confirmed=false
→ 展示草稿 + 提醒语「审阅后请说「发送」或「回复」以发布评论,说「取消」则结束本次操作。」(第一轮结束)
用户:把第二段改温和一点
→ 修改 draft_reply → 更新会话中的草稿
→ 展示修改后的草稿 + 提醒语(仍为未确认发送状态)
用户:发送
→ 触发第二轮 → 视为 send_confirmed=true
→ 取修改后的 draft_reply 写入临时文件
→ 执行 post_comment.py --body-file "<临时文件>" 发送回复正文
→ 反馈发送成功结果
Cancellation process
用户:回复这个 issue https://gitcode.com/owner/repo/issues/42
→ 生成草稿并展示 + 提醒语
用户:取消
→ 提示「已取消本次 Issue 回复操作」,流程结束,不发送回复评论
Prohibitions and conventions
- Do not send the reply body before the user explicitly expresses an intent to send: only when the usersubsequent messagecontains explicit sending intent such as "send", "reply", "post it", "just reply with this", may post_comment.py be called to sendreply content; after the first round of draft generation, the reply comment must not be sent in the same round or without user confirmation; when the user says "cancel", it must not be sent.
- Except for prepare_issue_reply.py、post_comment.py , do not generate or execute other scripts.
- For posting comments, always use post_comment.py。
- Temporary files must not be written to the SKILL_ROOT directory。
Reference
- Prompt template:
references/prompts/draft_reply.txt。 - GitCode API:Official documentation。