karpathy-guidelines の検証ログ
課題ごとに、依頼文と採点項目、項目ごとの点数、実行ごとの時間・トークン、Claude Code の全ログ、作られたファイルを載せています。配点を変えても計算し直せるよう、生データも置いています。
2026年11月1日 に実行(実行: claude-sonnet-5-5/採点: claude-opus-5-5)。数値は中央値です。課題は SKILL.md をもとに AI が作ったもので、スキルに有利な場面に偏ることがあります。
生データ(JSON)課題・実行ごとの測定値・採点・集計をそのまま置いています。
実行ごとの測定値
| 実行 | 結果 | 時間 | トークン | 費用 | ターン | スキル使用 | ログ |
|---|---|---|---|---|---|---|---|
| 課題 1 1 回目 スキルなし | 完了 | 20秒 | 67,926 | $0.044 | 6 | - | 全ログ |
| 課題 1 1 回目 スキルあり | 完了 | 15秒 | 71,120 | $0.043 | 8 | 使った | 全ログ |
| 課題 1 1 回目 スキルあり(名指しなし) | 完了 | 10秒 | 68,177 | $0.037 | 6 | 使わず | 全ログ |
| 課題 1 2 回目 スキルあり | 完了 | 15秒 | 71,572 | $0.023 | 9 | 使った | 全ログ |
| 課題 1 2 回目 スキルなし | 完了 | 17秒 | 50,551 | $0.018 | 6 | - | 全ログ |
| 課題 1 2 回目 スキルあり(名指しなし) | 完了 | 18秒 | 68,397 | $0.021 | 6 | 使わず | 全ログ |
| 課題 1 3 回目 スキルなし | 完了 | 16秒 | 67,967 | $0.021 | 6 | - | 全ログ |
| 課題 1 3 回目 スキルあり | 完了 | 19秒 | 71,213 | $0.021 | 8 | 使った | 全ログ |
| 課題 1 3 回目 スキルあり(名指しなし) | 完了 | 14秒 | 68,181 | $0.020 | 6 | 使わず | 全ログ |
| 課題 2 1 回目 スキルなし | 完了 | 13秒 | 51,233 | $0.043 | 5 | - | 全ログ |
| 課題 2 1 回目 スキルあり | 完了 | 11秒 | 53,109 | $0.044 | 7 | 使った | 全ログ |
| 課題 2 1 回目 スキルあり(名指しなし) | 完了 | 18秒 | 50,818 | $0.037 | 4 | 使わず | 全ログ |
| 課題 2 2 回目 スキルあり | 完了 | 28秒 | 52,833 | $0.030 | 6 | 使った | 全ログ |
| 課題 2 2 回目 スキルなし | 完了 | 18秒 | 50,723 | $0.022 | 4 | - | 全ログ |
| 課題 2 2 回目 スキルあり(名指しなし) | 完了 | 15秒 | 51,227 | $0.023 | 5 | 使わず | 全ログ |
| 課題 2 3 回目 スキルなし | 完了 | 15秒 | 68,137 | $0.024 | 5 | - | 全ログ |
| 課題 2 3 回目 スキルあり | 完了 | 15秒 | 52,848 | $0.024 | 6 | 使った | 全ログ |
| 課題 2 3 回目 スキルあり(名指しなし) | 完了 | 13秒 | 50,784 | $0.021 | 4 | 使わず | 全ログ |
「スキルあり(名指しなし)」は呼ばれやすさを測るための実行で、採点はしていません。
課題 1: クーポン適用で合計が負になるバグを最小限の変更で修正
依頼文
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.採点基準
- 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).
項目ごとの点数(1 = 満たした・0.5 = 一部・0 = 満たさない)
| # | 1 回目 スキルなし / スキルあり | 2 回目 スキルなし / スキルあり | 3 回目 スキルなし / スキルあり |
|---|---|---|---|
| 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 |
初期ファイル(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()
1 回目: 引き分け (達成率 100% / 100%)
両者とも0止めの修正と再現テストを入れ無関係な部分は不変で、B の percent 追加修正もクーポン処理内のため実質差なし
スキルなし100%
最終メッセージ
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.
作った・変えたファイル
スキルあり100%
最終メッセージ
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.
作った・変えたファイル
2 回目: スキルあり (達成率 80% / 100%)
Bは固定クーポン分岐だけを直して範囲を絞り、修正前に失敗したことも示した。Aは依頼にない割合クーポンの挙動まで変えた。
スキルなし80%
最終メッセージ
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.
作った・変えたファイル
スキルあり100%
最終メッセージ
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.
作った・変えたファイル
3 回目: スキルあり (達成率 80% / 90%)
両者とも修正済みだが、Aは依頼外のpercent分岐まで変えて挙動を広げ、Bは焦点を絞り追加案として提示した
スキルなし80%
最終メッセージ
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.
作った・変えたファイル
スキルあり90%
最終メッセージ
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.
作った・変えたファイル
課題 2: ログ集計CLIに--levelオプションを簡潔に追加
依頼文
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.採点基準
- `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.
項目ごとの点数(1 = 満たした・0.5 = 一部・0 = 満たさない)
| # | 1 回目 スキルなし / スキルあり | 2 回目 スキルなし / スキルあり | 3 回目 スキルなし / スキルあり |
|---|---|---|---|
| 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 |
初期ファイル(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
1 回目: スキルあり (達成率 80% / 100%)
Bは最小限の変更で、該当なしや値欠落時の挙動も報告。Aは余計な機能を加え、値欠落時の挙動も未報告。
スキルなし80%
最終メッセージ
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.
作った・変えたファイル
スキルあり100%
最終メッセージ
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.
作った・変えたファイル
2 回目: スキルなし (達成率 100% / 90%)
両方とも正しく動くが、Aは実際のapp.logで確認し、Bは自作の小さなログでしか試さず元の出力とも比べていない
スキルなし100%
最終メッセージ
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.
作った・変えたファイル
スキルあり90%
最終メッセージ
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.
作った・変えたファイル
3 回目: スキルなし (達成率 100% / 90%)
実装は両者とも正しいが、Bはapp.logでの実際の出力を示し、Aは確認内容が曖昧だった。
スキルなし100%
最終メッセージ
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.
作った・変えたファイル
スキルあり90%
最終メッセージ
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.