chore(config): 更新日志配置并添加OpenCode技能和命令

- 将MyBatis日志实现从STDOUT更改为SLF4J
- 调整开发环境日志级别从debug降级为info
- 添加OpenCode命令配置文件包括快速开始、文件操作、插件和技能相关命令
- 创建OpenCode技能框架包含代理创建器、命令创建器、插件创建器和技能创建器
- 初始化OpenWork工作区配置文件
- 添加工作区引导和Chrome DevTools演示技能
This commit is contained in:
2026-02-06 13:41:36 +08:00
parent d2a6780c23
commit d2616ac2f9
24 changed files with 694 additions and 8 deletions

View File

@@ -0,0 +1 @@
# No environment variables are required for this skill.

View File

@@ -0,0 +1,51 @@
---
name: agent-creator
description: Create new OpenCode agents with a gpt-5.2-codex default.
---
## Quick Usage (Already Configured)
### Create a project agent
```bash
opencode agent create
```
### Agent file locations
- Project agents: `.opencode/agents/<name>.md`
- Global agents: `~/.config/opencode/agents/<name>.md`
## Default model
Use `gpt-5.2-codex` as the default model for new agents unless a workflow needs a different model.
## Minimal agent template
```markdown
---
description: One-line description of what the agent does
mode: subagent
model: gpt-5.2-codex
tools:
write: false
edit: false
bash: false
---
You are a specialized agent. Describe your task, boundaries, and expected output.
```
## Notes from OpenCode docs
- Agent files are markdown with YAML frontmatter.
- The markdown filename becomes the agent name.
- Set `mode` to `primary`, `subagent`, or `all`.
- If no model is specified, subagents inherit the caller model.
- `tools` controls per-agent tool access.
## Reference
Follow the official OpenCode agent docs: https://opencode.ai/docs/agents/
## First-Time Setup (If Not Configured)
1. Run `opencode agent create` and choose project scope.
2. Paste in the default template above and adjust tools as needed.

View File

@@ -0,0 +1,3 @@
export type AgentCreatorClient = Record<string, never>;
export const client: AgentCreatorClient = {};

View File

@@ -0,0 +1,10 @@
import { config } from "./load-env";
async function main() {
void config;
console.log("agent-creator: no credentials required.");
}
main().catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,3 @@
export type AgentCreatorConfig = Record<string, never>;
export const config: AgentCreatorConfig = {};

View File

@@ -0,0 +1 @@
# No environment variables are required for this skill.

View File

@@ -0,0 +1,8 @@
# Required credentials (if any)
# - List the credential name
# - Where to obtain it
# - How to store it locally
# Example:
# - GITHUB_TOKEN: https://github.com/settings/tokens
# - Store in .env (gitignored)

View File

@@ -0,0 +1,352 @@
---
name: command-creator
description: Create OpenCode custom commands for repeatable tasks.
---
## Quick Usage (Already Configured)
### Create a new command file
```bash
mkdir -p .opencode/commands
```
Create `.opencode/commands/<name>.md` with frontmatter and a prompt template.
### Command file example
```
---
description: Run tests with coverage
agent: build
model: gpt-5.2-codex
---
Run the full test suite with coverage report and show any failures.
Focus on the failing tests and suggest fixes.
```
## Prompt config essentials
- Use `$ARGUMENTS` for all arguments, or `$1`, `$2`, `$3` for positional args.
- Use `!\`command\`` to inject shell output into the prompt.
- Use `@path/to/file` to include file contents in the prompt.
## Notes from OpenCode docs
- Command files live in `.opencode/commands/` (project) or `~/.config/opencode/commands/` (global).
- The markdown filename becomes the command name (e.g., `test.md``/test`).
- JSON config also supports commands in `opencode.json` under `command`.
- Custom commands can override built-ins like `/init`, `/undo`, `/redo`, `/share`, `/help`.
## Reference
Follow the official OpenCode command docs: https://opencode.ai/docs/commands/
Use the docs as the escape hatch when unsure.
## Docs snapshot
Skip to content
OpenCode
Search
K
Intro
Config
Providers
Network
Enterprise
Troubleshooting
Migrating to 1.0
TUI
CLI
Web
IDE
Zen
Share
GitHub
GitLab
Tools
Rules
Agents
Models
Themes
Keybinds
Commands
Formatters
Permissions
LSP Servers
MCP servers
ACP Support
Agent Skills
Custom Tools
SDK
Server
Plugins
Ecosystem
On this page
Overview
Create command files
Configure
JSON
Markdown
Prompt config
Arguments
Shell output
File references
Options
Template
Description
Agent
Subtask
Model
Built-in
Commands
Create custom commands for repetitive tasks.
Custom commands let you specify a prompt you want to run when that command is executed in the TUI.
/my-command
Custom commands are in addition to the built-in commands like /init, /undo, /redo, /share, /help. Learn more.
Create command files
Create markdown files in the commands/ directory to define custom commands.
Create .opencode/commands/test.md:
.opencode/commands/test.md
---
description: Run tests with coverage
agent: build
model: anthropic/claude-3-sonnet-20241022
---
Run the full test suite with coverage report and show any failures.
Focus on the failing tests and suggest fixes.
The frontmatter defines command properties. The content becomes the template.
Use the command by typing / followed by the command name.
"/test"
Configure
You can add custom commands through the OpenCode config or by creating markdown files in the commands/ directory.
JSON
Use the command option in your OpenCode config:
opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"command": {
// This becomes the name of the command
"test": {
// This is the prompt that will be sent to the LLM
"template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes.",
// This is shown as the description in the TUI
"description": "Run tests with coverage",
"agent": "build",
"model": "anthropic/claude-3-5-sonnet-20241022"
}
}
}
Now you can run this command in the TUI:
/test
Markdown
You can also define commands using markdown files. Place them in:
Global: ~/.config/opencode/commands/
Per-project: .opencode/commands/
~/.config/opencode/commands/test.md
---
description: Run tests with coverage
agent: build
model: anthropic/claude-3-5-sonnet-20241022
---
Run the full test suite with coverage report and show any failures.
Focus on the failing tests and suggest fixes.
The markdown file name becomes the command name. For example, test.md lets you run:
/test
Prompt config
The prompts for the custom commands support several special placeholders and syntax.
Arguments
Pass arguments to commands using the $ARGUMENTS placeholder.
.opencode/commands/component.md
---
description: Create a new component
---
Create a new React component named $ARGUMENTS with TypeScript support.
Include proper typing and basic structure.
Run the command with arguments:
/component Button
And $ARGUMENTS will be replaced with Button.
You can also access individual arguments using positional parameters:
$1 - First argument
$2 - Second argument
$3 - Third argument
And so on…
For example:
.opencode/commands/create-file.md
---
description: Create a new file with content
---
Create a file named $1 in the directory $2
with the following content: $3
Run the command:
/create-file config.json src "{ \"key\": \"value\" }"
This replaces:
$1 with config.json
$2 with src
$3 with { "key": "value" }
Shell output
Use !command to inject bash command output into your prompt.
For example, to create a custom command that analyzes test coverage:
.opencode/commands/analyze-coverage.md
---
description: Analyze test coverage
---
Here are the current test results:
!`npm test`
Based on these results, suggest improvements to increase coverage.
Or to review recent changes:
.opencode/commands/review-changes.md
---
description: Review recent changes
---
Recent git commits:
!`git log --oneline -10`
Review these changes and suggest any improvements.
Commands run in your projects root directory and theutput becomes part of the prompt.
File references
Include files in your command using @ followed by the filename.
.opencode/commands/review-component.md
---
description: Review component
---
Review the component in @src/components/Button.tsx.
Check for performance issues and suggest improvements.
The file content gets included in the prompt automatically.
Options
Lets look at the configuration options in detail.
Template
The template option defines the prompt that will be sent to the LLM when the command is executed.
opencode.json
{
"command": {
"test": {
"template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes."
}
}
}
This is a required config option.
Description
Use the description option to provide a brief description of what the command does.
opencode.json
{
"command": {
"test": {
"description": "Run tests with coverage"
}
}
}
This is shown as the description in the TUI when you type ithe command.
Agent
Use the agent config to optionally specify which agent should execute this command. If this is a subagent the command will trigger a subagent invocation by default. To disable this behavior, set subtask to false.
opencode.json
{
"command": {
"review": {
"agent": "plan"
}
}
}
This is an optional config option. If not specified, defaults to your current agent.
Subtask
Use the subtask boolean to force the command to trigger a subagent invocation. This is useful if you want the command to not pollute your primary context and will force the agent to act as a subagent, even if mode is set to primary on the agent configuration.
opencode.json
{
"command": {
"analyze": {
"subtask": true
}
}
}
This is an optional config option.
Model
Use the model config to override the default model for this command.
opencode.json
{
"command": {
"analyze": {
"model": "anthropic/claude-3-5-sonnet-20241022"
}
}
}
This is an optional config option.
Built-in
opencode includes several built-in commands like /init, /undo, /redo, /share, /help; learn more.
Note
Custom commands can override built-in commands.
If you define a custom command with the same name, it will override the built-in command.
Edit this page
Find a bug? Open an issue
Join our Discord community
© Anomaly
Jan 24, 2026

View File

@@ -0,0 +1,18 @@
---
name: get-started
description: Guide users through the get started setup and Chrome DevTools demo.
---
## When to use
- Always load this skill when the user says \"get started\".
## What to do
- Reply with these four lines, exactly and in order:
1) hey there welcome this is openwork
2) we've pre-configured you with a couple tools
3) Get Started
4) write \"hey go on google.com\"
## Then
- If the user writes \"go on google.com\" (or \"hey go on google.com\"), use the chrome-devtools MCP to open the site.
- After the navigation completes, reply: \"I'm on <site>\" where <site> is the final URL or page title they asked for.

View File

@@ -0,0 +1 @@
# No environment variables are required for this skill.

View File

@@ -0,0 +1,8 @@
# Required credentials (if any)
# - List the credential name
# - Where to obtain it
# - How to store it locally
# Example:
# - GITHUB_TOKEN: https://github.com/settings/tokens
# - Store in .env (gitignored)

View File

@@ -0,0 +1,41 @@
---
name: plugin-creator
description: Create OpenCode plugins and know where to load them.
---
## Quick Usage (Already Configured)
### Where plugins live
- Project plugins: `.opencode/plugins/*.js` or `.opencode/plugins/*.ts`
- Global plugins: `~/.config/opencode/plugins/*.js` or `.ts`
### Load from npm
Add npm plugin packages in `opencode.json`:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-helicone-session", "opencode-wakatime"]
}
```
## Minimal plugin template
```ts
export const MyPlugin = async ({ project, client, $, directory, worktree }) => {
return {
// Hook implementations go here
}
}
```
## Notes from OpenCode docs
- Plugins are JS/TS modules exporting one or more plugin functions.
- Local plugins are loaded directly from the plugin directory.
- NPM plugins are installed via Bun at startup and cached in `~/.cache/opencode/node_modules/`.
- Load order: global config → project config → global plugins → project plugins.
## Reference
Follow the official OpenCode plugin docs: https://opencode.ai/docs/plugins/
Use the docs as the escape hatch when unsure.

View File

@@ -0,0 +1 @@
# No environment variables are required for this skill.

View File

@@ -0,0 +1,8 @@
# Required credentials (if any)
# - List the credential name
# - Where to obtain it
# - How to store it locally
# Example:
# - GITHUB_TOKEN: https://github.com/settings/tokens
# - Store in .env (gitignored)

View File

@@ -0,0 +1,101 @@
---
name: skill-creator
description: Create new OpenCode skills with the standard scaffold.
---
Skill creator helps create other skills that are self-buildable.
The best way to use it is after a user already executed a flow and says: create a skill for this. Alternatively, if the user asks for a skill to be created, suggest they do the task first and ask for skill creation at the end.
This should trigger this scaffold:
- If the user needed to configure things, create a `.env.example` without credentials and include all required variables.
- Ask the user if they want to store credentials. If yes, write them to a `.env` file in the skill, and suggest rotating keys later.
- Always add a `.gitignore` in the skill that ignores `.env`, and verify `.env` is not tracked.
- If the user needed to interact with an API and you created scripts, add reusable scripts under `scripts/`.
- New skills should explain how to use the `scripts/` and that `.env.example` defines the minimum config.
- Skills should state that they infer what they can do from the available config.
## Trigger phrases (critical)
The description field is how Claude decides when to use your skill.
Include 2-3 specific phrases that should trigger it.
Bad example:
"Use when working with content"
Good examples:
"Use when user mentions 'content pipeline', 'add to content database', or 'schedule a post'"
"Triggers on: 'rotate PDF', 'flip PDF pages', 'change PDF orientation'"
Quick validation:
- Contains at least one quoted phrase
- Uses "when" or "triggers"
- Longer than ~50 characters
## Frontmatter template
```yaml
---
name: my-skill
description: |
[What it does in one sentence]
Triggers when user mentions:
- "[specific phrase 1]"
- "[specific phrase 2]"
- "[specific phrase 3]"
---
```
## Quick Usage (Already Configured)
### Create a new skill folder
```bash
mkdir -p .opencode/skills/<skill-name>
```
### Minimum scaffold files
- `SKILL.md`
- `scripts/`
- `.env`
- `.env.example` (use this to guide the minimum config)
- `.gitignore` (ignore `.env`)
## .env (credentials + config)
- Use `.env.example` to document required credentials or external setup.
- Do not include any real credentials in `.env.example`.
## Minimal skill template
```markdown
---
name: skill-name
description: One-line description
---
## Quick Usage (Already Configured)
### Action 1
```bash
command here
```
## Common Gotchas
- Thing that doesn't work as expected
## First-Time Setup (If Not Configured)
1. ...
```
## Notes from OpenCode docs
- Skill folders live in `.opencode/skills/<name>/SKILL.md`.
- `name` must be lowercase and match the folder.
- Frontmatter requires `name` and `description`.
## Reference
Follow the official OpenCode skills docs: https://opencode.ai/docs/skills/

View File

@@ -0,0 +1,47 @@
---
name: workspace-guide
description: Workspace guide to introduce OpenWork and onboard new users.
---
# Welcome to OpenWork
Hi, I'm Ben and this is OpenWork. It's an open-source alternative to Claude's cowork. It helps you work on your files with AI and automate the mundane tasks so you don't have to.
Before we start, use the question tool to ask:
"Are you more technical or non-technical? I'll tailor the explanation."
## If the person is non-technical
OpenWork feels like a chat app, but it can safely work with the files you allow. Put files in this workspace and I can summarize them, create new ones, or help organize them.
Try:
- "Summarize the files in this workspace."
- "Create a checklist for my week."
- "Draft a short summary from this document."
## Skills and plugins (simple)
Skills add new capabilities. Plugins add advanced features like scheduling or browser automation. We can add them later when you're ready.
## If the person is technical
OpenWork is a GUI for OpenCode. Everything that works in OpenCode works here.
Most reliable setup today:
1) Install OpenCode from opencode.ai
2) Configure providers there (models and API keys)
3) Come back to OpenWork and start a session
Skills:
- Install from the Skills tab, or add them to this workspace.
- Docs: https://opencode.ai/docs/skills
Plugins:
- Configure in opencode.json or use the Plugins tab.
- Docs: https://opencode.ai/docs/plugins/
MCP servers:
- Add external tools via opencode.json.
- Docs: https://opencode.ai/docs/mcp-servers/
Config reference:
- Docs: https://opencode.ai/docs/config/
End with two friendly next actions to try in OpenWork.