部署前检查与安全发布
safe-deploy
在运行预检(pre-flight checks)后部署到目标环境。仅支持手动调用。
- License 许可
- MIT
- 最近更新
- 2026-05-15
- Stars
- ★ 13
- Forks
- 1
01 前言 Front Matter
- name
- safe-deploy
- title
- safe-deploy
- description
- Deploy to a target environment after running pre-flight checks. Only invoke manually.
- allowed-tools
- Bash(npm test) Bash(npm run build) Bash(git status) Bash(git log *) Bash(git push *) Bash(git tag *)
- argument-hint
- [ "environment" ]
- disable-model-invocation
- true
02 资源文件 1
- 其他SKILL.md.tmpl33.3 KB
03 SKILL.md 正文
Pre-flight checks
!git status --short
!git log --oneline -5
Deploy to: $ARGUMENTS
If $ARGUMENTS is empty, stop immediately. Report: "No environment specified. Invoke as: /safe-deploy <environment> (e.g., /safe-deploy staging or /safe-deploy production)."
Step 1: Abort if there are uncommitted changes
Check the git status output above. If it shows any modified, untracked, or staged files, stop here.
Report: "Deploy aborted: the working tree has uncommitted changes. Commit or stash them before deploying to $ARGUMENTS."
Do not proceed past this step if there are uncommitted changes.
Step 2: Run the test suite
Run:
npm test
If any test fails, stop here. Report the failing test names and do not proceed.
Step 3: Build the project
Run:
npm run build
If the build fails, report the full error output and stop. Do not proceed.
Step 4: Create a deployment tag
Construct a tag name:
deploy-$ARGUMENTS-<YYYYMMDD>-<HHMMSS>
Use the current UTC date and time. For example, a production deploy on 2026-05-13 at 14:32:07 UTC produces: deploy-production-20260513-143207.
Run:
git tag deploy-$ARGUMENTS-<YYYYMMDD>-<HHMMSS>
Step 5: Push the tag
Run:
git push origin deploy-$ARGUMENTS-<YYYYMMDD>-<HHMMSS>
If the push fails, report the error. Do not retry automatically.
Step 6: Report success
Print a final summary:
Deploy initiated.
Environment: $ARGUMENTS
Tag: deploy-$ARGUMENTS-<YYYYMMDD>-<HHMMSS>
Commit: <git rev-parse HEAD output>
Time: <YYYY-MM-DD HH:MM:SS UTC>
If any step failed, do not print this summary. The failure report for the failing step is the final output.
04 同仓库更多 Skills
版本号升级与 Git 标签
tag-version
升级软件包版本并创建带注释的 git 标签。接受语义化版本号(1.2.0)或升级类型(patch、minor、major)。不执行推送——请使用 publish 技能进行推送。作为发布工作流的一部分使用。
项目完整发布流程
release
运行完整的发布工作流:变更日志条目、版本升级、git 标签和 GitHub Release。依次调用 changelog-entry、tag-version 和 publish。在发布项目新版本时使用。
GitHub 版本发布
publish
将当前分支和所有标签推送到 origin,然后使用最新标签及其 CHANGELOG.md 条目创建 GitHub Release。在 tag-version 之后使用以完成发布。
变更日志条目生成
changelog-entry
按照 Keep a Changelog 格式为所有未发布的提交起草变更日志条目。将提交分组为新增(Added)、变更(Changed)、修复(Fixed)、移除(Removed)和安全(Security)。在发布新版本之前或更新 CHANGELOG.md 时使用。
代码自动格式化
auto-format-on-edit
每次编辑后使用 Prettier 和 ESLint 自动格式化代码文件。当 Claude 编辑文件时在后台激活。格式化是静默的——没有提示,除非格式化程序失败,否则没有输出。当您希望在编码会话期间自动执行一致的格式化时使用。
代码质量审计
code-quality-audit
运行全面的代码质量审计,涵盖安全性、性能和可维护性。用于季度审计、发布前审查或接入大型代码库时。