Communitygithub.com

lguidolin/conventional-commits-and-releases

用於提交、撰寫提交訊息、開啟將以壓縮合併(squash-merge)的 PR,或設定自動版本控制/變更日誌。關鍵字—Conventional Commits、release-please、semver、feat/fix/chore、破壞性變更、變更日誌。

conventional-commits-and-releases 是什麼?

此技能強制執行 Conventional Commits 格式,作為自動版本控制與變更日誌生成的機器可讀介面。它定義了提交訊息的結構(`<type>(<scope>): <description>`),並將 `feat`、`fix` 等類型對應至 semver 版本號(次要、修補),而 `feat!:`` 或 `BREAKING CHANGE:` 則觸發主要版本。它適用於 terminal(claude code)、Slack 及任何可配置的 IDE。該技能著重於「壓縮合併」工作流程,其中 PR 標題即是最終提交的訊息,因此必須是格式正確的 Conventional Commit。CI 會透過 `amannn/action-semantic-pull-request` 驗證 PR 標題,並透過一個專門的「無 AI 歸屬」任務封鎖 `Co-authored-by` 追蹤(特定 AI 的)或「Generated with [Claude...]」頁尾。分支提交主體則刻意不進行 lint,因為壓縮合併會將其捨棄。一個已知的漏洞是:若提交由 AI 代理者帳號執行,GitHub 會在壓縮合併時動態插入 `Co-authored-by` 追蹤,繞過 PR 檢查。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/conventional-commits-and-releases

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Conventional Commits 與版本發布

概述

提交訊息是一種機器可讀的介面,而非僅僅是散文。自動版本控制與變更日誌生成會解析它們;格式錯誤的訊息會導致錯誤的公開版本或損壞的發布。在小處(一個格式正確的訊息)保持紀律,將自動帶來大處(準確的變更日誌、正確的版本號)的正確性。

格式

<type>(<scope>): <description>

Type效果 / 用途
feat新功能 — 次要 版本提升
fix錯誤修正 — 修補 版本提升
docs僅文件變更
chore維護、依賴、設定
refactor保持行為的程式碼變更
test僅測試
ci / build管線 / 建置系統變更
  • 祈使語氣:「add X」,而非「added X」或「adds X」。
  • 破壞性變更: feat!: 或 BREAKING CHANGE: 頁尾 — 觸發 主要 版本提升。
  • scope 可選但鼓勵使用:feat(auth):、fix(db):。

關鍵細節

  • 類型↔版本連結意味著打錯 feat 或 fix 會發布錯誤版本。 謹慎選擇類型:「add」= 新功能,「update」= 對現有功能的增強,「fix」= 錯誤。
  • 壓縮合併:PR 標題即為最終提交的訊息。 它本身必須是有效的 Conventional Commit,否則發布會出錯。
  • 人為撰寫語調。 無 AI/助手歸屬、無 Co-authored-by 追蹤、無 generated-by 頁尾。提交讀起來像是由人撰寫的。

常見的合理化藉口

藉口現實
「訊息其實沒那麼重要」它驅動變更日誌和版本號碼。它在機械層面上至關重要。
「chore 對這個功能來說已經夠接近了」chore 不會提升版本;使用者在發布中不會獲得你的功能。請使用正確的類型。
「我之後再修正 PR 標題」在壓縮合併時,標題在合併時即為最終版本。請在此之前修正。
「Co-authored-by 追蹤是無害的」專案規則禁止 AI 歸屬。沒有例外。

紅旗 — 立即停止

  • 沒有類型前綴的提交訊息
  • 將 chore/docs 用於新增或修正使用者可見行為的事項
  • 非有效 Conventional Commit 的壓縮 PR 標題
  • 任何 AI 歸屬或 Co-authored-by 行

強制執行:

  • PR 標題 — 在 CI 中驗證,具有阻擋性(amannn/action-semantic-pull-request)。 由於壓縮合併時標題就是最終發布的提交,因此這是關鍵的把關。
  • AI 歸屬 — 一個阻擋性的「無 AI 歸屬」任務會拒絕包含 Claude/Anthropic 的 Co-authored-by 追蹤 以及 Generated with [Claude…] 頁尾,這些都會在分支提交和 PR 主體中檢查(PR 主體會成為壓縮提交的主體)。 人類的 Co-authored-by 追蹤則不受影響。
  • 分支提交主體 — 刻意不進行 lint。壓縮合併會捨棄它們,因此它們永遠不會進入變更日誌。如果你改用合併提交,請加上 commitlint。

已知漏洞: 如果提交是由代理者帳號作者,GitHub 會在壓縮合併時自動組合一個 Co-authored-by 追蹤 — 這是在 PR 檢查執行之後發生。上述把關無法看見它。請勿以代理者身份提交。

完整說明:憲法第三條,收錄於 engineering-constitution/references/engineering-constitution.md。

Individual skills in this repo

This repo contains 18 individual skills — each has its own dedicated page.

lguidolin/change-hygiene-and-code-craft

Use when writing or refactoring code, structuring a commit or PR, or deciding whether to abstract duplication. Symptoms — mixing reorg with logic changes, a PR doing several things at once, a file growing large, the second copy of similar code, or unsure whether to DRY something up.

lguidolin/cloud-delivery-aks

Use when deploying to Kubernetes or Azure Kubernetes Service (AKS), configuring cloud secrets, setting up progressive rollout/canary, per-PR ephemeral environments, or k8s health probes. Keywords — Kubernetes, AKS, Key Vault, Argo Rollouts, Flagger, canary, blue-green, liveness, readiness, PodDisruptionBudget, HPA, rollback, GHCR.

lguidolin/commit-history-rewrite

Use when an existing repository has messy commit history that needs to conform to conventional commits before adopting release-please, or when intermediate WIP/fixup/merge commits need to be cleaned up.

lguidolin/defense-in-depth-security

Use when handling untrusted input, secrets, authentication/authorization, or dependencies — or threat-modeling a new surface. Keywords — STRIDE, threat model, least privilege, secrets management, supply chain, dependency scanning, input validation, audit log, defense in depth.

lguidolin/designing-before-building

Use when starting a feature, fixing a non-trivial bug, or about to write implementation code — before any code exists. Symptoms you need this: "this is simple, I'll just code it", reaching for the editor before a design is approved, or an idea that hasn't been turned into a spec and plan.

lguidolin/engineering-constitution

Use when starting work in a project that follows the engineering constitution, orienting to its rules, or deciding which engineering practice applies to a task — spec writing, commits, testing, security, deploys, database, or UI work.

lguidolin/graphql-contract-testing

Use when writing a GraphQL query/mutation that the UI and a test will share, or building route/schema contract or smoke tests. Symptoms — copying a query into a test, a test asserting on query text, schema change that didn't break the UI build, or RLS/permission drift. Keywords — graphql-codegen, typed document, contract test, route smoke test.

lguidolin/init-repo-CI

Use when setting up a new repository with conventional commits, release-please, and CI automation, or when retrofitting an existing repository that lacks automated versioning and PR validation workflows.

lguidolin/interface-craft-and-accessibility

Use when building or styling UI — components, layouts, forms, design tokens — or making accessibility decisions. Keywords — a11y, WCAG, keyboard navigation, focus state, contrast, design system, minimalist UI, component reuse, ARIA, semantic HTML.

lguidolin/merge-gates-and-automation

Use when setting up or changing CI, pre-push hooks, or a task runner, or deciding what must pass before merge. Symptoms — tempted to put authoritative checks only in a local hook, skip CI, bypass with --no-verify, or unsure what gates a merge vs. runs locally.

lguidolin/observability-and-slos

Use when adding logging, metrics, tracing, health checks, SLOs, or alerting — or when building a service surface that needs to be operable and debuggable. Keywords — structured logs, OpenTelemetry, correlation id, RED metrics, liveness, readiness, SLI, SLO, error budget, alerting.

lguidolin/performance-and-scale

Use when working on hot paths, list endpoints, pagination, data-access in loops, or public interfaces/schemas. Symptoms — unbounded queries, N+1 access, no latency budget, optimizing without measuring, or changing an interface many consumers depend on. Keywords — pagination, N+1, Hyrum's Law, performance budget, bundle size.

lguidolin/postgres-postgraphile-rls-and-sql

Use when writing PostgreSQL, PostGraphile config, Row-Level Security policies, SQL schema files, or working on the Browser→App→PostGraphile→Postgres data path. Keywords — RLS, SECURITY DEFINER, search_path, pgSettings, grants, roles, GraphQL depth limit, query cost, statement_timeout, SQL file organization.

lguidolin/recording-decisions

Use when a design or architecture decision has been made and needs to be captured — writing a decision record or ADR, updating a decision index, noting a deferred idea, or superseding a past decision. Keywords — ADR, decision record, rationale, rejected alternatives, dependency index.

lguidolin/resilience-and-deploy-safety

Use when planning a deploy, designing a rollback, or responding to an incident or writing a postmortem. Keywords — deploy safety, rollback, immutable artifact, progressive delivery, canary, blast radius, incident response, blameless postmortem, error budget.

lguidolin/ship-it

Use when the user wants to ship work — push, PR, archive decision records, merge, and clean up. Handles the full lifecycle from committing final changes through post-merge cleanup including converting specs/plans to compact decision records.

lguidolin/tests-as-a-control

Use when writing or modifying tests, when a test breaks during a refactor, or when testing permission/role rules. Symptoms — tempted to edit a test to make it pass, testing only the happy path, a deny-test that started passing, flaky tests, or unsure what to assert.

lguidolin/zero-downtime-migrations

Use when changing a database schema where data must survive the change — adding/removing/renaming columns, constraints, indexes, or backfilling. Symptoms — a destructive migration bundled with a code deploy, a NOT NULL column with a backfill, a table-locking UPDATE, or a rename. Keywords — expand/contract, parallel change, backfill, NOT VALID, CREATE INDEX CONCURRENTLY, graphile-migrate.

相關技能