Understanding AI Coding Concepts: Skills, MCP, Workflows, Rules, and Memories
This article breaks down five core concepts in AI coding and general agent platforms—Skills, MCP, Workflows, Rules, and Memories—and explains how each solves a different layer of the problem: capability packaging, external system access, process orchestration, behavioral constraints, and context persistence. It covers their layered roles, structures, and collaboration patterns, with practical guidance on how to choose and combine them to build testable, rollback-capable, and auditable enterprise agents.
Understanding AI Coding Concepts: Skills, MCP, Workflows, Rules, and Memories
In intelligent coding tools and general-purpose agent platforms, five concepts appear frequently yet are easily confused: Skills, MCP, Workflows, Rules, and Memories. They are not competing alternatives; each addresses a different layer of the problem—how capabilities are packaged, how external systems are connected, how processes are orchestrated, how behavior is constrained, and how context persists across sessions. AI coding is essentially a specialized agent scenario, so these five components are also the building blocks of enterprise-grade agents. This article covers definitions, structures, collaboration, and implementation practices to help developers build a complete mental framework.
1. The Big Picture: How the Five Components Are Layered
The most effective way to understand these concepts is to look at where each one sits in the system:
- Rules: The static constraint layer that defines what must be done and what must never be done.
- Memories: The state persistence layer that defines what to remember across sessions.
- Skills: The capability packaging layer that defines the standard method for a class of tasks.
- MCP (Model Context Protocol): The connection layer that defines how to access external data and tools in a standard way.
- Workflows: The orchestration layer that defines the order, conditions, and parallel relationships among multiple steps.
A simple layered view looks like this:
User intent↓Workflow (orchestration: stages, conditions, parallelism, rollback)↓Skill (method: steps, rules, examples, scripts)↓MCP (connection: file system, databases, code repositories, retrieval services)↓Rules (constraints) + Memories (memory) run horizontally across the entire chain
Each component is covered in detail below, followed by selection and combination recommendations.
2. Skills: Turning “How to Do It” into Reusable Assets
A Skill is a modular capability component made up of a structured description, execution logic, and optional resources. It injects domain expertise and execution strategies into an agent and is triggered automatically when a semantic match occurs. A Skill is still a structured prompt at its core, but by organizing resources in a directory, it packages the method, steps, examples, and dependent scripts together—making it reusable, composable, and manageable.
A typical Skill directory structure looks like this:
skill-name/├── SKILL.md # Main description: name, description, steps, rules├── reference.md # Optional: reference docs and domain knowledge├── examples.md # Optional: positive and negative examples└── scripts/ # Optional: executable scripts└── read_table.py
The key to SKILL.md is how the description is written. The model relies on the name and description to decide whether to load the Skill, so the description should state the applicable scenarios, trigger conditions, and out-of-scope boundaries rather than offering a generic feature overview. For the body, the recommended order is “prerequisites → execution steps → validation rules → failure handling,” which keeps the model from drifting during long tasks.
Take “convert a business spreadsheet into a visualization dashboard page” as an example. The Skill should include how to call the script that reads the table structure, the mapping rules between fields and chart types, color scheme and responsive layout requirements, and a post-generation checklist (whether data is missing, whether charts are interactive). This way, the same capability can be reused directly across projects without restating the requirements every time.
3. MCP: A Standardized Access Layer to the External World
MCP is an open protocol that lets models discover and use external resources and tools in a unified way, abstracting away interface differences between systems. Its value lies in “connect once, reuse everywhere”: file systems, databases, code repositories, retrieval services, and monitoring and logging services can all expose capabilities through a unified client and server model.
Its core resource types generally fall into three categories:
- Resources (read-only data): such as documents, table schemas, and log snippets;
- Tools (executable actions): such as queries, writes, builds, and tests;
- Prompt templates (reusable instructions): common operations distilled into standard invocation patterns.
It is important to note that the protocol itself provides no “intelligence”; it only delivers capabilities to the model in a discoverable, authenticated, and auditable way. In practice, this must be paired with least privilege, invocation allowlists, and operation auditing. For write and delete operations in particular, a human confirmation step should be introduced.
4. Workflows: Converging Uncertainty into a Controllable Process
Workflows focus on orchestration: stage division, conditional branches, parallel execution, failure retries, and rollback. A Skill answers “can it be done,” while a Workflow answers “in what order should it be done, and at which point can it stop.”
An example orchestration for a practical development scenario:
Understand requirements → Break down the approach → Generate code → Static checks → Unit tests → Review → Commit↑___________ If validation fails, roll back to breaking down the approach ___________|
There are three design essentials. First, set stage gates so each stage produces a verifiable artifact. Second, control context size by trimming inputs per stage to avoid unrelated information diluting attention. Third, keep human checkpoints, inserting confirmation before irreversible operations. Overly rigid processes weaken flexibility, while overly free autonomous loops are hard to govern; in practice, “a fixed backbone with optional branches” is recommended.
5. Rules and Memories: Constraints and Continuity
Rules are long-lived static constraints, such as tech stack versions, directory conventions, commit message formats, the scope of files that must not be touched, and the requirement to include tests. Good rules should be decidable: “new public functions require unit tests” is better than “pay attention to code quality.” The number of rules needs to be controlled, since too many will conflict with each other and raise the cost of compliance.
Memories handle state persistence across sessions and are usually divided into short-term (the current task context), project-level (architecture decisions, interface contracts), and long-term (user preferences, past pitfalls). Implementation should follow three principles: only persist stable and reusable information; set a source and expiration for each memory; and allow explicit updates and deletions to prevent incorrect information from polluting decisions over the long term.
6. How They Combine and How to Choose
- Only need to constrain behavior: use Rules;
- Need consistency across sessions: add Memories;
- Need to capture the standard approach for a class of tasks: write a Skill;
- Need to access external systems: connect MCP;
- Need multi-stage, multi-role collaboration: orchestrate a Workflow.
The quick rule of thumb: for static constraints, use Rules; for state continuity, use Memories; for method reuse, use Skills; for system connectivity, use MCP; for step coordination, use Workflows. In engineering practice on platforms such as Baidu AI Cloud, skills and rules are typically put under version control, external access is consolidated with permission governance, and memories and workflows are persisted separately. This gives agent applications engineering properties such as testability, rollback, and auditability—the key step in moving from “works in a demo” to “ready for production.”
