All skills
aktsmm avatar

/agentic-workflow-guide

@fb34748
by yamapanaktsmm/agent-skills26 stars
4

Design, review, and debug agent workflows, and decide when a request should use a prompt, instruction, skill, agent, or hook before escalating to multi-agent design. Use for .agent.md / .instructions.md / .prompt.md / AGENTS.md work, workflow architecture, orchestration planning, scheduled automation model allocation, or when agent workflows may be overkill. Triggers on 'agent workflow', 'create agent', 'automation models', 'ワークフロー設計', 'orchestrator'.

Use this Skill: https://skilld.dev/gh/aktsmm/agent-skills/agentic-workflow-guide

This session only. Nothing lands on disk.

referencesdesign-principles.md

≈7.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Design Principles

A collection of principles for designing agent workflows.

Table of Contents


Tier 1: Core Principles (Essential)

1. SSOT (Single Source of Truth)

Manage information in one place

Aspect Description
Definition Don't define the same information in multiple places
Workflow Application Centralize context, configuration, and state
Violation Example Each agent maintains the same settings separately
Solution Use shared context or configuration files

Multi-Agent Propagation Rule:

In Orchestrator-Workers patterns, writing a rule only in the central document (e.g., AGENTS.md) is not enough. Worker agents may not read or follow central rules unless they are explicitly referenced or duplicated in each .agent.md.

Symptom Cause Fix
Workers ignore central conventions Rule exists only in orchestrator-level doc Add rule reference in each worker definition
Inconsistent output locations Output path defined centrally but not in workers Include output path in worker prompt/definition

Lesson: When adding shared rules to a central SSOT, always propagate to worker definitions simultaneously. Update checklist: central doc + each .agent.md + scripts + instructions.

2. SRP (Single Responsibility Principle)

1 Agent = 1 Responsibility

Aspect Description
Definition Each agent focuses on a single responsibility
Workflow Application Clearly separate tasks and assign to each agent
Violation Example One agent handles "search + analysis + reporting"
Solution Split agents by role

3. Simplicity First

Start with the simplest solution

Aspect Description
Definition Keep complexity to what's necessary and sufficient
Workflow Application Try with a single agent first. Add complexity only when needed
Violation Example Designing a 10-agent workflow from the start
Solution Start minimal, extend gradually

Anthropic's Recommendation:

"Start with simple prompts, optimize them with comprehensive evaluation, and add multi-step agentic systems only when simpler solutions fall short."

4. Fail Fast

Detect and fix errors early

Aspect Description
Definition Detect errors early and handle immediately
Workflow Application Validate at each step, stop immediately if issues
Violation Example Ignoring errors and continuing to the end
Solution Set up Gates/Checkpoints

Contract Binding Liveness:

Paths, schema fields, CLI flags, IDs, and state keys referenced by policies, orchestrators, validators, and tests are executable contracts. A rename or deletion is incomplete until every live binding is updated.

  • Before deleting or renaming an artifact, search policy/config, runtime code, tests, and generated-current-state definitions for references.
  • Add a deterministic liveness check at the workflow entry or CI boundary; tests alone are insufficient if operators may not run them before production.
  • Compare canonical path spelling against the source of truth. Git path case remains significant even on case-insensitive filesystems and can turn history/readback into a silent not found.
  • Structural faults such as unmapped inputs, missing artifacts, and case mismatches must fail before freshness or scheduling filters. Ordinary pending work must remain allowed.

5. Iterative Refinement

Build small, improve repeatedly

Aspect Description
Definition Prefer small improvements over large changes
Workflow Application MVP → verify → feedback → improve
Violation Example Implementing all features at once, testing at the end
Solution Implement and verify one task at a time

Related Pattern: Evaluator-Optimizer

6. Feedback Loop

Verify results at each step → adjust

Aspect Description
Definition Get feedback from execution results, apply to next
Workflow Application Evaluate agent output, re-execute if needed
Violation Example One-way flow without result verification
Solution Incorporate evaluation steps

Anthropic's Recommendation:

"During execution, it's crucial for the agents to gain 'ground truth' from the environment at each step to assess its progress."


Tier 2: Quality Principles (Recommended)

7. Transparency

Show plans and progress explicitly

Aspect Description
Definition Make what's happening visible
Workflow Application Show start/end of each step, display progress
Violation Example Black box with no visibility into what's happening
Solution Use logs, progress display, TodoWrite

Anthropic's Recommendation:

"Prioritize transparency by explicitly showing the agent's planning steps."

8. Gate/Checkpoint

Validation gates at each step

Aspect Description
Definition Validate before proceeding to the next step
Workflow Application Don't proceed unless quality criteria are met
Violation Example Passing through all steps without validation
Solution Quality checks with conditional branching

9. DRY (Don't Repeat Yourself)

Eliminate duplication, promote reuse

Aspect Description
Definition Don't repeat the same logic
Workflow Application Template common processes, reuse prompts
Violation Example Copy-pasting the same prompt to each agent
Solution Create common prompt templates

10. ISP (Interface Segregation Principle)

Minimal context only

Aspect Description
Definition Pass only necessary information to each agent
Workflow Application Excessive context becomes noise
Violation Example Passing all information to all agents
Solution Select and pass only task-relevant information

11. Idempotency

Safe to retry

Aspect Description
Definition Same operation produces same result regardless of retries
Workflow Application Design to allow retries on failure
Violation Example Retrying causes data duplication
Solution State checking, use unique IDs

Queue Hygiene for Issue/PR Automation:

For workflows that create or resume work through Issues, labels, and PRs, retry safety depends on treating those queue artifacts as workflow state.

  • Before creating new work, check whether an equivalent Issue or PR is already open.
  • If a blocker label such as needs-human-review can become stale, only auto-clear it under explicit safe conditions, for example when no open PR remains and the rerun was manual or triggered by a fresh failure.
  • If the latest evaluation says there is no actionable work, auto-close stale request Issues so the queue does not look blocked forever.

12. Observability

Record decisions and make progress visible

Aspect Description
Definition Make agent decisions and progress traceable
Workflow Application Log key decisions as Issue comments, files, or documents
Violation Example No visibility into why agent made a decision
Solution Decision logs, regular status reports for long tasks

Idle State Visibility:

If 0 new items is a valid and healthy result, surface that state separately from latest published artifact date. Otherwise, users may misread a normal no-op run as a stale deployment or failed automation.

Elapsed Time Tracking:

For multi-step workflows, record start/end timestamps to measure performance:

// manifest/status.json
{
  "startedAt": "2026-05-08T04:37:00+09:00",
  "completedAt": "2026-05-08T04:50:00+09:00",
  "elapsedMinutes": 13.0
}

This enables:

  • Performance regression detection across runs
  • User-facing elapsed time reports
  • Bottleneck identification (which step takes longest)

Decision Log Example:

| Time  | Decision                      | Rationale                  |
| ----- | ----------------------------- | -------------------------- |
| 10:00 | Delegate to @impl for task-01 | Code change required       |
| 10:05 | Skip task-02                  | File already up-to-date    |
| 10:10 | Escalate to human             | Requires production access |

13. Reasoning Before Conclusions

Show your thinking, then provide the answer

Aspect Description
Definition Generate reasoning steps before jumping to conclusions
Workflow Application Use chain-of-thought prompting, allow "scratch space"
Violation Example Agent provides answer without explaining logic
Solution Structure prompts to encourage step-by-step reasoning

Why This Matters:

LLMs perform better when they can "think out loud" before committing to an answer. This principle improves accuracy and makes agent decisions auditable.

Prompt Design:

✅ Encourage reasoning:

Before selecting a workflow pattern:

1. Analyze the task characteristics
2. List applicable patterns with pros/cons
3. Recommend the best fit based on your analysis

❌ Discourage reasoning:

Select the best workflow pattern for this task.

Implementation Techniques:

Technique Description
Chain-of-Thought (CoT) Prompt: "Let's think step by step..."
Scratch Space Allow working area for calculations/notes
Explicit Steps Require "Analysis → Options → Decision"
Self-Verification Ask agent to check its own reasoning

Example Output:

## Analysis

- Task requires processing 10 files
- Files are independent
- No interdependencies detected

## Options Considered

1. Prompt Chaining: ❌ Sequential would be slow
2. Parallelization: ✅ Files are independent
3. Orchestrator-Workers: ⚠️ Overkill for fixed task count

## Decision

Use Parallelization pattern (Pattern 3)

## Implementation Plan

[Detailed steps...]

Benefits:

Benefit Description
Higher Accuracy Reduces hallucination and logical errors
Debuggability Trace reasoning when output is wrong
Transparency Users understand why agent chose action
Self-Correction Agent catches its own mistakes during reasoning

References:


Intermediate Representation (IR) Architecture

→ workflow-patterns/ir-architecture.md (SSOT)

For complex workflows, use a two-stage architecture with an intermediate representation. Core principle: Same IR → Same Output. No creativity in transformation phase.


Tier 3: Scale Principles (Advanced)

14. Human-in-the-Loop

Human confirmation at critical points

Aspect Description
Definition Balance automation with human judgment
Workflow Application Confirm before important decisions, risky operations
Application Example Before production deploy, before mass deletion

15. KISS (Keep It Simple, Stupid)

Keep it simple

Aspect Description
Definition Avoid unnecessary complexity
Workflow Application Sufficient number of agents, simple coordination

16. Loose Coupling

Loose coupling between agents

Aspect Description
Definition Minimize dependencies between agents
Workflow Application Each agent can operate independently
Benefits Limit impact of changes, easier testing

17. Graceful Degradation

Continue operation despite partial failures

Aspect Description
Definition Maintain overall function even when parts fail
Workflow Application Fallback processing, skippable steps

ACI Design (Agent-Computer Interface)

Anthropic's Recommendation:

"Think about how much effort goes into human-computer interfaces (HCI), and plan to invest just as much effort in creating good agent-computer interfaces (ACI)."

Core Principles

Principle Description
Minimal Overlap Each tool has a distinct, non-overlapping purpose
Self-Contained Tools are robust to errors and handle edge cases
Clear Intent Tool name and description unambiguously convey purpose
Model-Friendly Formats Output formats are easy for LLMs to parse and use

Tool Design Guidelines

  1. Clear Description - Clarify tool purpose and usage
  2. Edge Cases - Document boundary conditions
  3. Input Format - Specify expected input format
  4. Error Handling - Define behavior on failure
  5. Testing - Actually use it and iterate
  6. Example Usage - Include usage examples in description
  7. Poka-yoke - Design to prevent mistakes (e.g., use absolute paths)
  8. Display Surface Fit - Match output structure to where users will read it, such as cards/fields for chat embeds instead of dense text

Format Selection

Choose formats that minimize cognitive load for LLMs:

Good Format Avoid
Markdown code blocks JSON with escaped strings
Absolute file paths Relative paths (context-dependent)
Structured sections Free-form text with implicit rules
Clear delimiters (XML tags) Ambiguous separators
Native UI payloads for the target surface One dense text block for every channel

Anthropic's Tool Format Recommendations

"Give the model enough tokens to 'think' before it writes itself into a corner. Keep the format close to what the model has seen naturally occurring in text on the internet."

Do:

  • Use formats the model has seen in training (Markdown, code, XML)
  • Allow space for reasoning before final output
  • Use descriptive parameter names

Don't:

  • Require accurate counting (e.g., line numbers in diffs)
  • Force heavy escaping (e.g., code inside JSON strings)
  • Create ambiguous decision points between similar tools

Tool Set Design

Symptom Problem Solution
User unsure which tool to use Overlapping functionality Consolidate or clearly delineate
Frequent tool misuse Unclear descriptions Improve docs, add examples
Verbose tool outputs Wasted context tokens Return summaries, not raw data
Error-prone inputs Complex parameter requirements Simplify, use defaults

Testing Checklist

- [ ] Can a junior developer understand how to use this tool from its description?
- [ ] Does running multiple test inputs produce expected outputs?
- [ ] Are error messages actionable?
- [ ] Is the output format consistent and parseable?
- [ ] Has the output been checked in the final reading surface or a faithful dry-run payload?
- [ ] Does the tool handle edge cases gracefully?

File Organization Principles

Instructions Organization

Group related instructions by domain/genre

Aspect Description
Definition Organize instruction files into logical folder categories
Workflow Application Categorize .github/instructions/ by domain
Violation Example All files flat in one directory
Solution Create genre-based folders (azure/, git/, skills/, etc.)

Why This Matters:

  • Easier navigation for both humans and agents
  • Related instructions stay together
  • Reduces cognitive load when searching
  • Enables folder-level .gitignore or permissions

Recommended Structure:

.github/instructions/
├── azure/
│   ├── bicep-style.instructions.md
│   ├── naming-conventions.instructions.md
│   └── resource-tagging.instructions.md
├── git/
│   ├── commit-message.instructions.md
│   ├── branch-naming.instructions.md
│   └── pr-contribution.instructions.md
├── code/
│   ├── python-style.instructions.md
│   ├── typescript-style.instructions.md
│   └── testing-guidelines.instructions.md
├── skills/
│   └── skill-creator.instructions.md
└── global.instructions.md  # Cross-cutting rules

Benefits:

Benefit Description
Discoverability Find related files quickly
Scoped Loading Load only relevant folder for specific tasks
Team Ownership Assign folder ownership to domain experts
Reduced Conflict Parallel edits in different folders avoid conflicts

Naming Conventions

Use consistent, descriptive file names

Aspect Description
Definition Follow predictable naming patterns
Workflow Application File names convey purpose without opening
Violation Example notes.md, stuff.md, doc1.md
Solution Use descriptive kebab-case with file type suffix
File Naming Rules
Rule Good Example Bad Example
Kebab-case commit-message.instructions.md commitMessage.md
Include type suffix azure-deploy.instructions.md azure-deploy.md
Be descriptive pr-contribution-guide.instructions.md pr.md
Avoid generic names bicep-naming-conventions.md conventions.md
Use lowercase github-actions.md GitHub-Actions.md
Suffix Conventions
Suffix Usage Example
.instructions.md Agent/Copilot instruction files code-review.instructions.md
.prompt.md Reusable prompt templates summarize-pr.prompt.md
.agent.md Agent definition files code-reviewer.agent.md
.md General documentation architecture-overview.md
Folder Naming Rules
Rule Good Example Bad Example
Singular or plural skills/ or skill/ (be consistent) Mixed usage
Lowercase azure/ Azure/
No spaces code-style/ code style/
Domain-based infrastructure/ misc/, other/
Agent/Prompt File Naming

For .agent.md and .prompt.md files, use action-oriented names:

✅ Good:
- code-reviewer.agent.md
- pr-summarizer.agent.md
- test-generator.prompt.md
- refactor-suggestions.prompt.md

❌ Bad:
- agent1.agent.md
- my-agent.agent.md
- prompt.prompt.md
- test.prompt.md
Versioning in Names (When Needed)

If maintaining multiple versions:

feature-flags-v1.instructions.md
feature-flags-v2.instructions.md

Or use folders:

feature-flags/
├── v1/
│   └── implementation.instructions.md
└── v2/
    └── implementation.instructions.md

References


SSOT Implementation Patterns

SSOT Reference Pattern

When referencing shared definitions across multiple files, use this standard format:

Format:

> **SSOT**: See [file](path) section "Section Name" for details

The referenced heading MUST exist in the target file, and the target MUST hold the definition itself. A pointer to a section that only forwards elsewhere leaves the rule undefined while every checker still reports the link as valid.

Anti-pattern (Before):

  • Same logic duplicated in 3+ files (e.g., holiday check, validation rules)
  • Requires updating all files when logic changes
  • Inconsistencies emerge over time

Best Practice (After):

  • Define authoritative rule in one file (e.g., instructions.md)
  • Other files reference SSOT with link only
  • Changes propagate automatically

Example:

### Step 0-2: Holiday Check

> **SSOT**: See [copilot-instructions.md](../copilot-instructions.md) section "Holiday Rules"

1. Check holiday calendar
2. If holiday: skip and notify

View vs Master Separation

For task/project management workflows, separate display views from data masters:

File Type Role Update Frequency Content
View (Dashboard) Today's top 3 actions Daily (morning) Links to Master
Master (active.md) All task details (SSOT) On change Full task specs
Archive (completed.md) Completion history On task completion Archived tasks

⚠️ Anti-pattern: Putting task tables in both View and Master creates dual maintenance burden.

Correct Structure:

DASHBOARD.md (View)
├── Today's Focus: TOP 3 actions (links only)
├── This Week: Schedule view
└── Recent Completions: Last 5 items

Tasks/active.md (Master - SSOT)
├── Full task details
├── All metadata
└── History

Activity Log Collection Strategy

When collecting activity logs from integrated tools (M365, Slack, etc.), use multiple query types for comprehensive coverage:

Query Type Purpose Detection Target
My Posts What I shared in channels Knowledge sharing, contributions
Mentions Messages that mentioned me Requests, thanks, dependencies
Files Files I shared/edited Deliverables, documentation

⚠️ Single query anti-pattern: Using only one query type causes detection gaps.

Example queries:

  1. What did I post in channels today? → Own contributions
  2. What messages mentioned me today? → Inbound requests
  3. What files did I share today? → Artifacts created

Source: SKILL.md on GitHub

2 warnings4mo4 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    This skill is a professional development toolkit for designing, reviewing, and managing AI agent workflows. It provides structured templates, architectural guidance, and utility scripts to help users build efficient multi-agent systems following best practices like Single Responsibility and Single Source of Truth.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: MEDIUM · 1 issue

  • Runlayer7mo

    15/58 files flagged

Signed by skilld at fb34748. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 14 hours ago.

Activeupdated last week
user-invocable
true
metadata
{
  "author": "yamapan (https://github.com/aktsmm)"
}
Other metadata
argument-hint
作りたい .agent.md / .instructions.md / .prompt.md / AGENTS.md、設計したい workflow、または困っている症状

README badge

README badge for aktsmm/agent-skills/agentic-workflow-guide