my-coder v0.2: feed a style anchor so generated code meets house standards - #4
Merged
Merged
Conversation
…dards The PR#10 review had to hand-fix generated tests (missing `-> None` and `from __future__ import annotations`) — root cause: my-raytracer has no CLAUDE.md, so the session had no convention to follow and guessed. Fix it at the source: show the session the repo's existing code. - _style_anchor(): include the repo file tree + the largest existing src/tests .py files (capped) in the session prompt, so generation matches conventions (type hints, imports, test shape) the first time instead of in review. - Strengthen the prompt's standards rule: match the shown code's layout, import style, type hints on EVERY signature (tests included), naming, and test style. 25 tests, 96% coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second iteration of the self-improvement loop — raising the standards bar, as requested.
The gap this closes
The my-raytracer#10 review had to hand-fix the generated tests: they lacked
-> Noneandfrom __future__ import annotations, diverging from the repo's owntest_smoke.py. Root cause: my-raytracer has noCLAUDE.md, so the session had no stated conventions and guessed. Polishing in review doesn't scale — the tool should meet the standard the first time.Change
_style_anchor()— inject the target repo's existing code into the session prompt: the file tree + the largestsrc//tests/.pyfiles (capped at 3 files × 6 KB). A repo's house style lives in its code even without aCLAUDE.md.Why this is the right depth
It generalizes: every target repo benefits,
CLAUDE.mdor not. And it doubles as correctness grounding — for my-raytracer#3 (camera), the session now sees the mergedvec.py/ray.py, so it usesVec3/Raycorrectly, not just stylistically.Tests
25 tests, 96% coverage. New test asserts the session prompt carries the existing code as a style anchor.
.format()substitution is safe against braces in injected code (values aren't re-parsed).Readiness
🤖 Generated with Claude Code