{"id":"code-dev-pr-description-team-template","audience":"developers","category":"coding","track":"coding","technique":"format","title":"Write a PR description in your team's template","free":false,"task":"Write the pull request description for this payment fix. First line 'PAY-512: <title under 60 characters>', then the headings ### What, ### Why and ### Testing in that order. Why must say what only you know: on Oct 30 a timeout retry charged 14 customers twice. Testing is exactly 3 numbered steps. The last line is 'Risk: low', 'Risk: medium' or 'Risk: high' plus a reason under 12 words. No code blocks, under 150 words.","materialLabel":"Your diff and the ticket (attached to your prompt automatically)","material":"Ticket PAY-512 (priority: high, reporter: Noor)\n\"Customers occasionally see two identical charges. Seems related to\nslow responses from the payment provider. Please investigate.\"\n\n$ git diff main --stat\n src/billing/charge.ts       | 14 ++++++++++----\n src/billing/charge.test.ts  | 31 +++++++++++++++++++++++++++++++\n\n$ git diff main -- src/billing/charge.ts\n@@ -12,14 +12,20 @@ export async function chargeCard(order: Order): Promise<Charge> {\n-  const res = await withRetry(() =>\n-    provider.post(\"/charges\", {\n-      amount: order.totalCents,\n-      currency: order.currency,\n-      source: order.cardToken,\n-    })\n-  );\n+  // Same key on every retry so the provider dedupes repeated attempts.\n+  const idempotencyKey = `order-${order.id}`;\n+  const res = await withRetry(() =>\n+    provider.post(\"/charges\", {\n+      amount: order.totalCents,\n+      currency: order.currency,\n+      source: order.cardToken,\n+    }, { headers: { \"Idempotency-Key\": idempotencyKey } })\n+  );\n\nNew tests in charge.test.ts:\n  - \"sends the same Idempotency-Key on each retry\"\n  - \"a timeout then success creates one charge\" (uses the provider sandbox)\n\nBranch: fix/pay-512-idempotency   Reviewers: @team-billing\nProvider docs: keys are kept for 24 hours.","rules":[{"type":"numberedItems","count":3},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":150}],"mistakes":[{"title":"The AI's own template","why":"The AI invents headings like Summary, Changes and Checklist.","fix":"Show it: \"First line PAY-512: <title>, then ### What, ### Why, ### Testing.\"","checks":["r0"]},{"title":"Leaving out the real impact","why":"The diff doesn't say who was affected; only you know about the 14 customers.","fix":"Add: \"Why: on Oct 30 a timeout retry charged 14 customers twice.\"","checks":["r1"]},{"title":"A sprawling test plan","why":"The AI lists 6 to 10 testing bullets or a code block of commands.","fix":"Add: \"Testing: exactly 3 numbered steps. No code blocks.\"","checks":["numberedItems","codeBlocks","r2"]},{"title":"No risk line","why":"Reviewers on your team look for the risk line first, and the AI won't add one.","fix":"Add: \"End with 'Risk: low|medium|high' plus a short reason.\"","checks":["r2","maxProseWords"]}],"promptHints":[{"label":"Gives the first line","patterns":["PAY-512"]},{"label":"Lists the headings","patterns":["### what","what, why","testing"]},{"label":"Adds the impact","patterns":["14 customers","oct(ober)? 30","twice"]},{"label":"Sets the test steps","patterns":["\\b(3|three)\\b.{0,20}(step|numbered)"]},{"label":"Asks for a risk line","patterns":["risk"]}],"hint":"Your team's template and the real impact aren't in the diff. Give the AI the exact lines and headings, the incident facts, and how it should end.","rubricLabels":["The first line starts with 'PAY-512: ' and the headings ### What, ### Why and ### Testing appear in that order, with no other headings","The Why section says that on Oct 30 a timeout retry charged 14 customers twice","Testing has exactly 3 numbered steps, and the last line starts with 'Risk: ' followed by low, medium or high and a short reason"]}