Understanding the Five Capability Layers of AI Coding Agents: Skills, Protocols, Workflows, Rules, and Memory

    As AI coding tools evolve from one-shot conversations into agents that execute sustained tasks, configuration sprawl becomes inevitable: teams juggle skill descriptions, external tool integrations, multi-step processes, project constraints, and long-term memory without a clear division of responsibilities. This article dissects the five core capability layers of intelligent programming systems—skills, model context protocols, workflows, rules, and memory—explaining what each layer owns, how they differ, how they combine in practice, the most common implementation mistakes, and a practical governance roadmap for turning an ever-growing prompt into a composable, testable, and accountable engineering system.

    Introduction

    AI coding tools have pushed large language models from “one-shot conversations” into an agentic form that “executes tasks continuously.” As a result, configuration items have proliferated rapidly. Teams often maintain skill descriptions, external tool integrations, multi-step processes, project constraints, and long-term memory all at once—yet struggle to define what each one is responsible for. The consequences: prompts grow ever longer, tools get wrapped redundantly, rules conflict with each other, and memory carries stale decisions into future sessions.

    To run this system reliably, you must first accept a principle of division of labor:

    • Skills answer: “How should this type of task be done professionally?”
    • Protocols answer: “Which external capabilities can be invoked, and how are they discovered?”
    • Workflows answer: “How are steps orchestrated and handed off?”
    • Rules answer: “What must always hold true?”
    • Memory answers: “Which facts are worth retaining across sessions?”

    These five layers can cooperate, but they cannot substitute for one another.

    1. Skills: Reusable Domain Practices

    A skill is a modular capability package for a particular class of tasks. It typically contains a name, a description, applicability conditions, core steps, quality constraints, examples, and optional reference material and helper scripts. The name and description are not documentation for humans—they serve as semantic routing for the model: only when the user’s intent matches the description is the skill’s body injected into context. Descriptions should therefore state “what problem it solves, under what conditions it applies, and what it does not solve,” rather than vague claims like “improves efficiency.”

    A skill is essentially a controlled prompt with accompanying resources—not a new model, and not an independently running service. It tells the model how to complete a task: first verify that inputs are complete, then follow fixed steps, and finally deliver in an agreed format. Optional scripts handle only deterministic work, such as reading spreadsheets, validating fields, or generating static page skeletons; scripts never make business judgments on the model’s behalf. The most important design split is this: push error-prone, repetitive, format-sensitive parts into scripts, and keep parts requiring judgment in the description.

    A typical scenario: the business side has already fixed report layouts and sample data in a spreadsheet, and needs a web-based demo suitable for review. A skill can specify: reconstruct structure only from the column names, hierarchy, and sample values in the spreadsheet; missing fields must be explicitly flagged rather than fabricated; output a self-contained page with data-source notes. Keep the directory organized into separate “main description, references, examples, scripts,” keep the main description short and executable, and move long formatting specifications and edge cases into reference documents so irrelevant text isn’t loaded on every invocation.

    Skills are best for capturing “practices the team has already validated”—not for writing universal prompts. Oversized skills route poorly; undersized ones cost more to combine than they deliver. A good granularity is one independently acceptable deliverable, such as “generate a compatibility note from an API change”—not “help write code.”

    2. Model Context Protocol: Discovery and Invocation Conventions for External Capabilities

    The model context protocol solves a different class of problems: how agents discover, describe, and invoke external tools and data sources in a uniform way. It is concerned with connectivity, not business steps. The server side exposes resources, tools, and prompt templates; the client side lists capabilities, passes parameters, and returns results. In programming scenarios, common integrations include code retrieval, ticket lookup, read-only log access, build artifacts in object storage, and internal knowledge bases.

    The protocol layer should stay “thin and stable.” Tool descriptions must be precise about inputs, outputs, permissions, and failure semantics—but they should not embed one department’s reporting standards into every tool. Those standards belong in skills or rules. Nor does the protocol handle orchestration: whether to check logs or the change log first should be decided by the workflow or by in-context reasoning. Hard-coding orchestration into a single tool makes the tool non-reusable and blurs permission boundaries.

    On security, protocol integrations should default to least privilege. Write operations, deletions, and production-environment changes must be declared separately and require explicit confirmation. Mixing read-only queries and mutation tools under one broad description is a common source of agent incidents. Returned content must be truncatable and referenceable—avoid pouring an entire log database into the context at once.

    3. Workflows: Steps, State, and Human-in-the-Loop Nodes

    A workflow is explicit process control. It defines node order, branching conditions, parallelism, retry-on-failure, and human approval points. Unlike skills, workflows do not rely on the model “remembering” which step comes next—the orchestrator guarantees that steps happen. Tasks suited to workflows have strong sequencing, audit requirements, or cross-system side effects: requirement clarification, generating change descriptions, running checks, submitting for review, and merging only after approval.

    Every node in a workflow may invoke a skill or a protocol tool, but each node should have clearly defined inputs and outputs. If an upstream check fails, downstream must not start. The model fits best in “generation and judgment” nodes, not in state transitions that “must be atomic.” Leave state transitions to the orchestrator and transactions; the model only produces suggestions or fills in explanations.

    Not everything needs to be a workflow, either. For one-off, low-risk tasks whose steps vary with context, a skill plus on-the-fly planning is lighter. Once irreversible operations, multi-person handoffs, or compliance audit trails are involved, upgrade to a workflow and log every step’s inputs, outputs, and decision rationale in a queryable log.

    4. Rules: Hard Constraints That Always Apply

    Rules are project- or organization-level invariants, and they take priority over one-off conversational preferences. Typical contents include language and framework versions, directory conventions, forbidden secrets, error-handling style, required test types, and formats for comments and commit messages. Rules should be short, verifiable, few, and hard. Stuffing tutorials, historical background, or a long post-incident retrospective into rules only crowds the context and leaves the model unable to tell which constraints truly cannot be violated.

    The difference between rules and skills lies in trigger scope: skills load on demand based on task semantics; rules apply by default in the corresponding project or session. The difference between rules and workflows: rules don’t specify “do A before B”—they specify conditions the result must satisfy regardless of the path taken. For example, “every new API must include a failure example” is a rule; “update the API docs first, then the implementation, then run checks” is a workflow.

    When rules conflict, there must be a priority order: safety and compliance over formatting preferences; repository-level conventions over personal habits. Rules that cannot be automatically checked should be written as observable deliverable requirements—otherwise compliance depends on the model’s discretion and will drift.

    5. Memory: A Limited Set of Facts Retained Across Sessions

    Memory stores stable information that remains valuable for future tasks: a user’s preferred delivery formats, confirmed project terminology, open technical decisions. It is not a full-text archive of chat history, and it is not a replacement for rules. Chat history handles the current session’s context; memory holds curated long-term facts; rules enforce mandatory constraints. Writing “this time, skip the tests” into memory would contaminate every future task.

    Memory needs scope, time validity, and revocability. Personal preferences and repository facts should be stored separately. Secrets, customer data, and undisclosed vulnerabilities must never enter memory. Writes should be confirmed by the user or pruned by explicit policy; reads should carry source and timestamp annotations, and outdated decisions should be overridable rather than infinitely accumulating. The model may suggest “is this worth remembering?”—but it should never silently solidify speculation into fact.

    6. Comparison and Composition

    Use five questions to classify any item:

    • Is it a professional practice for a class of tasks? → Put it in a skill.
    • Is it a callable capability of an external system? → Put it in a protocol tool.
    • Must it happen in a controlled order with an audit trail? → Put it in a workflow.
    • Is it a constraint that must hold no matter the task? → Put it in a rule.
    • Is it a fact worth remembering later, but not a hard institution? → Put it in memory.

    In practice, execution is a composition: rules define the boundaries first, memory supplies confirmed background, the protocol lists available tools, the workflow determines the critical path, and skills inject domain steps at particular nodes. The report-demo example could work like this: a rule forbids fabricating data; memory recalls the team’s preferred demo structure; the protocol or a local script reads the spreadsheet; a skill defines how to map it to a page; and if the result is published to a shared environment, a workflow adds approval.

    7. Common Implementation Mistakes

    1. Writing everything into one giant system prompt. Nothing can be loaded on demand, reviewed, or rolled back independently.
    2. Using skills to simulate permissions and workflows, hoping the model “remembers not to call the write API.” Permissions must be enforced at the tool and orchestration layer—not merely discouraged in text.
    3. Mixing memory and rules, letting personal preferences override team conventions.
    4. Vague protocol tool descriptions, leaving the model unable to choose correct parameters—so it retries endlessly and bloats the context.
    5. Missing acceptance examples. Both skills and rules should come with one or two positive and negative examples; otherwise you cannot tell whether the configuration actually changed behavior.

    8. How to Start Governing

    Begin by inventorying your existing prompts: mark hard constraints, task practices, external dependencies, sequencing requirements, and cross-session facts, then file each into its proper layer. Maintain each skill with its own description and examples, and route changes through review. Separate tools by read/write access and document their failure behavior. Limit workflows to paths with side effects or audit requirements. Keep rules within a length the model can fully comply with, and make them verifiable by check scripts wherever possible. Clean memory regularly and keep only facts still being referenced.

    In enterprise environments, these objects should be brought under the same version control and permission model as code: who may publish a skill, who may register an external tool, which rules apply to all repositories, and whether memory can be shared across projects. In cloud development scenarios such as Baidu AI Cloud, if an agent needs access to build artifacts, logs, or knowledge bases, it should connect through unified identity and auditing—never by embedding long-lived credentials into skill bodies or memory. Understand cloud capabilities in generic categories—object storage, logging and monitoring, container platforms—and consult the official documentation of your actual environment for specific parameters. Don’t fabricate interfaces in your prompts.

    Conclusion

    Once these five mechanisms are clearly separated, an AI coding system evolves from “an ever-growing prompt” into composable, testable, accountable engineering objects. Skills provide expertise; protocols provide reachability; workflows provide process control; rules provide invariants; memory provides continuity. With clear boundaries, scaling up doesn’t have to mean spinning out of control.