Skip to content

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) ​

bash
# Static template - always does the same thing
create-react-component Button --typescript --with-tests

Dynamic Approach (Orchestre) ​

bash
# Discovers context and adapts
/orchestre:execute-task (MCP) "Create a Button component"

The dynamic prompt:

  1. Discovers existing component patterns
  2. Adapts to your project's style
  3. Considers the current context
  4. Suggests appropriate implementations

Experiment 1: Context Discovery ​

Let's see dynamic prompts in action. In your task-api project:

bash
/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 protection

Experiment 2: Adaptive Implementation ​

Now execute a task without being specific:

bash
/orchestre:execute-task (MCP) "Add a new feature for task categories"

Watch the Adaptation ​

Orchestre will:

  1. Examine your existing Task model
  2. Identify your API patterns
  3. Implement consistently with your style
  4. 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:

typescript
// src/utils/custom-validator.ts
export function validateTaskTitle(title: string): boolean {
  return title.length >= 3 && title.length <= 100
}

Now ask Orchestre to add validation:

bash
/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:

bash
/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 ​

  1. Pattern Recognition

    • Finds existing code patterns
    • Maintains consistency
    • Evolves with your project
  2. Context Integration

    • Reads CLAUDE.md files
    • Considers recent changes
    • Understands project goals
  3. Intelligent Defaults

    • Makes smart assumptions
    • Asks when uncertain
    • Learns from corrections

Practical Examples ​

Example 1: Feature Addition ​

bash
# 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 ​

bash
# 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 ​

bash
# 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:

bash
/orchestre:execute-task (MCP) "Add caching (we expect high read traffic)"

2. Learning Loops ​

Let Orchestre learn from your project:

bash
/learn  # Extract patterns
/orchestre:execute-task (MCP) "Add another endpoint following our patterns"

3. Exploratory Prompts ​

Use uncertainty to your advantage:

bash
/orchestre:orchestrate (MCP) "What's the best way to add search functionality?"

4. Meta-Prompts ​

Create prompts that create prompts:

bash
/compose-prompt "Help me design a prompt for building a complex feature"

Common Patterns ​

The Discovery Pattern ​

bash
/orchestre:orchestrate (MCP) "Analyze my project and suggest improvements"

The Adaptive Pattern ​

bash
/orchestre:execute-task (MCP) "Add [feature] following existing patterns"

The Learning Pattern ​

bash
/learn
/orchestre:execute-task (MCP) "Apply these patterns to [new feature]"

The Composition Pattern ​

bash
/compose-prompt "Complex requirement with multiple concerns"

Practice Exercise ​

Try these experiments to deepen your understanding:

1. Pattern Evolution ​

bash
# 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 ​

bash
# 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 ​

bash
# 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 /learn to extract patterns
  • Provide more context in commands
  • Review project structure

Unexpected Behavior? ​

  • Use /status to 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-prompt with complex requirements
  • Experiment with /learn and pattern application
  • Use /interpret-state to understand context

Remember: Dynamic prompts are partners in thinking, not just tools for execution!

Built with ❤️ for the AI Coding community, by Praney Behl