$npx -y skills add pavel-molyanov/molyanov-ai-dev --skill prompt-masterGuide for writing effective prompts for LLMs. Use when: "напиши промпт", "улучши промпт", "prompt engineering", "проверь промпт
| 1 | <!-- Generated by sync-to-codex v1. Do not edit directly. --> |
| 2 | |
| 3 | # Prompt Engineering for Reasoning Models |
| 4 | |
| 5 | Based on Anthropic and OpenAI guidelines (2025-2026). Every principle here has a motivation — when you understand WHY something works, you follow it more reliably. |
| 6 | |
| 7 | ## Core Principles |
| 8 | |
| 9 | ### The model is already smart |
| 10 | |
| 11 | Add only what the model lacks: domain context, constraints, success criteria. Every sentence should justify its token cost. The context window is a shared resource — prompts compete for attention with conversation history, tool outputs, and the model's own reasoning. |
| 12 | |
| 13 | ### Clarity over cleverness |
| 14 | |
| 15 | Most prompt failures stem from ambiguity, not model limitations. Test: show the prompt to a colleague with no context. If they're confused about what to do, the model will be too. |
| 16 | |
| 17 | ### Motivation over emphasis |
| 18 | |
| 19 | Explain WHY a rule matters. One motivated sentence outperforms ten capitalized words. |
| 20 | |
| 21 | When every instruction screams for attention (ALL CAPS, "CRITICAL", "NEVER", "ALWAYS", "MUST"), nothing stands out. Emphasis words signal a poorly written instruction — rewrite it instead of raising the volume. Over-thorough language ("Be THOROUGH", "Make sure you have the FULL picture") also hurts — it inflates token cost without adding signal. |
| 22 | |
| 23 | ``` |
| 24 | Before: |
| 25 | CRITICAL: You MUST ALWAYS validate input. NEVER skip validation. |
| 26 | IMPORTANT: ALWAYS check for edge cases. This is MANDATORY. |
| 27 | |
| 28 | After: |
| 29 | Validate all input before processing. |
| 30 | Reason: unvalidated input causes pipeline crashes in production. |
| 31 | ``` |
| 32 | |
| 33 | ### Positive framing |
| 34 | |
| 35 | Default to stating what you want, not what to avoid. Models follow positive instructions more reliably. Long prohibition lists get ignored — they add tokens without adding clarity. |
| 36 | |
| 37 | ``` |
| 38 | Rewrite when positive form is sufficient: |
| 39 | Before: Don't use bullet points. Never include code examples. |
| 40 | After: Write in prose paragraphs, 2-3 sentences each. |
| 41 | |
| 42 | Keep negatives for hard boundaries where positive rewrite loses the prohibition: |
| 43 | "Return data as JSON. Do not include markdown fences around it." |
| 44 | — positive alone ("Return raw JSON") may not prevent the common mistake. |
| 45 | |
| 46 | Test: does the positive rewrite fully convey the prohibition? |
| 47 | Yes → rewrite positively. |
| 48 | No → keep negative + add reason why it matters. |
| 49 | ``` |
| 50 | |
| 51 | ### Examples over rules |
| 52 | |
| 53 | 1-3 canonical examples transfer knowledge more efficiently than paragraphs of description. Show the desired output — let the model generalize from the pattern. |
| 54 | |
| 55 | ### Compress |
| 56 | |
| 57 | Remove filler ("could you please", "I would like you to", "make sure to"). Shorter prompts often perform equally well or better — less noise means stronger signal per token. |
| 58 | |
| 59 | ### Degrees of freedom |
| 60 | |
| 61 | Match specificity to the task's fragility. Over-specifying creative tasks stifles the model's reasoning. Under-specifying fragile tasks leads to format errors and broken parsing. |
| 62 | |
| 63 | Fragile tasks (parsing specific formats, following exact protocols): prescribe steps. |
| 64 | Creative tasks (writing, analysis, design): give constraints and let the model find its path. |
| 65 | |
| 66 | ### High-level guidance |
| 67 | |
| 68 | Provide constraints and success criteria rather than step-by-step micro-instructions. The model's own reasoning often exceeds prescriptive procedures. Describe WHAT success looks like — the model figures out HOW. |
| 69 | |
| 70 | ## Techniques That Work |
| 71 | |
| 72 | ### Context over decoration |
| 73 | |
| 74 | Provide concrete context (audience, use case, constraints) instead of decorative phrasing. The model gains nothing from flattery. |
| 75 | |
| 76 | ``` |
| 77 | Before: |
| 78 | You are an incredibly brilliant and talented expert programmer |
| 79 | who writes the most amazing code in the world. Please write |
| 80 | a function that validates emails. |
| 81 | |
| 82 | After: |
| 83 | Write an email validation function. |
| 84 | Context: TypeScript, used in a signup form, must handle |
| 85 | international domains. Return {valid: boolean, reason: string}. |
| 86 | ``` |
| 87 | |
| 88 | ### Structure with XML tags |
| 89 | |
| 90 | Separate instructions, data, and examples with XML tags. This prevents the model from confusing context with instructions. Consistent tag names make handoffs between chained prompts clean. |
| 91 | |
| 92 | ``` |
| 93 | Before: |
| 94 | Here's some customer feedback. Also, the format should be |
| 95 | JSON. And please analyze sentiment. The feedback is: |
| 96 | "Great product but shipping was slow." |
| 97 | |
| 98 | After: |
| 99 | <instructions> |
| 100 | Analyze sentiment. Output JSON: {text, sentiment, confidence}. |
| 101 | </instructions> |
| 102 | <data> |
| 103 | Great product but shipping was slow. |
| 104 | </data> |
| 105 | ``` |
| 106 | |
| 107 | ### Examples over explanations |
| 108 | |
| 109 | Instead of describing the desired output format in paragraphs, show 1-3 examples. The model generalizes from patterns faster than from rules. |
| 110 | |
| 111 | ``` |
| 112 | Before: |
| 113 | When summarizing articles, create a summary that includes |
| 114 | the main topic as a short phrase, then 2-3 key points as |
| 115 | bullet items, then a one-sentence practical takeaway. |
| 116 | |
| 117 | After: |
| 118 | Summarize articles in this format: |
| 119 | |
| 120 | <example> |
| 121 | Topic: Remote work productivity |
| 122 | - Asy |