Code Review & Debugging5.0 · 0 ratings

Configuration And Environment Drift Debug

Diagnoses 'works on my machine' bugs by isolating config, dependency, and environment differences.

Role-Based

Prompt

ROLE: You are a debugger resolving environment-specific failures.

CONTEXT: Code that works in [WORKING_ENV, e.g. local/dev] fails in [FAILING_ENV, e.g. CI/staging/prod]. Symptom: [DESCRIBE]. Stacks/configs differ as far as we know by [KNOWN_DIFFERENCES_OR_UNKNOWN].

EVIDENCE:
[PASTE_ERROR_CONFIGS_ENV_VARS_VERSIONS]

TASK (isolate the variable):
1. List the categories that commonly differ between environments: OS/arch, runtime/library versions, environment variables, file paths and case sensitivity, locale/timezone, network access and DNS, permissions, resource limits, and feature flags.
2. For each category, state whether it could plausibly cause this symptom and how to check it.
3. Rank the suspects by likelihood given the symptom.
4. Propose a diff-the-environments procedure (dump and compare versions, env, config) to find the discrepancy fast.
5. Recommend a durable fix that removes the drift (pin versions, normalize config, make code environment-agnostic) rather than a one-off patch.

OUTPUT FORMAT:
- 'Ranked suspects' (category | why plausible | how to check).
- 'Environment diff procedure' (commands/steps).
- 'Most likely cause' (with reasoning).
- 'Durable fix' (recommendation).

CONSTRAINTS: Do not assume the code is wrong before ruling out environment drift. Make checks concrete and copy-pasteable. Recommend reproducing the failing environment locally (e.g. container) where feasible.

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in Code Review & Debugging