You can do this if you hold its hand a lot. Claude by default will do insane levels of abstraction for small things. Also make Python docstrings 3x longer than the actual code.
Anthropic bills by the token. Incentives might be different for open weight models.