Agent Skills & Custom Workflows
An architectural pattern for dynamically loading specialized procedural instructions, scripts, and templates (SKILL.md) into an agent's context window on demand (On-Demand Loading).
1. Concept Overview & Systemic Problem
As the complexity of agent systems increases, developers often attempt to equip the agent with expertise across all domains simultaneously: writing massive code formatting rules, server security checklists, UI accessibility requirements, SQL dialect syntax, and documentation templates.
The attempt to cram all this into a single static system prompt (system prompt) creates three critical systemic issues:
- Catastrophic Token Budget Drain: Even for a trivial request like "fix a typo," the model is forced to read 40,000 tokens of irrelevant documentation each time.
- Context Blurring and Instruction Drift: The more conflicting or heterogeneous rules present in the context, the higher the likelihood that the model will ignore specific instructions.
- Inability for Modular Updates: Changing one rule in a monolithic file can unpredictably alter the agent's behavior in entirely different tasks.
Agent Skills address this problem through the principle of procedural context separation: knowledge is stored as isolated modules on disk and loaded into the agent's memory only when there is a corresponding engineering need.
2. Architectural Taxonomy & Mental Model
The modern architecture of an agent skill is standardized as an autonomous package of procedural knowledge:
- 1. Manifest and Activation Triggers (Frontmatter Metadata):
Metadata in YAML format at the beginning of the
SKILL.mdfile. It defines the name, description of competence, and a list of natural language triggers (e.g., “purchased VPS”, “set up firewall”, “check accessibility”). - 2. Algorithmic Action Guide (Workflow Blueprint): A clear step-by-step action algorithm divided into phases: diagnosis -> plan preparation -> stepwise execution -> mandatory final verification of the result.
- 3. Executable Scripts and Utilities (
scripts/): Deterministic Python, Bash, or Node.js scripts that the agent invokes to perform routine calculations or checks instead of slow and error-prone generation from scratch. - 4. References and Benchmark Examples (
references/): Gold standard architectures, configuration schematics (Nginx, Docker Compose, TypeScript interfaces) that the agent uses as templates for imitation.
3. Technical Pipeline & Internal Mechanics
The lifecycle of skill activation by the agent occurs in 4 stages:
- Lightweight Index Discovery: Upon initialization, the agent receives only a compact index of available skills (2-3 sentence descriptions for each). This consumes fewer than 500 tokens.
- Intent Matching & Trigger Interception: The user sets a task. The agent matches the semantics of the request with the skill manifests. If a match is found, the agent makes an internal decision to load the expertise.
- Lazy File Ingestion:
The agent invokes a file tool (e.g.,
view_fileforskills/<skill_name>/SKILL.md) and loads the full specification directly into the working context. - Execution & Context Retirement: The agent executes the task, strictly following the skill's instructions. After completing the task and recording the result, subsequent sessions are not overloaded with outdated details.
4. Production Engineering Scenarios
01. Procedural Hardening and Protection of Linux VPS
The agent has a skill vps-hardening. When the user reports the purchase of a new server, the agent loads a clear 7-step checklist: generating SSH keys, configuring UFW, setting up fail2ban, tuning sysctl, and disabling password access strictly after verifying key-based login.
02. Specialized Accessibility Design Audit (WCAG 2.2)
The user requests an evaluation of a form layout. The agent activates the skill better-accessibility: checking color contrast per APCA/WCAG, the presence of aria labels, keyboard navigation (focus-visible), and accessibility for screen readers.
03. Automated Database Migration to Drizzle ORM
The skill contains precise schema generation rules: snake_case naming conventions, proper index definitions, prohibition of raw enums, and creating safe migration files without locking tables.
5. Pitfalls, Common Mistakes & Security
- Trigger Overlap: If two different skills have overly broad or similar descriptions (e.g.,
code-reviewandsecurity-audit), the agent may either load both, bloating the context, or hesitate in making a choice. Ensure trigger descriptions are mutually exclusive and contrasting. - Stale Tooling: Changes in the APIs of external libraries can break auxiliary scripts within
scripts/. Regularly run tests to validate the functionality of skill code. - Lack of Security Validation: Loading third-party skills from untrusted repositories may contain hidden instructions for stealing private keys. Trust only verified knowledge modules.
FAQ: Agent Skills & Custom Workflows
Related terms
System Prompt (System Instructions & Metaprompting)
The primary metacontext block of instructions passed at the zero position of the context window, defining the agent's role, safety rules, available tools, and behavioral boundaries.
Prompt Caching & KV Cache Reuse
A technology utilized by modern inference engines and cloud APIs (Anthropic, OpenAI, DeepSeek, vLLM) that stores precomputed attention matrices (KV Cache) of static prefixes, reducing processing costs by 80–90% and decreasing time to first token (TTFT) by 4–8 times.
MCP (Model Context Protocol)
An open standard from Anthropic based on JSON-RPC 2.0 for unified bidirectional connection of AI assistants to external tools, databases, and system environments.
Atomic Tasks
An engineering practice of breaking down large system requirements into minimal, self-sufficient, and deterministic work units that minimize cognitive load and the risk of context degradation in LLMs.
Related Ecosystem Resources
Explore practical workflows, core terminology, and engineering tools
Codex Skills for Beginners: Automating AI Agent Workflows
A comprehensive hands-on guide to building and executing Codex Skills: SKILL.md anatomy, explicit vs. auto-triggering, skills vs. scripts vs. tools, Skills API, and safety boundaries.
How to Build Custom Skills for Claude Code: Architecture and Best Practices
A comprehensive engineering guide to creating custom Claude Code skills: folder structure and SKILL.md, progressive disclosure, skills vs. hooks trade-offs, and evaluation-driven workflow development.
Agent-to-Agent Protocol (A2A)
An open standard for network interaction, decentralized discovery, and secure context exchange between independent AI agents across various vendors and platforms.
Agent Benchmarks: GAIA and SWE-bench
A new generation of rigorous practical benchmarks for evaluating the autonomy of artificial intelligence. GAIA tests multimodal tasks in the open web with files and a browser, while SWE-bench assesses agents' ability to find and fix real bugs in large GitHub repositories.
Claude Code cuts background subagent status update costs by 99%
In the CLI version of Claude Code, status updates for background subagents now use Haiku 5.5 based on short notes, reducing limit consumption.
AGENTS.md in Ghostty and Turborepo makes AI agents report on users
Examples of AGENTS.md files show how repository instructions can force AI agents to add insulting notes about developers to pull requests.