Prompt Engineering: Writing Agent Prompts as Reusable Engineering Standards

Preface

When building Agents or complex LLM applications, the common issue is often not “the model isn’t smart enough,” but rather fragmented prompts: the same type of task might use CoT sometimes and hard-coded steps other times, and performance fluctuates when switching models (Claude 4.x, GPT-4.1, OpenAI o-series). While there are many tips and tricks online, there is a lack of systematic documentation aligned with official docs that can be directly integrated into environments like Cursor or Claude Code. Below is an introduction to the prompt-engineering Skill maintained by oakoss: it consolidates reasoning modes, templates, extended thinking, and tool call design into an installable Agent Skill, allowing coding assistants to follow the same set of principles in relevant tasks.

What is this

prompt-engineering is a single Skill within the oakoss/agent-skills repository, located at skills/prompt-engineering. The metadata indicates: Author oakoss, Version 1.0, License MIT; content references the Anthropic Prompt engineering documentation. The Skill description covers: writing prompts for reasoning models, implementing Chain-of-Thought (CoT) or Tree-of-Thoughts (ToT), designing ReAct loops, building few-shot examples, optimizing prompt performance, structuring system prompts, using extended thinking, and designing tool call workflows; it also applies to prompt templates, multi-step Agent workflows, structured thinking protocols, and multimodal prompting.

This Skill is marked as user-invocable: false in the manifest, meaning it is typically selected automatically by the Agent when matching scenarios, rather than manually invoked via @ by the user every time; however, once installed, it still influences the assistant’s behavior in relevant tasks through the Skill mechanism.

Core Features

Key Principles

The Skill uses six principles to constrain writing styles, distinguishing it from simply “piling on rules”:

  1. Explicit over implicit: Be clear about output formats and behaviors; rely less on the model guessing intent (targeting models that execute literally, such as Claude 4.x, GPT-4.1).
  2. Objective over instruction: For OpenAI o-series or Claude with extended thinking, clearly state the objective without forcing a step-by-step method.
  3. Structure signals intent: Use XML tags, delimiters, and consistent formatting to express structure.
  4. One good example beats many rules: Consistent few-shot examples are often more effective than long paragraphs of rules.
  5. Feedback loops are built-in: Have the model self-check, critique, or score before finalizing.
  6. Token economy matters: Compress context, remove fluff, and front-load key information.

Model-Specific Writing Styles

  • Claude 4.x: Follows instructions with high precision; recommends XML segments like <rules>, <context>, <output_format>; uses positive descriptions (“what to do”); can utilize extended thinking and interleaved thinking.
  • OpenAI o-series (o3, o4-mini): Internally consumes reasoning tokens; use developer messages instead of system messages; treat function descriptions as interface contracts; do not add explicit reasoning prompts; return persisted reasoning items per API requirements in multi-turn scenarios.
  • GPT-4.1 & Standard Models: Suitable for explicit step-by-step instructions, few-shot examples, and structured output schemas; CoT and structured thinking protocols are more valuable here.
  • Multimodal: Explain what each image represents, use clear action verbs, and indicate relationships between multiple images; crop to relevant regions if necessary.

Quick Reference

The Skill provides a comparison table mapping tasks to techniques, for example:

Mode Key Points
Zero-shot CoT Trigger with "Let's think step by step", etc.; induces reasoning without examples
Few-shot CoT Includes full reasoning chains in examples
Self-consistency Generate multiple paths and majority vote; suitable for hard problems
Tree-of-Thoughts Parallelize multiple strategies and prune; high cost
ReAct Thought → Action → Observation loop
Extended thinking / Interleaved thinking Budgeted deep thinking on Claude; thinking between tool calls
Think tool No-op tool; provides space for structured reasoning for Agents
Reasoning models Use objective-oriented prompting for o3/o4-mini; do not stack CoT
Token optimization Control latency and cost

Common Errors and Corrections

The material lists typical anti-patterns in a table, such as: cramming rules into a single prompt → should use hierarchy and priority; forcing step-by-step plans on reasoning models → should be objective-oriented; adding CoT on top of reasoning models → redundant or even harmful; Claude’s thinking blocks should not be inserted into user text but returned as-is in assistant messages; no baseline metrics before optimization → measure first, then perform single-variable A/B testing.

Engineering Workflow

The Workflow before truncation starts with “Define objectives and success metrics,” followed by “Select the right mode (CoT, ReAct, ToT, etc.)”—refer to the SKILL body in the repository for complete steps. The overall approach is: measure first, then modify prompts, changing only one variable at a time.

Installation and Activation

The Skill is distributed as part of the agent-skills collection; installation methods are consistent with the repository README. To browse or preview:

pnpm dlx skills add oakoss/agent-skills --list

Install only prompt-engineering:

pnpm dlx skills add oakoss/agent-skills -s prompt-engineering

Install all Skills:

pnpm dlx skills add oakoss/agent-skills --all

Specify target Agent (example is Claude Code):

pnpm dlx skills add oakoss/agent-skills -a claude-code

User-level global installation:

pnpm dlx skills add oakoss/agent-skills -g

The collection description supports Claude Code, Cursor, Gemini CLI, OpenAI Codex, VS Code, GitHub Copilot, etc. (see agentskills.io). Specific Skill directories for each client depend on the documentation of the tool being used; this Skill follows the universal SKILL.md format.

Typical Usage

The Skill itself is a guideline-based capability and does not provide a standalone CLI. Typical usage involves letting the assistant automatically apply the modes and checklists described in the text within the following scenarios:

  1. Structured system prompts: Role + Expertise + Guidelines + Output Format; wrap complex segments in XML.
  2. Agent loops: Design “Think → Call Tool → Read Observation” prompts and stop conditions following ReAct; Claude 4 can use interleaved thinking between tools.
  3. Hard problem exploration: Use ToT (multiple strategies, eliminate weak branches) or self-consistency when cost is acceptable; use few-shot CoT for standard models.
  4. Reasoning model tasks: Write clear objectives and tool contracts for o3/o4-mini; avoid redundant CoT like "Let's think step by step".
  5. Optimization iteration: Define metrics first, then run A/B tests on prompt variants; use JSON mode or schemas for output to avoid parsing unstructured replies manually.

Refer to the full Skill text and official Anthropic / OpenAI documentation for specific template phrasing, tag naming, and API parameters.

Applicable Scenarios and Notes

Suitable for: Prompt design requiring structured reasoning, multi-step Agent orchestration, reusable prompt templates, extended thinking configuration, image-text multimodal prompting, tool call workflow design, and systematic optimization of prompt quality and token cost.

Not suitable for (Skill original text “When NOT to use”): Simple factual Q&A, direct retrieval, and creative writing better suited for open-ended generation—these scenarios do not require loading the full set of advanced modes.

Notes:

  • Prompting strategies for reasoning models and standard models are often opposite: the former avoids over-planning, while the latter often requires CoT and step-by-step instructions.
  • ToT and self-consistency significantly increase call counts and tokens; weigh task difficulty against budget.
  • user-invocable: false indicates reliance on the Agent’s automatic matching; if the environment does not load this Skill, the behavior will not take effect.
  • The material version is 1.0; model family names (e.g., Claude 4.x, GPT-4.1) are subject to the Skill text. Review the Model-Specific section after upgrading models.

Conclusion

prompt-engineering consolidates prompting from scattered tricks into a set of principles, mode tables, anti-pattern checklists, and workflows aligned with official documentation, making it suitable as a “prompt layer specification” for Agent projects. When you need to systematically rewrite system prompts, design ReAct/ToT, or distinguish between reasoning models and standard models, you can install it via agent-skills and let your coding assistant reference it on demand.

Official Address: https://github.com/oakoss/agent-skills/tree/main/skills/prompt-engineering

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye