saoudrizwan / claude-dev

Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.
https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev
MIT License
4.04k stars 381 forks source link

Add better prompts against lazy coding to avoid placeholder comments #141

Closed markmircea closed 1 week ago

markmircea commented 3 weeks ago

image

like the title says...

720pixel commented 3 weeks ago

Faced the exact same issue.

{/* ... (other form fields remain unchanged) ... */}

Faced this multiple times today. Instead of adding new changes and merging, it tried to replace everything.

I've seen a lot of posts on r/ClaudeAI/ regarding recent Claude behavior. But I don't know if this has anything to do with it.

jmchat commented 3 weeks ago

I also have this issue with the fact that it only changes a part and add the rest stays unchanged but then deleting everthing else 👎

image
saoudrizwan commented 3 weeks ago

I just tweaked the tool prompts a bit in v1.3.41, can you please give that a try and see if you're still dealing with this issue?

720pixel commented 3 weeks ago

2024-08-22_21-20

@saoudrizwan Updated the extension. Still facing this randomly.

gfsysa commented 3 weeks ago

Been adding the following to the custom instructions:

Handling Non-Relevant Code — Never Delete Code to Bypass It: Avoid removing code even if it’s temporarily irrelevant. The existing code may provide valuable context, comments, or serve as a future reference. Focus only on modifying the lines required.

For sessions with a lot of requests, when the context drifts a bit, you can brute force it... don't approve, don't reject, just reprompt with that message 3 times or so, usually does the trick.

brianschroeter commented 2 weeks ago

This unfortunately has gotten so much worse. It doesn't seem to happen on Anthropic's API, but does on Bedrock and OpenRouter now and I never really had this issue before. I tried your suggested prompt @gfsysa just now and it does seem to have corrected itself. Thank you.

Edit: Darn, it worked once but 4 times in a row now it just refuses to produce the file back to me, even though it's ~430 lines (so not huge).

720pixel commented 2 weeks ago

It doesn't seem to happen on Anthropic's API,

Well, it does for me. But I've noticed it only happens on big files. Like in my case, this happens only when it tries to modify homepage.js which is 531 lines.

brianschroeter commented 2 weeks ago

I spoke too soon. It's happening there now too.

IncreaseWebDev commented 2 weeks ago

Yup... this issue was apparent before with anthropic.com with pro account only sometimes. I would ask for the whole file, and it would correct. Now it's not.

UGH.

aaronbferrell commented 2 weeks ago

Same issue

Pgz1975 commented 2 weeks ago

this works for me :

You must NEVER replace any existing code with placeholders of the type " // ... (previous code remains unchanged)" or " // ... (other functions remain unchanged)" or " // ... (rest of the code remains unchanged)" or variants. Instead, you must only modify the specific functions that need to be updated or add new ones.

CiberNin commented 2 weeks ago

Imo giving claude a specific tool for doing single line changes might help.

brianschroeter commented 2 weeks ago

@Pgz1975 I tried this prompt instruction as well, but it doesn't seem to be working on my end. :/ It might work if I push it multiple times - but at two times so far (plus custom instructions), it's still trying to remove the whole file.

brianschroeter commented 2 weeks ago

Thank you so much for continuing to update the extension. I was so excited to see that this is being addressed. Unfortunately, I still see it happening on my end. :(

saoudrizwan commented 1 week ago

v1.5.6 now let's you edit Claude's changes before accepting! When he edits or creates a file, you can modify his changes directly in the right side of the diff view. You can even hover over a 'Revert Block' arrow button in the center to undo // rest of code here shenanigans when he deletes a bunch of code.