本文へ移動
cccskills
無料GitHub で公開

agentic-patterns

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use jury_rig-architect), specific tool implementation.

インストール方法を見る

含まれるファイル(5)

  • SKILL.md14.1 KB
  • references/converted-patterns.md1.3 KB
  • references/effect-reconciliation.md945 B
  • references/evidence-and-control-loop.md1.8 KB
  • references/INDEX.md271 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

/agentic-patterns — Fundamentals of Effective Agent Behavior

You are teaching effective agentic patterns. These are model-agnostic principles — they work for Claude, GPT, Gemini, or any LLM acting as an agent. The goal: agents that decompose well, use tools precisely, recover from errors, manage their context budget, assess their own quality, and know when to stop.


When to Use

Use for:

  • Designing the control flow of a multi-step agent
  • Choosing between sequential, parallel, and hierarchical agent architectures
  • Implementing error recovery and graceful degradation
  • Managing context window budget across long agent runs
  • Building quality self-assessment into agent outputs
  • Deciding when an agent should halt vs continue

NOT for:

  • Building agent infrastructure or frameworks (use agent-creator)
  • Designing DAG topologies (use jury_rig-architect)
  • Implementing specific tools (use the domain-specific skill)
  • Prompt optimization (use prompt-engineer)

The Five Pillars

Every effective agent embodies five capabilities:

1. DECOMPOSE  — Break the problem into steps before acting
2. ORCHESTRATE — Choose and sequence tools with purpose
3. RECOVER    — Handle failures without catastrophe
4. MANAGE     — Spend context tokens like a budget
5. ASSESS     — Know how well you did, and when to stop

Pillar 1: Decomposition

The Rule of Three Passes

Before acting, make scoped passes over the task as its risk and uncertainty require:

Pass 1 — Scope: What does "done" look like? Define the exit condition first.

Pass 2 — Subtasks: What concrete steps and dependency boundaries are needed to reach "done"? Each step should be achievable with a single tool call or a small chain of tool calls.

Pass 3 — Dependencies: Which steps depend on which? Independent steps can parallelize. Dependent steps must serialize.

Decomposition Anti-Patterns

Anti-PatternWhy It FailsFix
Acting before decomposingWasted tool calls, wrong directionAlways plan first, even briefly
One giant subtaskNo independent verification or ownershipSplit at real effect or verification boundaries
Many subtasksCognitive overhead, lost contextMerge or split based on dependency and review cost
No exit conditionAgent runs foreverDefine "done" before starting
Static planCan't adapt to discoveriesReplan after each wave of results

When to Re-Decompose

Replan when:

  • A tool call returns unexpected results
  • You discover the problem is different from what you assumed
  • A dependency fails and the downstream plan is invalid
  • A material dependency, observation, or risk changes the plan’s basis

Pillar 2: Tool Orchestration

The Minimum Tool Principle

Use the fewest tools with the narrowest scope to accomplish each subtask. Every tool call has costs:

  • Tokens consumed (input + output)
  • Latency added
  • Error surface increased
  • Context budget spent

Wrong: Read 20 files to understand a codebase. Right: Grep for the specific symbol, read the 2-3 files that contain it.

Tool Selection Heuristics

NeedPreferred ToolWhy
Find a file by nameGlobDirect pattern match, no content scanning
Find content in filesGrepTargeted search, returns locations
Understand a specific fileReadFull context for one file
Understand a codebaseTask (explore agent)Delegates exploration, protects context
Make a small changeEditMinimal diff, preserves surrounding code
Create something newWriteFresh file, no edit conflicts
Run a commandBashSystem interaction, build/test
Complex sub-problemTask (subagent)Isolates context, parallelizable

Sequential vs Parallel

Sequential work passes each result to the next action. Parallel work collects independent results before synthesis. See references/evidence-and-control-loop.md for rendered control-loop diagrams.

Rule: If two tool calls don't share data, run them in parallel. If one needs the other's output, serialize them.

The Subagent Decision

Spawn a subagent (Task tool) when:

  • The sub-problem has a bounded question whose exploration would otherwise crowd out integration
  • The work is independent and can be described in one paragraph
  • You need to explore broadly (many files, web search) without polluting your context
  • The sub-problem maps to a known skill (code review, testing, research)

Do NOT spawn a subagent when:

  • The task is a single tool call
  • You need the result immediately for your next sentence
  • The overhead of describing the task exceeds the overhead of doing it

Pillar 3: Error Recovery

The Recovery Ladder

When a tool call fails, escalate through four levels:

Level 1 — Classify, then retry when justified: A rejected read or an input-validation failure can often be retried after correction. Before repeating a write, determine whether it may already have taken effect; an ambiguous outcome requires reconciliation or target-enforced idempotency. A retry count is a task-specific budget, not a universal rule.

Level 2 — Alternative approach: Use a different tool or strategy to achieve the same goal. If Edit fails, try a different Edit. If Grep finds nothing, try Glob with a different pattern.

Level 3 — Complete independent work: If a dependency is blocked, finish the authorized parts that do not depend on it and retain a concrete handoff. Partial results do not change the requested exit condition or make the task complete.

Level 4 — Request missing input or authority: Name the actual blocker and evidence. Ask as soon as a required user decision is clear; do not perform unsafe retries merely to exhaust a ladder.

Error Recovery Anti-Patterns

Anti-PatternConsequenceFix
Repeat a failed call without new evidenceDuplicate effects or wasted workClassify the outcome, then use a justified recovery step
Ignore the error and continueCascading failures downstreamEvery error must be handled
Quietly reduce the requested taskUser gets less than they asked forPreserve the exit condition; report the exact blocked portion
Abandon a recoverable taskUseful authorized work remainsContinue concrete independent steps; escalate real dependencies

Structured Error Handling

When a tool call fails:

  1. Read the error message carefully — it usually tells you what's wrong
  2. Diagnose: Is the request known not to have executed, known applied, or uncertain? Separately classify transient versus structural failure.
  3. Act: Apply the appropriate recovery level
  4. Report: If the error affects the final output, note it transparently

External effects: unknown is a state

A timeout after a local or remote write is neither success nor failure. Record the intended effect, stable idempotency identity, authorization used, observed receipt, and reconciliation query. Resume by re-grounding from the authoritative external state; retry only with a target-enforced duplicate-suppression contract, or authoritative absence plus a mechanism preventing the earlier attempt from committing later. If the provider cannot answer, leave the effect unknown and escalate rather than creating a second successor. Local workspace rollback cannot undo remote effects. See references/effect-reconciliation.md.


Pillar 4: Context Management

Context is a Budget

Every token in your context window costs money and attention. Treat context like a budget:

  • Income: User message, tool results, retrieved content
  • Spending: Each tool call adds to context
  • Savings: Subagents isolate expensive exploration
  • Debt: Unnecessary reads/searches that you can't un-read

Reserve room for synthesis

Reserve a task-specific synthesis budget. Stop research when another read is less valuable than integrating the evidence already obtained.

Context-Efficient Patterns

PatternHowSaves
Targeted readsRead specific line ranges, not whole filesDepends on the relevant fraction of the file
Grep before readFind the exact location, then read only that sectionAvoids reading irrelevant files
Subagent delegationExpensive exploration happens in isolated contextProtects main context
Summarize earlyAfter a research phase, write a summary before continuingPrevents re-reading
Batch tool callsRun independent calls in parallelReduces round trips

What NOT to Load Into Context

  • Entire files when you need 10 lines
  • Build output or test logs beyond the relevant failure
  • Files you've already read and understood
  • Exploratory searches when you already know the answer

Pillar 5: Quality Self-Assessment

Evidence before self-ratings

Assess completeness against the requested deliverables and correctness against the available acceptance evidence. Record completed, missing, blocked and unverified items separately. Passing a named test is evidence for that test's scope, not probability 1 that an artifact is correct.

If an application genuinely needs numerical confidence, define the event being forecast and calibrate predictions against held-out labeled outcomes. A verbal self-rating or a convenient decimal is not automatically a probability. Keep task coverage, correctness forecasts and expected benefit of further work as different quantities.

When to Stop

Finish when the requested exit condition and matching acceptance checks are satisfied. Pause dependent work when a required input or authority is missing, while continuing useful independent work. Use explicit time, cost or context limits where the task supplies them; report unmet deliverables when a real limit prevents completion.

Continue when the exit condition remains unmet and there is a concrete authorized next step that can resolve a material gap. Do not replace the user's completion requirement with an invented confidence threshold or stop because a turn is getting long.

The "One More Thing" Trap

Resist the urge to add improvements the user didn't ask for. Every "one more thing" costs tokens, risks introducing bugs, and delays delivery. If you see an improvement opportunity, note it in your response — don't implement it unasked.


Architecture Patterns

Pattern 1: Scout-Then-Act

Scout, plan, act, and verify are distinct phases; findings may revise the plan before an authorized effect.

Best for: Bug fixes, feature additions, refactoring. You need to understand before you change.

Pattern 2: Parallel Fan-Out

Run independent research in one bounded wave, synthesize it, then decide whether implementation is authorized.

Best for: Tasks requiring multiple independent information sources. Research tasks, competitive analysis, multi-file understanding.

Use fan-out only after a single-worker plan is written. Add workers when the task has independently verifiable branches and the expected coordination cost is bounded; serialize coupled edits and unresolved effect reconciliation.

Pattern 3: Iterative Refinement

Produce a draft, evaluate it against stated criteria, repair the most material gap, and stop when the task-specific exit condition or budget says to stop.

Best for: Creative tasks, code generation, content production. Each pass improves quality.

Pattern 4: Staged Pipeline

The pipeline is extraction, filtering, enrichment, then synthesis. Its stage count and stopping rule depend on the task and evidence budget.

Best for: Data processing, research synthesis, skill compression. Each stage narrows the working set.


Quality Checklist

Before considering an agentic task complete:

[ ] Exit condition defined before starting
[ ] Task decomposed into concrete, independently checkable subtasks
[ ] Dependencies identified (what must serialize vs parallelize)
[ ] Each tool call has a clear purpose (no exploratory fishing)
[ ] Errors handled at the appropriate recovery level
[ ] Context budget tracked with a task-specific synthesis reserve
[ ] Output addresses every part of the user's request
[ ] Confidence self-assessed on completeness and correctness
[ ] Improvements not requested by user noted but not implemented
[ ] Clear stopping point reached (exit condition met)

The Meta-Pattern

All five pillars follow one meta-pattern: think before acting, act with precision, assess after acting.

Think sets goal and evidence needs; act takes the narrowest authorized action; assess checks the observed result and whether the exit condition is met.

Agents that skip THINK waste tokens exploring. Agents that skip ASSESS don't know when to stop. Agents that skip ACT just plan forever. All three, in that order, every cycle.

Bundle navigation

references index.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

日本語の概要は準備中です。原文の説明を表示しています。

curiositech/port-daddy22026年10月8日 更新

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

日本語の概要は準備中です。原文の説明を表示しています。

curiositech/port-daddy22026年10月8日 更新

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

日本語の概要は準備中です。原文の説明を表示しています。

curiositech/port-daddy22026年10月8日 更新

Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

日本語の概要は準備中です。原文の説明を表示しています。

curiositech/port-daddy22026年10月8日 更新

Use for insight, reframing, contradiction, impasse, and anomaly-driven problem solving when execution effort no longer helps. NOT for routine optimization, error correction, or well-specified tasks with known solution paths.

日本語の概要は準備中です。原文の説明を表示しています。

curiositech/port-daddy22026年10月8日 更新

Apply cognitive task analysis to expert work that depends on perceptual cues, branching judgment, and recurring monitoring loops. Use when decomposing expert capability into agent structure, simulation design, or validation interviews. NOT for ordinary step-by-step SOP capture or simple pipelines with no tacit cue layer.

日本語の概要は準備中です。原文の説明を表示しています。

curiositech/port-daddy22026年10月8日 更新

curiositech のスキルをすべて見る

このスキルの問題を報告する