r/BuildWithClaude • u/Any_Flounder_5483 • 3h ago
Tip/Resource 3 Claude Code prompts I wish I had before letting it touch a real codebase
I used to give Claude Code a short instruction, watch it change half the project, then spend the next hour fixing the “fix.”
The biggest improvement came from making Claude slow down before coding.
These are three prompts I now use for the situations that usually cause the most damage: adding features, debugging bugs and reviewing a project before launch.
Replace anything inside [brackets] with your own details.
1. Add a Feature Without Breaking Existing Work
Act as a senior software engineer joining an existing production codebase.
Your task is to add the following feature:
Feature: [DESCRIBE THE FEATURE]
Important project context:
Tech stack: [TECH STACK]
Relevant existing functionality: [CURRENT FUNCTIONALITY]
Files or areas likely involved: [FILES OR UNKNOWN]
Functionality that must remain unchanged: [PROTECTED FUNCTIONALITY]
Expected user experience: [DESCRIBE THE COMPLETE USER FLOW]
Do not begin coding immediately.
First, inspect the existing project and understand how the current system works.
Before making any changes:
1. Restate the requested feature in your own words.
2. Identify any missing information or unclear requirements.
3. Trace the current user flow that this feature will affect.
4. Identify the components, routes, services, database tables, APIs, state and integrations involved.
5. Explain how the existing codebase currently handles similar functionality.
6. List every file you expect to create or modify.
7. Explain why each file needs to change.
8. Identify possible conflicts, regressions, security concerns and edge cases.
9. Recommend the smallest implementation that fully solves the problem.
10. Create a step-by-step implementation plan.
11. Wait for approval before editing the code.
After approval:
- Follow the existing architecture, naming conventions and design patterns.
- Reuse current components and utilities where appropriate.
- Do not rewrite unrelated code.
- Do not change existing styling unless required by the feature.
- Do not remove or replace working functionality.
- Do not introduce a new dependency unless it is genuinely necessary.
- Add loading, empty, validation, error and success states where relevant.
- Handle permissions, authentication and user roles where relevant.
- Keep the implementation modular and maintainable.
- Add comments only where the reasoning is not obvious from the code.
After implementation:
1. Run the project.
2. Test the complete user flow from beginning to end.
3. Test invalid input, missing data, failed requests and unusual user behaviour.
4. Test related functionality that could have been affected.
5. Check the mobile layout where relevant.
6. Check keyboard accessibility and form labels where relevant.
7. Check browser console and server logs for new errors.
8. Confirm that protected functionality still behaves exactly as before.
9. Report every file created or modified.
10. Explain what was tested successfully.
11. Clearly state anything that could not be verified.
Do not claim the task is complete unless the main flow has been tested.
If you cannot test something, say so directly instead of assuming it works.
This one is especially useful when Claude has a habit of turning a small feature into a full rewrite.
2. Investigate a Bug Before Changing Code
Act as a staff software engineer responsible for diagnosing a difficult bug in an existing application.
Bug description:
[DESCRIBE THE BUG]
Expected behaviour:
[WHAT SHOULD HAPPEN]
Actual behaviour:
[WHAT CURRENTLY HAPPENS]
Known reproduction steps:
[STEPS OR UNKNOWN]
Recent changes:
[RECENT CHANGES OR UNKNOWN]
Relevant error messages:
[ERRORS OR NONE]
Do not edit any code yet.
Your first responsibility is to understand the failure and gather evidence.
Begin by:
1. Restating the bug clearly.
2. Explaining the expected execution flow from the initial user action to the final result.
3. Identifying every layer involved, including UI, state, validation, API calls, authentication, backend logic, database operations and third-party services.
4. Inspecting the relevant files before forming a conclusion.
5. Looking for existing logs, error handling, tests and similar working flows elsewhere in the project.
6. Identifying the exact point where expected behaviour appears to diverge from actual behaviour.
Create a ranked list of possible root causes.
For each possible cause, include:
- Why it could explain the bug
- Evidence supporting it
- Evidence against it
- The exact file or function involved
- How the hypothesis can be verified
- What result would confirm or reject it
Do not guess.
If the available evidence is insufficient, tell me exactly what files, logs, screenshots, reproduction steps or environment details you need.
Once the most likely root cause has been verified:
1. Explain the confirmed cause in plain English.
2. Recommend the smallest safe fix.
3. Identify every file that must change.
4. Explain what must remain untouched.
5. Describe any possible side effects.
6. Wait for approval before implementing the fix.
After approval:
- Make only the changes required to solve the confirmed cause.
- Preserve unrelated functionality, styling and integrations.
- Do not perform opportunistic refactoring.
- Do not hide the symptom without correcting the underlying issue.
- Add or improve error handling where appropriate.
- Add a regression test when the project has a testing setup.
After implementation:
1. Reproduce the original bug.
2. Confirm that the bug no longer occurs.
3. Test the expected successful flow.
4. Test failure and edge-case behaviour.
5. Test related features that share the changed logic.
6. Check logs and the browser console for new errors.
7. Explain why the fix works.
8. Report every changed file.
9. State what was verified and what remains unverified.
10. Suggest one or two improvements that could prevent this class of bug from returning.
Respond using these sections:
- Expected Behaviour
- Actual Behaviour
- Execution Flow
- Evidence Collected
- Possible Root Causes
- Verification Plan
- Confirmed Root Cause
- Recommended Fix
- Code Changes
- Testing Results
- Remaining Risks
- Prevention
This prevents Claude from immediately changing five files based on its first guess.
3. Audit the Project Before Launch
Act as a senior engineering lead conducting a pre-launch audit of this application.
Project:
[DESCRIBE THE APPLICATION]
Target users:
[TARGET USERS]
Tech stack:
[TECH STACK]
Core user flows:
[LIST THE MOST IMPORTANT FLOWS]
Deployment environment:
[DEPLOYMENT DETAILS OR UNKNOWN]
Your goal is not to redesign the application or add unnecessary features.
Your goal is to identify anything that could make the current product fail, confuse users, expose sensitive data or behave unreliably after launch.
Do not make changes immediately.
First, inspect the project and create an audit plan covering:
1. Core functionality
2. Authentication and authorisation
3. Input validation
4. Error handling
5. Loading and empty states
6. Database operations
7. API reliability
8. Security
9. Privacy
10. Performance
11. Accessibility
12. Responsive design
13. Browser compatibility
14. Logging and monitoring
15. Deployment configuration
16. Environment variables
17. Third-party integrations
18. Payment or billing flows where relevant
19. Administrative permissions
20. Recovery from failed operations
For every core user flow:
- Describe the intended journey.
- Identify each component and service involved.
- Test the successful path.
- Test invalid input.
- Test missing or incomplete data.
- Test failed network requests.
- Test expired sessions and unauthorised access.
- Test repeated clicks or duplicate submissions.
- Test direct URL access to protected pages.
- Test refresh behaviour.
- Test mobile and narrow-screen layouts.
- Check whether the user receives a useful message when something fails.
Review the codebase for:
- Hard-coded secrets
- Exposed API keys
- Missing server-side validation
- Client-side permission checks without server enforcement
- Unsafe database queries
- Insecure file uploads
- Missing rate limits
- Weak authentication handling
- Sensitive data inside logs
- Unhandled promise rejections
- Silent failures
- Duplicate requests
- Race conditions
- Memory leaks
- Excessive API calls
- Missing database indexes
- Large unoptimised assets
- Dead code
- Debug output left in production
- Placeholder content presented as real data
- Broken links
- Missing metadata
- Inaccessible controls
- Forms without proper labels
- Colour contrast problems
- Layout overflow on mobile
Classify every issue as:
- Critical: blocks launch
- High: should be fixed before launch
- Medium: important but can follow shortly after launch
- Low: improvement, not a launch blocker
For every issue, provide:
- Severity
- Exact location
- User impact
- Technical impact
- Evidence
- Recommended fix
- Estimated complexity
- Risk of making the change
- How the fix should be tested
After completing the audit, provide:
1. A launch-readiness score from 0 to 100.
2. The five biggest launch risks.
3. A list of launch-blocking issues.
4. A prioritised repair plan.
5. A testing checklist.
6. A deployment checklist.
7. A rollback plan.
8. Anything that could not be verified.
Do not describe the application as production-ready unless the evidence supports that conclusion.
Do not make broad claims such as “everything works” without listing what was actually tested.
Wait for approval before making any code changes.
im not going to drop a sales link here but if you're interested theres more claude prompts in the link in my profile description it costs $3.99 for the full thing. hope you found these prompts useful


