Reasoning Sandwich Pattern

SkillAI & models

Template for pre-reasoning → action → post-verification model allocation

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Reasoning Sandwich Pattern skill

What this skill tells your AI

The instructions your AI receives, as published by baekenough/oh-my-customcode in .claude/skills/reasoning-sandwich/SKILL.md and read by ahel’s review.

Purpose

A model allocation pattern that wraps implementation actions with stronger-model reasoning phases. The "sandwich" structure ensures complex tasks get proper analysis before and verification after the core action.

Pattern

[Pre-reasoning] → stronger model (opus)
  ├── Analyze requirements
  ├── Identify edge cases
  └── Define success criteria

[Action] → balanced model (sonnet)
  ├── Implement solution
  ├── Generate code/content
  └── Execute plan

[Post-verification] → balanced or lighter model (sonnet/haiku)
  ├── Verify against criteria
  ├── Check for regressions
  └── Validate completeness

Model Allocation Table

PhaseRecommended ModelRationale
Pre-reasoning (analyze/plan)opusComplex architectural reasoning, edge case detection
Pre-reasoning (Opus 4.8)opus48Opus 4.8 makes fewer tool calls and reasons more deeply; pre-reasoning phase should include explicit tool batch planning
Action (implement/generate)sonnetOptimized for code generation, balanced cost
Post-verification (review/test)sonnet or haikuStructural verification, checklist validation

When to Apply

ScenarioApply Sandwich?Reason
New feature implementationYesNeeds analysis → code → verification
Bug fix with clear root causeNoDirect action sufficient
Architecture decisionYesHeavy pre-reasoning, lighter action
Batch file editsNoMechanical action, no reasoning needed
Security-sensitive changesYesExtra verification phase critical

Integration

This pattern is used by:

  • structured-dev-cycle — stages map to sandwich phases
  • evaluator-optimizer — generator/evaluator model selection guidance
  • deep-plan — research (pre) → plan (action) → verify (post)

Anti-patterns

Anti-patternProblemFix
Opus for everythingWasteful, slowReserve opus for reasoning-heavy phases
Haiku for planningInsufficient depthUse opus for complex analysis
Skipping verificationFalse completion riskAlways include post-verification phase
Forcing frequent tool calls on Opus 4.8Fights model's natural reasoning-first tendencyLet Opus 4.8 reason; batch tool calls in pre-reasoning

Opus 4.8 Considerations

Opus 4.8 exhibits a distinct behavioral pattern: fewer tool calls with deeper reasoning per call. This affects how the sandwich pattern is applied:

AspectOpus 4.6Opus 4.8
Tool call frequencyModerateLower
Reasoning depth per callStandardDeeper
Pre-reasoning benefitPlan what to checkPlan explicit tool batch — model will under-call if not guided

Pre-reasoning Adjustment for Opus 4.8

When using Opus 4.8 in the pre-reasoning phase:

  1. Explicitly enumerate tools needed — Opus 4.8 may skip tool calls it deems unnecessary
  2. Batch tool-call plans upfront — structure the action phase with a concrete tool sequence
  3. Prefer fewer, richer tool calls — align with the model's natural tendency

Reference: Best practices for using Claude Opus 4.8 with Claude Code

Signals

GitHub stars
34
Forks
6
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
reasoning-sandwich
Source
github.com/baekenough/oh-my-customcode