| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
English | 简体中文
opencode-roles is an OpenCode plugin that adds a role layer on top of the normal skill system.
It helps the model choose a domain-specific role first, then load that role's full instructions and role-specific skills only when needed.
This plugin supports progressive skill disclosure through roles.
That matters because a traditional skill-only setup tends to expose every available skill up front. As the number of skills grows, too many unrelated skills get pulled into the model's decision space at the same time.
That usually leads to three problems:
With opencode-roles, the model only sees lightweight role metadata first. The full role instructions and role-specific skills are revealed only after that role is selected and loaded.
In practice, this keeps the prompt cleaner, reduces noise, and makes it easier for the model to use the right skills for the right task.
In this plugin, a role is a reusable expert identity for a specific domain or task type.
A role usually defines:
Examples:
A normal skill is a single capability.
A role is a full working perspective.
The role decides how the model should approach the task. The skill helps the model perform a more specific subtask inside that role.
Roles are useful when you want OpenCode to behave differently across different kinds of work.
Common use cases:
The plugin adds three behaviors:
This keeps the default prompt lightweight while still allowing rich domain-specific behavior.
Create or update opencode.json in your project root:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-roles"]
}Then restart OpenCode.
OpenCode will install the npm package through its normal plugin mechanism.
Default layout:
.opencode/
roles/
frontend-architect/
ROLE.md
backend-reviewer/
ROLE.md
skills/
react-performance/
SKILL.md
api-contracts/
SKILL.md
Rules:
Each role must include frontmatter with:
Example:
---
name: frontend-architect
description: Design frontend architecture, component boundaries, and UI implementation strategy
---
You are the frontend architect role.
Focus on:
- component boundaries
- state placement
- rendering behavior
- maintainable UI structure
## Available role skills
- `react-performance`: Optimize React rendering, state boundaries, and unnecessary rerendersRequirements:
Role skills use the same SKILL.md format as normal skills.
Example:
---
description: Improve React rendering performance and state boundaries
---
# React Performance
Use this skill when reviewing React code for:
- unnecessary rerenders
- state placed too high in the tree
- unstable props or closures
- over-coupled componentsThe expected flow is:
Example task routing:
If you do not want to keep all roles under .opencode/roles, add extra roots in .opencode/roles/config.json:
{
"paths": [
".shared/opencode-roles",
"~/company/opencode-roles"
]
}Notes:
If the plugin does not appear to work, check these first:
Common mistakes:
.opencode/
roles/
code-reviewer/
ROLE.md
skills/
review-checklist/
SKILL.md
ROLE.md
---
name: code-reviewer
description: Perform practical code review with emphasis on bugs, regressions, and missing tests
---
You are the code reviewer role.
Focus on:
- correctness
- regressions
- missing tests
## Available role skills
- `review-checklist`: Review code using a checklist for bugs, regressions, and missing testsSKILL.md
---
description: Review code using a checklist for bugs, regressions, and missing tests
---
# Review Checklist
When reviewing code, check:
- correctness under edge cases
- behavioral regressions
- missing tests for changed paths{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-roles"]
}| Back | FazBrowse Home | New Git URL |