skill-system-github

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill System GitHub

GitHub技能系统

Run consistent GitHub operations through
gh
with explicit safety checks for workflow writes and predictable return shapes.
通过
gh
执行标准化的GitHub操作,针对工作流写入操作提供明确的安全检查,并返回可预测格式的结果。

Decision Matrix

决策矩阵

Task IntentOperationPrimary BackendNotes
Create/list/comment/close/reopen issues
manage-issues
gh issue
Check duplicates before creating new issues
Create/update/delete labels, apply labels to issue
manage-labels
gh label
,
gh issue edit
Confirm destructive delete before execution
Bootstrap/update issue templates
manage-templates
file read/write toolsEdit
.github/ISSUE_TEMPLATE/*
directly
List/check/create/update workflows
manage-workflows
gh workflow
, file read/write tools
Run
safety-check
before pushing workflow changes
Decide workflow push path based on token scope
safety-check
gh auth status
,
gh api
Use API fallback when
workflow
scope is missing
任务目标操作核心后端工具说明
创建/列出/评论/关闭/重新打开Issue
manage-issues
gh issue
创建新Issue前检查是否重复
创建/更新/删除标签、为Issue添加标签
manage-labels
gh label
,
gh issue edit
执行删除操作前需确认
初始化/更新Issue模板
manage-templates
文件读写工具直接编辑
.github/ISSUE_TEMPLATE/*
列出/检查/创建/更新工作流
manage-workflows
gh workflow
, 文件读写工具
推送工作流变更前运行
safety-check
根据令牌权限范围决定工作流推送路径
safety-check
gh auth status
,
gh api
当缺少
workflow
权限时使用API降级方案

Core Patterns

核心模式

Pattern 1: Resolve repository and perform issue operation

模式1:解析仓库并执行Issue操作

bash
gh issue list --repo <owner/repo> --state open --limit 50
gh issue create --repo <owner/repo> --title "<title>" --body "<body>"
bash
gh issue list --repo <owner/repo> --state open --limit 50
gh issue create --repo <owner/repo> --title "<title>" --body "<body>"

Pattern 2: Label lifecycle and issue label application

模式2:标签生命周期与Issue标签应用

bash
gh label create "<name>" --repo <owner/repo> --description "<desc>" --color "<hex>"
gh label edit "<name>" --repo <owner/repo> --new-name "<new>" --description "<desc>" --color "<hex>"
gh issue edit --repo <owner/repo> <number> --add-label "<label1>,<label2>"
bash
gh label create "<name>" --repo <owner/repo> --description "<desc>" --color "<hex>"
gh label edit "<name>" --repo <owner/repo> --new-name "<new>" --description "<desc>" --color "<hex>"
gh issue edit --repo <owner/repo> <number> --add-label "<label1>,<label2>"

Pattern 3: Workflow visibility and recent run checks

模式3:工作流可见性与最近运行记录检查

bash
gh workflow list --repo <owner/repo>
gh run list --repo <owner/repo> --workflow "<name>" --limit 5
bash
gh workflow list --repo <owner/repo>
gh run list --repo <owner/repo> --workflow "<name>" --limit 5

Pattern 4: Workflow scope gate before writing
.github/workflows/*

模式4:写入
.github/workflows/*
前的工作流权限校验

bash
gh auth status
gh api repos/<owner>/<repo>/contents/.github/workflows/<file> \
  --method PUT \
  -f message="update workflow via api" \
  -f content="<base64-content>" \
  -f branch="<branch>"
bash
gh auth status
gh api repos/<owner>/<repo>/contents/.github/workflows/<file> \
  --method PUT \
  -f message="update workflow via api" \
  -f content="<base64-content>" \
  -f branch="<branch>"

Guidelines

指导原则

  • Always resolve
    owner/repo
    first; infer from
    git remote get-url origin
    when not provided.
  • Always check duplicate issue titles before issue creation.
  • Always ask for explicit confirmation before label deletion.
  • Always run
    safety-check
    before workflow writes that require push permissions.
  • Always use file tools for
    .github/ISSUE_TEMPLATE/*
    and
    .github/workflows/*
    edits.
  • Never include secrets in issue/comment/template/workflow bodies.
  • Return structured output with
    status
    ,
    url
    , and
    error
    fields for all operations.
skill
{
  "schema_version": "2.0",
  "id": "skill-system-github",
  "version": "1.0.0",
  "capabilities": ["github-issue", "github-label", "github-template", "github-workflow", "github-safety"],
  "effects": ["net.fetch", "proc.exec", "git.read", "fs.read", "fs.write"],
  "operations": {
    "manage-issues": {
      "description": "Create, list, comment on, close, or reopen GitHub issues with duplicate detection before create.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: create, list, comment, close, reopen" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "title": { "type": "string", "required": false, "description": "Issue title for create" },
        "body": { "type": "string", "required": false, "description": "Issue body for create or comment body" },
        "number": { "type": "number", "required": false, "description": "Issue number for comment/close/reopen" },
        "state": { "type": "string", "required": false, "description": "Issue listing state: open, closed, all" },
        "limit": { "type": "number", "required": false, "description": "List limit" },
        "label": { "type": "string", "required": false, "description": "Optional label filter for listing" }
      },
      "output": {
        "description": "Operation status and issue URL when applicable.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-issues.md"
      }
    },
    "manage-labels": {
      "description": "Create, update, delete labels, and apply labels to issues in a GitHub repository.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: create, update, delete, apply" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "name": { "type": "string", "required": false, "description": "Label name for create/update/delete" },
        "new_name": { "type": "string", "required": false, "description": "New label name for update" },
        "description": { "type": "string", "required": false, "description": "Label description for create/update" },
        "color": { "type": "string", "required": false, "description": "Hex color without #, for create/update" },
        "number": { "type": "number", "required": false, "description": "Issue number for apply" },
        "labels": { "type": "string", "required": false, "description": "Comma-separated labels for apply" },
        "confirm_delete": { "type": "boolean", "required": false, "description": "Explicit confirmation for delete" }
      },
      "output": {
        "description": "Operation status and optional resource URL.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-labels.md"
      }
    },
    "manage-templates": {
      "description": "Bootstrap and update repository issue templates under .github/ISSUE_TEMPLATE.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: bootstrap, update" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "template_type": { "type": "string", "required": false, "description": "Template selector: bug_report, feature_request, config" },
        "content": { "type": "string", "required": false, "description": "Updated YAML content for update action" }
      },
      "output": {
        "description": "Operation status and changed path details.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-templates.md"
      }
    },
    "manage-workflows": {
      "description": "List or check workflow runs and create/update workflow YAML files safely.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: list, check, create, update" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "workflow_name": { "type": "string", "required": false, "description": "Workflow display name or filename for check/update" },
        "workflow_file": { "type": "string", "required": false, "description": "Workflow filename under .github/workflows" },
        "content": { "type": "string", "required": false, "description": "Workflow YAML content for create/update" },
        "branch": { "type": "string", "required": false, "description": "Branch for API fallback updates" }
      },
      "output": {
        "description": "Operation status and workflow URL when available.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-workflows.md"
      }
    },
    "safety-check": {
      "description": "Check gh auth token scopes for workflow writes and choose push or gh api fallback path.",
      "input": {
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "workflow_file": { "type": "string", "required": false, "description": "Workflow filename to write under .github/workflows" },
        "workflow_content": { "type": "string", "required": false, "description": "Workflow YAML content used for API fallback" },
        "branch": { "type": "string", "required": false, "description": "Target branch name" },
        "commit_message": { "type": "string", "required": false, "description": "Commit message for API fallback" }
      },
      "output": {
        "description": "Decision and recommended write path.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/safety-check.md"
      }
    }
  },
  "stdout_contract": {
    "last_line_json": false,
    "note": "Agent-executed operations; procedures are defined in markdown entrypoint scripts."
  }
}
  • 始终优先解析
    owner/repo
    ;当未提供时,从
    git remote get-url origin
    中推断。
  • 创建Issue前始终检查标题是否重复。
  • 删除标签前始终要求明确确认。
  • 执行需要推送权限的工作流写入操作前,始终运行
    safety-check
  • 编辑
    .github/ISSUE_TEMPLATE/*
    .github/workflows/*
    时始终使用文件工具。
  • 切勿在Issue、评论、模板或工作流内容中包含敏感信息。
  • 所有操作返回包含
    status
    url
    error
    字段的结构化输出。
skill
{
  "schema_version": "2.0",
  "id": "skill-system-github",
  "version": "1.0.0",
  "capabilities": ["github-issue", "github-label", "github-template", "github-workflow", "github-safety"],
  "effects": ["net.fetch", "proc.exec", "git.read", "fs.read", "fs.write"],
  "operations": {
    "manage-issues": {
      "description": "Create, list, comment on, close, or reopen GitHub issues with duplicate detection before create.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: create, list, comment, close, reopen" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "title": { "type": "string", "required": false, "description": "Issue title for create" },
        "body": { "type": "string", "required": false, "description": "Issue body for create or comment body" },
        "number": { "type": "number", "required": false, "description": "Issue number for comment/close/reopen" },
        "state": { "type": "string", "required": false, "description": "Issue listing state: open, closed, all" },
        "limit": { "type": "number", "required": false, "description": "List limit" },
        "label": { "type": "string", "required": false, "description": "Optional label filter for listing" }
      },
      "output": {
        "description": "Operation status and issue URL when applicable.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-issues.md"
      }
    },
    "manage-labels": {
      "description": "Create, update, delete labels, and apply labels to issues in a GitHub repository.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: create, update, delete, apply" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "name": { "type": "string", "required": false, "description": "Label name for create/update/delete" },
        "new_name": { "type": "string", "required": false, "description": "New label name for update" },
        "description": { "type": "string", "required": false, "description": "Label description for create/update" },
        "color": { "type": "string", "required": false, "description": "Hex color without #, for create/update" },
        "number": { "type": "number", "required": false, "description": "Issue number for apply" },
        "labels": { "type": "string", "required": false, "description": "Comma-separated labels for apply" },
        "confirm_delete": { "type": "boolean", "required": false, "description": "Explicit confirmation for delete" }
      },
      "output": {
        "description": "Operation status and optional resource URL.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-labels.md"
      }
    },
    "manage-templates": {
      "description": "Bootstrap and update repository issue templates under .github/ISSUE_TEMPLATE.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: bootstrap, update" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "template_type": { "type": "string", "required": false, "description": "Template selector: bug_report, feature_request, config" },
        "content": { "type": "string", "required": false, "description": "Updated YAML content for update action" }
      },
      "output": {
        "description": "Operation status and changed path details.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-templates.md"
      }
    },
    "manage-workflows": {
      "description": "List or check workflow runs and create/update workflow YAML files safely.",
      "input": {
        "action": { "type": "string", "required": true, "description": "One of: list, check, create, update" },
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "workflow_name": { "type": "string", "required": false, "description": "Workflow display name or filename for check/update" },
        "workflow_file": { "type": "string", "required": false, "description": "Workflow filename under .github/workflows" },
        "content": { "type": "string", "required": false, "description": "Workflow YAML content for create/update" },
        "branch": { "type": "string", "required": false, "description": "Branch for API fallback updates" }
      },
      "output": {
        "description": "Operation status and workflow URL when available.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/manage-workflows.md"
      }
    },
    "safety-check": {
      "description": "Check gh auth token scopes for workflow writes and choose push or gh api fallback path.",
      "input": {
        "repo": { "type": "string", "required": false, "description": "Target repo in owner/repo format" },
        "workflow_file": { "type": "string", "required": false, "description": "Workflow filename to write under .github/workflows" },
        "workflow_content": { "type": "string", "required": false, "description": "Workflow YAML content used for API fallback" },
        "branch": { "type": "string", "required": false, "description": "Target branch name" },
        "commit_message": { "type": "string", "required": false, "description": "Commit message for API fallback" }
      },
      "output": {
        "description": "Decision and recommended write path.",
        "fields": { "status": "string", "url": "string", "error": "string" }
      },
      "entrypoints": {
        "agent": "scripts/safety-check.md"
      }
    }
  },
  "stdout_contract": {
    "last_line_json": false,
    "note": "Agent-executed operations; procedures are defined in markdown entrypoint scripts."
  }
}