Tip: CodeGPT shows a full preview of the changes before applying them — using a Git-style diff view, with removed lines in red and new lines in green. You'll also see the lines directly highlighted in your editor, so you know exactly where changes are happening.
1. Start with a clear prompt before asking for changes
Don’t start by asking CodeGPT to "just implement something." First, give it a clear objective using natural language.
Instead of:
Add JWT auth to this endpoint.
Try:
I want to protect the /admin routes using JWT,
just like we do for /users.
Can you walk me through what files and middleware should be updated?
Once you understand the plan, follow up with:
Now go ahead and implement it using the same patterns.
2. Scale up tasks that work well
If you see that CodeGPT handles simple tasks reliably, increase the scope of your prompt.
Example of small prompts:
Add logging. Now add validation. Now add error handling.
Combine into one:
Update this function to include:
- Input validation
- Error handling
- LoggingFollow the same style as logRequest() and validateUser().
This gives you cleaner, more cohesive code in fewer steps.
3. If It’s Struggling, Break the Task Down
If a complex change isn’t working as expected, split the work into smaller pieces.
First prompt:
Add logging to this function using logRequest().
Then:
Now add validation like in validateUser().
This helps keep control over the outcome and reduces surprises.
4. Reference Your Codebase to Give It Context
The more specific your prompt, the better the results. You can tell CodeGPT to use similar code patterns from your own codebase.
Example:
Use the same caching strategy as cacheUserData.ts.
Or:
Before implementing, look for validation logic in the middleware/ folder.
This grounds CodeGPT in your actual code, not just generic boilerplate.
5. Mention Common Patterns You Want to Follow
Don’t assume CodeGPT will guess the right implementation style. Be explicit about things like:
Error handling
Caching
Authentication
Input validation
Example:
Add input validation and error handling.
Use validatePayload() and handleApiError() as references.
This helps CodeGPT align with your conventions.
6. Ask for a Summary Once the Change Is Ready
After the implementation, you can ask CodeGPT to summarize the changes it made — perfect for writing pull request descriptions or quick sanity checks.
Example:
Summarize what you changed in this file.
7. Always Review the Diff Before Applying
Before CodeGPT applies any changes, it shows a full diff view:
You’ll also see in-editor highlights showing where the changes are happening. This makes it easy to:
Spot unexpected changes
Request a revision
Manually tweak the output before committing
🔒 Always review before hitting "Accept". This is your last chance to confirm the update looks right.
Final Thoughts
Prompting is a skill. The better you describe what you want, and how it should align with your existing code, the better CodeGPT will perform.
🧪 Prompt Templates You Can Use
To investigate first:
What functions are involved in sending payments?
I want to add error handling.
To perform multiple tasks:
Add email verification, logging, and error handling to the registration flow.
Follow patterns in auth.ts and emailService.ts.
To get a summary:
Summarize the changes across these three files.
Got feedback or tricks of your own?
Message us directly in Intercom. We’re learning from every user and constantly improving CodeGPT.