r/opencode • u/basicduck3953 • 3d ago
I have difficulty understanding the conceptual difference between skills, instructions and agents. Please help
I can understand tools, permissions, plugins and agents. Tools call external processes. Permissions are set by the harness and cannot fail (they are sort of deterministic instructions), unless the agent edits the project permissions file itself, which can be prevented from permissions themselves. Plugins plug in to the harness and change the harness itself.
But skills, instructions and agents are all text processed by LLM. From what I understood,
Skills - HOW to do something
Agents - overall WHAT to do + permissions
Instructions - KNOWLEDGE of what is happening
But they all seem to contain some aspects of the other. Are they redundant? Have I understood them incorrectly?
2
u/Grouchy-Stranger-306 3d ago
they can be redundant so you have to make them in a way so they aren't, but between skills and agents.md there is still a difference: the agents.md file is generally always read, and as for skills they are only read when needed, so the context isn't bloated and the agent only sees the description and the title of the skill
1
u/tiredofmissingyou 3d ago
it only matters when they load and thats how you determine what to put where.
So for example - SKILL.md with a description of "Load always" is basically the same as global AGENTS.md file.
The point is not to maximize this system. Just find what you like, keep it simple and small and you'll be able to tell which instructions cause which behavior:)
1
u/basil_0408 3d ago edited 3d ago
Try using them and you will understand, its not complicated.
For example, if I want the agent to talk in a really funny way or never do something, I modify agents.md, its similar to a system prompt. Or if I want the agent to perform a repeated task reliably, I should create a skill. For example, a skill that pulls the news from website A. It will create a script with instructions and bundle them as a skill, so next time I just need to ask, "Hey, run the skill," to get the news, and because it is the same script every time, I do not need to worry that it will pull from the wrong website.
1
u/FallDisastrous6621 3d ago
You can think of in a way:
- Instructions (AGENTS.md) are default context, everything you put there will be prefixed in every prompt as general knowledge relevant to any action over current project (workspace, folder)
- Commands in Opencode are just saved prompts, if you have some repeatable prompt - you create command of it and use /commant_name to save time and effort
- Skills are similar to instructions, but in scope of particular task, they're injected into prompt conditionally by agent (if it thinks some skill is relevant) or manually via '/' similarly to commands.
- Agent are similar to instructions, but scoped. Think of it as of environment definition, or role.
I agree they all looks redundant as they all just .md/.json files, and you technically can acheive the save using just one of them.
But the key - you should cook them properly, because agent treats them differently in terms of behavior, and outcomes are efficiency, control and flexibility.
1
u/MiraiHatada 3d ago
They're just how to pre-load and occationally-load text you wrote.
AGENTS.md -
{project dir}/AGENTS.mdand{home}/{harness}/AGENTS.mdare entirely loaded everytime you start a session, and on compactionSkills - it loads a table of (skill_name, skill_description) everytime you start a session, and after that, load specific
{skill dir}/{skill_name}/SKILL.mdwhen circumstance matches skill_descriptionInstruction - idk what you mean by this word but you said "Knowledge of what is happening" that indicates Context Window, the memory of current session, up to 1M tokens in most cases. The more context the higher charge you pay. Forget it until it matters you