Session 2

Advanced Patterns & Complete Workflows — from simple templates to orchestrated systems

Joey Lopez · Prompt Engineering Bootcamp · 60 minutes

Session Agenda

TimeActivityType
0–5 minSession 1 Recap + Advanced Patterns OverviewLecture
5–10 minSpec-Kit MethodologyLecture
10–15 minReAct + Tree of ThoughtsLecture
15–25 minDemo: Interview Prep WorkflowHands-on
25–40 minYour Turn: Build Interview MaterialsHands-on
40–55 minLive Java Demo: Spring MigrationHands-on
55–60 minIntegration + Next StepsLecture

Session 1 Recap

In Session 1 you built the foundation:

Session 2 evolves each of those: simple patterns become orchestrated workflows, single-step tasks become multi-phase reasoning, and the same methodology scales from priorities to interviews to code.

Advanced Patterns

When a single prompt with four foundational patterns isn't enough for complex, multi-step tasks, two research-backed patterns handle the gap:

ReAct Pattern

From Yao et al. (2022). Designed for tasks that require validation checkpoints between steps — where you can't know the next action until you observe the result of the current one.

THINK: Analyze the situation — what's actually being asked?

ACT: Take a specific, concrete action

OBSERVE: Check results — did it work? What changed?

THINK: Next steps based on what you observed

Repeat until task complete

When to use: Multi-step tasks where each step depends on the previous result. Code migration, gap analysis, systematic positioning strategy.

Tree of Thoughts

From Yao et al. (2023). Designed for decision points where multiple valid approaches exist and the right choice requires explicit evaluation of tradeoffs.

1. Generate 3 genuinely different approaches to the problem
2. Evaluate pros/cons/risks of each approach explicitly
3. Choose the best approach with clear rationale
4. Proceed with that choice

When to use: Any decision point with real tradeoffs. Interview positioning strategy, architecture choices, migration approach selection.

When Simple Patterns Are Enough

Use Foundational Patterns (Session 1)

  • Single-step tasks
  • Well-understood domains
  • Template-driven outputs
  • Quick iterations needed

Use Advanced Patterns (Session 2)

  • Multi-step reasoning required
  • Decision points with tradeoffs
  • Complex domain knowledge
  • Audit trail needed
  • Team scalability important

Decision rule: Use the simplest approach that handles the complexity. Don't reach for ReAct when a good Persona + Template covers it.

Spec-Kit 4-File Workflow

The spec-kit pattern separates concerns across files so each piece can be reused, updated independently, and understood by teammates without context from your head.

File 1
knowledge-base.md
Domain expertise. Reusable across tasks. STAR method, positioning options, evaluation criteria.
File 2
specification.md
This task's specific requirements. Role details, candidate background, gaps and strengths.
File 3
implementation-plan.md
Execution strategy using ReAct + Tree of Thoughts. Reasoning documented.
File 4
execution.md
Generated materials — positioning statement, STAR examples, talking points.

Key advantage: Separation of concerns. knowledge-base.md stays reusable; specification.md is the only file that changes per task; execution.md is throwaway.

Exercise: Build Interview Strategy

Phase 1 — Create specification.md (8 minutes)

  1. Start with the provided knowledge-base.md (interview fundamentals, STAR method, positioning options)
  2. Select a job from the participant materials (Senior Manager AI Strategy, Principal Consultant Banking, Director Digital Transformation)
  3. Pick the same demo persona you used in Session 1 for continuity
  4. Document: target role details, your persona's background, key gaps and key strengths

Phase 2 — Execute implementation-plan.md (7 minutes)

ReAct Analysis

THINK: What is the biggest gap between my background and this role?
ACT: Map my specific experience to each key requirement
OBSERVE: What positioning angle emerges from this mapping?
THINK: How do I turn gaps into learning narratives?
ACT: Develop core connecting story: past experience → role requirements

Tree of Thoughts Strategy

Option A: Technical Expert
  Pros: Deep credibility, clear differentiation
  Cons: May undersell business acumen, narrow appeal
  Risk: Medium

Option B: Strategic Leader
  Pros: Broad appeal, executive positioning
  Cons: May lack specificity, needs strong evidence
  Risk: Medium

Option C: Balanced Bridge
  Pros: Technical depth + business growth story
  Cons: Harder to articulate concisely
  Risk: Low

Selected: [Your choice with rationale]

Success criteria: Clear positioning strategy with documented rationale, not just a chosen answer.

Live Java Demo: Spring Boot Migration

Same patterns, technical domain. Spring Boot 2→3 migration involves three types of changes: namespace updates (javaxjakarta), annotation modernization, and security configuration updates.

The three approaches from Session 1 apply directly:

Approach A — ADRs + Config

A .github/copilot-instructions.md that documents migration standards. Single prompt referencing that document handles most cases.

"Following .github/copilot-instructions.md migration standards,
migrate UserController to Spring Boot 3"

Approach B — Structured Files (with ReAct)

A spec/ folder workflow. ReAct pattern in the implementation plan:

THINK: Dependencies must be updated before annotations
ACT: Update javax → jakarta imports first
OBSERVE: mvn compile — success, proceed to annotations
THINK: Security config needs modernization next
ACT: Migrate to SecurityFilterChain pattern

Approach C — Tool-Assisted (Windsurf)

290-line cascade workflow. Built-in validation gates at each step. Tree of Thoughts for security config decision:

  • Option A: Keep current security config (low risk, technical debt remains)
  • Option B: Modernize to SecurityFilterChain (balanced)
  • Option C: Full OAuth2 rewrite (high risk, high reward)
  • Decision: Option B — balanced modernization

Cross-Domain Pattern Recognition

The same cognitive patterns appear across all three domains in this workshop:

Universal pattern: ReAct

  • Priorities: Think what category fits → Act on metrics → Observe quality → Refine
  • Interview: Think about gap → Act on positioning → Observe fit → Select strategy
  • Code: Think dependencies → Act on imports → Observe compilation → Continue

The domain changes. The systematic thinking doesn't.

What You Now Have

Evaluation Framework

  • Three Approaches — ADRs vs Structured vs Tool-assisted
  • Tier Assessment — proven vs emerging vs experimental

Pattern Library

  • Foundational: Persona, Few-shot, Template, Chain-of-Thought
  • Advanced: ReAct, Tree of Thoughts, Spec-Kit

This Week

  1. Apply ReAct pattern to one complex work decision
  2. Use Tree of Thoughts for your next strategic choice — write out the three options explicitly
  3. Create a spec-kit workflow for one task you do repeatedly

Longer Term

Research Papers

  • White et al. (2023) — Prompt Pattern Catalog · arXiv 2302.11382
  • Yao et al. (2022) — ReAct Pattern · arXiv 2210.03629
  • Yao et al. (2023) — Tree of Thoughts · arXiv 2305.10601
.md