Modular Design

Domain: Prompt Engineering

🎯 Motivation

Breaking prompts into reusable modules (instructions, examples, constraints) that can be mixed and matched for different tasks.

πŸ“‹ Concrete Example

Module A: β€˜You are a Python tutor.’ Module B: β€˜Explain [concept].’ Module C: β€˜Include a code example.’ Module D: β€˜Max 200 words.’ For different tasks, swap modules: use Module A + B + D for a brief explanation, A + B + C + D for a full one.

πŸ”— Analogy

Lego blocks - you have different pieces (modules) that snap together. A car chassis + wheels + steering wheel = a car. Swap wheels for tank treads = a tank. Modular design lets you build different prompts from reusable parts.