|
| 1 | +--- |
| 2 | +name: clean-commit |
| 3 | +description: Draft, validate, or create Clean Commit messages from Git changes when the repository adopts Clean Commit or the user requests it. Preserve other repositories' required commit conventions and distinguish drafting from committing. |
| 4 | +--- |
| 5 | + |
| 6 | +# Clean Commit |
| 7 | + |
| 8 | +Write one clear message for one logical change. This skill works without |
| 9 | +Clean Workflow or any other skill. Git is needed to inspect or commit local |
| 10 | +changes; validating supplied message text alone needs no repository access. |
| 11 | + |
| 12 | +## Establish the convention and input |
| 13 | + |
| 14 | +Read repository instructions and contribution rules, then inspect recent |
| 15 | +commits when a repository is available. Apply Clean Commit for an adopting |
| 16 | +project or an explicit request, subject to repository requirements. Installing |
| 17 | +the skill alone does not override an upstream project's commit convention. |
| 18 | +If the user requests a Clean Commit example for comparison, keep it separate |
| 19 | +from a commit that must follow another project's rules. |
| 20 | + |
| 21 | +For staged changes, inspect `git status --short`, `git diff --cached --stat`, |
| 22 | +and the actual `git diff --cached`, including relevant callers or surrounding |
| 23 | +code when needed to understand the change. Distinguish unstaged and untracked |
| 24 | +work from the staged diff; do not describe them as part of the commit. If the |
| 25 | +index is empty, say so rather than invent a staged change or stage files. |
| 26 | +For a supplied diff or message, use that input and disclose missing context. |
| 27 | + |
| 28 | +## Subject format |
| 29 | + |
| 30 | +```text |
| 31 | +<emoji> <type>: <description> |
| 32 | +<emoji> <type> (<scope>): <description> |
| 33 | +<emoji> <type>!: <description> |
| 34 | +<emoji> <type>! (<scope>): <description> |
| 35 | +``` |
| 36 | + |
| 37 | +| Emoji | Type | Use | |
| 38 | +| --- | --- | --- | |
| 39 | +| 📦 | `new` | New features, capabilities, or dependencies | |
| 40 | +| 🔧 | `update` | Existing-code changes, refactoring, performance, ordinary bug fixes | |
| 41 | +| 🗑️ | `remove` | Remove code, features, or dependencies | |
| 42 | +| 🔒 | `security` | Security fixes and vulnerability remediation | |
| 43 | +| ⚙️ | `setup` | Initial configuration, CI, build systems, or tooling | |
| 44 | +| ☕ | `chore` | Maintenance, dependency updates, or housekeeping | |
| 45 | +| 🧪 | `test` | Test additions and test fixes | |
| 46 | +| 📖 | `docs` | Documentation, guides, or comments | |
| 47 | +| 🚀 | `release` | Version releases or release preparation | |
| 48 | + |
| 49 | +Use the exact emoji and lowercase type. Prefer the specific purpose of the |
| 50 | +change: adding a test is `test`, not `new`; a security fix is `security`, not |
| 51 | +an ordinary `update`; new configuration is `setup`; ongoing dependency |
| 52 | +maintenance is `chore`. Do not introduce a `fix` or `feat` type. |
| 53 | + |
| 54 | +The description starts lowercase, uses present tense, has no final period, |
| 55 | +and accurately describes the diff. The **entire subject**, including emoji, |
| 56 | +type, optional scope, spaces, and punctuation, must be at most 72 characters. |
| 57 | +Count the complete subject instead of estimating from the description alone. |
| 58 | + |
| 59 | +Use one space between emoji and type, before an optional scope, and after the |
| 60 | +colon. A scope is lowercase, preferably one word, and hyphenated when useful. |
| 61 | +Omit it when it adds no clarity. Use one primary type; if the staged work is |
| 62 | +unrelated, recommend splitting it without modifying the index unless asked. |
| 63 | + |
| 64 | +## Breaking changes |
| 65 | + |
| 66 | +Put a single `!` immediately after `new`, `update`, `remove`, or `security`, |
| 67 | +before the optional scope or colon. It is invalid on `setup`, `chore`, `test`, |
| 68 | +`docs`, or `release`. Choose the type from the actual change, then add `!` |
| 69 | +only for a demonstrated compatibility break. Do not infer a break from size. |
| 70 | + |
| 71 | +Prefer a `BREAKING CHANGE:` body explaining the incompatibility and migration |
| 72 | +when using `!`. The specification also accepts a subject marker alone and a |
| 73 | +body-only `BREAKING CHANGE:` for backward compatibility; do not reject those |
| 74 | +forms or invent missing migration details. |
| 75 | + |
| 76 | +```text |
| 77 | +🔧 update! (api): return paginated results |
| 78 | +
|
| 79 | +BREAKING CHANGE: callers must read items from the results field. |
| 80 | +``` |
| 81 | + |
| 82 | +## Draft, validate, or commit |
| 83 | + |
| 84 | +- **Draft:** Return a usable message based on the requested diff. Briefly flag |
| 85 | + mixed changes or unknowns that materially affect it. Do not stage, commit, |
| 86 | + amend, or push during a draft-only request. |
| 87 | +- **Validate:** Check format, exact emoji/type pairing, scope spacing, breaking |
| 88 | + marker eligibility, length, tense, punctuation, and fit to the supplied |
| 89 | + change. Explain concrete violations and give a corrected message when the |
| 90 | + evidence permits. Format validity alone does not prove semantic accuracy. |
| 91 | +- **Commit:** When committing is authorized, recheck the index and selected |
| 92 | + files immediately before committing. Preserve unrelated work, follow |
| 93 | + repository-required checks, and pass the message as literal data. For a |
| 94 | + multiline body, use a message file rather than shell interpolation. Inspect |
| 95 | + the resulting commit and remaining status afterward. Amend, history rewrite, |
| 96 | + push, and release operations require their own scope in the user's request. |
| 97 | + |
| 98 | +Reuse authorization already given; do not add a confirmation step to an |
| 99 | +already-authorized ordinary commit. Never bypass a failed required check or |
| 100 | +claim a commit succeeded without verifying it. |
| 101 | + |
| 102 | +## Source and maintenance |
| 103 | + |
| 104 | +Derived from [Clean Commit specification v1.1.0](https://github.com/wgtechlabs/clean-commit/blob/main/SPECIFICATION.md). |
| 105 | +The mandatory format rules govern over inconsistent illustrative examples. |
| 106 | +The essential rules are bundled here for independent installed use. This |
| 107 | +repository owns the skill; update it alongside specification changes. Clean |
| 108 | +Workflow can consume released copies downstream. |
0 commit comments