Rules, Memory, and Skills in AI Coding Tools: A Layered Guide
This article breaks down the overlapping mechanisms found in AI coding tools—rules, memory, skills, connectors, workflows, and hooks—into five layers: constraints, context, experience, capability, and orchestration. It explains what each layer does, how they differ, and why enabling everything at once can degrade model performance. You will also find practical guidance on writing concise rules, keeping memory reviewable and expiring, separating skills from connectors, designing observable workflows, and choosing a minimal starting configuration.
1. Why the Confusion: Same Names for Different Things, Different Names for the Same Thing
When you open the configuration panel of an AI coding tool, you often see six or seven entries side by side: rules, memory, skills, connectors, workflow orchestration, and hooks. The problem for most teams is not that these mechanisms are too difficult. It is that they address different layers of the same class of problem, yet different products wrap them in different names. This leads to debates such as “Are rules and memory the same thing?” or “How do connectors differ from skills?” Some people simply turn on every switch, and model performance ends up getting worse.
To untangle these relationships, start with a unified layered view. These mechanisms can be grouped into five layers:
- Constraint layer: defines what must be done and what must not be done. It is long-lived and travels with the project.
- Context layer: provides static background knowledge about what the project is.
- Experience layer: records how things were done last time and what pitfalls were hit, accumulating over time.
- Capability layer: brings in external systems, external data, and external actions.
- Orchestration layer: chains multiple steps into repeatable workflows and attaches automatic trigger points.
The rest of this article walks through these five layers one by one and offers selection and combination advice.
2. Constraint Layer: Rules Are the Project’s Onboarding Notes
Rules are the simplest and most critical of all these mechanisms. They are like an onboarding document for a new teammate: primary language and version, directory conventions, naming style, forbidden syntax, test commands, and commit and release processes. Their defining trait is that they stay in effect permanently. The model reads them before starting any work and constrains its output accordingly.
Rules should be kept “short and hard.” It is best to include only content that can be mechanically verified, for example:
# Project Conventions- Language: strongly typed language; implicit nulls and unhandled exceptions are forbidden- Directories: business code in src/, tests in tests/, scripts in scripts/- Testing: unit tests and static checks must pass before committing- Commits: one commit does one thing; use the imperative mood for messages
The anti-pattern to avoid is stuffing lengthy design documents, historical decision records, or full API specifications into the rules file. The longer the rules, the more diluted the key constraints become, and the model loses focus. A common industry practice is layered loading: a global layer for general preferences, a project layer for engineering conventions, and a directory layer for local exceptions, with more specific scopes taking higher priority. This preserves consistency while allowing local exceptions.
3. Context Layer and Experience Layer: Memory Is the Model’s Own Work Notes
Memory is the mechanism most easily confused with rules. The difference lies in “who writes it and when it changes.” Rules are explicitly maintained by people and change slowly. Memory is accumulated by the model during use, changes quickly, and is often tied to a specific task—for example, the historical defects of a module, a trade-off confirmed during a review, or the verification steps for a certain type of change.
The value of memory is cross-session continuity, but that is also where its risk lies: once a wrong conclusion is written in and repeatedly referenced, the bias keeps amplifying. In practice, three principles are recommended:
- Reviewable: memory entries must be visible, editable, and deletable by people, not a black box.
- Expirable: attach a timestamp and applicable scope to each entry so stale information does not contaminate new tasks.
- Layered isolation: keep project-level memory separate from temporary task memory, and clear the latter when the task ends.
A practical rule of thumb: if a piece of information should constrain everyone over the long term, put it in the rules; if it is a fact confirmed during a specific collaboration, put it in memory; if it belongs to product requirements or architecture decisions, go back to the requirements and design documents rather than relying on memory.
4. Capability Layer: Skills and Connectors Solve “Knowing How” and “Being Able to Reach”
Skills describe reusable ways of getting things done, close to an “operations manual plus checklist”—for example, “the standard steps for adding a new API endpoint” or “the fixed path for troubleshooting a certain class of performance issue.” Their key attributes are composability and explicit invocation. They break complex tasks into stable steps and reduce the variance caused by the model improvising each time.
Connectors solve a different problem: letting the model reach the outside world. They typically expose the data and operations of external systems through standardized protocols, such as querying a task system, reading monitoring metrics, searching an internal knowledge base, or operating a container platform or object storage. It is worth emphasizing that connectors themselves provide no intelligence; they only provide controlled input and output channels. This makes permission boundaries and auditing more important than the number of capabilities. It is recommended to add a confirmation step for all write operations, restrict the data scope of read operations, and keep complete call logs.
The division of labor is easy to remember: skills are “how to do it,” connectors are “what you can touch.” Writing the invocation details of external systems directly into rules makes the rules swell quickly and become hard to maintain. The correct approach is to let rules declare constraints only, let skills solidify processes, and let connectors handle integration.
5. Orchestration Layer: Workflows and Hooks Solidify Repetitive Work
Workflow orchestration targets repeatable multi-step tasks, such as “pull requirements—generate changes—run tests—summarize results.” Its purpose is to turn a one-off successful path into an executable asset, producing more stable output and making it easier for the team to share. Hooks are event-driven trigger points that automatically run validation or cleanup before or after specific actions, such as running static checks before a commit or auto-formatting after generation.
The key to orchestration design is not length but observability and rollback capability. Every step should have clear inputs and outputs, failure handling, and a timeout policy. Keep intermediate artifacts on failure to make diagnosis easier. Never hard-code uncertain human judgment into a workflow, or occasional issues will turn into systemic blockers.
6. Common Pitfalls and Selection Advice
- Enabling everything makes the model dumber: when constraints, context, and capabilities all expand at once, they crowd out effective attention and key instructions get ignored. Start from a minimal configuration by default.
- Using memory instead of documentation: memory suits experience, not authoritative information.
- Writing secrets into rules or memory: credentials should be injected through environment variables or a secrets management capability, with only references kept in configuration files.
- Missing layering: mixing global and project rules in a single file makes future maintenance impossible.
The recommended rollout order is: first write a concise set of rules to unify engineering conventions; then introduce skills as needed to solidify high-frequency processes; next connect the necessary external connectors and set up permissions and auditing; finally use workflows and hooks to automate repetitive steps, with memory serving only as a supplement and being cleaned up periodically.
7. Conclusion
These configuration items are not mysterious. Together they form a governance framework for human-machine collaboration: rules set boundaries, context provides background, memory stores experience, skills and connectors extend capability, and workflows and hooks ensure stability. Once you understand the layered relationships, the selection question dissolves—it is not about which one to choose, but which layer to fill in at each stage. In engineering practice on platforms such as Baidu AI Cloud, the same advice applies: start with a minimal viable configuration, continuously observe results with logging and monitoring alerts, and then expand step by step. This way you gain efficiency while keeping results controllable and reproducible.
