.claude/skills/agentic-workflow-patterns/SKILL.md
Use when designing or choosing a multi-step AI workflow, deciding between an autonomous agent and a structured workflow, or when a task requires more than one LLM call and you need a pattern to orchestrate them reliably. Covers the five agentic workflow patterns — prompt chaining, routing, parallelization (sectioning and voting), orchestrator-workers, and evaluator-optimizer — when to use each, and how they map to the Truenorth agent and skill hierarchy. Domain: AI Architecture, Orchestration. Level: Advanced. Tags: agentic, workflows, orchestration, prompt-chaining, routing, parallelization, evaluator-optimizer.
npx skillsauth add klod68/littlerae agentic-workflow-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When a task requires more than one LLM call, developers reach for complexity by default — chaining calls without structure, building frameworks, or treating every problem as an autonomous agent. This leads to systems that are hard to debug, unreliable, and costlier than necessary.
The right question is not "should I use an agent?" but "which workflow topology fits this task, and is a workflow even needed?"
Single LLM call → Optimise the prompt. Start here. Most tasks end here.
│
▼
Workflow → LLMs and tools orchestrated through predefined code paths.
│ Predictable. Cheaper. Easier to debug.
▼
Agent → LLM dynamically directs its own process and tool use.
Flexible. Higher cost. Non-deterministic path.
Default to the simplest option that produces acceptable output. Only add a workflow or agent when a simpler approach demonstrably falls short.
A task is decomposed into a fixed sequence of LLM calls. Each call processes the output of the previous one. Optional gates (programmatic checks) sit between steps to catch drift early.
Input ──► [LLM Step 1] ──► Gate? ──► [LLM Step 2] ──► Gate? ──► [LLM Step 3] ──► Output
│ │
▼ fail ▼ fail
Abort / retry Abort / retry
When to use:
Examples:
Truenorth mapping: The SDLC Orchestrator's stage pipeline (Requirements → Design → Scaffold → Implement → Review → Docs) is a prompt chain with gates between each stage.
An initial classifier (LLM or rule-based) inspects the input and dispatches it to a specialised handler. Each handler is optimised for one class of input.
┌─► [Handler A: General Questions] ──► Output A
Input ──► [Router] ─┼─► [Handler B: Refund Requests] ──► Output B
└─► [Handler C: Technical Support] ──► Output C
When to use:
Examples:
Truenorth mapping: Orchestrators (SDLC, DevOps, Frontend, Library, Quality, Troubleshooting) are routers. They classify the incoming task and dispatch to the appropriate filter agent. The task-complexity-routing rule implements routing at the task-tier level (Trivial / Standard / Complex / Structural).
Multiple LLM calls run concurrently and their outputs are aggregated. Two variants:
┌─► [LLM Worker 1: Subtask A] ──┐
Input ──► [Split] ──┼─► [LLM Worker 2: Subtask B] ──┼──► [Aggregator] ──► Output
└─► [LLM Worker 3: Subtask C] ──┘
When to use sectioning:
Examples:
┌─► [LLM Instance 1] ──┐
Input ──► [Fanout] ─┼─► [LLM Instance 2] ──┼──► [Vote / Consensus] ──► Output
└─► [LLM Instance 3] ──┘
When to use voting:
Examples:
Truenorth mapping: The SDLC pipeline's Code Review stage dispatches Security Reviewer, Performance Reviewer, and Contract Reviewer concurrently (sectioning). The Quality Orchestrator runs multiple review filters in parallel over the same codebase.
A central LLM (the orchestrator) inspects the task, dynamically determines what subtasks are needed, delegates each to a worker LLM, and synthesises the results. The subtask list is not predefined — it is determined at runtime.
┌──► [Worker: edit file A] ──┐
Input ──► [Orchestrator LLM] ─┼──► [Worker: edit file B] ──┼──► [Synthesizer] ──► Output
(plans dynamically) └──► [Worker: add tests] ──┘
When to use:
Examples:
Key difference from parallelization: Parallelization runs predefined subtasks. Orchestrator-Workers determines subtasks dynamically from the input.
Truenorth mapping: The sdlc-orchestrator agent itself operates in this pattern when deciding which agents to invoke based on the specific task. A task requiring only a backend fix routes differently than one requiring new UI + new API + new tests.
One LLM generates a response. A separate LLM evaluates it against defined criteria and provides feedback. The generator refines based on the feedback. The loop repeats until evaluation passes or a maximum iteration count is reached.
Input ──► [Generator LLM] ──► [Evaluator LLM] ──► Pass? ──► Output
▲ │
│ feedback │ fail
└─────────────────────┘
(refine loop)
When to use:
Examples:
Stopping conditions: Always define a maximum iteration count. Unbounded loops compound cost and can oscillate.
Truenorth mapping: The Troubleshooting Orchestrator implements an evaluator-optimizer loop: diagnose → fix → verify → if failing, diagnose again. Code review with requested changes and re-review is the same pattern applied manually.
Apply this decision tree before designing any multi-LLM system:
Can a single, well-crafted prompt solve this?
Yes ──► Use a single LLM call. Done.
No ──► Continue.
Is the sequence of steps fixed and predictable?
Yes ──► Prompt Chaining
No ──► Continue.
Does the input type determine the approach?
Yes ──► Routing
No ──► Continue.
Are subtasks independent and known up front?
Yes ──► Parallelization (Sectioning)
No ──► Continue.
Do you need confidence through consensus?
Yes ──► Parallelization (Voting)
No ──► Continue.
Are subtasks determined dynamically at runtime?
Yes ──► Orchestrator-Workers
No ──► Continue.
Is the output iteratively improvable by an evaluator?
Yes ──► Evaluator-Optimizer
No ──► Continue.
Is the task open-ended with unpredictable tool use?
Yes ──► Autonomous Agent
No ──► Revisit. You may be over-engineering.
These patterns compose. Complex systems combine multiple:
| Combination | Example | |---|---| | Routing + Prompt Chaining | Route task type → run a tailored chain for each type | | Orchestrator-Workers + Parallelization | Orchestrator determines N subtasks → runs them in parallel | | Prompt Chaining + Evaluator-Optimizer | Each chain step has an inline evaluator loop before proceeding | | Routing + Voting | Classify input → run the matched handler N times → vote on result |
Prefer flat compositions over deeply nested ones. Each additional layer multiplies latency and cost.
The best workflow is often no workflow.
tools
Use when cross-cutting concerns (logging, metrics, validation, authorization) are tangled into command handlers or service methods, when building database command pipelines with reorderable concerns, or when HTTP client pipelines or message handlers need composable, independently-replaceable processing stages. Covers ICommandInterceptor interface, InterceptorPipeline with reverse-chain construction, zero-cost Empty sentinel to skip overhead when no interceptors are registered, and ConfigureAwait(false) discipline for library code. Domain: Architecture, Cross-Cutting Concerns. Level: Intermediate. Tags: interceptor, pipeline, middleware, decorator, cross-cutting-concerns.
development
Use when writing integration tests for Razor Pages, MVC, or Minimal API applications to validate routing, middleware, page rendering, and HTTP behavior without a browser or live server, or when adding fast smoke tests to a CI pipeline. Covers WebApplicationFactory<Program> setup with public partial class Program, in-memory test server, AngleSharp HTML parsing, CSS selector assertions, redirect and status code testing, and a shared static fixture pattern for minimal per-test startup overhead. Domain: Testing, ASP.NET Core. Level: Intermediate. Tags: integration-testing, webapplicationfactory, razor-pages, anglesharp, http-testing.
development
Use when designing indexes for new tables, diagnosing slow queries that are not using indexes efficiently, reviewing index fragmentation and maintenance, or when the current indexing strategy results in key lookups, table scans, or missing index warnings. Covers clustered index key selection (narrow, unique, ever-increasing), non-clustered index design for query patterns, covering indexes with INCLUDE columns, filtered indexes for subset queries, composite index column ordering, DMV-based monitoring for missing and unused indexes, and rebuild vs reorganize maintenance thresholds. Domain: Database, Performance. Level: Intermediate. Tags: index, sql-server, covering-index, filtered-index, performance, dmv, maintenance.
development
Use when building a searchable in-memory catalog or registry for documentation sites, admin panels, or type/API browsers where you need keyword matching, fuzzy search, and ranked results without an external search engine or database. Covers RegistryService with weighted scoring across name, description, keywords, and method names; Levenshtein fuzzy matching; synonym expansion; category and subcategory filtering; and singleton DI registration for datasets of hundreds to low thousands of items. Domain: Search, Data Access Patterns. Level: Intermediate. Tags: search, registry, fuzzy-matching, in-memory, catalog, filtering.