Specify a reusable commit-message generator with conventions, input rules and evaluation cases.
Design a reusable commit-message generation workflow for a repository. This task defines the generator; it is not a request to write one commit message. ## Inputs Team convention (for example Conventional Commits 1.0.0, plus allowed types and scopes): [CONVENTION] Available inputs such as staged diff, file paths, branch name and issue IDs: [INPUTS] Examples of accepted messages from this repository: [EXAMPLES] Enforcement already in place (for example commitlint rules or a commit-msg hook): [ENFORCEMENT] ## Instructions 1. Define the generator's input schema: type, optional scope, short description, optional body, related issues, breaking-change note. Mark which fields the generator may infer from the diff and which must come from the developer. 2. Write rules for each part: - type from the allowed list (the Conventional Commits spec requires `feat` for features and `fix` for bug fixes; other types are team choices); - scope as a noun naming a section of the codebase; - description as a short imperative summary, within [ENFORCEMENT] limits if any (the spec itself sets no length limit); - body explaining what and why; - footers in `Token: value` or `Token #value` form, with `BREAKING CHANGE:` or `!` for breaking changes. 3. Define behaviour for insufficient context (ask for the reason) and for unrelated changes in one diff (recommend splitting). 4. Write the generator prompt or function specification that implements these rules. 5. Write evaluation cases with expected properties. ## Return 1. Generator instructions and input schema. 2. Rules for type, scope, subject, body and breaking-change footers. 3. Handling for unrelated changes or insufficient context. 4. Representative evaluation cases with expected properties. ## Acceptance checks Do not infer user intent from filenames alone. Avoid unsupported issue-closing claims. Mark evaluation cases as proposed unless they were actually executed.
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
Convention: Conventional Commits 1.0.0 with types feat, fix, docs, refactor, test, chore, ci, perf; scopes api, web, db Inputs: staged diff, branch name like feature/412-discount-codes, issue IDs typed by the developer Examples: "fix(api): reject expired discount codes", "feat(web)!: replace legacy checkout form" Enforcement: commitlint with @commitlint/config-conventional; header-max-length 100
A generator spec where type and scope may be proposed from the diff but must be confirmed, the description is imperative and at most 100 characters because commitlint enforces that (not because the spec does), issue references come only from developer-supplied IDs (a branch number alone produces "Refs: #412" only if confirmed), unrelated changes trigger a split recommendation, and evaluation cases include a breaking API change requiring "!" or a BREAKING CHANGE footer and a diff with no stated reason that should produce a question. The original example "feature: Add user authentication" is replaced by the spec-valid "feat: add user authentication". Illustrative expectation; the header rule was exercised locally with a regex on sample headers (see report).
Ask questions or share concrete improvements.
No comments yet.
Sign in to join the discussion.
Guides for adapting and checking prompts: