AI code generator

An AI code generator for drafts you can test

Tell ZeroTwo the language, the contract and the tests the code has to pass. You get a draft to run and review, not a finished feature. Below is a complete brief with a runnable test file, and a look at what that test file does not cover.

Free plan, no card required.

brief.txt
Language and runtime: JavaScript (ES modules), Node 22. No dependencies.
Write slugify(input) in slugify.js, exported by name.
Contract: input is a string; return a lowercase ASCII URL slug.
- Replace each run of characters outside a-z and 0-9 with one hyphen.
- No leading or trailing hyphen.
- Strip accents from Latin letters (creme brulee, not crème brûlée).
- Throw a TypeError if input is not a string.
Return only slugify.js. Then list every behavior you chose that this brief did not specify.

The brief used in the worked example below.

A brief is a contract, not a wish

Most weak drafts trace back to a brief that never said what the code must do at the edges. Four parts cover it.

  • Language and runtime

    Name the language, the module system and the runtime version, and say whether dependencies are allowed. Node 22, ES modules, no packages removes a whole class of answers that will not run on your machine.

  • Interface

    The function name, its arguments, what it returns and where it is exported from.

  • Rules

    A short list of behaviors, each one checkable. If you cannot picture a test for a rule, rewrite the rule.

  • Tests

    Paste the tests, or ask for them first and review them before any implementation. A test file is the part of the brief a reviewer can run, and it is where you find out whether you and the model understood the same thing.

Worked example: a slug function and seven tests

This is an illustration, not a recorded ZeroTwo session. The brief and the tests are real: all seven tests pass with node --test on Node 22 against the hand-written reference further down. We have not published any model's output for this brief, so none is shown.

brief.txtwhat you send
Language and runtime: JavaScript (ES modules), Node 22. No dependencies.
Write slugify(input) in slugify.js, exported by name.
Contract: input is a string; return a lowercase ASCII URL slug.
- Replace each run of characters outside a-z and 0-9 with one hyphen.
- No leading or trailing hyphen.
- Strip accents from Latin letters (creme brulee, not crème brûlée).
- Throw a TypeError if input is not a string.
Return only slugify.js. Then list every behavior you chose that this brief did not specify.
slugify.test.jsseven tests
import test from "node:test";
import assert from "node:assert/strict";
import { slugify } from "./slugify.js";

const cases = [
  ["Hello, World!", "hello-world"],
  ["  Multiple   spaces  ", "multiple-spaces"],
  ["Crème brûlée", "creme-brulee"],
  ["---already-slugged---", "already-slugged"],
  ["100% Pure_Awesome", "100-pure-awesome"],
  ["", ""],
];

for (const [input, expected] of cases) {
  test(JSON.stringify(input), () => assert.equal(slugify(input), expected));
}

test("non-string input throws TypeError", () => {
  assert.throws(() => slugify(42), TypeError);
});
slugify.jshand-written reference, not model output
export function slugify(input) {
  if (typeof input !== "string") {
    throw new TypeError("slugify expects a string");
  }
  return input
    .normalize("NFKD")
    .replace(/\p{M}/gu, "")
    .toLowerCase()
    .replace(/[^a-z0-9]+/g, "-")
    .replace(/^-+|-+$/g, "");
}

What seven passing tests do not tell you

slugify("Łódź")
"odz"
the Polish ł does not decompose, so it is dropped
slugify("日本語")
""
non-Latin scripts vanish entirely
slugify("Straße")
"stra-e"
ß is treated as a separator

These are the reference's real outputs, and every one of them satisfies the written rules. The brief never said what to do with letters that do not decompose or with non-Latin scripts. That is your decision, and the cheapest place to make it is the next version of the brief.

One function is a good unit for a chat. When you need to make and test a change across a repository, that is a different workflow with its own page.

Review the draft like a colleague's pull request

  1. Run the tests before you read the code

    A failing test tells you more than a skim does. If the draft does not even run, paste the error back and ask for a fix before reviewing anything else.

  2. Read what it chose for you

    The last line of the brief asks the model to list every behavior it decided on its own. Check each one against what you meant.

  3. Turn every surprise into a test

    The three inputs above are candidates. Add the ones that matter to you, then ask for a revision against the longer test file.

  4. Keep the tests, not the chat

    The tests carry your intent to the next draft, the next model and the next teammate. The draft is disposable.

Pick a model by the task, then compare two

ZeroTwo lists dozens of models, and which ones you can select depends on your plan; Free has limited model selection. We have not run a matched coding test across them, so this page names no best model. It gives you a way to choose and a way to check the choice.

Where to start for four kinds of coding task, and what to check before accepting the result.
Coding taskTry firstWhat to check
Boilerplate, glue code, regex, SQLA model built for code, such as Grok Code Fast or Qwen Coder PlusYour tests catch the mistakes, so speed matters more than depth. If the first model fails twice, run the same brief on a second one.
A bug with a stack trace and several files of contextA general frontier model such as Claude Sonnet 4.6, GPT 5.2 or Gemini 3.1 ProGive it the error text, the smallest reproduction and your versions. Compare how each explains the root cause before you accept a fix.
A large rewrite or migrationTwo models, run separatelyAsk each for a plan, not code. Where the plans differ is where your requirements are ambiguous.
Reviewing or explaining unfamiliar codeThe model that wrote it, then a different oneA second model gives a different angle, not a guarantee. Treat findings as leads to verify.

Models named above, from ZeroTwo's model list

  • GPT 5.2
  • Claude Sonnet 4.6
  • Gemini 3.1 Pro
  • Kimi K3
  • Kimi K3.1 Pro
  • Grok Code Fast
  • Qwen Coder Plus

Availability changes, so check the current model list. To weigh models against each other rather than tools, compare coding models rather than coding tools; to choose the tool itself, see best AI for coding.

What to hand it, task by task

Generate

A function, a component, a query or a script. Give the contract and the tests, then open the result in Canvas to edit the code directly.

How Canvas works
Debug

Paste the error text, the smallest code that reproduces it and the versions in play. Canvas has a shortcut for debugging code you have open.

Canvas shortcuts
Refactor

Say what must not change and paste the tests that pin it. Ask for a diff rather than a rewrite so you can review each change.

Review and explain

Ask for a line-by-line walkthrough of unfamiliar code, or a review against a checklist you supply. For UI work, the web design prompt playbook gives the model a design brief to follow.

AI prompt for web design

What the plans give you for code

Plus includes access to the code agent and Pro to ZeroCode. Credits are spent per request, so what a plan covers depends on the model you choose; the pricing page has the full comparison.

  • Free

    $0/mo

    No card required

    • 100 free credits to start
    • 1 file upload per message
    • Limited model selection
    Start on Free
  • Plus

    $14.99/mo

    $11.99/mo billed annually

    • 1,650 monthly credits
    • Unlimited fast models in chat
    • Multiple file uploads per task
    • Access to Work and Code agents
    Choose Plus
  • Pro

    $29.99/mo

    $26.99/mo billed annually

    • 3,500 monthly credits
    • Better unlimited chat model selection
    • Access to Work and Code agents
    Choose Pro

Code generation questions

Can I trust AI-generated code in production?

Treat it as a draft from someone who has not seen your system. Run your tests, read the diff, check dependencies and API versions against the ones you run, and review security-sensitive code the way you would a colleague's. The worked example on this page is built around that loop.

Which programming languages does it handle?

The models available in ZeroTwo are general-purpose, so you can ask for any mainstream language and framework. Output is less predictable for niche languages and very recent framework releases, so state exact versions in the brief and run the tests.

Which model should I use for code?

It depends on the task, and ZeroTwo has not published a matched coding test, so this page does not name a best model. Start with the task table above, then run the same brief on two models and keep the one whose output passes your tests with the least editing.

Compare coding models rather than coding tools

Does ZeroTwo run the tests for me?

In an ordinary chat, run the tests in your own environment and paste any failures back. For work where an agent runs checks itself against a specification and a test suite, see the AI coding agent page, which describes that workflow.

AI coding agent

Can it help me debug?

Yes. Give it the error message, the smallest code that reproduces the problem and the versions involved. Ask for the root cause before the fix, and add a test that fails before the change and passes after.

Is the AI code generator free?

You can start on the Free plan: 100 free credits to start plus 20 bonus credits every day you log in, with limited model selection and no card required. Paid plans add monthly credits and features such as the code agent and ZeroCode; the plan strip above lists what each includes.

Write the tests first, then ask for the code