Tutorial 2: Understanding Dynamic Prompts
In this tutorial, we'll explore what makes Orchestre's prompts "dynamic" and how they differ from traditional static approaches. You'll learn to leverage this power for more intelligent development workflows.
Learning Objectives
By the end of this tutorial, you'll understand:
- ✅ Dynamic vs static prompt philosophy
- ✅ How prompts discover and adapt
- ✅ Context-aware command execution
- ✅ Prompt composition techniques
- ✅ The intelligence emergence pattern
Prerequisites
- Completed "Your First Project" tutorial
- Basic understanding of AI assistants
- 45 minutes of time
What Are Dynamic Prompts?
Static Approach (Traditional)
# Static template - always does the same thing
create-react-component Button --typescript --with-testsDynamic Approach (Orchestre)
# Discovers context and adapts
/orchestre:execute-task (MCP) "Create a Button component"The dynamic prompt:
- Discovers existing component patterns
- Adapts to your project's style
- Considers the current context
- Suggests appropriate implementations
Experiment 1: Context Discovery
Let's see dynamic prompts in action. In your task-api project:
/orchestre:orchestrate (MCP) "Add user authentication to the API"Observe the Analysis
Notice how Orchestre:
- Recognizes you have a Cloudflare Workers project
- Suggests edge-compatible authentication
- Considers your existing API patterns
- Proposes a plan that fits your architecture
The output adapts to what it discovered:
🎯 Orchestration Plan: Edge Authentication
## Context Discovery
- Project Type: Cloudflare Workers API
- Existing Pattern: RESTful endpoints
- Storage: In-memory (needs upgrade for auth)
- Framework: Hono with TypeScript
## Adaptive Recommendations
Since you're using Cloudflare Workers:
- JWT-based authentication (stateless)
- KV storage for refresh tokens
- Edge-compatible crypto libraries
- Middleware pattern for protectionExperiment 2: Adaptive Implementation
Now execute a task without being specific:
/orchestre:execute-task (MCP) "Add a new feature for task categories"Watch the Adaptation
Orchestre will:
- Examine your existing Task model
- Identify your API patterns
- Implement consistently with your style
- Update related endpoints automatically
Compare this to a static approach that would require:
- Manually updating the model
- Remembering to update each endpoint
- Maintaining consistency yourself
- Updating documentation
Experiment 3: Learning from Context
Add some custom code manually to your project:
// src/utils/custom-validator.ts
export function validateTaskTitle(title: string): boolean {
return title.length >= 3 && title.length <= 100
}Now ask Orchestre to add validation:
/orchestre:execute-task (MCP) "Add validation for task descriptions"See the Intelligence
Orchestre will:
- Find your custom validator pattern
- Create a similar validator for descriptions
- Use the same style and location
- Integrate it consistently
This is impossible with static templates!
Experiment 4: Prompt Composition
Dynamic prompts can be composed for complex tasks:
/compose-prompt "I need to add real-time updates to tasks, but I'm not sure how to approach it with Cloudflare Workers"Intelligent Response
The composed prompt will:
- Research Cloudflare's real-time capabilities
- Suggest WebSockets or Server-Sent Events
- Consider Durable Objects for coordination
- Provide a complete implementation strategy
Understanding the Magic
Discovery Phase
Every dynamic prompt starts with discovery:
Adaptation Mechanisms
Pattern Recognition
- Finds existing code patterns
- Maintains consistency
- Evolves with your project
Context Integration
- Reads CLAUDE.md files
- Considers recent changes
- Understands project goals
Intelligent Defaults
- Makes smart assumptions
- Asks when uncertain
- Learns from corrections
Practical Examples
Example 1: Feature Addition
# Static way - rigid, predefined
rails generate scaffold Product name:string price:decimal
# Dynamic way - adaptive, intelligent
/orchestre:execute-task (MCP) "Add a products feature to my API"The dynamic approach:
- Matches your existing patterns
- Uses your validation style
- Integrates with your auth
- Updates your documentation
Example 2: Refactoring
# Static way - manual, error-prone
# Must update every file yourself
# Dynamic way - intelligent, thorough
/orchestre:execute-task (MCP) "Refactor task storage to use KV instead of memory"The dynamic approach:
- Identifies all storage touchpoints
- Maintains API compatibility
- Updates tests if present
- Documents the migration
Example 3: Problem Solving
# Static way - no help
# You're on your own
# Dynamic way - intelligent assistance
/orchestre:orchestrate (MCP) "My API is slow, help me optimize it"The dynamic approach:
- Analyzes your specific code
- Identifies bottlenecks
- Suggests targeted optimizations
- Provides implementation guidance
Advanced Techniques
1. Contextual Hints
Provide context for better adaptation:
/orchestre:execute-task (MCP) "Add caching (we expect high read traffic)"2. Learning Loops
Let Orchestre learn from your project:
/learn # Extract patterns
/orchestre:execute-task (MCP) "Add another endpoint following our patterns"3. Exploratory Prompts
Use uncertainty to your advantage:
/orchestre:orchestrate (MCP) "What's the best way to add search functionality?"4. Meta-Prompts
Create prompts that create prompts:
/compose-prompt "Help me design a prompt for building a complex feature"Common Patterns
The Discovery Pattern
/orchestre:orchestrate (MCP) "Analyze my project and suggest improvements"The Adaptive Pattern
/orchestre:execute-task (MCP) "Add [feature] following existing patterns"The Learning Pattern
/learn
/orchestre:execute-task (MCP) "Apply these patterns to [new feature]"The Composition Pattern
/compose-prompt "Complex requirement with multiple concerns"Practice Exercise
Try these experiments to deepen your understanding:
1. Pattern Evolution
# Add a custom pattern
/orchestre:execute-task (MCP) "Create a custom error handler with logging"
# See it adapted
/orchestre:execute-task (MCP) "Add error handling to task deletion"2. Context Building
# Build context
/update-state "We're building this for a startup with 1000 users"
# See adapted suggestions
/orchestre:orchestrate (MCP) "How should we prepare for scale?"3. Intelligent Refactoring
# Let Orchestre analyze and improve
/suggest-improvements
/orchestre:execute-task (MCP) "Implement the top performance improvement"Key Insights
1. Discovery Over Prescription
Dynamic prompts discover what you need rather than prescribing solutions.
2. Adaptation Over Rigidity
They adapt to your project rather than forcing you to adapt to them.
3. Intelligence Over Automation
They help you think better, not just execute faster.
4. Context Over Configuration
They understand context rather than requiring configuration.
Common Misconceptions
"It's Just Templates with Variables"
No! Dynamic prompts:
- Analyze your entire project
- Learn from your patterns
- Adapt their behavior
- Generate novel solutions
"It's Unpredictable"
Actually, dynamic prompts are:
- Consistent with your patterns
- Predictable in approach
- Transparent in reasoning
- Controllable through context
"It's Overkill for Simple Tasks"
Dynamic prompts shine when:
- Projects evolve
- Requirements change
- Patterns emerge
- Complexity grows
Troubleshooting
Prompts Not Adapting?
- Check CLAUDE.md is updated
- Use
/learnto extract patterns - Provide more context in commands
- Review project structure
Unexpected Behavior?
- Use
/statusto check context - Run
/orchestre:review (MCP)for analysis - Clear context with
/update-state - Provide explicit hints
What You've Learned
✅ Dynamic prompts discover and adapt ✅ Context awareness drives intelligence ✅ Composition enables complex tasks ✅ Learning loops improve results ✅ Intelligence emerges from exploration
Next Steps
You now understand the core philosophy of dynamic prompts. This foundation will help you leverage Orchestre's full power.
Continue to: Working with Templates →
Explore further:
- Try
/compose-promptwith complex requirements - Experiment with
/learnand pattern application - Use
/interpret-stateto understand context
Remember: Dynamic prompts are partners in thinking, not just tools for execution!
