Version: 1.0.0 Status: ACTIVE
Diagnose why a prompt, system instruction, agent workflow, or reusable AI process produced poor output.
The goal is not:
FAILED OUTPUT
↓
ADD MORE WORDS TO PROMPT
The goal is:
FAILED OUTPUT
↓
IDENTIFY FAILURE CLASS
↓
FIND ROOT CAUSE
↓
MAKE SMALLEST REPAIR
↓
RETEST
Prompt debugging should behave more like software debugging than creative rewriting.
Use this skill when:
Do not use this skill when:
First determine whether the prompt is actually the problem.
Preserve evidence.
When a prompt fails, retain:
ORIGINAL PROMPT
INPUT
OUTPUT
EXPECTED OUTPUT
ENVIRONMENT / MODEL
TOOLS AVAILABLE
RELEVANT SYSTEM INSTRUCTIONS
Do not immediately overwrite the failed version.
Without the original evidence, debugging turns into guessing.
Use:
REPRODUCE
↓
CLASSIFY
↓
ISOLATE
↓
HYPOTHESIZE
↓
PATCH
↓
RETEST SAME CASE
↓
REGRESSION TEST
↓
PROMOTE OR REVERT
Before changing the prompt, determine whether the failure is repeatable.
Ask:
Does the same input produce the same problem?
Does a similar input produce the same problem?
Is the problem model-specific?
Is the problem caused by missing context?
If the failure cannot be reproduced, classify confidence appropriately.
Do not create permanent rules from weak evidence.
You cannot debug a prompt without knowing what success should look like.
Define:
EXPECTED BEHAVIOR
ACTUAL BEHAVIOR
DIFFERENCE
Example:
Expected:
Ask only one diagnostic question.
Actual:
Asked eight questions at once.
Difference:
Interaction mode and question-count constraint were not enforced.
Check these failure classes before modifying the prompt.
1. MISSING CONTEXT
2. AMBIGUOUS OBJECTIVE
3. WEAK CONSTRAINTS
4. CONFLICTING INSTRUCTIONS
5. INSTRUCTION OVERLOAD
6. WRONG INTERACTION MODE
7. POOR OUTPUT CONTRACT
8. INCORRECT TOOL ASSUMPTIONS
9. STALE PROJECT INFORMATION
10. WRONG SCOPE
11. WEAK VERIFICATION
12. BAD EXAMPLE / FEW-SHOT BIAS
13. PERSONA FAILURE
14. EXCESSIVE AUTONOMY
15. EXCESSIVE CLARIFICATION
16. PROMPT DOES TOO MANY JOBS
Symptoms:
generic output
invented assumptions
wrong architecture
wrong technology
questions that repository evidence could answer
Example:
Prompt:
Create a controller for this project.
but no project context is supplied or discovered.
The model invents a framework pattern.
Root cause:
MISSING CONTEXT
Possible repair:
Before implementing, inspect existing controllers,
routing, project instructions, and related services.
Follow the established project pattern.
Do not solve missing context by adding generic architecture advice.
Symptoms:
technically valid output
wrong level of detail
wrong deliverable
agent solves a different problem
Example:
Improve this script.
“Improve” could mean:
faster
safer
shorter
more readable
more compatible
Repair the objective.
Example:
Improve reliability and error reporting without changing
the script's public behavior or adding dependencies.
Symptoms:
unwanted framework
unnecessary dependencies
unrelated refactor
changed public behavior
overengineering
Example failure:
User wanted one ASP Classic endpoint.
Agent introduces a new application framework.
Repair:
Follow the existing ASP Classic architecture.
Do not introduce a new framework.
Do not modify unrelated endpoints.
Use constraints that protect real boundaries.
Symptoms:
inconsistent output
agent follows one rule while violating another
behavior changes unpredictably
Example:
Instruction A:
Always ask before making assumptions.
Instruction B:
Do not ask unnecessary questions.
These may conflict.
Repair by defining hierarchy:
Discover first.
If a critical variable cannot be discovered and
a wrong assumption materially affects correctness, ask.
Otherwise state a safe assumption and proceed.
Resolve the conflict rather than adding a third vague rule.
Symptoms:
important rules ignored
output becomes generic
model follows later minor rules instead of important earlier rules
behavior becomes inconsistent
Possible cause:
too many permanent instructions
Before adding more instructions, consider:
REMOVE
MERGE
MOVE TO SKILL
MOVE TO PROJECT DOCS
Prompt debugging may require deleting instructions.
Symptoms:
agent asks questions when complete output was requested
agent gives full answer when teaching was requested
agent waits unnecessarily
agent produces partial output for an autonomous task
Classify the required mode:
AUTONOMOUS
INTERACTIVE
SOCRATIC
REVIEW-ONLY
ADVERSARIAL
Then specify it explicitly when needed.
Symptoms:
unstructured response
missing fields
hard-to-use output
inconsistent format
extra commentary
Weak:
Review this.
Better:
Return:
1. blockers
2. important findings
3. optional improvements
For each finding:
- location
- issue
- consequence
- recommended fix
Output contracts should make downstream use easier.
Symptoms:
agent claims something cannot be checked
agent invents results
agent searches the web when project files contain the answer
agent fails to run available tests
Repair tool behavior.
Example:
Search the repository before stating that a function does not exist.
Run the existing test command after modifying code.
Do not list every possible tool.
Define what evidence must be gathered.
Symptoms:
wrong framework version
wrong deployment target
obsolete directory structure
old command
retired API
The prompt may be correct but project context is stale.
Repair the source of truth.
Possible destination:
PROJECT DOCUMENTATION
not necessarily the prompt.
Symptoms:
A rule intended for one domain affects every task.
Example:
A prompt rule says:
Always create a rollback plan.
This may be useful for:
database migrations
deployments
infrastructure
but excessive for:
spelling correction
Move narrow procedures into skills.
Symptoms:
good-looking output
unverified commands
wrong code
silent data problems
Repair:
After implementation, run the strongest available verification.
If verification cannot be performed,
state exactly what remains unverified.
Verification requirements often improve prompt reliability more than additional stylistic rules.
Examples strongly influence behavior.
A few-shot example may accidentally teach:
wrong structure
wrong assumptions
wrong verbosity
project-specific details
If prompt output keeps resembling an example too literally, inspect the examples.
Ask:
Is the model learning the intended rule
or copying accidental details?
Remove or diversify biased examples.
Symptoms:
reviewer too agreeable
reviewer too hostile
fake objections
wrong priorities
Weak persona:
Be a tough reviewer.
Better:
You are the infrastructure engineer responsible
for recovering this deployment during an outage.
Primary fear:
irreversible deployment failure.
Non-negotiable metric:
recoverability.
Persona should encode incentives.
Symptoms:
agent makes major architectural decisions without surfacing them
agent performs destructive changes
agent modifies unrelated systems
agent expands scope
Repair authority boundaries.
Example:
Routine implementation decisions may proceed autonomously.
Surface decisions that alter architecture,
security boundaries, destructive behavior,
or public compatibility.
Symptoms:
agent repeatedly asks questions
user has already supplied information
questions could be answered from repository evidence
task becomes stalled
Repair using Diagnostic Intake rules.
Example:
Search project evidence before asking.
Ask only when a critical variable cannot be discovered
and a wrong assumption materially affects correctness.
Symptoms:
very long prompt
many unrelated responsibilities
poor adherence
complex branching
hard to test
Example:
One prompt attempts to:
design architecture
write code
review security
teach the user
write documentation
create release notes
audit itself
Consider splitting into:
SKILLS
WORKFLOW PHASES
TASK PROMPTS
Composition is often more reliable than one giant prompt.
For meaningful prompt debugging, use:
SYMPTOM | FAILURE CLASS | EVIDENCE | REPAIR
Example:
Agent asks 12 questions
Excessive clarification
Repository already contained most answers
Add discovery-first intake rule
Agent overengineers simple fixes
Wrong scope
Architecture rules trigger on all tasks
Introduce Fast/Standard/High-Risk paths
Agent ignores critical instructions
Instruction overload
Root prompt exceeds useful scope
Move procedures to skills
After identifying the root cause:
DO NOT REWRITE EVERYTHING
Change only what is necessary.
Example:
Bad approach:
replace 500-line system prompt
Preferred:
add one missing output rule
or:
remove one conflicting instruction
or:
move one procedure into a skill
Small changes are easier to test.
Always retest the exact failure case first.
Use:
SAME PROMPT CONTEXT
SAME INPUT
CHANGED INSTRUCTION
Compare:
BEFORE
AFTER
If the original problem remains, the hypothesis was probably wrong or incomplete.
After the failed case improves, test unrelated behavior.
Example:
Prompt change:
Ask fewer questions.
Regression test:
Give it a genuinely ambiguous high-risk migration.
Ensure it still asks when clarification really is required.
Every prompt rule has tradeoffs.
When practical, compare:
VERSION A — CURRENT
VERSION B — REVISED
using several representative inputs.
Evaluate:
correctness
instruction adherence
usefulness
verbosity
number of manual corrections
verification quality
Avoid choosing the revised version merely because it is newer.
Important production prompts may maintain a small test suite.
Example:
tests/
├── normal.md
├── ambiguous.md
├── edge-case.md
├── incomplete-context.md
└── regression.md
Expected behavior can be documented in each case.
This makes prompt changes more like code changes.
A prompt test may assert behavior such as:
GIVEN:
A one-line typo request
EXPECT:
Fast Path
DO NOT EXPECT:
architecture plan
red-team review
five clarification questions
Another:
GIVEN:
Production database migration with missing backup requirements
EXPECT:
High-Risk Path
rollback discussion
critical clarification if not discoverable
Behavioral tests are often enough.
When debugging a large prompt, ask:
Can this rule be removed?
Can two rules be merged?
Does this belong in a skill?
Does this belong in project documentation?
Does this apply often enough to remain global?
Deleting low-value instructions can improve adherence to important ones.
When root instructions change, inspect other instruction layers:
AGENTS.md
CLAUDE.md
AI-OS.md
WORKFLOW.md
loaded skills
project docs
Look for contradictory behavior.
Example:
AGENTS.md:
Compress workflow for trivial tasks.
Skill:
Always perform full architecture audit.
That conflict should be corrected.
For recurring or important failures, record:
WHAT HAPPENED
EXPECTED BEHAVIOR
ROOT CAUSE
WHY EXISTING RULES FAILED
CHANGE MADE
TEST PERFORMED
RESULT
If reusable, capture the learning in:
.ai/state/LEARNINGS.md
Problem:
Generated status reports contain:
lengthy introduction
corporate buzzwords
repeated conclusion
Bad repair:
Add 50 banned words.
Better diagnosis:
Failure class:
weak output/tone constraint.
Repair:
Start with the substantive update.
Use direct language.
Prefer concrete facts.
Remove redundant closing summaries.
Then optionally use:
.ai/skills/coffee-chat-editor/SKILL.md
Problem:
Agent repeatedly creates new abstractions for minor features.
Diagnosis:
WRONG SCOPE
+
MISSING PROJECT CONTEXT
Repair:
Search for analogous existing implementations first.
Prefer existing architecture.
Do not introduce abstractions unless the task demonstrates repeated need.
Test on:
small feature
large new subsystem
Ensure the second can still justify abstraction.
Problem:
User requests a script.
Agent asks:
OS version?
PowerShell version?
domain?
permissions?
directory?
environment?
even though most details are discoverable or irrelevant.
Diagnosis:
EXCESSIVE CLARIFICATION
Repair:
Ask only for critical variables that cannot be discovered.
Use safe assumptions for low-risk reversible details.
Problem:
Agent says:
The build should pass.
without running it.
Diagnosis:
WEAK VERIFICATION
Repair:
When a build command is available, execute it after relevant changes.
Do not claim successful verification based on code inspection alone.
Problem:
Root prompt contains:
coding rules
deployment instructions
writing style
database migration steps
teaching behavior
security checklist
API design
release procedures
Agents inconsistently follow important rules.
Diagnosis:
INSTRUCTION OVERLOAD
Repair:
Keep model-neutral core behavior in AGENTS.md.
Move detailed procedures into skills.
Load skills when their triggers match.
This is structural prompt debugging.
Problem:
Red-team output contains dozens of speculative objections.
Diagnosis:
PERSONA FAILURE
+
POOR OUTPUT CONTRACT
Repair:
Require:
1–3 highest-impact findings
severity
evidence
real consequence
mitigation
distinguish speculative concerns
Problem:
Agent explains a concept, asks a question, and immediately gives the answer.
Diagnosis:
WRONG INTERACTION MODE
Repair:
After asking the drill, stop.
Do not provide the answer until the learner responds
or explicitly asks for it.
After fixing a prompt, ask:
Was this failure one-off?
Does it affect one prompt?
Does it affect a skill?
Does it affect all agents?
Does it apply only to one model?
Then place the repair in the narrowest correct location.
Promote a prompt fix when:
failure is reproducible
root cause is reasonably understood
new behavior performs better
regression tests pass
Do not promote merely because one response looked better.
Revert the prompt change when:
original failure remains
unrelated behavior becomes worse
instruction conflict increases
prompt becomes materially harder to follow
manual correction increases
Record meaningful failed experiments in the changelog.
A prompt-debugging result should normally contain:
OBSERVED FAILURE
EXPECTED BEHAVIOR
FAILURE CLASS
ROOT CAUSE
SMALLEST REPAIR
RETEST
REGRESSION TEST
PROMOTION DECISION
For trivial issues, compress this.
Improve this skill when:
Avoid turning every individual prompt failure into a new general failure class.
Initial active version.
Introduced:
Powered by TurnKey Linux.