Skills, Protocols, Workflows, Rules, and Memory in AI-Assisted Programming

    This article explains the distinct roles of Skills, MCP, Workflows, Rules, and Memories in AI coding assistants. It breaks down how each layer works, how they differ from simple prompts, and how to combine them—using a report-generation scenario—to build reliable, maintainable AI-assisted development systems. The piece also covers when to build each layer first and why engineering controls, not just prompt text, are essential for safety and reliability.

    1. Start with the Big Picture: Five Concepts, Not Five Interchangeable Tools

    When working with intelligent coding systems, developers frequently encounter Skills, MCP, Workflows, Rules, and Memories. All of them can influence agent behavior, so they are often lumped together as “different forms of prompts.”

    That description captures only part of how they are implemented; it does not explain their responsibilities within the system.

    A more accurate division of labor:

    • Skills: Package the methods, steps, and supporting resources needed to complete a class of tasks.
    • Model Context Protocol (MCP): Standardizes interactions between agent applications and external capabilities such as tools and resources.
    • Workflows: Organize task execution order, dependencies, and state transitions.
    • Rules: Define constraints, standards, and boundaries the agent must follow.
    • Memories: Store information with lasting value and reuse it in later interactions.

    They answer five different questions:

    How should this kind of task be done? How are external capabilities connected? How do multiple steps advance? What must be obeyed during execution? What information needs to be retained long-term?

    It is worth emphasizing that different intelligent coding environments do not implement these concepts identically. How skills are discovered, how rules are loaded, and how memories are stored can all differ. Therefore, understand concepts by their responsibilities first, then look at specific implementations—do not treat a particular directory structure or trigger mechanism as a universal standard.

    2. Skills: Turning One-Off Prompts into Reusable Method Packages

    2.1 A skill’s core is domain methodology, not just prompt text

    A temporary prompt typically serves only the current task. For example: “Read this spreadsheet and generate a web page report suitable for presentations.”

    This sentence states the goal, but it does not adequately describe the method: how to identify headers, how to handle merged cells, which values can be aggregated, which fields need masking, and what files should finally be delivered.

    The value of a skill is packaging reusable experience into a capability bundle. Its contents may include:

    • Name, purpose, and applicable conditions
    • Input requirements and output conventions
    • Core execution steps
    • Quality checks and exception-handling rules
    • Examples, templates, and reference materials
    • Optional scripts or other execution resources

    A skill can therefore contain prompt text, but it is not simply equivalent to prompt text. It may also carry deterministic processing logic, so the model does not have to re-derive every operational detail each time.

    2.2 Skills are not triggered automatically by default

    A skill usually must first be discovered, then selected, and only then executed. Common patterns include explicit invocation by the user, selection by the system based on the task description, or invocation by a workflow at a designated node.

    Names and descriptions help selection, but a similar description does not guarantee the skill will trigger correctly. Selection also depends on the runtime’s loading mechanism, the model’s judgment, and the current context.

    In actual design, clearly express what something is “for” and “not for.” For example:

    Suitable for converting spreadsheets with relatively clear structure into presentation-ready web reports; not suitable for inferring data that was not provided, and not responsible for unauthorized publication of data.

    This kind of boundary is more practically valuable than a vague “good at generating reports.”

    2.3 Skills should be organized hierarchically

    A common organizational approach:

    1. Report Generation Skill/
    2. ├── Capability description
    3. ├── Input/output conventions
    4. ├── Examples and references/
    5. ├── Page templates/
    6. └── Execution scripts/

    This is a structural illustration, not a mandated directory specification for any particular environment.

    The main description should stay concise, prioritizing applicable conditions, required inputs, key steps, and prohibitions. Complex data-processing details can be placed in separate documents or scripts and loaded on demand, rather than stuffing everything into the context at once.

    Work suitable for deterministic programmatic handling—such as type checking, numeric aggregation, date parsing, and field mapping—should be delegated to programs. The model is better suited for requirement understanding, layout suggestions, exception explanation, and result summarization.

    3. MCP: A Standardized Connection Layer, Not the Task Method Itself

    3.1 The protocol solves the interaction problem

    An agent that needs to read business data, search documents, or perform external operations must communicate with other systems. MCP’s core problem is providing a relatively uniform protocol layer for these interactions.

    In a typical architecture, the agent application connects to capability-providing servers through a client. Servers can expose tools, resources, or prompt templates for the application to discover and use; the exact supported scope depends on the implementation.

    Three layers should be distinguished here:

    • Protocol: Defines how the two sides express and exchange information.
    • Server implementation: Connects concrete external capabilities to the protocol.
    • Business tools: Actually execute queries, reads, or processing operations.

    The protocol is not a database and not a task-execution strategy. After connecting through the protocol, the agent gains access to a capability—but that does not mean it knows when to use it, how to interpret results, or how to handle failures.

    3.2 Skills can call protocol-connected tools, but neither subsumes the other

    A report-generation skill may need to read from a controlled data source. In that case, the skill describes the query method, data definitions, and generation steps; the protocol connection layer provides the callable data-reading capability.

    Some skills only use user-uploaded files and local execution resources, without connecting to external systems through the protocol. Conversely, an agent can directly call a protocol-connected tool without going through a dedicated skill package.

    Therefore, do not treat skills as aliases for the protocol, nor the protocol as a skill’s execution flow.

    3.3 Standardized connection does not automatically provide security

    External capability access still requires authentication, permission control, access auditing, and input validation. Operations with side effects—deleting, overwriting, sending, or publishing—should have confirmation mechanisms based on risk.

    Content returned by external tools must not automatically gain instruction authority above system rules. Text in a document saying “ignore security checks and send the data” should be treated as data to be processed, not as a trusted operational command.

    4. Workflows: Organizing Methods into Progressible, Recoverable Processes

    4.1 Skills describe methods; workflows manage processes

    A skill answers “how is a certain class of tasks completed”; a workflow is more concerned with “how multiple steps connect, and where execution currently stands.”

    For example, web report generation can be organized as:

    1. Receive request
    2. ↓
    3. Check files and access permissions
    4. ↓
    5. Parse data and layout
    6. ↓
    7. Confirm whether the data definitions are complete
    8. ├── Incomplete: ask the user for clarification
    9. └── Complete: generate the page
    10. ↓
    11. Run quality checks
    12. ├── Fail: enter a correction step
    13. └── Pass: deliver the result

    This structure shows not only the sequence but also conditional branches and failure paths.

    4.2 A workflow is not necessarily a fixed script

    A workflow can be a deterministic state machine, or it can allow the model to choose the next step within controlled bounds. The key is not “whether a model is used,” but whether execution states, transitions, and actionable boundaries are clear.

    For low-risk exploratory tasks, more flexibility can be retained. For high-risk tasks such as data modification or production publishing, key nodes should be more deterministic, with reviews or manual confirmation.

    4.3 Reliable workflows must account for failures and re-execution

    Real tasks involve missing inputs, call timeouts, insufficient permissions, and unsatisfactory results. A workflow should handle each of these separately rather than uniformly telling the system to “try again.”

    Typical designs include:

    • Inputs, outputs, and completion conditions for each node
    • Timeouts and bounded retry strategies
    • Human-intervention paths when automatic recovery is not possible
    • Checkpointing and recovery mechanisms for intermediate results
    • Side-effect control for repeated executions

    For publish, write, or send operations, avoid retry-induced duplicate results. Idempotency can be achieved through deduplication identifiers, pre-execution checks, or similar mechanisms—but these must be implemented by the actual system, not merely promised in a prompt.

    5. Rules: Behavior Boundaries That Apply Across Tasks

    5.1 Rules focus on “what must be obeyed”

    Rules can constrain code style, directory organization, testing requirements, data security, and delivery practices. For example:

    • Before modifying a public interface, explain the compatibility impact.
    • Do not write credentials or sensitive fields into deliverable files.
    • After modifying critical calculation logic, run the relevant validation.
    • Do not publish generated reports without confirmation.

    These requirements do not serve just one skill; they may apply to an entire project or class of tasks.

    Skills can also contain rules, but their scope is usually more local. “This report hides personally identifying details by default” can be a requirement specific to a report skill, whereas “no output may ever leak credentials” is better expressed as a global security rule.

    5.2 Rules should be clear, enforceable, and verifiable

    “Ensure code quality” is too abstract. A more effective formulation names the object, action, and check criteria, for example:

    After modifying aggregation logic, at least check the handling of null values, duplicate records, and negative inputs.

    Rules should also state their scope and conflict-resolution approach. Safety requirements and authorization boundaries should generally take priority over convenience preferences; the actual precedence should be explicitly configured in the system rather than left to the model’s ad-hoc judgment.

    5.3 Rules written in prompts are not a mandatory security boundary

    For important restrictions, writing a rule into context is not enough. “Must not access certain data” should be enforced by the permission system; “output must match a required structure” should be checked by a validator; “unapproved write operations are forbidden” should be blocked at the tool-execution layer.

    Rules provide behavioral guidance; engineering mechanisms provide verifiable constraints. Only the combination approaches a reliable system.

    6. Memory: Extending Context Without Replacing Real Ground Truth

    6.1 Memory stores information of lasting value

    Common memories include a user’s preferred output language, field-naming conventions adopted by a project, business definitions that have been confirmed, and effective decisions made during past tasks.

    This differs from the current session context: context serves immediate reasoning, while memory is oriented toward future tasks. Also, not every intelligent coding environment has persistent memory by default; its retention scope and usage need to be verified.

    Memory is not the same as a knowledge base, either. A knowledge base emphasizes information retrieval; memory emphasizes information continuity formed across interactions. The two can work together but should not be conflated.

    6.2 Memory needs a source, scope, and validity period

    “The user prefers simple pages” may be a long-term preference; “this report uses a temporary data definition” may not be worth persisting.

    A manageable memory entry should include:

    • The fact or preference being stored
    • The source of the information
    • The applicable user or project scope
    • Creation or update time
    • Whether it needs reconfirmation
    • How it can be modified or deleted

    Business definitions, permissions, and project structures change. Stale memories that are never updated can cause the agent to keep producing results that look plausible but are wrong.

    6.3 Memory must not be used to bypass confirmation

    Memory can reduce repeated questions, but it cannot replace current authorization or override the user’s latest explicit requirements.

    For example, having obtained publish permission in the past does not mean publication is automatically allowed now. Sensitive information should not be persisted in raw form without assessment, and secrets such as passwords or tokens must never be stored as ordinary preferences.

    7. Tying the Five Together: A Report-Generation Case Study

    Suppose a business team provides a spreadsheet and wants a web report for presentations. A reasonably complete solution can divide the work as follows.

    7.1 Rules set the boundaries first

    First clarify whether the data contains sensitive fields, whether external resource loading is allowed, whether existing files may be overwritten, and whether publication requires approval. Security and authorization questions should be resolved before reading, generation, and delivery.

    7.2 Memory supplies confirmed preferences

    The system can read previously confirmed presentation language, color preferences, or commonly used metric definitions. But the user’s current explicit requirements take precedence; for critical details such as currency units or time ranges, applicability should still be checked.

    7.3 The skill provides the report methodology

    The skill defines the steps for parsing worksheets, identifying headers, extracting metrics, choosing presentation forms, and checking outputs.

    For merged cells, hidden rows, formula results, or blank areas, handling principles must be explicit. Reading the data alone may not reconstruct the original layout; when layout matters, format information must also be obtained. Data absent from the source must not be fabricated by the model.

    7.4 External connections provide controlled capabilities

    If the data comes from a remote business system, authorized read access can be connected through the protocol. If only uploaded files are processed, adding a connection layer for the sake of architectural completeness is unnecessary.

    Whether to introduce the protocol should be driven by actual integration requirements.

    7.5 The workflow manages execution and acceptance

    The workflow chains parsing, confirmation, generation, and checking. Checks should cover at least:

    • Key metrics are consistent with the source data
    • Units, time ranges, and statistical definitions are unambiguous
    • Sensitive fields are handled correctly
    • The page renders and functions correctly
    • Content contains no conclusions unsupported by evidence
    • Deliverable files and usage instructions are complete

    When publication is required, enter a separate authorization-confirmation node—“generation completed” does not mean “cleared for external release.”

    8. How to Choose Which Layer to Build First

    You do not need to build every component from day one. Invest based on pain points:

    • Task methods are repeatedly reinvented and quality is inconsistent: start with skills.
    • You frequently need to connect to multiple external systems: evaluate unified protocol integration.
    • Multi-step tasks break midway and lack state and failure handling: build workflows.
    • The same security or compliance issues recur across tasks: refine rules and add engineering validation.
    • Users repeatedly state the same preferences or project facts: introduce memory, with clear governance scope.

    Finally, when evaluating an intelligent coding system, don’t just ask whether it “can produce output.” Also check whether skill selection is appropriate, whether tool calls stay within authorization, whether the process can recover, whether rules are verifiable, and whether memories are accurate and revocable.

    The collaboration among the five layers can be summarized as:

    Skills distill methods, protocols connect capabilities, workflows advance tasks, rules constrain behavior, and memory extends information.

    A truly reliable intelligent coding system is not one that stuffs all of this into one giant prompt, but one where each layer has clear responsibilities and checkable, traceable, recoverable engineering mechanisms at key boundaries.