skills/generate-github-workflow/SKILL.md
GitHub Actions YAML with embedded output contract: security-first, minimal permissions, version pinning. For CI, release, PR checks. Differs from generic templates by spec compliance and auditability.
npx skillsauth add nesnilnehc/ai-cortex generate-github-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
为各种软件项目生成满足此技能的 附录 A:工作流输出合同 的 GitHub Actions 工作流文件。标准化结构、触发器和安全性可降低 CI/CD 设置成本并提高可维护性和可审核性,同时避免常见的安全和权限问题。该技能仅产生工作流YAML;它与文档或规则技能无关。如果用户稍后需要 README 或 AGENTS.md 更新,请单独调用这些技能。
首要目标:针对用户的场景、堆栈和安全态势生成完整、符合规范且可立即运行的 GitHub Actions 工作流 YAML 文件 — 只需要替换占位符即可部署。
成功标准(必须满足所有要求):
on 块的范围仅限于特定分支/路径/标签 - 没有没有过滤器的裸露 on: Push.github/Workflows/ 之前获得用户确认验收测试:用户替换占位符后,除了秘密名称和环境特定值之外,工作流是否可以在目标存储库中运行而无需进一步修改?
本技能负责:
本技能不负责:
.github/工作流s/转交点:生成并确认工作流YAML后,经用户批准将文件写入.github/工作流/。对于新工作流触发的文档更新,请单独使用文档技能。
何时使用:当用户或项目需要“为当前或指定项目创建或添加 GitHub 工作流”时。
范围:此技能的输出遵循嵌入式附录 A(狭窄的触发器、最小权限、固定版本、可审核)。通用模板(例如 Skills.sh github-actions-templates)更加通用;这项技能强调安全性和可维护性。
on必须指定分支/路径/标签;避免每次推送时触发。常见模式:带有“branches”或“paths”的“push”/“pull_request”。 发布 工作流必须仅在版本标签上触发(例如push:tags:['v*'])并且存在于与 CI 不同的文件中。内容:读取,释放内容:写入,包:写入;避免“全部”。CLAUDE.md 或 .ai-cortex/config.yaml,优先读取其中的 test_command、base_branch 等;否则从用户输入或项目推断。参见 docs/guides/project-config.md。.github/工作流s/ 或在未经用户确认的情况下提交。contents: write、packages: write),列出要创建/覆盖的文件和权限范围,然后在写入之前确认。main、develop)、路径过滤器、可选的工作流_dispatch。.github/Workflows/;对于多个工作流,指定每个文件名(例如“ci.yml”、“release.yml”)。.github/工作流s/<name>.yml。name、on、jobs,并且每个作业必须有runs-on和steps;不要使用未固定的第三方操作或硬编码的机密。.github/工作流/,请调整命名和风格并避免重复或冲突。GITHUB_TOKEN、BUILDX_BUILDER);不要重新实现该逻辑。不要做这些(其他技能可以处理它们):
.github/工作流s/.goreleaser.yaml 或 Dockerfiles 中已定义的构建/发布逻辑何时停止并交接:
on块的范围仅限于特定分支/路径/标签 - 没有没有过滤器的裸露on:push.github/Workflows/ 之前获得用户确认用户替换占位符后,除了秘密名称和环境特定值之外,工作流是否可以在目标存储库中运行而无需进一步修改?
输入:场景:CI。堆栈:节点 20、pnpm、测试 pnpm test、lint pnpm lint。触发器:“pull_request”到“main”。文件:ci.yml。
预期:带有“name”的单个“ci.yml”,例如“CI”; on: pull_request: 分支: [main];在 ubuntu-latest 上进行工作,包括结帐、设置 Node/pnpm、安装、lint、测试;使用固定的官方“actions/checkout”和“pnpm/action-setup”(或同等内容);没有硬编码的秘密;如果设置了“权限”,则为只读。
输入:场景:PR 检查。堆栈:Go 1.21,测试“go test ./...”。仅当 go.mod 或 *.go 更改时触发。文件:pr-check.yml。
预期:on.pull_request 和 paths: ['**.go', 'go.mod'];固定“actions/setup-go”的工作,步骤结账,设置 Go,进行测试;如果不需要写入,则省略“权限”或“内容:读取”。
输入:场景:CD/发行版。堆栈:Go、Docker 多架构 (amd64/arm64)、GoReleaser for image 和 GitHub Release。触发器:仅“push”标签“v*”。文件:release.yml。
预期:on:push:tags:['v*']; 权限包括内容:写、包:写。步骤:签出(fetch-深度:0)→设置Go(go-version-file:go.mod,缓存)→设置QEMU(linux/amd64,linux/arm64)→设置Docker Buildx(id:buildx,相同平台)→登录GHCR(docker/login-action,ghcr.io)→GoReleaser(goreleaser/goreleaser-action pinned, pass GITHUB_TOKEN and BUILDX_BUILDER: ${{ steps.buildx.outputs.name }}).不要重新实现 .goreleaser.yaml/Dockerfile 中定义的逻辑。 参见附录 B。
输入:项目:legacy-api。没有描述。语言和命令未知。用户想要“至少一个 CI 占位符工作流程”。
预期:生成一个结构完整、符合附录 A 的 YAML;对运行程序和步骤使用占位符(例如“指定运行程序和安装/测试命令”)并标记“要替换”;保持“on”范围较小(例如“pull_request:branches:[main]”);不要发明测试或构建命令;保留“name”、“on”、“jobs”、“runs-on”、“steps”和推荐字段(例如“permissions”),以便用户稍后填写。
development
Generate an LLM agent test suite (golden cases, mock-LLM unit tests, evaluator harness) from an agent implementation and its agent-test contract. Use when an agent has no tests, or a contract exists but the test code is missing.
development
After code changes, auto-detect the project's build system and local deployment method for a given directory, then build the project and restart its locally-deployed environment (Docker Compose / systemd / process manager). Never assumes — asks only when detection is ambiguous. Caches detected commands per project in .cortex/redeploy-local.yaml; re-invocations on the same project skip re-scanning until signal files change, the cache expires (30 days), or the skill version bumps.
tools
Publish a NATS message conforming to a cross-team contract, using NATS MCP tools. Authors the contract on first use if missing. Reads project-level cache (.cortex/nats.yaml) to avoid re-prompting basics across sessions.
tools
Drain pending NATS messages from a producer contract via NATS MCP tools (default batch / drain-style). Applies Tolerant Reader semantics and per-message ack/nak/term, returning aggregated stats. Reads project-level cache (.cortex/nats.yaml) to avoid re-prompting.