|
| 1 | +--- |
| 2 | +name: commitizen |
| 3 | +description: Use this skill for tasks involving Conventional Commits, commit message validation, Commitizen configuration, semantic version bumps, changelog generation, or CI/release automation with the Commitizen CLI. |
| 4 | +license: MIT |
| 5 | +compatibility: Git repository with Python and Commitizen available as `cz` or runnable from source. Network access is optional and mainly relevant for CI or release integrations. |
| 6 | +metadata: |
| 7 | + project: commitizen-tools/commitizen |
| 8 | + docs: https://commitizen-tools.github.io/commitizen/ |
| 9 | + install: pip install commitizen | uv add commitizen |
| 10 | +--- |
| 11 | + |
| 12 | +# Commitizen |
| 13 | + |
| 14 | +Commitizen is a CLI for enforcing Conventional Commits, automating version bumps, and generating changelogs. |
| 15 | + |
| 16 | +## Use this skill when |
| 17 | + |
| 18 | +- A task involves commit message authoring or validation. |
| 19 | +- A repository needs Commitizen initialization or configuration updates. |
| 20 | +- Work depends on version schemes, version providers, version files, tags, or changelog behavior. |
| 21 | +- CI/CD automation needs commit validation, automated version bumps, or release notes. |
| 22 | + |
| 23 | +## Core workflow |
| 24 | + |
| 25 | +1. Find the active configuration file in this order: `.cz.toml`, `cz.toml`, `.cz.json`, `cz.json`, `.cz.yaml`, `cz.yaml`, then `pyproject.toml` under `[tool.commitizen]`. |
| 26 | +2. Read the effective settings before acting, especially `name`, `version`, `version_provider`, `version_scheme`, `version_files`, `tag_format`, `update_changelog_on_bump`, `annotated_tag`, `bump_message`, `pre_bump_hooks`, and `post_bump_hooks`. |
| 27 | +3. Match the command to the task: |
| 28 | + - `cz commit` for interactive commit authoring |
| 29 | + - `cz check` for validating commit messages or git ranges |
| 30 | + - `cz init` for bootstrapping configuration |
| 31 | + - `cz bump` for calculating or applying release versions |
| 32 | + - `cz changelog` for generating or updating `CHANGELOG.md` |
| 33 | + - `cz ls` for listing available commit rules |
| 34 | + - `cz version` for showing the current version |
| 35 | +4. Prefer read-only inspection first. Safe discovery commands include `cz version`, `cz ls`, `cz check`, `cz bump --get-next`, and `cz bump --dry-run`. |
| 36 | +5. Treat `cz bump` as stateful: it can update version files, create a bump commit, and create a git tag. Verify the version provider, version scheme, tag format, and changelog settings before running it for real. |
| 37 | +6. When automating in CI, check whether the workflow should ignore specific exit codes with `--no-raise` and whether `bump_message` should include skip-CI text. |
| 38 | +7. After making changes, validate the resulting configuration, commands, and automation against the repository's actual version scheme and provider. |
| 39 | + |
| 40 | +## Important domain details |
| 41 | + |
| 42 | +- Commitizen installs with `pip install commitizen` or `uv add commitizen`. |
| 43 | +- The default version scheme is PEP 440; `semver` and `semver2` are also supported. |
| 44 | +- Common version providers include `commitizen`, `pep621`, `poetry`, `cargo`, `npm`, `composer`, `uv`, and `scm`. |
| 45 | +- `cz changelog` generates Markdown changelogs. |
| 46 | +- `cz commit` supports `--dry-run` and `--write-message-to-file`. |
| 47 | +- `cz check` can validate a literal message, a commit-msg file, or a git revision range. |
| 48 | + |
| 49 | +## Suggested references |
| 50 | + |
| 51 | +- Command docs: |
| 52 | + - `docs/commands/commit.md` |
| 53 | + - `docs/commands/bump.md` |
| 54 | + - `docs/commands/changelog.md` |
| 55 | + - `docs/commands/check.md` |
| 56 | + - `docs/commands/init.md` |
| 57 | +- Config docs: |
| 58 | + - `docs/config/configuration_file.md` |
| 59 | + - `docs/config/option.md` |
| 60 | + - `docs/config/bump.md` |
| 61 | +- Automation docs: |
| 62 | + - `docs/tutorials/github_actions.md` |
| 63 | + - `docs/tutorials/gitlab_ci.md` |
| 64 | +- Error handling: |
| 65 | + - `docs/exit_codes.md` |
| 66 | + |
| 67 | +## Examples |
| 68 | + |
| 69 | +- Validate one message: `cz check --message "feat(cli): add release command"` |
| 70 | +- Validate branch history: `cz check --rev-range master..HEAD` |
| 71 | +- Preview the next version: `cz bump --get-next` |
| 72 | +- Preview bump details: `cz bump --dry-run` |
| 73 | +- Preview changelog output: `cz changelog --dry-run` |
| 74 | +- Initialize configuration: `cz init` |
0 commit comments