Test log of karpathy-guidelines
For each task: the request, the rubric and the score for each item, time and tokens for every run, Claude Code’s full logs, and the files it produced. The raw data is here too, so the score can be recomputed if the weighting changes.
Run on Nov 1, 2026 (runs: claude-sonnet-5-5 / judge: claude-opus-5-5). Figures are medians. The tasks were written by AI from SKILL.md, so they may lean toward situations where the skill helps.
Raw data (JSON)Tasks, per-run measurements, judgments and the summary as stored.
Measurements per run
| Run | Result | Time | Tokens | Cost | Turns | Skill used | Log |
|---|---|---|---|---|---|---|---|
| Task 1 Run 1 Without skill | Done | 20s | 67,926 | $0.044 | 6 | - | Full log |
| Task 1 Run 1 With skill | Done | 15s | 71,120 | $0.043 | 8 | Yes | Full log |
| Task 1 Run 1 With skill (not named) | Done | 10s | 68,177 | $0.037 | 6 | No | Full log |
| Task 1 Run 2 With skill | Done | 15s | 71,572 | $0.023 | 9 | Yes | Full log |
| Task 1 Run 2 Without skill | Done | 17s | 50,551 | $0.018 | 6 | - | Full log |
| Task 1 Run 2 With skill (not named) | Done | 18s | 68,397 | $0.021 | 6 | No | Full log |
| Task 1 Run 3 Without skill | Done | 16s | 67,967 | $0.021 | 6 | - | Full log |
| Task 1 Run 3 With skill | Done | 19s | 71,213 | $0.021 | 8 | Yes | Full log |
| Task 1 Run 3 With skill (not named) | Done | 14s | 68,181 | $0.020 | 6 | No | Full log |
| Task 2 Run 1 Without skill | Done | 13s | 51,233 | $0.043 | 5 | - | Full log |
| Task 2 Run 1 With skill | Done | 11s | 53,109 | $0.044 | 7 | Yes | Full log |
| Task 2 Run 1 With skill (not named) | Done | 18s | 50,818 | $0.037 | 4 | No | Full log |
| Task 2 Run 2 With skill | Done | 28s | 52,833 | $0.030 | 6 | Yes | Full log |
| Task 2 Run 2 Without skill | Done | 18s | 50,723 | $0.022 | 4 | - | Full log |
| Task 2 Run 2 With skill (not named) | Done | 15s | 51,227 | $0.023 | 5 | No | Full log |
| Task 2 Run 3 Without skill | Done | 15s | 68,137 | $0.024 | 5 | - | Full log |
| Task 2 Run 3 With skill | Done | 15s | 52,848 | $0.024 | 6 | Yes | Full log |
| Task 2 Run 3 With skill (not named) | Done | 13s | 50,784 | $0.021 | 4 | No | Full log |
“With skill (not named)” runs only measure the pick-up rate and are not judged.
Task 1: Fix negative cart total bug from fixed coupons with a minimal change
Request
We got a customer report: someone applied a $20 fixed-amount coupon to a $15 order and the checkout showed a negative total. That should never happen. Please fix this in cart.py and make sure it doesn't come back. The existing tests are in test_cart.py (run with `python3 -m unittest`). Please keep the change focused; this module is used in other places and I don't want surprises in the diff.Rubric
- A fixed coupon larger than the order subtotal (e.g. $20 on a $15 order) now yields a total of 0, not a negative number.
- All original tests in test_cart.py still pass, and percent/fixed coupon results for normal cases are unchanged.
- A new automated test reproducing the reported case (coupon exceeding subtotal) was added and passes.
- The diff is small and limited to the coupon/total logic: unrelated code such as _legacy_round, export, imports, comments and formatting is left as it was (mentioning the unused helper in the message is fine).
- The final message briefly explains the cause, the fix, and how it was verified (e.g. test run results).
Score per rubric item (1 = met, 0.5 = partly, 0 = not met)
| # | Run 1 Without skill / With skill | Run 2 Without skill / With skill | Run 3 Without skill / With skill |
|---|---|---|---|
| 1 | 1 / 1 | 1 / 1 | 1 / 1 |
| 2 | 1 / 1 | 1 / 1 | 1 / 1 |
| 3 | 1 / 1 | 1 / 1 | 1 / 1 |
| 4 | 1 / 1 | 0.5 / 1 | 0.5 / 1 |
| 5 | 1 / 1 | 0.5 / 1 | 0.5 / 0.5 |
Starting files(2)
cart.py
# cart.py - shopping cart totals
import math
import json # used by export
TAX_RATE = 0.10
def _legacy_round(x):
# old rounding helper, no longer used
return math.floor(x*100+0.5)/100
def line_total(item):
return item['price'] * item['qty']
def subtotal(items):
total = 0
for i in items:
total += line_total(i)
return total
def apply_coupon(amount, coupon):
if coupon is None:
return amount
if coupon['type'] == 'percent':
return amount * (1 - coupon['value']/100)
if coupon['type'] == 'fixed':
return amount - coupon['value']
return amount
def total(items, coupon=None):
s = subtotal(items)
s = apply_coupon(s, coupon)
taxed = s * (1+TAX_RATE)
return round(taxed, 2)
def export(items):
return json.dumps(items)
test_cart.py
import unittest
from cart import total, subtotal, apply_coupon
ITEMS = [{'price': 10.0, 'qty': 2}, {'price': 5.0, 'qty': 1}]
class CartTests(unittest.TestCase):
def test_subtotal(self):
self.assertEqual(subtotal(ITEMS), 25.0)
def test_total_no_coupon(self):
self.assertEqual(total(ITEMS), 27.5)
def test_percent_coupon(self):
self.assertEqual(total(ITEMS, {'type': 'percent', 'value': 20}), 22.0)
def test_fixed_coupon(self):
self.assertEqual(total(ITEMS, {'type': 'fixed', 'value': 5}), 22.0)
if __name__ == '__main__':
unittest.main()
Run 1: Tie (Rubric met 100% / 100%)
Both clamp at zero and add a repro test with unrelated code untouched; B's percent clamp stays in coupon logic.
Without skill100%
Final message
I fixed the negative total in apply_coupon in cart.py. A coupon can no longer take the amount below zero, so a $20 fixed coupon on a $15 order now gives $0. All 6 tests pass.
- The change: the
fixedandpercentbranches now wrap their results inmax(0, ...). I clamped the percent branch too, because a percent value over 100 had the same bug. Nothing else in the module changed. - Tests: I added two to
test_cart.py. One checks a $20 fixed coupon on a $15 order, through bothtotalandapply_coupon. The other checks a 150% coupon.
One thing in the diff you might not expect: when the clamp applies, total returns 0 (an int) instead of 0.0. 0 == 0.0 in Python, so it only matters if some caller checks the type or formats the number as a string.
Files created or changed
With skill100%
Final message
I fixed it: a fixed coupon larger than the order now brings the total to $0.00 instead of going negative. All 5 tests pass. I didn't run the new test against the old code first, so it hasn't been shown to fail before the fix.
cart.py: the fixed-coupon branch ofapply_couponnow returnsmax(amount - coupon['value'], 0). That is the only line changed.test_cart.py: I addedtest_fixed_coupon_larger_than_order. It uses the reported case, a $20 coupon on a $15 order, and checks bothapply_couponandtotalreturn 0.
A percent coupon with a value over 100 would also give a negative total. I left it alone because it's outside this report and you asked for a narrow diff. The same clamp would fix it if you want it.
I also left _legacy_round in cart.py alone. It looks unused, but removing it isn't part of this fix.
Files created or changed
Run 2: With skill (Rubric met 80% / 100%)
B fixed only the fixed-coupon branch and showed the pre-fix failure; A also changed percent coupons unasked.
Without skill80%
Final message
I fixed it in apply_coupon in cart.py. A coupon can no longer take the discounted amount below 0, so a $20 fixed coupon on a $15 order now gives a total of $0. All 6 tests pass: the 4 existing ones and 2 new ones.
- Fix: both coupon branches now wrap the result in
max(0, ...). I clamped the percent branch too, because a percent coupon over 100 (say 150%) goes negative the same way. Totals that were already non-negative come out exactly as before. - Tests: I added two regression tests to
test_cart.py, one for the $20 coupon on a $15 order and one for a 150% percent coupon.
The diff touches only those two lines in cart.py. I left the unused _legacy_round helper alone to keep the change focused.
Files created or changed
With skill100%
Final message
A $20 fixed coupon on a $15 order now gives a $0 total instead of a negative one. All 5 tests pass, including the new one.
cart.py: inapply_coupon, the fixed-coupon branch is nowmax(amount - coupon['value'], 0). That's a one-line change.test_cart.py: I addedtest_fixed_coupon_larger_than_order, which checks bothapply_couponandtotalfor this case. It failed before the fix (-5.0 != 0).
I didn't touch anything else, so the other callers of this module behave the same, except that an oversized fixed coupon now bottoms out at 0.
Two things I noticed and left alone:
- A percent coupon over 100 (say
value: 150) would also produce a negative total. You only reported the fixed case, so I didn't change it. It's the same one-line fix if you want it. _legacy_roundincart.pyis unused.
Files created or changed
Run 3: With skill (Rubric met 80% / 90%)
Both fix the bug, but A also changed the unrequested percent branch; B stayed focused and offered it as a follow-up.
Without skill80%
Final message
I fixed the negative total in apply_coupon in cart.py. A $20 fixed coupon on a $15 order now gives a $0 total. All 6 tests pass, including the two new ones.
- The fix: the coupon result is now
max(0, …). I applied it to the percent branch as well as the fixed one, because a percent coupon over 100 would also go negative. It's a one-line change in each branch, and no other function in the module is touched. - Tests: I added two to
test_cart.py. One is your exact case, a $20 fixed coupon on a $15 order. The other is a 150% coupon. Both expect a total of 0.
Normal coupons behave as before. The existing tests pass unchanged.
I left alone the unused _legacy_round helper and the rest of the module.
Files created or changed
With skill90%
Final message
A $20 fixed coupon on a $15 order now gives a total of 0 instead of a negative number. All 5 tests pass, including the new one.
- Fix: in
cart.py, thefixedbranch ofapply_couponis nowreturn max(amount - coupon['value'], 0). That is the only line changed in the module. - Test: I added
test_fixed_coupon_larger_than_order_is_not_negativetotest_cart.py. It covers the $15 order with a $20 coupon, both throughtotal()and throughapply_coupon()directly.
Anything else that calls apply_coupon with a fixed coupon larger than the amount now gets 0 as well.
I left a related case alone because you asked for a focused change. A percent coupon with a value over 100 would still produce a negative amount. Clamping the percent branch the same way would be a one-line follow-up if you want it.
_legacy_round in cart.py is unused. I didn't touch it.
Files created or changed
Task 2: Add a simple --level option to a log summary CLI
Request
I have a little Node script, summarize.js, that counts log lines per level in a log file (try `node summarize.js app.log`). I'd like to add a `--level` option so that `node summarize.js app.log --level ERROR` prints only the count for that level, plus the most recent message logged at that level. Running it without `--level` should behave exactly as it does today. No new dependencies please.Rubric
- `node summarize.js app.log --level ERROR` prints the ERROR count (2) and the most recent ERROR message ("payment service timeout"); other levels work too (e.g. WARN gives 2 and "cache miss rate high").
- `node summarize.js app.log` without the flag produces exactly the same output as the original script (DEBUG 1, ERROR 2, INFO 3, WARN 2, tab-separated, sorted).
- No new dependencies or extra files beyond what is needed (no package.json/argument-parsing library added); the change stays focused on summarize.js.
- The implementation is proportionate: no unrequested features (e.g. multiple-level filters, JSON output, config files) and no unrelated rewriting of existing functions or formatting.
- The final message reports how the change was checked (e.g. commands run and their output) and notes any behaviour decisions made for unclear cases, such as a level with no matching lines or a missing value after --level.
Score per rubric item (1 = met, 0.5 = partly, 0 = not met)
| # | Run 1 Without skill / With skill | Run 2 Without skill / With skill | Run 3 Without skill / With skill |
|---|---|---|---|
| 1 | 1 / 1 | 1 / 1 | 1 / 1 |
| 2 | 1 / 1 | 1 / 1 | 1 / 1 |
| 3 | 1 / 1 | 1 / 1 | 1 / 1 |
| 4 | 0.5 / 1 | 1 / 1 | 1 / 1 |
| 5 | 0.5 / 1 | 1 / 0.5 | 1 / 0.5 |
Starting files(2)
summarize.js
#!/usr/bin/env node
const fs = require('fs');
function parseLine(line) {
// format: 2026-10-01T12:00:00Z LEVEL message
const m = line.match(/^(\S+)\s+(DEBUG|INFO|WARN|ERROR)\s+(.*)$/);
if (!m) return null;
return { ts: m[1], level: m[2], msg: m[3] };
}
function summarize(lines) {
const counts = {};
for (const line of lines) {
const e = parseLine(line);
if (!e) continue;
counts[e.level] = (counts[e.level] || 0) + 1;
}
return counts;
}
function main() {
const file = process.argv[2];
if (!file) {
console.error('usage: summarize.js <logfile>');
process.exit(1);
}
const lines = fs.readFileSync(file, 'utf8').split('\n');
const counts = summarize(lines);
for (const level of Object.keys(counts).sort()) {
console.log(`${level}\t${counts[level]}`);
}
}
if (require.main === module) main();
module.exports = { parseLine, summarize };
app.log
2026-10-01T08:00:00Z INFO server started 2026-10-01T08:00:05Z DEBUG loading config 2026-10-01T08:01:10Z WARN slow query: 1200ms 2026-10-01T08:02:00Z ERROR db connection reset 2026-10-01T08:02:30Z INFO retrying db connection 2026-10-01T08:03:00Z ERROR payment service timeout this line is garbage 2026-10-01T08:04:00Z INFO request handled 2026-10-01T08:05:00Z WARN cache miss rate high
Run 1: With skill (Rubric met 80% / 100%)
B is minimal and reports no-match and missing-value behaviour; A adds extra options and omits the missing-value case.
Without skill80%
Final message
I added --level to /work/summarize.js. I ran it against app.log and it works. I only ran the cases below, and I didn't check what happens when a level has no matching lines.
- Without
--level: the output is unchanged. It still prints oneLEVEL<tab>countline per level, sorted. - With
--level:node summarize.js app.log --level ERRORprints the count, then the latest message at that level. Forapp.logit printed:ERROR 2 2026-10-01T08:03:00Z payment service timeout - Option forms: the option can go before or after the filename.
--level=WARNalso works, and so does lowercase (--level warn). - Bad level: an unknown level such as
FATALprints the usage message and exits with code 1. - "Most recent": this means the last matching line in the file, not the one with the latest timestamp. That's the same thing as long as the log is in chronological order.
I added no dependencies, and the exports (parseLine, summarize) are untouched.
Files created or changed
With skill100%
Final message
I added --level to summarize.js. I ran it against app.log and the output looked right, but I didn't write any tests.
- Without
--level: the output is the same as before. I compared it with the earlier run. - With
--level ERROR: it printsERROR<tab>2, then the last ERROR message in the file (payment service timeout).
I made a few choices you didn't specify:
- "Most recent": this means the last matching line in the file, not the latest timestamp. The two are the same if the log is in time order.
- Option position:
--levelcan go before or after the filename, so--level WARN app.logworks too. - Level with no matches: it prints just
FATAL<tab>0and no message line. - Missing value:
--levelwith no value exits with an error. - Level names: the level isn't validated and is case-sensitive, so
errorwould report 0.
I also updated the usage text to mention --level.
Files created or changed
Run 2: Without skill (Rubric met 100% / 90%)
Both work, but A checked on the real app.log; B only used a small sample log and never compared with the old script.
Without skill100%
Final message
I added --level to /work/summarize.js. I ran it on app.log and it behaves as you described.
- Without
--level: the output is the same as before:DEBUG 1,ERROR 2,INFO 3,WARN 2. node summarize.js app.log --level ERROR: prints the count, then the most recent message:ERROR 2 latest: 2026-10-01T08:03:00Z payment service timeout- Argument forms:
--level=ERRORworks too, and the option can come before the file name. The level is case-insensitive. - Level with no matches: it prints just the count, for example
NOPE 0. That includes a misspelled level likeNOPE, which isn't rejected. - Missing value:
--levelwith nothing after it prints the usage message and exits with code 1. - "Most recent": this means the last matching line in the file, not the latest timestamp. If your logs can be out of order, tell me and I'll compare timestamps instead.
I added no dependencies, and the exports (parseLine, summarize) are unchanged.
Files created or changed
With skill90%
Final message
node summarize.js app.log --level ERROR now prints the count for that level, then the most recent message at that level. I checked it on a small sample log. The no---level output matched the existing format, but I didn't compare it against the old script.
ERROR 2
Last: second
- Most recent: this is the last matching line in the file, not the one with the latest timestamp. Say so if you'd rather go by timestamp.
- Option position:
--levelworks before or after the filename. - No matches: a level with no lines (such as
WARNin my sample) printsWARN 0and noLast:line. - Missing value:
--levelwith nothing after it prints the usage message and exits with code 1. - Unchanged code: I didn't touch
summarizeorparseLine. The change is inmaininsummarize.js, and there are no new dependencies.
I didn't validate the level name, so --level error in lowercase just reports a count of 0.
Files created or changed
Run 3: Without skill (Rubric met 100% / 90%)
Both implementations are correct, but B shows actual output from app.log while A's verification report is vague.
Without skill100%
Final message
I added --level to /work/summarize.js. I ran it on app.log and it works.
- With
--level:node summarize.js app.log --level ERRORprints the count, then the timestamp and message of the most recent line at that level:ERROR 2 2026-10-01T08:03:00Z payment service timeout - Without
--level: the output is the same as before. I leftsummarize()and the exports unchanged. - Argument handling: the flag can go before or after the file name, and the level is case-insensitive, so
--level warnworks. An unknown level, a missing level value, or extra arguments print the usage message and exit with code 1. - No matches: if the level never appears, it prints just
LEVEL 0and no message line. - "Most recent": this means the last matching line in the file, not the latest timestamp. If your logs can be out of order, I can compare timestamps instead.
Files created or changed
With skill90%
Final message
I added --level to /work/summarize.js. I ran it against a small test log, and each case behaved as expected.
--level ERROR:node summarize.js app.log --level ERRORprintsERROR<tab>2, then the last matching line as<timestamp> <message>. "Most recent" means the last matching line in the file, not the latest timestamp.- Without
--level: the output is the same per-level counts as before. - Option position:
--levelcan come before or after the filename. - Zero matches: if the level never appears (or isn't a real level), it prints
WARN<tab>0and no message line. - Missing value:
--levelwith nothing after it prints the usage message and exits with an error. - Usage text: the usage message now mentions
[--level LEVEL].
The level name is case-sensitive, so error finds nothing. There are no new dependencies.