💡 AIモデルは英語のプロンプトで最も高い精度を発揮します。そのため、プロンプト本文は英語のまま掲載しています。英語で入力することで、より正確で詳細な回答が得られます。 深夜2時の本番障害対応でも、スケールが必要なシステム設計でも、この10のプロンプトはコーディングワークフロー全体をカバーします。未知のコードの理解、根本原因分析によるバグ修正、包括的なテスト作成、SQLクエリ最適化、Regexパターン構築、パフォーマンスボトルネックの特定まで。GPT-4.1、Gemini 2.5 Pro、Claude Sonnet 4、Grok 3でテスト済みなので、各タスクに最適なモデルがわかります。
プロンプト
未知のコードを数時間ではなく数分で理解
Explain this code so I can understand and confidently modify it. ```[language] [Paste the code block — include imports and calling context] ``` Language/framework: [language and version if relevant] My skill level: [beginner / intermediate / advanced] What I need to do with it: [modify / extend / debug / understand before reviewing a PR] What's confusing me: [specific parts, if any] Provide: 1. **Plain-English summary:** what this code does in 2-3 sentences a non-developer could understand 2. **Block-by-block walkthrough:** annotate each logical section with what it does, why it's structured this way, and what happens if it fails 3. **Patterns and idioms:** identify any design patterns, framework conventions, or language idioms being used — explain why they're used here (not just what they are) 4. **Hidden complexity:** potential bugs, edge cases, race conditions, or gotchas that aren't obvious from a quick read 5. **Modification guide:** how I would change this code to [describe intended change], with the specific lines to modify and what to watch out for 6. **Dependency map:** what this code depends on and what depends on it — so I know the blast radius of any changes
プロのコツ
混乱している関数だけでなく、周辺のコンテキストも含めましょう。import文、呼び出し元のコード、ファイルパスを貼り付けてください。孤立したスニペットでは重要な意味が失われます。特に依存性注入パターンやフレームワークの規約において、AIは全体像が見えると10倍優れた説明を提供します。
テスト済み Mar 15, 2026
根本原因分析であらゆるエラーをデバッグ
Help me find and fix this bug. **Code:** ```[language] [Paste the relevant code — include the function and its callers] ``` **Error message:** ``` [Paste the EXACT error message and full stack trace] ``` Expected behavior: [what should happen] Actual behavior: [what actually happens — include specific values if relevant] Reproduction steps: [how to trigger the bug] What I've already tried: [debugging steps taken and their results] Environment: [language version, OS, framework versions, relevant dependencies] Provide: 1. **Root cause:** what's actually causing this error and WHERE in the code the problem originates (not just where it manifests) 2. **The fix:** corrected code with the specific changes highlighted. Explain each change 3. **Why this works:** the underlying concept that was wrong — so I understand the principle, not just the patch 4. **Collateral check:** related bugs that often accompany this one. Check the surrounding code for similar patterns 5. **Prevention strategy:** a linting rule, type annotation, or test that would catch this bug class automatically 6. **Test case:** a specific test to verify the fix and prevent regression, with expected input/output
プロのコツ
常にスタックトレース全体を含む正確なエラーメッセージを貼り付けてください。エラーを自分の言葉で要約すると、AIに必要な行番号やコンテキストが失われます。また、すでに試したことも記載しましょう。AIは失敗したアプローチをスキップして、より見落としがちな解決策に直接進みます。
テスト済み Mar 15, 2026
オンデマンドでシニアエンジニアレベルのPRレビューを取得
Review this code as if you were a senior engineer on my team. **PR Description:** [what this change does and why] ```[language] [Paste the code or diff] ``` Framework: [framework and version] Team conventions: [style guide, naming patterns, architecture patterns, test requirements] Priority: [shipping fast / production-critical / library code / hackathon] Security context: [handles user input? PII? Payments? Auth?] Review across 4 tiers: 1. **Blockers** (must fix before merge): bugs, security vulnerabilities, data loss risks, broken error handling. For each: exact location, what's wrong, and the fix 2. **Should fix:** design issues, missing abstractions, performance concerns, insufficient error handling. For each: what's suboptimal, why it matters, and the recommended change 3. **Suggestions:** naming improvements, readability, documentation gaps, minor refactors. Non-blocking but would improve quality 4. **Questions:** things that need clarification from the author before I can assess correctness Also provide: - **Test coverage gaps:** specific scenarios that aren't tested but should be - **Verdict:** ship as-is / ship after minor fixes / needs significant rework. With reasoning
プロのコツ
PRの説明と変更理由を含めましょう。AIは意図を理解すると、コード品質をはるかに的確にレビューします。コンテキストがないと、意図的なトレードオフをバグとしてフラグ付けする可能性があります。また、チームの規約も伝えてください。スタイルガイドに違反する優れたレビューは、役に立つどころか追加作業を生みます。
テスト済み Mar 15, 2026
壊さずにコード品質を改善
Review and refactor this code for better quality. ```[language] [Paste the code to refactor] ``` Language/framework: [language and version] What this code does: [brief description of its purpose] Primary concern: [readability / performance / maintainability / testability / all] Constraints: [backward compatibility requirements, team style guide, performance SLAs] Upcoming changes: [features being built that will touch this code next] Provide: 1. **Quality assessment:** what's good (preserve these), what needs work (change these), and what's dangerous (fix these immediately) 2. **Refactored code:** the improved version with all changes applied 3. **Change log:** every modification explained — what changed, why, and the specific quality dimension it improves 4. **Performance analysis:** did the refactoring change performance? Better, same, or trade-offs to be aware of 5. **Testability improvement:** how the refactored code is easier (or harder) to test, with example test structure 6. **Verification checklist:** how to confirm the refactored code behaves identically to the original — specific inputs/outputs to test
プロのコツ
チームのコーディングスタイルと今後の機能について伝えましょう。チームのパターンに合わないリファクタリングはPRで摩擦を生みます。次のスプリントで必要になるパターンに向けたリファクタリングは価値がありますが、抽象的な「きれいさ」のためのリファクタリングは価値がありません。常に目的を持ってリファクタリングしましょう。
テスト済み Mar 15, 2026
最適なアプローチでコーディング問題を解決
Help me solve this algorithm/data structure problem. **Problem:** [paste the problem statement or describe it clearly] Language: [preferred language for the solution] Context: [interview prep / competitive programming / real project / learning] Constraints: [time complexity requirement, space limits, input size range] What I've tried: [approaches attempted and where they fail] Pattern guess: [what type of problem you think this is, if any] Provide: 1. **Problem classification:** identify the pattern (sliding window, two pointer, dynamic programming, graph traversal, etc.) and explain WHY this pattern applies 2. **Brute force solution:** working code with time/space complexity analysis. This is the baseline 3. **Optimized solution:** improved algorithm with explanation of the optimization insight — what observation makes the better approach possible? 4. **Dry run:** step-by-step walkthrough with a small example input showing how the algorithm progresses 5. **Edge cases:** specific inputs that break naive implementations (empty input, single element, all same values, maximum size, negative numbers) 6. **Related problems:** 3 similar problems that use the same pattern, so I can practice the technique
プロのコツ
AIに質問する前に、少なくとも15分は自分で取り組みましょう。何を試してどこで詰まったかを記述してください。AIはあなたの部分的な理解をもとに構築すると、はるかに効果的に教えます。面接準備なら、パターン名を聞きましょう。パターン認識は新しい問題にも転用できます。
テスト済み Mar 15, 2026
本番環境対応のコードであらゆるAPIに接続
Help me integrate with this API in production-ready code. API: [service name and version] What I need: [specific operations: fetch data, send data, webhook handling, etc.] My stack: [language, framework, existing HTTP client/SDK] Auth type: [API key / OAuth 2.0 / JWT / Basic / custom] Sample response: ```json [Paste a sample API response if available] ``` Error handling needs: [retry on failure / fail fast / degrade gracefully / queue and retry later] Rate limits: [if known] Provide: 1. **Complete working code** with all imports, types/interfaces, and configuration 2. **Auth setup:** secure credential handling (env vars, not hardcoded). Include token refresh logic if OAuth 3. **Type definitions:** request/response types that match the actual API contract 4. **Error handling:** specific handlers for each failure mode (rate limits, auth expiry, timeout, 4xx, 5xx). Not just try/catch everything 5. **Retry strategy:** exponential backoff with jitter, configurable max retries, and circuit breaker pattern for sustained failures 6. **Integration test:** a test that verifies the integration works against the real API (or a mock). Include setup/teardown
プロのコツ
ドキュメントのサンプルでもいいので、実際のAPIレスポンスをプロンプトに貼り付けましょう。AIは実際のレスポンス構造を見ると、はるかに正確な型定義とパースロジックを生成します。また、エラーハンドリングの方針(リトライ?即時失敗?グレースフルデグラデーション?)も指定してください。これによりコードアーキテクチャが変わります。
テスト済み Mar 15, 2026
あらゆるコードに対して包括的なテストを生成
Write comprehensive tests for this code. ```[language] [Paste the code to test] ``` Test framework: [Jest / pytest / JUnit / Go testing / RSpec / other] What this code does: [brief description] Critical invariants: [what must ALWAYS be true — e.g., 'balance never goes negative,' 'auth tokens expire after 1 hour'] External dependencies: [databases, APIs, file system, time-dependent behavior] Existing test patterns: [describe your team's test conventions if any] Generate: 1. **Happy path tests:** the main use cases that should always work. 3-5 tests covering core functionality 2. **Edge case tests:** empty inputs, boundary values, maximum sizes, null/undefined, Unicode, special characters. 5+ tests 3. **Error path tests:** what happens when things fail — invalid input, network errors, permission denied, timeout. 3-5 tests 4. **Integration tests:** if the code touches external services, tests with mocks/stubs that verify the interaction contract 5. **Regression tests:** based on the code's complexity, tests for specific bugs that are likely to be introduced during future changes 6. **Test data factory:** reusable fixtures or builders for the test data, so future tests are easy to write
プロのコツ
ハッピーパスだけをテストしないでください。本番環境に到達するバグは常にエッジケースにあります:空入力、null値、並行アクセス、ネットワークタイムアウト、境界条件。AIに最も重要な不変条件を伝えれば、それを守るテストを生成します。
テスト済み Mar 15, 2026
パフォーマンスに最適化されたデータベースクエリの作成と最適化
Help me write or optimize this SQL query. **What I need:** [describe the data you want to retrieve or modify] **Database:** [PostgreSQL / MySQL / SQLite / SQL Server / other] **Current query (if optimizing):** ```sql [Paste the current query] ``` **Table schema:** ```sql [Paste relevant CREATE TABLE statements or describe the schema] ``` **Current indexes:** [list existing indexes if known] **Table sizes:** [approximate row counts for each table involved] **EXPLAIN output:** [paste if available] **Performance issue:** [slow reads / slow writes / lock contention / timeout / N+1] Provide: 1. **Optimized query:** the best SQL for this task with explanation of approach 2. **EXPLAIN analysis:** what the execution plan tells us and where the bottleneck is 3. **Index recommendations:** specific indexes to create (with CREATE INDEX statements) and why each one helps 4. **Query alternatives:** 2-3 different approaches (subquery vs. JOIN vs. CTE vs. window function) with trade-offs 5. **Anti-patterns check:** common SQL mistakes in the original query (SELECT *, implicit conversions, functions on indexed columns, unnecessary JOINs) 6. **Scaling considerations:** will this query still perform at 10x and 100x current data volume? What breaks first?
プロのコツ
テーブルサイズとEXPLAIN出力(または推定行数)を必ず含めてください。1,000行で高速なクエリが1,000万行でデータベースを破壊する可能性があります。AIはスケールと現在の実行計画がわかって初めて、意味のある最適化ができます。
テスト済み Mar 15, 2026
頭を悩ませずに正規表現を構築・理解
Help me build a regular expression for this pattern. **What I need to match:** [describe the pattern in plain English] **Language/tool:** [JavaScript / Python / Go / Java / grep / other — regex flavors differ!] **Test strings that SHOULD match:** ``` [List 5+ examples] ``` **Test strings that should NOT match:** ``` [List 5+ counter-examples] ``` **Capture groups needed:** [what specific parts do I need to extract?] **Performance context:** [running once on a string / running on millions of lines / real-time input validation] Provide: 1. **The regex pattern** with a character-by-character explanation of what each part does 2. **Visual breakdown:** annotated regex showing groups, quantifiers, and anchors 3. **Test results:** run all provided test strings and show match/no-match for each 4. **Edge cases I haven't considered:** patterns that would match incorrectly or fail to match valid inputs 5. **Performance notes:** is this regex safe from catastrophic backtracking? ReDoS risk assessment 6. **Alternative approaches:** if regex is the wrong tool for this (parsing HTML, complex nesting), say so and recommend the right tool
プロのコツ
エッジケースを含む5つ以上のテスト文字列を必ず提供しましょう。マッチすべき文字列とマッチしてはいけない文字列の両方です。最も一般的なRegexバグは、マッチ範囲が広すぎることです。AIはネガティブな例があると、はるかに精密なパターンを構築します。
テスト済み Mar 15, 2026
すべてを遅くしているコードを発見して修正
Help me find and fix performance bottlenecks in my code. **What's slow:** [specific operation, endpoint, page load, build time, test suite] **Current performance:** [measured response time, throughput, memory usage — be specific] **Target performance:** [what you need it to be] **Code:** ```[language] [Paste the relevant code or describe the architecture] ``` **Profiling data (if available):** ``` [Paste profiler output, flame graph description, or timing logs] ``` **Infrastructure:** [language version, server specs, database, caching layer] **Scale:** [requests per second, data volume, concurrent users] Provide: 1. **Bottleneck identification:** analyze the code/profiling data to identify the top 3 performance bottlenecks. Rank by impact 2. **Quick wins:** optimizations that take under 30 minutes and yield measurable improvement. Specific code changes 3. **Architecture improvements:** structural changes that require more effort but unlock significant performance gains (caching, query optimization, async processing, connection pooling) 4. **Memory analysis:** are there memory leaks, excessive allocations, or unbounded growth? Specific patterns to fix 5. **Benchmark template:** code to measure before/after performance accurately so you can prove the optimization worked 6. **Scaling ceiling:** at what point does this code need a fundamentally different approach? When should you re-architect vs. keep optimizing?
プロのコツ
最適化する前にプロファイリングしましょう。ボトルネックはほぼ間違いなくあなたが思っている場所にはありません。実際の測定値(レスポンスタイム、メモリ使用量、CPUプロファイル)をプロンプトに含めましょう。AIがボトルネックを推測すると一般的なアドバイスになりますが、実際のプロファイリングデータを分析すると外科的な修正を提供します。
テスト済み Mar 15, 2026
実際のテストに基づいています — 推測ではありません。 テスト方法を見る
Gemini 2.5 Pro
アルゴリズム問題、SQL最適化、Regex構築に最適。明確なBig O解説を含む徹底した計算量分析を提供します。他のモデルよりも初回でコードが正しく動作する頻度が高い。新しいフレームワークのエコシステム知識も豊富。コードレビューではやや意見が控えめで、バグは検出するがアーキテクチャ改善の提案は少なめ。
アルゴリズムに最適GPT-4.1
APIインテグレーション、デバッグ、テスト生成に最適。包括的なエラーハンドリングと型安全性を備えた最も本番環境向きのコードを出力します。ライブラリ、SDK、フレームワーク固有のパターンに関する知識が最も広い。シンプルなソリューションを過剰設計する傾向があるため、軽量な実装が欲しい場合は「最小限の実装で」と指定してください。
APIインテグレーションに最適Claude Sonnet 4
コードレビュー、リファクタリング、パフォーマンス分析に最適。すべての変更に対する最も明確な根拠を提供し、他のモデルが見逃す微妙なアーキテクチャ上の問題を発見します。コードレビューはシニアエンジニアのフィードバックのように読めます。シンプルな概念を過剰に説明する傾向がやや。
コードレビューに最適Grok 3
素早いデバッグと実践的な問題解決に最適。長い説明なしに直接修正方法を提示します。必要な機能を正確に満たす簡潔でクリーンなコードを書きます。Regexやワンオフスクリプトに優れています。アーキテクチャの議論や長文のコードレビューはやや弱め。
クイックデバッグに最適AIが生成したコードはデプロイ前に必ず検証しましょう。AIモデルは一見正しく見えても、微妙なバグ、セキュリティ脆弱性、パフォーマンス問題を含むコードを出力します。すべてのコードを実行し、テストを書き、本番環境に投入する前にすべての行を理解してください。
良いコード出力にはコンテキストがすべてです。言語バージョン、フレームワーク、既存のパターン、制約条件を毎回プロンプトに含めましょう。React 19のHooksを使っているのにReact 17のクラスコンポーネントを生成するAIは時間の無駄です。
AIは出荷するためだけでなく、学ぶために使いましょう。コードを書かせるだけでなく、なぜそのコードが動くのかをAIに説明させてください。理由を理解することでスキルが向上し、AI生成コードが壊れた時のデバッグにも役立ちます。