Raj's approach, plus: split the 400-line component. That's also why the AI struggles; smaller files mean smaller, complete answers.
And use git (even locally): after pasting, git diff shows immediately if 80 lines disappeared. That's the part that bites you a day later.