Tips for longer context and better code
Don't summarize your code—paste it all. Claude can handle 200K tokens (roughly 150K words). Use it.
"I have a React component that fetches data and displays it. It's about 200 lines. How do I add loading states?"
"Here's my React component [paste all 200 lines]. How do I add loading states?"
Start conversations by pasting all relevant files. Then ask your questions. This prevents the back-and-forth of "can you show me that file?"
Claude tends to be thorough. Ask it to explain its reasoning—you'll learn more and catch potential issues.
When Claude generates code, it can create "artifacts"—standalone code blocks you can copy. Ask for artifacts when you want clean, copy-able code.
You can drag and drop files into Claude. This is often easier than copy-pasting, especially for multiple files or non-text files.
Claude tries to be helpful, which sometimes means it over-explains or adds things you didn't ask for. Be specific.
"Can you improve this code?"
"Refactor this to use async/await instead of callbacks. Don't change the logic, just the syntax."
Claude is a chat interface, not an IDE plugin. For in-editor suggestions, use Copilot or Cursor.
Claude's training data has a cutoff. For brand-new APIs, check the official docs or use web search.
Claude can write code but can't run it. Test everything in your actual environment.