Code-gen

Plato is structured coding — every change is a typed, reviewable artifact, unlike the improvised code generation of Cursor, Replit, v0, and Raycast.

The first workflow, Code Generation from Natural Language, hands you a single typed artifact per prompt — no chat loop, no streaming diffs. Pricing lives on /pricing, and the only door in during early access is the /waitlist.

Three worked examples. Each one below starts with the natural-language prompt you would type, then the single artifact Plato returns, then a short note on why the output meets the Precision & Elegance Standard. One prompt, one reviewable artifact, one diff in your editor.

Express rate-limit middleware that buckets by IP.

Prompt

Write an Express middleware that throttles requests per client IP using a sliding window. It should accept a windowMs and a max request count, and return 429 with a Retry-After header once the bucket is full. The middleware should be a drop-in RequestHandler.

Artifact

function ipRateLimit({
  args:   { windowMs: number, max: number },
  returns: RequestHandler,
  body:   `
  const buckets = new Map<string, { count: number; resetAt: number }>();
  return (req, res, next) => {
    const ip  = req.ip ?? req.socket.remoteAddress ?? 'unknown';
    const now = Date.now();
    const cur = buckets.get(ip);
    if (!cur || cur.resetAt <= now) {
      buckets.set(ip, { count: 1, resetAt: now + windowMs });
      return next();
    }
    if (cur.count >= max) {
      const retryAfter = Math.ceil((cur.resetAt - now) / 1000);
      res.setHeader('Retry-After', String(retryAfter));
      return res.status(429).json({ error: 'rate_limited' });
    }
    cur.count += 1;
    return next();
  };
`})

named inputs and return type are visible before the diff lands, so you can reject the contract in five seconds — not debate it in a chat thread.

A CSV row parser that handles quoted fields and embedded commas.

Prompt

Write a pure function that parses a CSV string with a header row into { headers, rows }. It should support an optional custom delimiter and correctly unquote fields that contain commas inside double quotes. No dependencies — return the parsed shape synchronously.

Artifact

function parseCsv({
  args:   { input: string; options?: { delimiter?: string } },
  returns: { headers: string[]; rows: string[][] },
  body:   `
  const delim = options?.delimiter ?? ',';
  const lines  = input.split(/\\r?\\n/).filter((l) => l.length > 0);
  const split  = (line) => {
    const out: string[] = []; let buf = ''; let inQuote = false;
    for (let i = 0; i < line.length; i += 1) {
      const ch = line[i];
      if (inQuote) {
        if (ch === '"' && line[i + 1] === '"') { buf += '"'; i += 1; }
        else if (ch === '"')                        { inQuote = false; }
        else                                        { buf += ch; }
      } else {
        if      (ch === '"') { inQuote = true; }
        else if (ch === delim) { out.push(buf); buf = ''; }
        else                  { buf += ch; }
      }
    }
    out.push(buf);
    return out;
  };
  const [headers, ...rows] = lines.map(split);
  return { headers, rows };
`})

the body is shape-on-the-page, not stacks of edits in a chat loop — what you see is what lands, and the typed return value makes the failure modes impossible to miss at review.

A JWT verifier that returns a discriminated result, not a thrown error.

Prompt

Write a JWT verifier that takes a token and a secret and returns a discriminated union — { ok: true, payload } on success, { ok: false, reason } on failure where reason is 'expired' or 'bad-signature'. No exceptions cross the boundary; callers must narrow the result. Use Node's built-in crypto.

Artifact

function verifyJwt({
  args:   { token: string; secret: string },
  returns: { ok: true; payload: JwtPayload } | { ok: false; reason: 'expired' | 'bad-signature' },
  body:   `
  const [headerB64, payloadB64, sigB64] = token.split('.');
  if (!headerB64 || !payloadB64 || !sigB64) {
    return { ok: false, reason: 'bad-signature' };
  }
  const data        = \`\${headerB64}.\${payloadB64}\`;
  const expected    = crypto.createHmac('sha256', secret).update(data).digest('base64url');
  const providedOk  = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(sigB64));
  if (!providedOk) return { ok: false, reason: 'bad-signature' };
  const payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString('utf8'));
  if (typeof payload.exp === 'number' && payload.exp * 1000 < Date.now()) {
    return { ok: false, reason: 'expired' };
  }
  return { ok: true, payload };
`})

the discriminated return makes intent reviewable, not just correctness — Opinionated shapes like this are why every artifact arrives with a contract before it lands, and why one prompt produces one review.