Skip to content
Skills Library
AI & agents · Writing

prompt-engineering-patterns

/prompt-engineering-patterns

Design effective prompts for LLM agents with structured input/output formats, chain-of-thought reasoning, few-shot examples, and system prompt architecture. Covers Claude-specific patterns and multi-turn conversation design. Triggers on prompt design, LLM interaction patterns, or system prompt architecture requests.

Repository
a-i--skills ↗
Licence
Apache-2.0
Last repository change
24.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Design effective prompts for LLM agents with structured input/output formats, chain-of-thought reasoning, few-shot examples, and system prompt architecture. Covers Claude-specific patterns and multi-turn conversation design. Triggers on prompt design, LLM interaction patterns, or system prompt architecture requests.

Original author description

Design effective prompts for LLM agents with structured input/output formats, chain-of-thought reasoning, few-shot examples, and system prompt architecture. Covers Claude-specific patterns and multi-turn conversation design. Triggers on prompt design, LLM interaction patterns, or system prompt architecture requests.

How it works

  1. Prompt Architecture
  2. Core Patterns
  3. Advanced Patterns
  4. Claude-Specific Patterns
  5. Multi-Turn Conversation Design
  6. Prompt Testing
  7. Anti-Patterns
Original SKILL.md headings · 265 lines, 855 words
SKILL.md preview
---
name: prompt-engineering-patterns
description: Design effective prompts for LLM agents with structured input/output formats, chain-of-thought reasoning, few-shot examples, and system prompt architecture. Covers Claude-specific patterns and multi-turn conversation design. Triggers on prompt design, LLM interaction patterns, or system prompt architecture requests.
license: MIT
complexity: intermediate
time_to_learn: 30min
tags:
  - prompt-engineering
  - llm
  - system-prompts
  - chain-of-thought
  - few-shot
governance_phases: [build]
organ_affinity: [all]
triggers: [user-asks-about-prompts, context:prompt-design, context:llm-interaction, context:system-prompt]
complements: [agent-swarm-orchestrator, session-lifecycle-patterns, cross-agent-handoff]
---

# Prompt Engineering Patterns

Design prompts that produce reliable, structured, high-quality outputs from language models.

## Prompt Architecture

### System Prompt Structure

```
┌─ Identity & Role ─────────────────┐
│ Who the model is, what it does     │
├─ Context & Constraints ───────────┤
│ Domain knowledge, guardrails       │
├─ Output Format ───────────────────┤
│ Structure, length, style           │
├─ Examples (Few-Shot) ─────────────┤
│ Input/output pairs                 │
├─ Instructions ────────────────────┤
│ Step-by-step task guidance         │
└────────────────────────────────────┘
```

### Priority Layering

When instructions conflict, models follow this precedence:

1. **System prompt** — Highest structural authority
2. **Most recent user message** — Immediate task context
3. **Earlier conversation** — Background context
4. **Training data** — Default behaviors

## Core Patterns

### Structured Output

```xml
<system>
Analyze the given code and return findings in this exact format:

<analysis>
  <summary>One-sentence overall assessment</summary>
  <findings>
    <finding severity="high|medium|low">
      <location>file:line</location>
      <issue>Description</issue>
      <fix>Recommended fix</fix>
    </finding>
  </findings>
  <score>1-10</score>
</analysis>
</system>
```

### Chain of Thought

```
Before answering, think through the problem step by step:

1. Identify the core question
2. List relevant constraints
3. Consider 2-3 approaches
4. Evaluate tradeoffs
5. Recommend the best approach with reasoning

Show your reasoning in <thinking> tags, then give your final answer.
```

### Few-Shot Examples

```
Classify the following commit messages by type.

Examples:
- "Add user authentication with JWT" → feat
- "Fix null pointer in dashboard render" → fix
- "Update README with API documentation" → docs
- "Refactor database connection pooling" → refactor

Now classify:
- "Implement rate limiting for API endpoints" →
```

### Role Prompting

```
You are a senior security engineer reviewing code for a financial services application.
Your priorities are:
1. Authentication and authorization flaws
2. Data exposure risks
3. Input validation gaps
4. Dependency vulnerabilities

Review with the paranoia appropriate for systems handling financial data.
```

## Advanced Patterns

### Constraint Prompting

```
Generate a Python function with these constraints:
- No external dependencies (stdlib only)
- Must handle the empty input case
- Must include type hints
- Maximum 20 lines
- Must include a docstring
```

### Decomposition

Break complex tasks into sequential sub-prompts:

```
Step 1: Analyze the current code structure
Step 2: Identify the specific change needed
Step 3: Write the minimal diff
Step 4: Verify the change doesn't break existing behavior
```

### Self-Verification

```
After generating your response:
1. Re-read the original question
2. Check that every requirement is addressed
3. Verify any code compiles/runs mentally
4. Flag any assumptions you made
```

### Negative Prompting

Specify what NOT to do:

```
Important:
- Do NOT add error handling beyond what was requested
- Do NOT refactor surrounding code
- Do NOT add comments explaining obvious operations
- Do NOT change the function signature
```

## Claude-Specific Patterns

### XML Tags for Structure

Claude responds well to XML-tagged sections:

```xml
<context>
  Repository: a-i--skills
  Organ: IV (Orchestration)
  Current branch: feature/governance-aware-skill-taxonomy
</context>

<task>
  Create a new skill following the existing frontmatter format.
</task>

<constraints>
  - Match the YAML frontmatter schema exactly
  - Name must match directory name
  - Include governance metadata fields
</constraints>
```

### Extended Thinking

For complex reasoning tasks, allocate thinking budget:

```python
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=16000,
    thinking={
        "type": "enabled",
        "budget_tokens": 10000,
    },
    messages=[{"role": "user", "content": prompt}],
)
```

### Tool Use

Define tools for structured interaction:

```python
tools = [{
    "name": "create_skill",
    "description": "Create a new skill file",
    "input_schema": {
        "type": "object",
        "required": ["name", "category", "description"],
        "properties": {
            "name": {"type": "string", "pattern": "^[a-z][a-z0-9-]*$"},
            "category": {"type": "string"},
            "description": {"type": "string", "maxLength": 600},
        },
    },
}]
```

## Multi-Turn Conversation Design

### Context Window Management

```
Conversation budget allocation:
- System prompt: ~2K tokens (fixed)
- Conversation history: ~50K tokens (growing)
- Current task context: ~10K tokens (variable)
- Response space: ~4K tokens (reserved)
```

### Conversation Summarization

When context grows large, summarize earlier turns:

```
<conversation_summary>
In previous messages, we:
1. Identified the bug in auth middleware (missing token refresh)
2. Agreed on fix approach (add refresh check before expiry)
3. Implemented the fix in src/auth/middleware.ts
</conversation_summary>

Now continuing with testing...
```

## Prompt Testing

### Evaluation Criteria

| Criterion | Test Method |
|-----------|-------------|
| Correctness | Compare output against known-good answers |
| Consistency | Run same prompt 5x, check variance |
| Format compliance | Validate output structure programmatically |
| Edge cases | Test with empty input, long input, adversarial input |
| Robustness | Rephrase prompt, check output stability |

### A/B Testing Prompts

```python
async def evaluate_prompts(prompts: list[str], test_cases: list[dict]) -> dict:
    results = {}
    for i, prompt in enumerate(prompts):
        scores = []
        for case in test_cases:
            output = await generate(prompt, case["input"])
            score = evaluate(output, case["expected"])
            scores.append(score)
        results[f"prompt_{i}"] = sum(scores) / len(scores)
    return results
```

## Anti-Patterns

- **Vague instructions** — "Do something good" vs. "Return a JSON object with exactly 3 fields"
- **Conflicting constraints** — "Be concise" + "Explain thoroughly"
- **Prompt injection vulnerability** — Always separate system instructions from user input
- **No output format spec** — Always specify expected format for machine-consumed output
- **Over-prompting** — Adding unnecessary instructions that dilute important ones
- **Ignoring model capabilities** — Using chain-of-thought when a simple instruction suffices

Versions

RepositoryScoreLicence
This page · organvm-iv-taxis/a-i--skills100Apache-2.0
event4u-app/agent-config100MIT
wshobson/agents100MIT
the-aios/aios100LGPL
LeoYeAI/openclaw-master-skills100MIT
kumaran-is/claude-code-onboarding100MIT
EricGrill/agents-skills-plugins100MIT
rootcastleco/rei-skills98MIT
rmyndharis/antigravity-skills98MIT

Identical content appears in 4 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 88ce45a823b7 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100prompt-engineer
    Expert in designing effective prompts for LLM-powered applications. Masters prompt structure, context management, output formatting, and prompt evaluation. Use when: prompt engineering, system prompt, few-shot, chain of thought, prompt design.
  • 100prompt-engineer
    Design, test, and optimize prompts for LLM interactions. Cover prompt patterns (few-shot, chain-of-thought, ReAct), system prompt design, output formatting, prompt evaluation, and prompt optimization techniques. Triggers on "write prompt", "optimize prompt", "design system…
  • 100prompt-engineering-expert
    Expert prompt engineering: prompt structure, few-shot, chain-of-thought, structured output, and iteration. Trigger keywords: prompt, prompt engineering, system prompt, few-shot, chain-of-thought, output format, JSON schema, structured output, instructions, role, examples, eval.…
  • 95senior-prompt-engineer
    World-class prompt engineering skill for LLM optimization, prompt patterns, structured outputs, and AI product development. Expertise in Claude, GPT-4, prompt design patterns, few-shot learning, chain-of-thought, and AI evaluation. Includes RAG optimization, agent design, and…
  • 95senior-prompt-engineer
    World-class prompt engineering skill for LLM optimization, prompt patterns, structured outputs, and AI product development. Expertise in Claude, GPT-4, prompt design patterns, few-shot learning, chain-of-thought, and AI evaluation. Includes RAG optimization, agent design, and…
  • 100prompt-engineering
    Provides workflows to write, debug, and optimize prompts for LLMs, including few-shot example selection, chain-of-thought structuring, system prompt design, and template composition. Use when the user asks to write or improve a prompt, wants help with few-shot examples,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.