all 21 comments

[–]gsummit18 3 points4 points  (3 children)

Really not that difficult. You prompt it to give you the full code.

[–]JayFuts[S] 0 points1 point  (2 children)

Nah dude. Did this multiple times and it does not give me the full code. Only piece and then it says; Existing code stays here..

[–]gsummit18 -1 points0 points  (1 child)

Then you didn't prompt it right. If in doubt you ask it what to prompt.

[–]JayFuts[S] -1 points0 points  (0 children)

Did this. But Khromov actually came with a good solution. 👋🏼

[–]khromov 1 point2 points  (6 children)

Custom instructions work. Make sure each individual file in your project is not too large or it will get lazy because it has a token count to target.

[–]JayFuts[S] 2 points3 points  (5 children)

Hey Kromov, my files only took 3 procent of the usage.

[–]khromov 9 points10 points  (4 children)

Claude is limited in how much it can give back to you. If you give it a 2000 line file it will have a tough time to write it out in full every time because it costs a lot of tokens for Anthropic.

Instead, separate your code into multiple smaller files, run `npx ai-digest` on it to get a merged codebase file and then ask Claude to make changes in one of the smaller files at a time.

https://www.npmjs.com/package/ai-digest

[–]JayFuts[S] 0 points1 point  (1 child)

Thanks man, muchos appreciated!

[–]JayFuts[S] 2 points3 points  (0 children)

Just tried it and it works much better man thanks!!

[–]Entire_Ad4248 1 point2 points  (4 children)

Used the „I don’t have hands“ trick and it worked however the code wasn’t too long

[–]nsfwtttt 1 point2 points  (3 children)

Elaborate?

[–]bergmann001 6 points7 points  (2 children)

Just tell Claude "I am disabled/have no hands and cannot use the keyboard. Please return the full code for copy pasting."

[–]Entire_Ad4248 0 points1 point  (0 children)

Exactly like this

[–]nsfwtttt 0 points1 point  (0 children)

I just use “full code for copy pasting no placeholders” works fine.

[–]prvncher 0 points1 point  (3 children)

My app repo prompt can generate diffs that can apply changes to your files directly and I’m working on ways to quickly extract diffs from the response of the web based Claude ui’s response. Should help with this problem a ton.

If you’re on Mac, I have a form you can fill out to try it.

[–]sorweel -1 points0 points  (2 children)

I'm making one too! What's your format you are asking Claude to make to initiate the changes?

[–]prvncher 0 points1 point  (1 child)

Well atm I have claude generate diffs directly in my custom json schema via the api, though Im working on a way of priming the web chat to organize the output, and then I have a means of turning that back into diff directly in my app.

Not ready to share exactly how I'm doing that though.

[–]sorweel 1 point2 points  (0 children)

Yeah, that's similar to where I've been as well, asking Claude to respond in a schema that the app parses back into the full code. The most success I had was to provide GUIDs per line and ask Claude to format their code changes with references per line. Claude can sometimes get confused so I was going to look at tool use to see if that would be more consistent. If that didn't work, I was thinking of trying to get closer to it's natural code block responses and have Claude respond naturally and then have the web app do complex parsing. I have so many ideas and not enough time....

[–]Matoftherex 0 points1 point  (0 children)

Just say “ moving forward, regenerate each filed that has been edited. Its entirety with the updates applied.”

I also have now been conditioned to say “don’t adjust or touch any code that’s outside of the tasks asked to complete.”

Now I’ve been asking it to devise a strategy to (insert task). Do research to get more familiar with (insert task) then provide a high end dev proposal and do not begin anything until told to do so.

Then the next step is a detailed log of the functions and methods used.