Prompt Patterns

Dependency Decomposition

Solves complex problems by progressively establishing prerequisite answers so that later steps become solvable.

Also known asLeast-to-Most PromptingProgressive Problem Solving
Dependency Decomposition pattern diagram

Problem

Complex answers fail when prerequisites are not established first; the model guesses missing enablers and produces brittle conclusions.

Solution

Sequence subproblems by prerequisite dependency so each step enables the next. Earlier outputs become explicit working context, making later reasoning tractable and grounded.

Example

One worked example. The book has 2–4 per technique.

Prompt
Answer the following questions in order. Use your previous answers to inform each subsequent answer.

1. What information is needed to estimate the timeline for migrating a PostgreSQL database to a managed cloud service?
2. Given that our database is 500 GB with 200 tables, 40 stored procedures, and an acceptable downtime window of 2 hours, which of those factors most affect the timeline?
3. Based on those factors, estimate a timeline broken into phases.
Response
1. Key information needed: database size, number and complexity of tables, stored procedures and triggers, application-level dependencies on database-specific features, acceptable downtime window, network bandwidth between source and target, and whether the migration can use logical replication for near-zero downtime.

2. The dominant factors for this migration are:
   - **40 stored procedures** — each must be tested for compatibility with the managed service, and some may require rewriting if they use unsupported extensions.
   - **2-hour downtime window** — this is tight for 500 GB and likely requires pre-staging via logical replication rather than a dump-and-restore approach.
   - **500 GB size** — large enough that the initial data transfer must be planned around network bandwidth.

3. Estimated timeline:
   - **Week 1-2:** Environment setup, compatibility audit of stored procedures, replication configuration
   - **Week 3:** Rewrite incompatible stored procedures, begin logical replication to pre-stage data
   - **Week 4:** Application testing against the managed service, performance validation
   - **Week 5:** Cutover rehearsal with simulated 2-hour window, then production cutover

   Total: approximately 5 weeks, with the stored procedure compatibility work as the most likely source of schedule risk.

Techniques

Concrete ways to implement Dependency Decomposition. Each technique fits a different situation.

  • 01

    Sequential Dependency

    Structure the questions in dependency order yourself so each answer establishes prerequisites the next step needs.

  • 02

    Self-Directed Dependency

    Instruct the model to discover its own prerequisites, answer those first, then proceed to the original question.

Prompt Patterns book cover

Full treatment in the book

Dependency Decomposition — the complete chapter

  • Mechanism — why this pattern works
  • 2–4 worked examples per technique
  • Placement, sequencing, and debugging rules
  • Composition with related patterns