Conventional Commit and PR Description from a Diff and Ticket

Produces a Conventional Commits message and a reviewer-ready PR description covering what changed, why, how to test it, and the risks, based on your diff and ticket.

You get: Working code with an explanation

More like this

The prompt

conventional-commit-and-pr-description-from-a-diff-and-ticket.md
You are a senior engineer writing a pull request for a reviewer who has not seen this code. Here is the diff: {paste your diff here} Here is the ticket or context: {paste ticket or context here} If the base branch, the test setup, or the ticket intent is missing and it would change the answer, ask me one or two short questions first. Rules: describe only what the diff actually changes, and list anything the ticket asks for that the diff does not do. Keep facts and assumptions separate. Write test steps as runnable commands or numbered manual steps, each with an expected result. Tie every risk to a file or behavior in the diff (migrations, API contract, performance, config, rollback) and write 'none found' instead of inventing one. Output exactly this: 1) Commit message in Conventional Commits format: type(scope): subject under 72 characters, a body wrapped at 72 characters that explains why, and a footer with BREAKING CHANGE or issue references if relevant. 2) PR description with these sections: Summary, Why, What changed (bullets by file or area), How to test, Risks and rollback, Assumptions and open questions. 3) A short checklist of missing tests or follow-ups a reviewer should expect.

Example output

AI-written example
## 1) Commit message

feat(auth): rate limit password reset requests

Password reset emails can currently be triggered without limit, which
allows inbox flooding and account enumeration probing. Add a Redis-backed
fixed-window limiter keyed on both normalized email and client IP.
Requests over the limit now get a 429 with a Retry-After header.

The limit is read from RESET_LIMIT_PER_HOUR (default 5) and can be
disabled with RESET_RATE_LIMIT_ENABLED=false for quick rollback.

Refs: AUTH-412

---

## 2) PR description

### Summary
Adds rate limiting to `POST /v1/auth/password-reset`: max 5 requests per
hour per email and per IP, returning 429 with `Retry-After` when exceeded.

### Why
AUTH-412: the endpoint is unauthenticated and sends an email on every
call, so it can be used to spam a user's inbox.

### What changed
- `src/auth/rate_limiter.py` (new): `check_and_increment(key, limit,
  window_s)` using Redis `INCR` + `EXPIRE`. Returns allowed flag and
  seconds remaining.
- `src/auth/reset_controller.py`: calls the limiter for `email:<lowercased>`
  and `ip:<addr>` before sending mail. Returns 429 and sets `Retry-After`
  if either key is over the limit.
- `config/settings.py`: adds `RESET_LIMIT_PER_HOUR` (default 5) and
  `RESET_RATE_LIMIT_ENABLED` (default true).
- `tests/auth/test_reset_rate_limit.py` (new): 4 tests covering under the
  limit, over the limit, per-IP limit, and window expiry.

**Ticket asks that this diff does not do:**
- Emit a `password_reset_throttled` metric.
- Update the API docs for the new 429 response.

### How to test
1. Run unit tests:
   `pytest tests/auth/test_reset_rate_limit.py -q`
   Expected: 4 passed.
2. Start the app with a local Redis, then run:
   `for i in $(seq 1 6); do curl -s -o /dev/null -w "%{http_code}\n" -X POST localhost:8000/v1/auth/password-reset -H 'Content-Type: application/json' -d '{"email":"test@example.com"}'; done`
   Expected: five `202` lines, then one `429`.
3. Repeat step 2 and inspect headers with `curl -i`.
   Expected: `Retry-After` is a positive integer of 3600 or less.
4. Set `RESET_RATE_LIMIT_ENABLED=false`, restart, and repeat step 2.
   Expected
Generated from this prompt by AI. Your results will vary.

Tips and common edits

Use it right before opening a PR. Paste the output of git diff against the base branch and the ticket text or a one-paragraph summary of the intent.

Questions about this prompt

Rewrite a Vague Issue into a Copilot Coding Agent-Ready Issue

Turns a vague GitHub issue into a self-contained task with context, testable acceptance criteria, files to touch, and tests to add, so the Copilot coding agent can finish it.

Architecture Decision Record for a Technology Choice

Compares realistic options against your constraints and produces a decision record. The record has a weighted comparison, risks, a reversal plan, and a recommendation the team can approve or challenge.

Design System Component Spec Writer for Figma Handoff

Produces a developer-ready component specification covering anatomy, variants, states, tokens, accessibility, and open questions from a short component brief.

Coding Agent Task Brief with Guardrails, Test Plan, and Rollback Steps

Creates a scoped brief for an AI coding agent that limits file changes, defines tests, and includes a rollback plan and review checklist.

Pull Request Review with Merge Recommendation

Reviews a diff against your standards and returns a merge, merge-with-changes, or do-not-merge recommendation. Findings are ranked by severity, with evidence, suggested fixes, and open questions.

20-Case Agent Eval Set with Pass/Fail Rubric for Normal, Edge and Unsafe Requests

Builds 20 test cases for your agent's task, with expected behavior, failure signals and a pass/fail rubric covering normal, edge and unsafe requests.

Agent Tool Names, Descriptions and JSON Schemas from API Docs

Turns pasted API docs or a function list into agent-ready tool names, descriptions, JSON input schemas and when-to-use and when-not-to-use notes.

Agent Workflow Decomposition with Autonomy Levels and Stop Rules

Turns a manual process into a step-by-step agent plan with tools, approval gates, retry limits, and a build/pilot/skip recommendation.

Characterization Tests Before a Refactor

Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely.

Checkable Guardrail Rules for a Coding Agent: Blocked Commands, Approvals, Secrets and Hooks

Produces a set of testable guardrail rules for your coding agent, covering blocked commands, approval gates, secret handling and hook checks.

Codebase Tour for a Specific Task

Explores a repo through the lens of your task and explains the architecture, key files and data flow, then says where to start.

Failing Test First Bug Fix

Reproduces a bug with a failing test, finds the root cause, applies the smallest fix and shows the test passing.