graphify の検証ログ
課題ごとに、依頼文と採点項目、項目ごとの点数、実行ごとの時間・トークン、Claude Code の全ログ、作られたファイルを載せています。配点を変えても計算し直せるよう、生データも置いています。
2026年12月2日 に実行(実行: claude-sonnet-5-5/採点: claude-opus-5-5)。数値は中央値です。課題は SKILL.md をもとに AI が作ったもので、スキルに有利な場面に偏ることがあります。
生データ(JSON)課題・実行ごとの測定値・採点・集計をそのまま置いています。
実行ごとの測定値
| 実行 | 結果 | 時間 | トークン | 費用 | ターン | スキル使用 | ログ |
|---|---|---|---|---|---|---|---|
| 課題 1 1 回目 スキルなし | 完了 | 36秒 | 108,765 | $0.090 | 7 | - | 全ログ |
| 課題 1 1 回目 スキルあり | 完了 | 38秒 | 209,997 | $0.177 | 7 | 使った | 全ログ |
| 課題 1 1 回目 スキルあり(名指しなし) | 完了 | 30秒 | 71,102 | $0.068 | 4 | 使わず | 全ログ |
| 課題 1 2 回目 スキルあり | 完了 | 38秒 | 208,749 | $0.078 | 7 | 使った | 全ログ |
| 課題 1 2 回目 スキルなし | 完了 | 28秒 | 70,983 | $0.052 | 4 | - | 全ログ |
| 課題 1 2 回目 スキルあり(名指しなし) | 完了 | 40秒 | 127,618 | $0.072 | 7 | 使わず | 全ログ |
| 課題 2 1 回目 スキルなし | 完了 | 33秒 | 89,653 | $0.077 | 5 | - | 全ログ |
| 課題 2 1 回目 スキルあり | 完了 | 29秒 | 170,391 | $0.159 | 6 | 使った | 全ログ |
| 課題 2 1 回目 スキルあり(名指しなし) | 完了 | 29秒 | 89,448 | $0.070 | 5 | 使わず | 全ログ |
| 課題 2 2 回目 スキルあり | 完了 | 28秒 | 170,172 | $0.064 | 6 | 使った | 全ログ |
| 課題 2 2 回目 スキルなし | 完了 | 29秒 | 90,108 | $0.063 | 5 | - | 全ログ |
| 課題 2 2 回目 スキルあり(名指しなし) | 完了 | 36秒 | 89,897 | $0.058 | 5 | 使わず | 全ログ |
「スキルあり(名指しなし)」は呼ばれやすさを測るための実行で、採点はしていません。
課題 1: Pythonパッケージの依存構造・循環import・中心モジュール分析
依頼文
I just inherited this `shop` Python package and I'm getting weird ImportErrors in some environments. Can you map out how the modules inside `shop/` depend on each other (internal imports only)? I need to know whether there are any circular imports and exactly which modules form each cycle, which modules are depended on the most (the ones where a change would ripple out furthest), and whether any module isn't imported by anything. Please write your findings to `ARCHITECTURE.md` in the project root, including a dependency list or diagram, and give me a short summary in your reply.採点基準
- ARCHITECTURE.md exists in the project root and lists the internal import relationships between the shop modules, at least correctly covering db→config, models→db, and services/api modules→models
- Identifies the circular import between shop.services.orders and shop.services.payments
- Identifies the circular import between shop.services.notifications and shop.api.formatters
- Names shop.models as the most depended-on module (imported by orders, payments, notifications, formatters, handlers), with utils mentioned as another widely used module
- Points out that shop.legacy_export is not imported by any other module (and does not wrongly flag modules that are used)
- Makes no false claims about cycles (e.g., does not report a cycle involving config, db, or utils)
項目ごとの点数(1 = 満たした・0.5 = 一部・0 = 満たさない)
| # | 1 回目 スキルなし / スキルあり | 2 回目 スキルなし / スキルあり |
|---|---|---|
| 1 | 1 / 1 | 1 / 1 |
| 2 | 1 / 1 | 1 / 1 |
| 3 | 1 / 1 | 1 / 1 |
| 4 | 1 / 1 | 1 / 1 |
| 5 | 1 / 1 | 1 / 1 |
| 6 | 1 / 1 | 1 / 1 |
初期ファイル(12)
shop/config.py
DB_URL = "sqlite:///shop.db" CURRENCY = "USD" PAYMENT_PROVIDER = "stripe-sandbox"
shop/db.py
from shop import config
def get_connection():
return {"url": config.DB_URL, "open": True}
shop/models.py
from shop.db import get_connection
class Order:
def __init__(self, order_id, total):
self.id = order_id
self.total = total
self.paid = False
def save(self):
conn = get_connection()
return conn["open"]
class Payment:
def __init__(self, order_id, amount):
self.order_id = order_id
self.amount = amount
shop/utils.py
def money(value):
return f"{value:.2f}"
shop/legacy_export.py
import csv
import io
def export_orders_csv(rows):
buf = io.StringIO()
writer = csv.writer(buf)
for r in rows:
writer.writerow(r)
return buf.getvalue()
shop/services/__init__.py
shop/services/orders.py
from shop.models import Order
from shop.services import payments
from shop.services.notifications import notify_order_placed
from shop.utils import money
def place_order(order_id, total):
order = Order(order_id, total)
order.save()
payments.charge(order)
notify_order_placed(order)
return money(order.total)
def mark_paid(order):
order.paid = True
return order
shop/services/payments.py
from shop import config
from shop.models import Payment
from shop.utils import money
from shop.services.orders import mark_paid
def charge(order):
p = Payment(order.id, order.total)
print(f"charging {money(p.amount)} {config.CURRENCY} via {config.PAYMENT_PROVIDER}")
mark_paid(order)
return p
shop/services/notifications.py
from shop.models import Order
from shop.api.formatters import format_order_summary
TEMPLATES = {"placed": "Your order {id} was placed: {summary}"}
def notify_order_placed(order: Order):
msg = TEMPLATES["placed"].format(id=order.id, summary=format_order_summary(order))
print(msg)
return msg
shop/api/__init__.py
shop/api/formatters.py
from shop.models import Order
from shop.utils import money
from shop.services.notifications import TEMPLATES
def format_order_summary(order: Order):
status = "paid" if order.paid else "pending"
return f"#{order.id} {money(order.total)} ({status}) [{len(TEMPLATES)} templates]"
shop/api/handlers.py
from shop.models import Order
from shop.services import orders, payments
from shop.api.formatters import format_order_summary
def handle_create(order_id, total):
return orders.place_order(order_id, total)
def handle_refund(order: Order):
payments.charge(Order(order.id, -order.total))
return format_order_summary(order)
1 回目: 引き分け (達成率 100% / 100%)
両者とも2つの循環、models集中、legacy_export未使用を正しく記載し実質差がない
スキルなし100%
最終メッセージ
I've written the findings, including a dependency table and a mermaid diagram, to /work/ARCHITECTURE.md. I read every import line in shop/ and found no dynamic imports. I also imported each module in a fresh interpreter to check the failures.
Circular imports: there are two separate 2-module cycles. Neither pulls in the other's modules except one way (orders reaches notifications).
services.orders⇄services.payments.paymentsdoesfrom shop.services.orders import mark_paid, andordersdoesfrom shop.services import payments.api.formatters⇄services.notifications.formattersdoesfrom shop.services.notifications import TEMPLATES, andnotificationsdoesfrom shop.api.formatters import format_order_summary.
Likely cause of your ImportErrors: both cycles use from X import name on a module that is still partway through importing. Importing handlers, orders, payments, notifications or formatters first all raises ImportError ... partially initialized module. Only models, db, config and utils import cleanly on their own. Which error you see depends on which module gets imported first. That would explain why it differs between environments, since entry point and test ordering vary.
Most depended-on:
modelshas 5 direct importers, the most of any module.utilshas 3.confighas only 2 direct importers, but it sits at the bottom of the chain (config → db → models). A change there reaches nearly everything.
Not imported by anything:
api.handlersis probably the intended entry point.legacy_exporthas no importers and no internal imports. It looks like dead code, but I only searched this project directory. Check for outside users before deleting it.
To break the cycles, move mark_paid, TEMPLATES and format_order_summary into a lower-level module that both sides import. Alternatively, import inside the function that uses them. I haven't changed any code.
作った・変えたファイル
スキルあり100%
最終メッセージ
I wrote the findings to /work/ARCHITECTURE.md. It has a dependency table, a mermaid diagram, and fix suggestions. I couldn't use graphify itself. pip isn't installed here, so I parsed every shop/**/*.py with Python's ast instead, which is exact for a package this small.
Circular imports (2, each between two modules)
shop.api.formattersandshop.services.notificationsimport each other.formattersimportsTEMPLATESfromnotifications, andnotificationsimportsformat_order_summaryfromformatters.shop.services.ordersandshop.services.paymentsimport each other.ordersdoesfrom shop.services import payments, andpaymentsdoesfrom shop.services.orders import mark_paid.
These explain the environment-dependent ImportErrors. The from X import name lines fail with "cannot import name" when the other module of the pair gets loaded first. Which one loads first depends on the entry point, such as the test runner or the web server. Cycle 2 only fails if orders is imported before payments.
Where changes ripple furthest
shop.modelshas the most direct importers (5).shop.confighas only 2 direct importers, but it sits underdbandmodels. A change there reaches 7 of the other 10 modules.shop.utilshas 3 direct importers and reaches 5 modules.
Not imported by anything
shop.legacy_exporthas no importers and no internal imports. It is probably dead code, but check for dynamic loading or scripts before deleting it.shop.api.handlersalso has no importers. That's expected if it's an entry point.
shop/ has no __init__.py, so it is a namespace package. That's another possible cause of environment differences, and adding one is worth considering.
I didn't change any code. The doc suggests two fixes: move TEMPLATES and mark_paid into modules both sides can import, or import lazily inside the functions that need them.
作った・変えたファイル
2 回目: 引き分け (達成率 100% / 100%)
両者とも2つの循環・models最多・legacy_export未使用を正確に記述し実質差がない
スキルなし100%
最終メッセージ
I mapped the internal imports and wrote the findings to /work/ARCHITECTURE.md. It has a dependency table, a Mermaid diagram, and the exact import lines. I read the import statements but didn't run the code, so the failure behavior below is reasoned from the imports, not reproduced.
Circular imports (two cycles):
shop.services.ordersandshop.services.payments.ordersdoesfrom shop.services import payments, andpaymentsdoesfrom shop.services.orders import mark_paid.shop.services.notificationsandshop.api.formatters.notificationsdoesfrom shop.api.formatters import format_order_summary, andformattersdoesfrom shop.services.notifications import TEMPLATES.
These probably explain your ImportErrors. In each pair, importing one module first works and importing the other first fails, because from X import name hits a half-loaded module. Which one loads first depends on the entry point, so it varies by environment. For example, if orders loads first, payments can't find mark_paid. The fix I suggest in the file is to move mark_paid and TEMPLATES into a lower-level module, or to import inside functions. I haven't changed any code.
Most depended-on modules:
shop.modelsis imported by 5 modules, so changes there ripple furthest.shop.utilsis imported by 3.config,payments,orders,notificationsandformattersare each imported by 2.
Modules nothing imports:
shop.api.handlersis probably the entry point, so that's expected.shop.legacy_exporthas no internal imports and no importers. It looks like dead code, but I only searched/work, so check for external callers before deleting it.
shop/ also has no top-level __init__.py, so it's a namespace package. That could behave differently across environments or tools, so you may want to add one.
作った・変えたファイル
スキルあり100%
最終メッセージ
I wrote the findings to /work/ARCHITECTURE.md. It includes a dependency table and a Mermaid diagram. I couldn't build a graphify graph because pip isn't installed. I parsed the shop/ imports directly and ran a cycle check, so there is no graphify-out/.
Circular imports: there are two, and both come from top-level imports.
shop.api.formattersandshop.services.notifications.formattersimportsTEMPLATESfromnotifications, andnotificationsimportsformat_order_summaryfromformatters. Whichever module loads first fails.shop.services.ordersandshop.services.payments.ordersimportspaymentsas a module, andpaymentsdoesfrom ...orders import mark_paid. This only works ifpaymentsis imported first.
orders also imports notifications, which links the two cycles. Which one fails depends on the entry point, which would explain errors that appear in some environments and not others. The doc suggests fixes but I haven't applied any. The main ones are moving TEMPLATES to a leaf module and moving mark_paid to a lower layer.
Most depended-on modules:
modelsis imported by 5 modules, so a change there ripples furthest. It also depends ondb, which depends onconfig.utilsis imported by 3 modules.config,payments,formatters,ordersandnotificationsare each imported by 2.
Modules nothing imports:
api.handlersis the entry layer, so that is expected.legacy_exportimports nothing fromshopand nothing imports it, so it looks like dead code. Check for external or script use before removing it.
There is also no shop/__init__.py, so shop is a namespace package. That is another possible source of environment differences.
作った・変えたファイル
課題 2: チェックアウト処理の流れを追い、ドキュメントとのずれを特定
依頼文
Someone on the team says `docs/architecture.md` is out of date. Can you trace exactly what happens when `POST /checkout` is hit, starting at the route handler and going down to where stock is written? List the files and functions in the order they actually run. Then compare that with what's in `docs/` and list every statement in the docs that no longer matches the code, each with a correction. Don't change the code. Put the findings in `CHECKOUT_FLOW.md`.採点基準
- CHECKOUT_FLOW.md exists and lists the actual call order: postCheckout (routes/checkout.js) → buildOrder (services/cart.js) → getCart (db/carts.js) → holdStock (services/inventory.js) → checkAvailable/readStock → writeReservation (db/stock.js), followed by applyDiscounts and then chargeCard
- Flags that the handler is named postCheckout, not handleCheckout
- Flags that stock is held/reserved before the card is charged (during buildOrder), so the doc's ordering of 'charge first, then reserve' is wrong
- Flags that the inventory function is holdStock, not reserveStock
- Does not wrongly flag the accurate statements (writeReservation in db/stock.js, applyDiscounts in pricing.js, chargeCard in billing.js)
- No files under src/ were modified
項目ごとの点数(1 = 満たした・0.5 = 一部・0 = 満たさない)
| # | 1 回目 スキルなし / スキルあり | 2 回目 スキルなし / スキルあり |
|---|---|---|
| 1 | 1 / 1 | 1 / 1 |
| 2 | 1 / 1 | 1 / 1 |
| 3 | 1 / 1 | 1 / 1 |
| 4 | 1 / 1 | 1 / 1 |
| 5 | 0.5 / 0.5 | 0.5 / 0.5 |
| 6 | 1 / 1 | 1 / 1 |
初期ファイル(9)
src/server.js
const http = require('http');
const { postCheckout } = require('./routes/checkout');
const routes = { 'POST /checkout': postCheckout };
function start(port = 3000) {
return http.createServer((req, res) => {
let data = '';
req.on('data', (c) => (data += c));
req.on('end', () => {
req.body = data ? JSON.parse(data) : {};
res.json = (obj) => { res.setHeader('content-type', 'application/json'); res.end(JSON.stringify(obj)); };
const handler = routes[`${req.method} ${req.url}`];
if (!handler) { res.statusCode = 404; return res.end(); }
handler(req, res);
});
}).listen(port);
}
module.exports = { start };
src/routes/checkout.js
const { buildOrder } = require('../services/cart');
const { chargeCard } = require('../services/billing');
async function postCheckout(req, res) {
const order = await buildOrder(req.body.cartId);
const receipt = await chargeCard(order.customerId, order.total);
res.json({ orderId: order.id, receipt });
}
module.exports = { postCheckout };
src/services/cart.js
const { getCart } = require('../db/carts');
const { holdStock } = require('./inventory');
const { applyDiscounts } = require('./pricing');
async function buildOrder(cartId) {
const cart = await getCart(cartId);
await holdStock(cart.items);
const total = applyDiscounts(cart.items, cart.coupon);
return { id: `ord_${cartId}`, customerId: cart.customerId, total };
}
module.exports = { buildOrder };
src/services/inventory.js
const { readStock, writeReservation } = require('../db/stock');
async function checkAvailable(sku, qty) {
const onHand = await readStock(sku);
if (onHand < qty) throw new Error(`insufficient stock for ${sku}`);
}
async function holdStock(items) {
for (const item of items) {
await checkAvailable(item.sku, item.qty);
await writeReservation(item.sku, item.qty);
}
}
module.exports = { holdStock };
src/services/pricing.js
function applyDiscounts(items, coupon) {
const subtotal = items.reduce((s, i) => s + i.price * i.qty, 0);
return coupon === 'TEN' ? subtotal * 0.9 : subtotal;
}
module.exports = { applyDiscounts };
src/services/billing.js
async function chargeCard(customerId, amount) {
return { customerId, amount, status: 'captured', at: Date.now() };
}
module.exports = { chargeCard };
src/db/carts.js
const carts = {
c1: { customerId: 'u1', coupon: 'TEN', items: [{ sku: 'A', qty: 2, price: 5 }] },
};
async function getCart(cartId) {
const cart = carts[cartId];
if (!cart) throw new Error('cart not found');
return cart;
}
module.exports = { getCart };
src/db/stock.js
const stock = new Map([['A', 10], ['B', 0]]);
const reservations = [];
async function readStock(sku) {
return stock.get(sku) || 0;
}
async function writeReservation(sku, qty) {
stock.set(sku, (stock.get(sku) || 0) - qty);
reservations.push({ sku, qty });
}
module.exports = { readStock, writeReservation };
docs/architecture.md
# Checkout architecture 1. `POST /checkout` is handled by `handleCheckout` in `src/routes/checkout.js`. 2. The handler first charges the customer's card via `chargeCard` in `src/services/billing.js`. 3. After the payment succeeds, it calls `reserveStock` in `src/services/inventory.js` to reserve the items. 4. Inventory checks availability and then writes the reservation through `writeReservation` in `src/db/stock.js`. 5. Totals, including coupon discounts, are computed by `applyDiscounts` in `src/services/pricing.js`.
1 回目: 引き分け (達成率 91.7% / 91.7%)
両者とも正しい呼び出し順と3つの誤りを示し、正しい記述も表に載せた点まで同じで実質差がない
スキルなし91.7%
最終メッセージ
I traced POST /checkout and wrote the results to /work/CHECKOUT_FLOW.md. I only read the code and didn't run it, and I changed no code.
Actual order:
server.jsstartparses the body and dispatches through theroutesmap.postCheckoutinroutes/checkout.jsruns.buildOrderinservices/cart.jsruns next. It callsgetCartindb/carts.js, thenholdStockinservices/inventory.js.- For each item,
holdStockcallscheckAvailable(which callsreadStock), thenwriteReservationindb/stock.js. This is where stock is written. buildOrderthen callsapplyDiscountsinservices/pricing.js.- Back in
postCheckout,chargeCardinservices/billing.jsruns. res.jsonsends the response.
What the docs get wrong:
- Handler name: the docs say
handleCheckout. The function ispostCheckout, and it's registered inserver.js. - Order: the docs say the card is charged first. In the code, stock is held and the total is computed first, and the card is charged last.
- Stock function: the docs say
reserveStock, called after payment and by the handler. The function isholdStock, called bybuildOrderbefore payment. - Reservation step: the docs' description of
writeReservationis right in substance. It leaves outcheckAvailable/readStockand the per-item loop. It also doesn't say thatwriteReservationdecrements stock. - Discounts:
applyDiscountsand its file are correct. The docs imply it runs after payment, but it runs before and feeds the charge. - Omissions: the docs never mention
cart.js,carts.jsor theserver.jsrouting.
A risk in the code: stock is written before the charge. If chargeCard fails, the reservation is never released. A failure partway through holdStock also leaves earlier items reserved. There's also no error handling, so errors like cart not found or insufficient stock likely leave the request hanging.
作った・変えたファイル
スキルあり91.7%
最終メッセージ
I wrote the trace and the doc comparison to /work/CHECKOUT_FLOW.md. I didn't change any code. I also didn't build a graphify graph. There were only 8 source files and one doc, so I read them directly.
What runs on POST /checkout, in order
src/server.jsparses the body and looks uproutes['POST /checkout'].postCheckoutinsrc/routes/checkout.jscallsbuildOrderinsrc/services/cart.js.buildOrdercallsgetCartinsrc/db/carts.js.buildOrdercallsholdStockinsrc/services/inventory.js. For each item it runscheckAvailable, which callsreadStock, and thenwriteReservationinsrc/db/stock.js.writeReservationis where stock is written.buildOrdercallsapplyDiscountsinsrc/services/pricing.js.- Back in
postCheckout,chargeCardinsrc/services/billing.jsruns last, and the handler sends the response.
What in docs/architecture.md is wrong
- Handler name: the doc says
handleCheckout. The real name ispostCheckout, and it's registered inserver.js. - Step order: the doc says charge first, then reserve stock. The code builds the order and holds stock first, then charges.
reserveStock: the doc names this function, but it doesn't exist. The function isholdStock, andbuildOrdercalls it, not the route handler.- Pricing position: the doc doesn't say when
applyDiscountsruns. It runs insidebuildOrder, after stock is held and before the charge. - Missing pieces: the doc leaves out
buildOrder,getCart,checkAvailable,readStockand the per-item loop.
Because the stock write happens before the charge, nothing releases the reservation if chargeCard fails. A multi-item cart also isn't rolled back if a later item is short. This is a behaviour issue in the code, not a doc error, so I only noted it in the file.
作った・変えたファイル
2 回目: 引き分け (達成率 91.7% / 91.7%)
両者とも実際の呼び出し順と3つの誤りを正しく指摘し、正しい記述も不一致欄に載せた点まで同等
スキルなし91.7%
最終メッセージ
I traced POST /checkout and wrote the findings to /work/CHECKOUT_FLOW.md. I didn't change any code.
Actual order: server.js routes the request to postCheckout, which calls buildOrder. buildOrder then runs these steps:
getCartloads the cart.holdStockloops over the items. For each item,checkAvailablecallsreadStock, thenwriteReservationwrites the stock decrement. This is where stock is written.applyDiscountscomputes the total.
After buildOrder returns, postCheckout calls chargeCard and sends the response.
What docs/architecture.md gets wrong:
- Handler name: it says
handleCheckout, but the function ispostCheckout. - Order of charge and stock: the docs say the card is charged first and stock is reserved after payment succeeds. In the code, stock is held first and the card is charged last.
- Stock function: it says
reserveStock, which doesn't exist. The function isholdStock. - Caller: the docs say the route handler calls it, but
buildOrderinservices/cart.jsdoes. - Pricing:
applyDiscountsis listed as a final step, but it runs before the charge. The only coupon it supports isTEN, for 10% off. - Inventory detail: the file and function names in item 4 are right, but it leaves out the per-item loop. It also leaves out that a failure partway through doesn't undo earlier reservations.
The doc also doesn't mention three behaviours, which are in the findings file:
- No rollback: if the charge fails, the stock decrement stays.
- Unhandled errors: a missing cart, insufficient stock or a malformed JSON body leaves the request unanswered, because
postCheckoutand the server callback have no error handling. - Undocumented files:
buildOrderandgetCartaren't in the docs at all.
作った・変えたファイル
スキルあり91.7%
最終メッセージ
I traced the POST /checkout flow and wrote it up in /work/CHECKOUT_FLOW.md. I didn't change any code. I also didn't build a graphify graph. The code is only 8 source files, and the skill says reading them directly is faster at that size.
What actually runs
server.jslooks uproutes['POST /checkout']and callspostCheckout.postCheckoutcallsbuildOrderinservices/cart.js.buildOrderruns three steps:getCartindb/carts.jsloads the cart.holdStockinservices/inventory.jsloops over the items. For each one it callscheckAvailable, which callsreadStock, and thenwriteReservationindb/stock.js.writeReservationis where stock is written.applyDiscountsinservices/pricing.jscomputes the total.
- Back in
postCheckout,chargeCardinservices/billing.jscharges the card. postCheckoutresponds withres.json.
Where docs/architecture.md is wrong
- Handler name: the doc says
handleCheckout, but the function ispostCheckout. - Order of steps: the doc says the card is charged first and stock is reserved after payment succeeds. In the code, stock is reserved and the total is computed first, and the card is charged last.
- Function name: the doc says
reserveStock, but the function isholdStock, and it is called bybuildOrder, not by the route handler. - Check and write: the doc leaves out that this happens per item and goes through
checkAvailableandreadStock. - Pricing caller:
applyDiscountsis called bybuildOrder, after stock is written, not by the route. - Missing files:
cart.js,db/carts.jsand the routing inserver.jsaren't mentioned.
Side effect of the real order
If chargeCard fails, nothing releases the reservation that holdStock already made. That is a code issue rather than a doc mismatch, and I noted it in the file.
CHECKOUT_FLOW.md also has a table giving a correction for each mismatch, and a corrected summary you can paste into the doc.