← Back to blog
Practical Cheatsheet to Maximize Coding with GPT-5
Published: 2025年08月24日
Core Points
- No ambiguity or conflicting instructions
- Declare reasoning level (low / medium / high)
- Segment rules in XML-like blocks
- Avoid terms like “exhaustively” or “thoroughly”
- Add a self-evaluation prompt before coding
- Control tool budget and parallelism
10-Second Quick Summary
- Zero ambiguity
- Specify reasoning level
- Fix the output contract in XML
- Avoid strong imperatives
- Self-reflection first
- Limit tool calls and concurrency
Ready-to-Paste Prompt Template
<code_editing_rules>
<guiding_principles>
- Keep changes minimal. List side effects.
- Prefer modularity and reuse.
- Prioritize type safety (TypeScript strict).
</guiding_principles>
<stack_defaults>
- Styling: Tailwind CSS
- Framework: Next.js App Router
- Tests: Vitest + Testing Library
</stack_defaults>
<output_contract>
- Changed files list
- Patch diff and summary
- Test code and run command
</output_contract>
</code_editing_rules>
<reasoning_effort level="medium"/> <!-- trivial=low, hard=high -->
<self_reflection>
- Create a 5-item checklist before coding and score it.
- If not perfect, re-propose the design before implementing.
</self_reflection>
<persistence>
- Proceed with assumptions, then list “assumptions and alternatives” at the end.
- Tool budget: up to 6 calls. Parallel search up to 2.
- Ban unrelated exploration and dependency installs.
</persistence>
Task-Specific Mini Snippets
Bug Fix (small)
<task intent="fix-bug" severity="minor">
- Write repro steps first.
- List 3 cause hypotheses → test the most likely one.
- Change at function scope. Keep public API stable.
</task>
<reasoning_effort level="low"/>
Refactor (medium)
<task intent="refactor" scope="module">
- Remove cycles. Raise cohesion, lower coupling, report numbers.
- Preserve existing tests. Explain any snapshot updates.
</task>
<reasoning_effort level="medium"/>
Greenfield (large)
<task intent="greenfield">
- List use cases, boundaries, and error-time UX.
- Fix API contract first. Show I/O types.
</task>
<reasoning_effort level="high"/>
Anti-Patterns → Improvements
- Bad: “Gather all info then answer,” “exhaustively”
Better: “Max 4 tool calls. Try in priority order. Summarize mid-results before coding.” - Bad: “Use the optimal approach.”
Better: “Prefer latency <300 ms, memory <200 MB, ≤3 files changed.”
IDE/Agent Integration Rules
- Store the XML blocks in
.cursor/rulesorAGENTS.md - Write repo-specific prohibitions (no new deps, no file deletions, no public API breaks)
- Set default tool budget and parallelism
- Add self-check to the PR template
Evaluation Checklist
- Instruction unambiguity: removal rate of vague terms
- Reasoning-level fit vs task difficulty
- Minimal-change score: touched lines/files
- Regression safety: added tests and coverage delta
- Observability: consistent logging and error handling
- Reproducibility: clear setup and run steps
Example Uses
- Draft App Router migration → self-check → PR with diffs
- Gradual refactor of weakly typed utilities
- Add a cache layer while preserving API compatibility
Recommended Thinking Process
- Classify task difficulty → set reasoning level
- Freeze the output contract first (diffs, tests, steps)
- Constrain exploration via tool budget and parallelism
- Self-check before coding. Ensure rework criteria are met
- Implement with minimal changes → regression tests → record assumptions and alternatives