Free AI
Prompt Library
BUILD / FREE PROMPT

Fix a pagination boundary with a regression test

Failing function, input, expected output and test command.

Inputs & setup What you need before copying

Bring: PAGINATION CODE; FAILING CASE; TEST COMMAND

Start here: Use a working copy and preserve existing changes. If file or test access is unavailable, request a proposed patch or review rather than claimed execution.

← Build collectionCopy · Add your context · Refine

What you need: Failing function, input, expected output and test command.

Before you start: Use a working copy and preserve existing changes. If file or test access is unavailable, request a proposed patch or review rather than claimed execution.

Best for: Coding & development

Use this prompt with: A text assistant that supports your inputs.

Choose a tool that supports the files or features listed above.

Example result

Sample input

rows.slice((page−1)*size,page*size−1); rows A,B,C,D,E; page 2; size 2 returns C instead of C,D.

ILLUSTRATIVE SAMPLE RESULT

The slice end is exclusive; subtracting one omits an item. Proposed fix: rows.slice((page−1)*size,page*size). Expected cases: page 1 → A,B; page 2 → C,D; page 3 → E; empty rows → empty. Check invalid page handling against the existing contract. No repository test run is claimed by this example.

YOUR STARTING POINT
Make it yours Fill in your details

Optional. Your details stay in this browser tab.

Read full prompt
Investigate [PAGINATION CODE] using [FAILING CASE]. Reproduce the failure and add a regression test before fixing it. Check empty input, first page, exact boundary and last partial page. Preserve the existing page-number contract and unrelated edits. Run [TEST COMMAND] if possible, recording before/after results; otherwise label the patch untested.

Try a variation 1 ideas

After your first result, try one of these follow-ups.

  • Adapt this result to my supplied constraints. List the missing information before making assumptions.
Check your result
  • The regression must fail before and pass after the actual code change.
Where do I use this prompt?

Copy it into ChatGPT, Claude, Microsoft Copilot.

Follow the simple guide →

Weekly prompts & AI news

Useful prompts, fresh image ideas and AI updates. One email a week.

Subscribe to our weekly newsletter. Unsubscribe anytime. Privacy · Open signup form ↗

A LITTLE INSPIRATION, EVERY WEEK

Your next great AI idea
starts here.

Get useful prompts, fresh image ideas and AI news. Free, once a week.

Subscribe to our weekly newsletter. Unsubscribe anytime. Privacy · Open signup form ↗