Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> When the agents needs to run commands like 'npm test' in a sub-directory, they almost never get it right the first time)

I was running into this constantly on one project with a repo split between a Vite/React front end and .NET backend (with well documented structure). It would sometimes go into panic mode after some npm command didn’t work repeatedly and do all sorts of pointless troubleshooting over and over, sometimes veering into destructive attempts to rebuild whatever it thought was missing/broken.

I kept trying to rewrite the section in CLAUDE.md to effectively instruct it to always first check the current directory to verify it was in the correct $CLIENT or $SERVER directory. But it would still sometimes forget randomly which was aggravating.

I ended up creating some aliases like “run-dev server restart” “run-dev client npm install” for common operations on both server/client that worked in any directory. Then added the base dotnet/npm/etc commands to the deny list which forced its thinking to go “Hmm it looks like I’m not allowed to run npm, so I’ll review the project instructions. I see, I can use the ‘run-dev’ helper to do $NPM_COMMAND…”

It’s been working pretty reliably now but definitely wasted a lot of time with a lot of aggravation getting to that solution.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: