Hands-on Python with Claude Code · Challenge 05 · 中文版

Lesson 5: Apply this to your own project

Checkpoint l0510 ptsself-reported — code from verify.pyClaude Code 2.x

Port the workflow — not the code — to one script you own: contract, isolation, rounding, atomic writes, and an honest verification record.

Doing this with your agent? One sentence starts the whole course:

Read https://flypython.com/skills/flypython/SKILL.md and start the FlyPython course `hands-on-python-with-claude-code`.

Lesson 5: Apply this to your own project

Objective

You select one real script you own, write its task contract (from Lesson 2), and apply the smallest useful slice of this course to it — with tests, a verify command, and a written record of what the tests do not prove.

Why this lesson exists

Course projects are forgiving: the data is small, the tests exist, the contract is written for you. Your project is where the habits either transfer or evaporate. The transfer works when you shrink the scope: one script, one contract, one failing test made to pass — not a rewrite.

The lesson

  1. Pick the script. One you run repeatedly and have been mildly afraid of. Not the biggest one — the most annoying one.
  2. Write its contract (Lesson 2 exercise): three behavior statements, one boundary clause, one acceptance command.
  3. Add one failing test for the scariest contract line. Copy the shape from tests/test_report_tool.pytempfile for outputs, inline data, one assertion per behavior.
  4. Have the agent make it pass under Lesson 3’s rules: smallest change, show the diff, no drive-by refactors.
  5. Write the verification record (Lesson 4): verified / not verified / known limits.

Which pattern to port depends on your script’s actual failure mode:

If your script…Port this course pattern
crashes on one bad rowerror isolation with {"index", "reason"} collection
prints 0.30000000000000004two-decimal rounding at aggregation boundaries
leaves half-written output when interruptedatomic write via temp file + os.replace
mixes two input formatsone loader, explicit unsupported-type rejection
has no way to say “done”the verify command: failing starter, passing target

What verification does not prove

Be equally clear about the limits, because overselling tests is how projects get hurt:

  • Passing tests prove the pinned behaviors on the tested inputs — not correctness on tomorrow’s data, not absence of bugs elsewhere.
  • A green suite says nothing about performance on production-sized files, or about the upstream system changing its schema next month.
  • The repo’s tests are not your outcome. Your outcome is a user-visible behavior (a correct report delivered, a crash eliminated), with tests as evidence. For the full framing, read the companion guide “Use Python Well with AI Coding” and the product-quality guide (flypython.com or the repository guides/ directory).

Exercise

Ship the slice. Run your new acceptance command from a clean checkout of your project (or a colleague’s machine) and confirm it reproduces the same result. If it does not, your command depends on your machine — fix the command, not the excuse.

Checkpoint

Your project now has: a written contract, one test that used to fail and now passes, a single command that demonstrates both, and a three-line verification record. That is the whole course, compressed into your codebase.

Expected evidence

The contract, the test transcript, and the verification record. If you found the workflow useful, the course’s landing page lists where to go next — and the course-feedback issue form is where teaching drift gets fixed.

Hints

Stuck? Open one at a time.

Hint 1 — What this checkpoint tests

That you port the workflow — not the code — to one script you own: a task contract, an isolated run, and an honest record.

Hint 2 — Port the smallest useful slice

Atomic JSON write, one aggregate with rounding, and main exit codes are the portable core. Do not port the grouping machinery if your script does not need it.

Hint 3 — The honest record

Write down what your new tests do NOT prove — that unverified list is the point of the course, not a footnote.

Submit

Done? Record it.

The 8-character code verify.py progress printed for this checkpoint — from the browser, or straight from your agent.

Youbrowser

Submit the claim code

Your agentauto-submit

Let the agent solve and submit

Hand it this checkpoint (copy button on hover) — it solves, verifies, and submits on its own:

Work on the FlyPython challenge "Hands-on Python with Claude Code" (course id course-claude-code), checkpoint l05.
Machine-readable brief: https://flypython.com/api/challenges/hands-on-python-with-claude-code
Open the course folder and read TASK.md first — it is the contract.
Rules: smallest change, no new dependencies, never edit tests/ or solution/.
Check with python verify.py until its gates pass, then report each claim code to me.
Target: solve only checkpoint l05, and submit it as soon as it passes.

With a token from your agent page (env FLYPYTHON_TOKEN), it records the result directly:

curl -X POST https://flypython.com/api/claims \
  -H "Authorization: Bearer $FLYPYTHON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"claims":[{"course":"hands-on-python-with-claude-code","checkpoint":"l05","code":"<8-char code>"}]}'

Or install the full FlyPython agent skill once and skip the paste.

Official demo · Pro

Watch how a human runs this challenge

An official walk-through of this exact checkpoint — the task-contract handoff, the moment the agent is stopped, the uncut failure correction, the verify.py gates. Included in Pro; there is no free preview, and the challenge itself stays free.

Files

The starter and verifier

Solving runs on your machine — your agent fetches the course files itself via /api/challenges/hands-on-python-with-claude-code/files; you download nothing by hand. Prefer reading the source? Browse the folder on GitHub ↗