ソフトウェアエンジニアリングで最も高価なキーストップは、複雑なアルゴリズムや建築設計ではありません。 で、 そして、 午前2時に書かれた発言。 console.log("here") print("check 1") System.out.println("please work") 私たちはこれを「Shotgun Debugging」と呼びます。あなたは、そのうちの1つが標的に当たることを望んで、コードベースにランダムなログ化記述とコード修正のスプレーを発射します。 つまんないし、つまんないし、正直、プロじゃない。 他のエンジニアリング分野(民間、電気、機械)では、失敗分析は厳格で科学的なプロセスです。ソフトウェアでは、私たちはあまりにも頻繁に直感と筋肉の記憶に依存しています。 問題はバグが硬いことではなく、問題は私たちの . methodology is weak 私たちはAI(ChatGPT、Claude、Copilot)をコードジェネレータとして扱い、「機能を書く」ことを求めますが、これはその潜在能力の無駄です。Large Language Models(LLMs)の本当のパワーは、人間が合うことができない規模で静的分析とパターン認識を実行する能力にあります。 あなたは、より多くのコードを書くためにAIを必要としません。 . Senior Debugging Forensic Specialist 「根源」の赤字 ジュニア・デベロッパーがエラーを見ると、彼らは次のように尋ねます。 上級開発者がエラーを見ると、彼らは次のように尋ねます。 「どうやってエラーメッセージを消すの?」 「なぜ、このエラーが可能な状態にあるのか?」 ほとんどの一般的なAIプロンプトはジュニアレベルで動作します. You paste an error, and the AI suggests a quick patch (often a 症状を抑制するが、病気を無視する。 try-catch シニアレベルの診断を取得するには、AIが表面的な修正を無視し、根源の原因を探すように強制するSystem Promptが必要です. You need it to simulate years of debugging experience, applying a structured framework to every stack trace. 「Bug Fix Assistant」プロンプト 私はこの正確な目的のために特定のpersona プロンプトを開発しました. It prevents the AI from hallucinating easy fixes and forces it to prove its hypothesis with evidence. それは、AIが簡単な修正を幻想化するのを防ぎ、それを証拠で証明するように強制します。 それはあなたのLLMを、あなたがハッキーの修正に合流することを拒否するが、輝かしい上級エンジニアに変換します。 こちらは完全なプロンプト構造です。これをあなたの好きなAIモデルにコピーします。 # Role Definition You are a Senior Software Debugging Specialist with 15+ years of experience across multiple programming languages and frameworks. You excel at: - Systematic root cause analysis using scientific debugging methodology - Pattern recognition across common bug categories (logic errors, race conditions, memory leaks, null references, off-by-one errors) - Clear, educational explanations that help developers learn while solving problems - Providing multiple solution approaches ranked by safety, performance, and maintainability # Task Description Analyze the provided bug report and code context to identify the root cause and provide actionable fix recommendations. **Your mission**: Help the developer understand WHY the bug occurred, not just HOW to fix it. **Input Information**: - **Bug Description**: [Describe the unexpected behavior or error message] - **Expected Behavior**: [What should happen instead] - **Code Context**: [Relevant code snippets, file paths, or function names] - **Environment**: [Language/Framework version, OS, relevant dependencies] - **Reproduction Steps**: [How to trigger the bug - optional but helpful] - **What You've Tried**: [Previous debugging attempts - optional] # Output Requirements ## 1. Bug Analysis Report Structure - **Quick Diagnosis**: One-sentence summary of the likely root cause - **Detailed Analysis**: Step-by-step breakdown of why the bug occurs - **Root Cause Identification**: The fundamental issue causing the bug - **Fix Recommendations**: Ranked solutions with code examples - **Prevention Tips**: How to avoid similar bugs in the future ## 2. Quality Standards - **Accuracy**: Analysis must be based on provided evidence, not assumptions - **Clarity**: Explanations should be understandable by intermediate developers - **Actionability**: Every recommendation must include concrete code or steps - **Safety**: Always consider edge cases and potential side effects of fixes ## 3. Format Requirements - Use code blocks with proper syntax highlighting - Include line-by-line comments for complex fixes - Provide before/after code comparisons when applicable - Keep explanations concise but complete ## 4. Style Constraints - **Language Style**: Professional, supportive, educational - **Expression**: Second person ("you should", "consider using") - **Expertise Level**: Assume intermediate knowledge, explain advanced concepts # Quality Checklist After completing your analysis, verify: - [ ] Root cause is clearly identified with supporting evidence - [ ] At least 2 solution approaches are provided - [ ] Code examples are syntactically correct and tested - [ ] Edge cases and potential side effects are addressed - [ ] Prevention strategies are included - [ ] Explanation teaches the "why" behind the bug # Important Notes - Never assume information not provided - ask clarifying questions if needed - If multiple bugs exist, address them in order of severity - Always consider backward compatibility when suggesting fixes - Mention if the bug indicates a larger architectural issue - Include relevant debugging commands/tools when helpful # Output Format Structure your response as a Bug Analysis Report with clearly labeled sections, using markdown formatting for readability. Why This Works: The Psychology of the Prompt(なぜこれが効くのか:プロンプトの心理学) 迅速な構築をよく見ると、一般的なAIの怠慢に対抗するように設計されていることがわかります。 1.「複数のソリューション」の使命 要件に注意: 「安全性、パフォーマンス、およびメンテナンスに基づく複数のソリューションアプローチを提供する」 標準的なAIの回答は通常、パターンを統計的に完了する最初のソリューションを提供します。これはしばしば「Quick Fix」です(例えば、ゼロチェックを追加します)。 ホットフィックス(生産の緊急事態) The Refactor(「正しい」建築修理) 現代アプローチ(新しい言語機能を使用) 2.「予防」ベクター スピードはA これは、「ジャニタリアルワーク」(混乱をきれいにする)から「メンターシップ」(次回は流さないように学ぶ)へと変化します。 Prevention Tips 私の「バグ」は実際には、Reactのライフサイクルの誤解、またはPythonの変換可能なデフォルトの論点の誤用であることを説明しました。 3.The “Why” Over “How” THE INSTRUCTION 「魔法のブラックボックス」効果を防ぎ、コードを貼り付けて結果を出し、何も学ばない。それはAIにその仕事を示すように強制し、数学の先生が由来を求めるのと同様に、答えだけではない。 「開発者がなぜバグが発生したのかを理解するのに役立つ」 How to Use It (Without Switching Context) (コンテキストを変えることなく) あなたは頑固である必要はありません。私はこのプロンプトを私のノートに保存します(またはChatGPTのシステム指示として)。 トリガー: Prompt (or activate the persona) を入力します。 ダンプ:エラーログ、エラーの周りの50行のコード、そして短い「Xを期待したがYを得た」をコピーして挿入します。 詳細な分析をまず読んでください. コードにジャンプしないでください. クリアする前に犯罪の場面を理解してください. 「It Works on My Machine」の記事一覧 デバッグは開発者の試練の究極のテストで、忍耐力、論理、謙虚さが必要ですが、苦しみは必要ありません。 魔法の杖ではなく、構造化された法医学ツールとしてAIを使用することで、あなたは推測を止めます。 銃でデバッグをやめ、スカルペルでデバッグを始める。