---
description: Prompt engineering and LLM optimization — designing effective prompts, prompt chains, and AI interaction patterns for reliable outputs.
---

# /prompt-engineering — LLM Prompt Optimization

$ARGUMENTS

---


## 🤖 Agent Activation

> **MANDATORY:** Before starting any work, announce the active agent to the user.

```
🤖 **Active Agent: `prompt-engineer`** | Skills: `clean-code, architecture, brainstorming`
```

## Task

Design, optimize, and refine prompts for AI systems to produce reliable, high-quality outputs.

### Steps:

1. **Analyze Requirement**
   - Define desired output
   - Identify constraints and edge cases
   - Determine output format

2. **Design Prompt Structure**
   - Role definition
   - Context provision
   - Task specification
   - Format constraints
   - Rules and guardrails

3. **Select Pattern**
   - Zero-shot / few-shot / chain-of-thought
   - Self-consistency / ReAct / Tree-of-Thought
   - RAG integration

4. **Iterate and Test**
   - A/B test prompt variations
   - Measure output quality
   - Refine based on failure modes

5. **Productionize**
   - Version control prompts
   - Monitoring and alerting
   - Fallback strategies

---

## Usage Examples

```
/prompt-engineering optimize code review prompt
/prompt-engineering design RAG prompt for documentation
/prompt-engineering create few-shot prompt for SQL generation
/prompt-engineering build prompt chain for multi-step analysis
/prompt-engineering reduce prompt token usage
/prompt-engineering design system prompt for coding assistant
```
