Debugging, Testing, Git & Deployment Prompts (Phases 7–9)
Use these prompts when diagnosing bugs, writing tests, reviewing code for security, preparing clean Git commits/PRs, and deploying safely.
Prompt 1: Root-Cause Bug Investigation (Diagnose Before Fixing)
Context:
I reproduced a bug and gathered the exact logs below:
- Expected behavior: [what should happen]
- Actual behavior: [what happened]
- Steps to reproduce:
1. [step 1]
2. [step 2]
- Browser Console / Network error: [exact message & status code]
- Server Terminal error / stack trace: [exact lines]
Objective:
Inspect the relevant files and find the exact ROOT CAUSE before editing any code.
Boundaries:
- Do NOT edit files yet.
- Do NOT suggest hiding the error with empty try/catch blocks or removing validation.
- Cite exact file paths and line numbers from the files you read.
Expected Output:
1. Plain-English explanation of the root cause.
2. Minimal, targeted fix plan (which lines change and why).
3. Verification steps to confirm the bug is gone AND nearby features did not regress.
Prompt 2: Pre-Commit Code & Security Review
Context:
I finished implementing Task [ID & name] and want a thorough code and security review before committing.
Objective:
Inspect all modified files (or `git diff`) and check for bugs, security risks, and scope creep.
Boundaries:
- Do NOT edit files during review—report findings first.
- Check specifically for:
1. Hardcoded secrets, API keys, or sensitive data in logs/frontend
2. Missing server-side input validation
3. Missing server-side authorization / ownership checks
4. Unsafe database queries (string concatenation instead of parameterized queries)
5. Unrelated changes outside our approved task scope
Expected Output:
1. Prioritized findings (Critical -> Medium -> Minor) with exact file paths and line numbers.
2. Missing automated tests needed to protect against regressions.
Prompt 3: Write Meaningful Automated Tests
Context:
Feature / module to test: [describe feature and link to Acceptance Criteria in docs/prd.md].
Objective:
Inspect the feature code and existing test setup, then propose and write focused automated tests.
Boundaries:
- Do NOT over-mock core behavior until tests pass trivially while real code is broken.
- Test BOTH valid ("happy path") cases AND failure cases (empty input, invalid types, missing records, unauthorized user).
- Run the test suite after writing tests and report the exact unfiltered output.
Expected Output:
1. List of test cases added (Unit / Integration / E2E).
2. Test files created or updated.
3. Exact terminal command to run the tests and observed pass/fail summary.
Prompt 4: Clean Commits & Pull Request Summary
Context:
I am ready to commit and open a Pull Request for Task [ID & name] on branch `[branch-name]`.
Here is `git status` and `git diff` (or inspect the repo directly).
Objective:
Check the diff for stray debug code or secrets, recommend clean commit grouping/messages, and draft a clear PR summary.
Boundaries:
- Never suggest `git push --force` or destructive resets.
- Flag any leftover debug statements, `.env` changes, or unrelated file edits first.
Expected Output:
1. Pre-commit hygiene warnings (if any).
2. Clear commit message(s) describing what changed and why.
3. PR description: Summary of Changes, Related Task/Story, How Tested, Verification Checklist.
Prompt 5: Pre-Deployment Readiness & Live Smoke Test
Context:
I am preparing to deploy this application to production.
- Stack & Database: [state stack & database]
- `.env.example`: [paste variable names—NO real values]
Objective:
Inspect project configs (`package.json` / `requirements.txt`, server entry point, API URLs, database setup) for deployment blockers and generate a Live Smoke Test checklist.
Boundaries:
- Never ask me to paste real production secrets.
- Explicitly check for hardcoded `localhost`, missing `PORT` env support, missing DB migrations, or ephemeral disk storage risks.
Expected Output:
1. Codebase readiness findings (any fixes needed before deploying).
2. Exact Build, Migration, and Start commands + required Production Environment Variables.
3. Post-deploy Incognito Smoke Test checklist to verify the live HTTPS app works end-to-end.
Navigation: ← Previous: Implementation Prompts | Prompts Index