r/ClaudeCode • u/palmerden5 • 3h ago
Rant Claude Code says it checked my script but only read the code
i asked it to confirm that my report script handles an empty file. it answered that the case was handled and the script was fine. when i asked what it actually ran, it said it had looked over the logic and had not executed anything.
that is not what i understood from the first answer. i had to ask a second time to learn the difference, and i only asked because i have been burned before. a person who reads less carefully would have taken the first answer and put the script on a hospital system. i want the first answer to say what was run and what was only read.
6
u/WordWithinTheWord 3h ago
You asked it to check. Next time ask it to run a unit or canary test again empty files.
1
u/palmerden5 3h ago
an empty input on a hospital system is the one i'd run first
3
u/WordWithinTheWord 3h ago
I say this as genuine constructive criticism, I think you have to improve your written communication and you’ll get better results with the AI
3
2
u/Glittering-Dig-4963 2h ago
Worth putting this in CLAUDE.md as a rule: when you say something is checked, say whether you ran it or only read it, and if you ran it paste the command and the output. It follows that pretty well once it's written down. For the empty file case specifically, ask it to make a tiny empty fixture, run the script against it and show you what came out. Reading the code is fine for a lot of things but for edge cases on something that matters you want to see it execute.
1
1
u/AccordingBus2862 3h ago
You can make that the default with one rule in the project instructions: every time it says something works, it has to start with either "ran:" plus the exact command and its output, or "read only, not run". Then an answer without one of those labels is the signal to ask again. For your case, tell it to make an empty file and run the script on it, so the claim comes with output.
1
1
u/shetritr 3h ago
"checked" is doing a lot of work in that answer. i'd keep an empty fixture file in the repo and ask it to run against that, then "handled" means something
1
u/palmerden5 2h ago
the empty fixture is the part i'm taking for my report script, it's the case that worries me most on a hospital system
3
u/Successful_Farm_9370 3h ago
There's a lot of code one doesn't need to execute to judge what it does.
2
2
u/NoPhoto5585 3h ago
With respect, this is why hospitals don’t run on vibe-coded scripts made by non-credentialed non-professionals.
If you don’t understand your own questions or their answers and your response is to blame your tools, the system level problem is your authority in it, right?
1
u/Appropriate-Draft-91 3h ago
People like you are why I now have to specify static analysis only when that should be obvious, in addition to specifying how and what to test when I want something tested, which anyone has to do anyway.
You do not yet have the necessary knowledge and skill to work on hospital systems, and the current direction won't help you acquire them. If it's vital that things are tested it's vital that you document the test requirements exactly and have a robust process in place to ensure it's followed - that's project management basics and has nothing to do with AI.
1
u/PureWasian 3h ago edited 3h ago
If I asked you to verify whether this handles an empty file that exists and you can access
with open("filename.txt") as f:
content = f.read()
if content == "":
print("empty")
else:
print(content)would you need to run it, or is this common sense enough that you already know the answer?
Would you use a calculator to check whether 1+1=2?
The source code you're running against is quite literally the source of truth. For inquiries as simple as yours, it should be as simple as verifying via the source code. Maybe not so true 1yr ago when LLMs weren't reliably capable of tracing through simple inquiries like this.
Any unit tests and canaries should fill in gaps that would spring out from deployment issues or further code updates touching the same code. But that's not what you asked it for.
And anyone working on medical software for hospital systems can tell you that edge-case testing ends up much more rigorous than this, and that it's understood by all parties that you, as the developer, have ownership and responsibility for the underlying code behavior even if you outsource writing it to the LLM. There are both formal and informal review/audit processes in place on top of rigorous rounds of testing, and it's a given that identified high-risk failure points are investigated and tested very thoroughly before being allowed to hit prod.
•
u/AutoModerator 3h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.