Skip to content
Gab AI

AI for software developers

AI for developers: debug, test and explain a focused change.

Debug a reproducible failure, write regression tests and explain a pull request with the relevant code in view. Follow an order-total bug from its failing calculation to a proposed patch and reviewer note.

Start in Chat

Reason through the code. Ask a better follow-up.

Ask a question, try an idea and refine the answer in the same conversation.

Find why quantity is missing from an order total

The helper counts each price once, so it returns 2,149 cents.

Try this in Gab AI Chat
Gab AI Chat conversation and follow-up for developers.
Enlarge preview

Understand the bug

Gab AI Chat conversation and follow-up for developers.
Read the conversation and try the prompt

Arya

The helper counts each price once, so it returns 2,149 cents. Multiply each unit price by its quantity: 1,250 × 3 + 899 × 2 = 5,548 cents. Preserve integer cents throughout.

Your follow-up

What is the smallest useful regression case?

Arya

Use one line with unitCents: 1250 and quantity: 3. Expect 3750. That case fails when quantity is ignored and isolates the behavior you want to protect.

Fix an order total and reproduce the regression

Inspect the patch, switch to regression cases, or prepare the review note.

Fix a quantity-sensitive order total

Get a focused JavaScript patch with explicit input and overflow behavior.

Try this in Gab AI Work
Gab AI Work: Fix a quantity-sensitive order total.
Enlarge preview

Focused patch

Gab AI Work: Fix a quantity-sensitive order total.
Read the prompt and inspect the full example
totalCents.jsOrder-total-contract.txt

totalCents.fixed.jsJavaScript
export function totalCents(lines) {
  return lines.reduce((sum, line) => {
    if (!Number.isSafeInteger(line.unitCents) ||
        line.unitCents < 0 ||
        !Number.isSafeInteger(line.quantity) ||
        line.quantity < 1) {
      throw new TypeError("Invalid order line");
    }
    const next = sum + line.unitCents * line.quantity;
    if (!Number.isSafeInteger(next)) {
      throw new RangeError("Total exceeds safe range");
    }
    return next;
  }, 0);
}

totalCents.js

Order-total-contract.txt

Curated patch example. The sample helper and listed cases are checked locally; integration into your repository still needs review.

Read the source material

totalCents.js

Current behavior

The helper adds each line.unitCents once and never reads line.quantity. It returns 2,149 cents for the supplied two-line order.

Order-total-contract.txt

Function contract

totalCents(lines) returns the sum of unitCents × quantity for every line. unitCents is a non-negative safe integer; quantity is a positive safe integer. Empty input returns 0. Keep the exported function name and return integer cents.

Example order

Line A: unitCents 1250, quantity 3. Line B: unitCents 899, quantity 2. Correct total: 3750 + 1798 = 5548 cents.

Invalid input and overflow

Reject a zero, negative, or non-integer quantity, and negative or non-integer unitCents, with TypeError. If the total is outside the safe integer range, throw RangeError. The sample scope assumes lines is an array of line objects; external API validation is separate.

About these examples

Debug code, write tests and explain a change

See the patch, the cases, and the context a reviewer needs.

A useful path from bug to review

Fix the behavior that actually failed

Quantity is part of the contract, so it is part of the calculation.

Explore the example

Write cases that catch the regression

A multi-quantity order makes the old bug visible.

Explore the example

Prepare a concrete change note

A trigger, a changed result, and explicit review boundaries.

Explore the example

Handle the edge cases deliberately

Keep invalid inputs and overflow behavior visible.

Explore the example

Add the relevant source, runtime versions and failing case before sending.

Read all source material

totalCents.js

Current behavior

The helper adds each line.unitCents once and never reads line.quantity. It returns 2,149 cents for the supplied two-line order.

Order-total-contract.txt

Function contract

totalCents(lines) returns the sum of unitCents × quantity for every line. unitCents is a non-negative safe integer; quantity is a positive safe integer. Empty input returns 0. Keep the exported function name and return integer cents.

Example order

Line A: unitCents 1250, quantity 3. Line B: unitCents 899, quantity 2. Correct total: 3750 + 1798 = 5548 cents.

Invalid input and overflow

Reject a zero, negative, or non-integer quantity, and negative or non-integer unitCents, with TypeError. If the total is outside the safe integer range, throw RangeError. The sample scope assumes lines is an array of line objects; external API validation is separate.

Prepare a code fix

Fix the order total helper against this contract. Keep the change focused.

totalCents.jsOrder-total-contract.txt

Refine a code change and its explanation

Compare the draft with a focused revision, keeping the source facts in view.

Try one focused revision

Suggested follow-up using the same source facts.

Focused follow-up

What change should I ask for?

Explain the bug in one reviewer-facing sentence, retaining both totals and the omitted quantity calculation. Do not claim a production fix.

Original excerpt

What does the existing example say?

The original helper counted unit prices once per line. The example order returned 2,149 cents rather than 5,548.

Suggested revision

What could that revision look like?

The original helper added each line’s unit price once instead of multiplying by quantity, returning 2,149 cents rather than the expected 5,548 in the sample order.

Revise the code explanation
Inspect the source facts and reasoning

Why this line needs to change

The function contract supplies the reason for the multiplication.

Why multiply unitCents by quantity?

Quantity The contract defines a line total as unitCents × quantity. Adding the unit price once ignores quantities greater than one.

What should the example order return?

Example total 1,250 × 3 = 3,750 cents. 899 × 2 = 1,798 cents. The order total is 5,548 cents; the original helper returns 2,149.

Order-total-contract.txt

totalCents.js

Prepare the code fix

Make the boundary conditions explicit

Reject invalid values without silently changing the order.

What happens for an empty order?

Empty input Return 0 cents. The contract states this explicitly, so the reduction starts at zero.

Should quantity zero be accepted?

Invalid input No. The contract requires a positive safe integer quantity and a TypeError for zero. Safe-range overflow is a separate RangeError.

Order-total-contract.txt

Write the boundary tests

Bring your code, error or implementation brief

Open a prompt as an editable draft. Add the listed source material or your own inputs before sending.

Chat

Plan a focused implementation

A focused implementation plan with acceptance criteria, likely file changes and unresolved requirements.

Plan a focused implementation
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Project files, acceptance criteria and test command

Example prompt

Here is a feature request and the relevant code. Propose the smallest implementation plan, identify files likely to change, and list acceptance criteria and unanswered questions. Preserve the current API and avoid adding dependencies unless the requirement needs them.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Work

Fix a quantity-sensitive order total

Get a focused JavaScript patch with explicit input and overflow behavior.

Read and use this prompt

Use Work to create the named artifact, inspect its sources, and request a focused revision.

Deliverable: totalCents.fixed.js

What to provide

  • totalCents.js: A small JavaScript helper that omits quantity when summing order lines.
  • Order-total-contract.txt: Expected integer-cent behavior, one example order, and invalid-input rules.

Example prompt

Review totalCents.js against Order-total-contract.txt. Create totalCents.fixed.js, preserving the exported name and returning integer cents. Correct quantity handling, reject invalid values and unsafe totals as specified, and avoid unrelated refactors. Add focused tests for quantity, the supplied order, empty input, invalid values and overflow. Run them if execution is available and report exactly what was tested and anything untested. Deliver the patched file.

What to check

  • Review the patch
  • Run relevant project tests
  • Check caller behavior
Work

Make the regression easy to reproduce

Turn the function contract into small, hand-checkable cases.

Write regression tests
Read and use this prompt

Use Work to create the named artifact, inspect its sources, and request a focused revision.

Deliverable: Order total regression cases.csv

What to provide

  • Order-total-contract.txt: Expected integer-cent behavior, one example order, and invalid-input rules.

Example prompt

Using Order-total-contract.txt, create Order total regression cases.csv with the case, exact input, expected return value or exception, and the requirement covered. Include quantity greater than one, the supplied two-line order, empty input, invalid values and overflow. Keep expected results distinct from executed results. Deliver the file and explain how to use the cases in the project test runner.

What to check

  • Review the patch
  • Run relevant project tests
  • Check caller behavior
Chat

Explain the patch for a reviewer

Summarize the concrete trigger, changed behavior, and remaining integration checks.

Explain the code change
Read and use this prompt

Use Chat to compare the supplied source excerpts and revise an answer before using it.

Deliverable: Response in Chat

What to provide

  • totalCents.js: A small JavaScript helper that omits quantity when summing order lines.
  • Order-total-contract.txt: Expected integer-cent behavior, one example order, and invalid-input rules.

Example prompt

Compare totalCents.js with Order-total-contract.txt and draft a concise pull-request description. Explain the quantity bug using the supplied two-line order, the required input and overflow guards, the focused test cases, and the caller behavior that still needs review. Do not claim tests were run or a payment integration was verified unless execution evidence is supplied.

What to check

  • Review the patch
  • Run relevant project tests
  • Check caller behavior
More prompts
Work

Build and test a small implementation

Changed source files implementing the supplied acceptance criteria, plus a test report showing exact commands, results and unresolved checks.

Read and use this prompt

Use Work to create and revise Source code and test report.zip alongside the conversation.

Deliverable: Source code and test report.zip

What to provide

  • Project files, acceptance criteria and test command

Example prompt

Implement the supplied acceptance criteria in the uploaded project, follow its conventions, and run the stated tests where supported. Deliver changed source files and a test report listing exact commands, results and remaining failures. Ask before using credentials, installing services or making external changes; do not commit or deploy. Deliver an editable artifact named "Source code and test report.zip". If source material is missing, ask for it instead of filling factual gaps.

What to check

  • Inspect the changed files against acceptance criteria
  • Read the exact test commands and their results
  • Resolve untested behavior before merging any code
Chat

Investigate a reproducible bug

Evidence-ranked bug hypotheses with a minimal diagnostic or regression check to run.

Investigate a reproducible bug
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Minimal reproduction and exact error output

Example prompt

Analyze this error trace, reproduction and source excerpt. Rank plausible causes by evidence, explain what supports each, and suggest one minimal diagnostic or regression test. Do not claim a cause is proven without evidence.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Explain a pull request

A pull-request description explaining the diff, resulting behavior, tradeoffs and tests actually performed.

Explain a pull request
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Pull-request diff and intended behavior

Example prompt

Write a pull request description from this diff. Explain the bug or requirement, resulting behavior, important tradeoffs and tests actually run. Highlight migration or compatibility concerns visible in the diff; do not invent test results.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Check an API change for compatibility

An API compatibility review listing changed fields, status codes and affected callers or regression cases visible in the supplied diff.

Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • The draft API change.diff and the source it should match

Example prompt

Review this API diff and the supplied endpoint contract. List changed request fields, response shapes, status codes and error behavior. Trace each change to the diff and identify callers or tests that may need updates. Separate observed breaking changes from questions about unavailable code. Do not claim you have executed tests or verified compatibility.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Scaffold a new feature

A routes-and-controller draft with validation failures, request examples and explicit runtime assumptions.

Scaffold a new feature
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • task-resource requirements, Node version and existing project conventions

Example prompt

Draft a Node/Express REST API for a tasks resource with create, read, update and delete routes. Use Zod for request validation. Show controller boundaries, validation failures, not-found handling and example requests. State runtime assumptions and list dependencies and tests needed before I use the draft in a project.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Write tests for my function

Jest test drafts linked to the supplied function contract, with untested behavior and setup questions identified.

Write tests for my function
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Function source, documented contract and project Jest configuration

Example prompt

Using the attached function and its stated contract, draft Jest tests for normal inputs, boundary values and documented errors. Explain which requirement each test checks and flag unspecified behavior. Use the project's existing test setup rather than assuming dependencies, and do not claim the tests have been run.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Convert code between languages

A TypeScript translation draft with types, behavior differences and proposed equivalence checks.

Convert code between languages
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Python source, documented behavior and target TypeScript runtime

Example prompt

Convert this supplied Python script to TypeScript while preserving its documented behavior. State runtime and input assumptions, add types, and flag differences in date handling, numeric behavior or library APIs. Propose equivalence checks for the translated functions and do not claim the conversion has been tested.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Write a SQL query

A SQL query draft with date and revenue assumptions, plus execution-plan checks to perform.

Write a SQL query
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Database schema, SQL dialect and revenue/refund definitions

Example prompt

Using this supplied schema, write a SQL query for the ten customers with the highest total revenue in the last 90 days, with order count and average order value. State the SQL dialect, date-boundary assumptions and treatment of refunds or cancelled orders. Identify indexes to inspect and explain how I should verify the execution plan.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Find the bug

An evidence-based debounce diagnosis, proposed correction and regression cases to execute.

Find the bug
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Debounce source, expected delay and callback behavior

Example prompt

Compare this debounce function with the expected behavior: one callback after the user stops typing for the stated delay. Trace how the timer is created and cancelled, identify evidence for the bug, and propose a minimal correction with regression cases. Do not claim a fix is verified without executing it.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Explain this error

A trace-based hypothesis list with supporting evidence, missing environment details and focused diagnostic checks.

Explain this error
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Redacted trace, source excerpt, runtime versions and reproduction attempts

Example prompt

Analyze this redacted production trace, source excerpt and reproduction attempts. Rank hypotheses by the evidence provided, explain what supports or contradicts each, and suggest a focused diagnostic check. Flag missing version or environment details rather than inventing probabilities or declaring a root cause.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Review my pull request

A diff review with referenced behavior changes, supported findings and missing regression questions.

Review my pull request
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Pull-request diff, requirements and surrounding source code

Example prompt

Review this diff against the feature requirements and supplied surrounding code. Identify behavior changes, observable bugs, security questions and missing regression cases with file references. Separate supported findings from questions requiring more context and do not invent executed test results.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Refactor for readability

A refactor proposal preserving public interfaces, with explanations and behavior checks to run.

Refactor for readability
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Module source, public interfaces and existing regression checks

Example prompt

Refactor this module for readability while preserving the supplied behavior and public interfaces. Explain each proposed change, flag code whose intent is unclear, and identify regression checks for the changed paths. Use existing dependencies and do not silently change error handling or data formats.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Compare rate-limiting approaches

A comparison of rate-limiting behavior, storage requirements and concurrency questions for the API.

Compare rate-limiting approaches
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • API traffic assumptions, authenticated/anonymous policies and storage constraints

Example prompt

Compare token bucket, leaky bucket and fixed-window rate limiting for a public API. Assume authenticated requests have a per-account limit and anonymous requests need a separate policy. Explain burst behavior, storage requirements and concurrent-request edge cases, then list questions I must answer before choosing an implementation.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Explain a concept simply

An explanation of index tradeoffs using an orders table and dialect-specific query-plan checks.

Explain a concept simply
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Target SQL dialect and learning level; use a clearly orders table

Example prompt

Explain database indexes to a junior developer using an orders table. Compare a query with and without an index, discuss write and storage costs, and show how to inspect a query plan for the SQL dialect I specify. Label estimated figures and do not promise a performance gain without measurement.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Design a system

An architecture discussion with explicit traffic assumptions, failure modes and load tests needed.

Design a system
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • URL-shortener brief, traffic ratio, retention and availability assumptions

Example prompt

Draft an architecture discussion for a URL shortener targeting 10,000 requests per second. State assumptions about read-write ratio, retention and availability. Cover data model, ID generation, cache behavior and failure modes. Identify measurements and load tests needed rather than claiming the design meets the target.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Chat

Document my code

Source-based function documentation with actual parameters, return values, errors and a checked-interface example.

Document my code
Read and use this prompt

Use Chat to question the source material and revise the response before preparing a file.

Deliverable: Response in Chat

What to provide

  • Source file, usage notes and public-interface tests

Example prompt

Draft documentation from this source file and its supplied usage notes. Describe actual functions, parameters, return values and error behavior, and include one example matching the public interface. Flag unclear behavior instead of inventing guarantees and list documentation statements I should check against tests.

What to check

  • Check requirements
  • Run relevant tests
  • Review the change
Work

Build and run a test fixture

A focused test fixture for the supplied behavior, run it in the available environment and deliver code plus exact execution results.

Build and run a test fixture
Read and use this prompt

Use Work to create and revise Test fixture and execution report.zip alongside the conversation.

Deliverable: Test fixture and execution report.zip

What to provide

  • Acceptance criteria, risk areas and approved test environment
  • Reproduction steps, expected/actual behavior and logs

Example prompt

Create a focused test fixture for the supplied behavior, run it in the available environment and deliver code plus exact execution results. Separate proposed tests from executed checks, include reproducible failures and do not label a release as approved or fully tested. Deliver an editable artifact named "Test fixture and execution report.zip". If source material is missing, ask for it instead of filling factual gaps.

What to check

  • Inspect fixtures against the supplied acceptance criteria
  • Read exact executed commands and failure output
  • Document skipped cases and unresolved environment limitations

Keep validation visible

A few practical questions

How can software developers use Gab AI in their work?

Explore code, investigate bugs, draft tests, and explain implementation tradeoffs with the context from your project. Provide the relevant source, runtime versions, expected behavior and constraints.

Can Gab AI check an API change for compatibility?

Compare old and new request and response behavior, then identify callers and regression cases that need checking.

What needs my professional review?

Run generated code and tests in your own environment. Check security, dependencies, licensing and edge cases; avoid including credentials or private data you are not authorized to share.

What is a practical first prompt?

Use the bug-investigation example with a reproduction, error trace, expected result and relevant source; ask for hypotheses tied to evidence.

How should I compare model responses to a coding problem?

Give each available model the same requirements, runtime versions and source excerpt. Compare the proposed behavior and assumptions, then run the relevant tests in your environment. Agreement between responses does not prove that an implementation works.

Can I use Gab AI from coding scripts?

Gab AI has an OpenAI-compatible API. Use the documented endpoint and model options for your script, and keep API keys out of source control and prompts. Verify the behavior and response handling your application needs.

What source should I provide for code review?

Provide the files involved in the behavior, their interfaces, the expected result and relevant tests. State the runtime versions and the review question. For a large repository, begin with the smallest useful set of files and add dependencies as needed.

Can Gab AI explain a production error?

It can organize a redacted trace, reproduction attempts and source into plausible causes and diagnostic questions. It cannot confirm a production cause from a trace alone. Test the proposed explanation and report only checks actually performed.

Can I build an editable source code and test report?

Use the "Build and test a small implementation" Work example with the listed source material. Inspect the delivered file and its source references before using it. Opening the draft does not start the task.

What should I look for when comparing Codex alternatives?

Start with a concrete task: fix a reproducible bug, review a patch or add regression tests. Gab AI Work can work from supplied project files and report the checks it actually runs. For your own coding client, consult the OpenAI-compatible API guide and check its required endpoints and model/tool support. Test the workflow with your project’s runtime and permissions before adopting it.

Can I try these prompts with my own code?

Yes. Supply the relevant source files, runtime versions, expected behavior and reproduction steps. Ask for a focused change and regression cases, then run and review the result in your environment. The page’s examples use sample code.

Which regression cases should I check after a proposed fix?

Start with the supplied failing order, then test an empty order, invalid quantities and unsafe integer totals against the stated contract. The example expects 5,548 cents for the quantity-sensitive order and zero for an empty order. Run the tests in your own environment; a proposed case list is separate from execution evidence.

Can I start in Chat, or do I need Work?

Use Chat for questions and text drafts. Choose Work when you want a project with tools and editable files. Work requires Plus and uses credits; see Pricing for plans and allowances. Opening a draft does not send it or attach the example files.

Bring the bug you can reproduce.

Start with the failing case, expected behavior and relevant source. Develop a focused patch and checks you can run in your own environment.

Add the relevant source, runtime versions and failing case before sending.