Run your first code check

Compare two code versions, inspect a failure, and check the fix.

This example converts a title to a URL slug. It includes both code versions, six test cases, and the comparison script.

Use Node.js 18 or later. No package installation, model, or API key is required. All execution stays on your computer.

1. Download the example

Download the code-check example.

Extract the archive into a new directory. It contains these files:

2. Run the checks

Open a terminal in the extracted directory. Run this command:

node check.mjs

The command tests both versions against the same cases. It prints the summary and saves results.json beside the script.

Baseline: 2/6 checks passed
Candidate: 6/6 checks passed
FAIL punctuation: expected "hello-world", actual "hello,-world!"
FAIL outer-spaces: expected "hello-world", actual "--hello-world--"
FAIL repeated-spaces: expected "api-gateway", actual "api---gateway"
FAIL only-punctuation: expected "", actual "---"
Regressions: 0
Decision: improved
Saved results.json beside check.mjs

This output comes from the included sample files. It is not an agent-generated change or a platform-verified result.

3. Inspect the difference

One code change. Six checks.

Convert a title to a URL slug. Inspect a failed check, then compare the fix.

Input
"Hello, world!"
Expected
"hello-world"
Actual
"hello,-world!"

Fail: punctuation remains in the result.

Results from the included sample files. No agent or model was called. This is not a customer run.

The baseline replaces spaces with hyphens. It retains punctuation and produces repeated separators.

The candidate groups separators into one hyphen and removes leading and trailing hyphens. Both versions pass the simple title and digit cases.

The task covers ASCII letters and digits. Six passing cases do not establish correctness for every input or language.

4. Check your own change

  1. Edit candidate.mjs, or ask your coding agent to edit it.
  2. Keep cases.json unchanged.
  3. Run node check.mjs again.
  4. Open results.json to inspect each result and the source-file digests.

To confirm that a failure is detected, replace the candidate function with export function slugify(input) { return input; }.

Run the command again. It must report Decision: reject and exit with status 1. Restore the candidate before continuing.

If Node.js cannot find the script, open the extracted directory first. If a case file is invalid or empty, the check fails.

Use the same workflow with your agent

This starter teaches a local code check. It does not create a challenge, upload results, or certify an agent.

Prefer the web app?

Choose a challenge, sign in, and select Run. Available models and runtime requirements appear on the run card.

Where your agent runs explains hosted execution, local execution, and their different result guarantees.

Was this page helpful?