Prompt Engineering Patterns
Master the art of creating effective prompts that leverage Orchestre's dynamic intelligence. These patterns help you communicate intent clearly and get optimal results.
Core Principles
- Clarity Over Brevity - Be specific about what you want
- Context Over Assumption - Provide relevant context
- Intent Over Implementation - Describe the goal, not the how
- Iterative Over Perfect - Refine through interaction
Effective Prompt Patterns
Pattern: Intent-Driven Prompts
Principle: Focus on what you want to achieve, not how to achieve it
❌ Poor: Implementation-focused
/execute-task "Create a UserController with GET, POST, PUT, DELETE methods"✅ Better: Intent-focused
/execute-task "Add user management with full CRUD operations"Why it works:
- Allows Orchestre to choose best implementation
- Adapts to your project's patterns
- Results in more idiomatic code
Pattern: Context-Rich Prompts
Principle: Provide relevant context for better results
❌ Poor: Missing context
/execute-task "Add authentication"✅ Better: Context-rich
/execute-task "Add JWT authentication for our REST API,
integrating with existing user model and middleware pattern"Why it works:
- Orchestre understands integration points
- Maintains consistency with existing code
- Reduces back-and-forth clarification
Pattern: Constraint-Based Prompts
Principle: Specify important constraints and requirements
❌ Poor: No constraints
/execute-task "Create a file upload feature"✅ Better: Clear constraints
/execute-task "Create file upload feature with:
- 10MB size limit
- Image files only (jpg, png, webp)
- Virus scanning before storage
- CDN integration for serving"Why it works:
- Prevents assumptions
- Ensures requirements are met
- Guides implementation decisions
Discovery Prompts
Pattern: Exploratory Analysis
Use when: Starting a new feature or investigating options
/orchestrate "Explore options for implementing [feature] considering:
- Current architecture constraints
- Performance requirements
- Security implications
- Maintenance burden"Example:
/orchestrate "Explore options for implementing real-time chat considering:
- Our current REST API architecture
- Need for <100ms message delivery
- End-to-end encryption requirements
- Long-term maintenance by small team"Pattern: Comparative Analysis
Use when: Choosing between approaches
/research "Compare [option1] vs [option2] for [use-case] considering:
- Implementation complexity
- Performance characteristics
- Maintenance requirements
- Team expertise"Example:
/research "Compare WebSockets vs Server-Sent Events for notifications considering:
- Implementation complexity in our Node.js stack
- Performance for 10k concurrent users
- Maintenance requirements
- Our team's real-time experience"Planning Prompts
Pattern: Hierarchical Planning
Use when: Breaking down complex features
/orchestrate "Plan [feature] with:
Top-level: [main components]
For each component:
- Core functionality
- Integration points
- Testing strategy
- Deployment considerations"Example:
/orchestrate "Plan e-commerce checkout with:
Top-level: Cart, Payment, Order, Notification
For each component:
- Core functionality
- Integration points
- Testing strategy
- Deployment considerations"Pattern: Risk-Aware Planning
Use when: Working with uncertain requirements
/orchestrate "Plan [feature] identifying:
- Technical risks and mitigation strategies
- Unknown requirements needing research
- Dependencies on external systems
- Fallback approaches for each risk"Implementation Prompts
Pattern: Progressive Enhancement
Use when: Building features incrementally
/execute-task "Implement basic [feature] with minimal functionality"
/execute-task "Enhance [feature] with [additional capability]"
/execute-task "Optimize [feature] for [specific requirement]"Example:
/execute-task "Implement basic search with exact string matching"
/execute-task "Enhance search with fuzzy matching and relevance scoring"
/execute-task "Optimize search for sub-100ms response time"Pattern: Example-Driven Implementation
Use when: You have specific behavior in mind
/execute-task "Implement [feature] that works like this:
Input: [example input]
Process: [what should happen]
Output: [expected output]
Edge cases: [special scenarios]"Example:
/execute-task "Implement discount calculation that works like this:
Input: Cart total $100, Coupon 'SAVE20'
Process: Apply 20% discount, max $50
Output: {original: 100, discount: 20, final: 80}
Edge cases: Expired coupons, minimum purchase requirements"Review Prompts
Pattern: Focused Review
Use when: Concerned about specific aspects
/review --focus "[specific concern]"Examples:
/review --focus "security vulnerabilities in authentication"
/review --focus "performance bottlenecks in database queries"
/review --focus "error handling completeness"Pattern: Comparative Review
Use when: Ensuring consistency
/review --compare "[reference implementation]"Example:
/review --compare "user service implementation for consistency"Optimization Prompts
Pattern: Metric-Driven Optimization
Use when: Having specific performance goals
/orchestrate "Optimize [feature] to achieve:
- Metric 1: [target]
- Metric 2: [target]
Current baseline: [measurements]"Example:
/orchestrate "Optimize API response time to achieve:
- P95 latency: <200ms
- Throughput: >1000 req/s
Current baseline: P95=500ms, Throughput=400 req/s"Pattern: Constraint-Based Optimization
Use when: Working within limitations
/execute-task "Optimize [feature] within constraints:
- Maximum memory: [limit]
- CPU budget: [limit]
- Cannot modify: [existing APIs]"Composition Prompts
Pattern: Workflow Composition
Use when: Creating multi-step processes
/compose-prompt "Create workflow for [goal]:
Prerequisites: [what's needed]
Steps:
1. [First major milestone]
2. [Second major milestone]
Success criteria: [how to verify]"Example:
/compose-prompt "Create workflow for user onboarding:
Prerequisites: User registered, email verified
Steps:
1. Profile setup (name, avatar, preferences)
2. Initial data import
3. Tutorial completion
4. First action prompt
Success criteria: User completes first meaningful action"Pattern: Conditional Composition
Use when: Workflow depends on conditions
/compose-prompt "Create adaptive workflow for [goal]:
If [condition1]: [path1]
If [condition2]: [path2]
Default: [default path]"Learning Prompts
Pattern: Pattern Extraction
Use when: Identifying reusable patterns
/learn "From implementing [feature], key patterns are:
- Pattern 1: [description]
- Pattern 2: [description]
Best practices discovered: [insights]
Potential improvements: [ideas]"Pattern: Retrospective Learning
Use when: Completing major features
/learn "Retrospective on [feature]:
What worked well: [successes]
Challenges faced: [difficulties]
Solutions found: [approaches]
Future recommendations: [advice]"Advanced Patterns
Pattern: Multi-Perspective Prompts
Use when: Needing comprehensive analysis
/orchestrate "Analyze [feature] from perspectives:
- User: [user concerns]
- Developer: [development concerns]
- Operations: [operational concerns]
- Business: [business concerns]"Pattern: Scenario-Based Prompts
Use when: Planning for different situations
/orchestrate "Design [feature] handling scenarios:
- Happy path: [normal flow]
- Error scenario: [failure handling]
- Edge case: [unusual situation]
- Scale scenario: [high load handling]"Anti-Patterns to Avoid
Anti-Pattern: Overly Prescriptive
❌ Avoid:
/execute-task "Create file controllers/UserController.js with
exactly these methods in this order..."✅ Better:
/execute-task "Add user management endpoints following our patterns"Anti-Pattern: Ambiguous Intent
❌ Avoid:
/execute-task "Make it better"✅ Better:
/execute-task "Improve API response time by implementing caching"Anti-Pattern: Missing Context
❌ Avoid:
/execute-task "Add the feature we discussed"✅ Better:
/execute-task "Add password reset feature with email verification"Prompt Debugging
When Prompts Don't Work
Check Context
bash/status /discover-contextAdd Specificity
- Include examples
- Specify constraints
- Provide context
Break It Down
bash# Instead of one complex prompt /compose-prompt "Break down [complex task] into steps"Use Discovery
bash/research "Best approach for [challenge]"
Quick Reference Card
Basic Formula
/command "action + target + context + constraints"Examples
# Feature Implementation
/execute-task "Add [feature] that [does X] using [approach] with [constraints]"
# Planning
/orchestrate "Plan [goal] considering [context] with phases for [milestones]"
# Review
/review --focus "[specific concern] in [component]"
# Learning
/learn "Key insight: [pattern] works well for [use case] because [reason]"Practice Exercises
Convert these poor prompts to effective ones:
- "Add search"
- "Make it faster"
- "Fix the bug"
Create prompts for:
- Adding a notification system
- Optimizing database queries
- Implementing file uploads
Practice composition:
- Create a workflow for user registration
- Plan a feature rollout
- Design a testing strategy
Next Steps
- Study Integration Patterns
- Review Security Patterns
- Practice with Real Examples
- Read Command Reference
