This commit is contained in:
jeremygan2021
2026-03-04 19:31:16 +08:00
parent f5117a90d1
commit 3eda3a947b
10 changed files with 439 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
---
description: OpenWork default agent (safe, mobile-first, self-referential)
mode: primary
temperature: 0.2
---
You are OpenWork.
When the user refers to \"you\", they mean the OpenWork app and the current workspace.
Your job:
- Help the user work on files safely.
- Automate repeatable work.
- Keep behavior portable and reproducible.
Memory (two kinds)
1) Behavior memory (shareable, in git)
- `.opencode/skills/**`
- `.opencode/agents/**`
- repo docs
2) Private memory (never commit)
- Tokens, IDs, credentials
- Local DBs/logs/config files (gitignored)
- Notion pages/databases (if configured via MCP)
Hard rule: never copy private memory into repo files verbatim. Store only redacted summaries, schemas/templates, and stable pointers.
Reconstruction-first
- Do not assume env vars or prior setup.
- If required state is missing, ask one targeted question.
- After the user provides it, store it in private memory and continue.
Verification-first
- If you change code, run the smallest meaningful test or smoke check.
- If you touch UI or remote behavior, validate end-to-end and capture logs on failure.
Incremental adoption loop
- Do the task once end-to-end.
- If steps repeat, factor them into a skill.
- If the work becomes ongoing, create/refine an agent role.
- If it should run regularly, schedule it and store outputs in private memory.

View File

@@ -0,0 +1,5 @@
---
description: "Get started"
---
get started

View File

@@ -0,0 +1,5 @@
---
description: "Safe, practical file workflows"
---
Show me how to interact with files in this workspace. Include safe examples for reading, summarizing, and editing.

View File

@@ -0,0 +1,5 @@
---
description: "What plugins are and how to install them"
---
Explain what plugins are and how to install them in this workspace.

View File

@@ -0,0 +1,5 @@
---
description: "How skills work and how to create your own"
---
Explain what skills are, how to use them, and how to create a new skill for this workspace.

11
.opencode/openwork.json Normal file
View File

@@ -0,0 +1,11 @@
{
"version": 1,
"workspace": {
"name": "skills",
"createdAt": 1772623586570,
"preset": "starter"
},
"authorizedRoots": [
"/Users/jeremygan/Library/Application Support/com.differentai.openwork/workspaces/starter/.opencode/skills"
]
}

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,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.

286
README.md Normal file
View File

@@ -0,0 +1,286 @@
# OpenCode Skills 技能文件夹
本文件夹包含 OpenCode 的各种技能Skills每个技能都是一个独立的功能模块可以为 AI 助手提供特定领域的能力。
## 目录结构
```
.opencode/
└── skills/
├── get-started/ # 入门引导技能
├── workspace-guide/ # 工作区指南技能
├── plugin-creator/ # 插件创建技能
├── skill-creator/ # 技能创建技能
├── command-creator/ # 命令创建技能
├── agent-creator/ # 代理创建技能
└── event-publisher/ # 活动发布技能
```
## 技能详解
### 1. get-started入门引导
**路径**: `skills/get-started/SKILL.md`
**功能**: 引导新用户完成 OpenWork 的入门设置和 Chrome DevTools 演示。
**触发条件**: 用户说 "get started" 或类似表达
**主要用途**:
- 欢迎新用户并介绍 OpenWork
- 引导用户访问 Google.com 演示 Chrome DevTools 功能
- 返回 "I'm on <site>" 确认导航完成
---
### 2. workspace-guide工作区指南
**路径**: `skills/workspace-guide/SKILL.md`
**功能**: 向新用户介绍 OpenWork 并帮助其入门。
**主要用途**:
- 区分技术用户和非技术用户,提供不同的说明
- 解释 Skills技能和 Plugins插件的概念
- 提供快速入门的操作建议
**针对非技术用户**:
- 解释 OpenWork 像聊天应用一样简单
- 指导如何总结、创建和组织文件
**针对技术用户**:
- 介绍 OpenCode 的完整功能
- 指向官方文档学习更多
---
### 3. plugin-creator插件创建
**路径**: `skills/plugin-creator/SKILL.md`
**功能**: 帮助创建 OpenCode 插件,提供插件开发指南和模板。
**插件存放位置**:
- 项目插件: `.opencode/plugins/*.js``.ts`
- 全局插件: `~/.config/opencode/plugins/*.js``.ts`
**从 npm 加载插件**:
`opencode.json` 中配置:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-helicone-session", "opencode-wakatime"]
}
```
**最小插件模板**:
```typescript
export const MyPlugin = async ({ project, client, $, directory, worktree }) => {
return {
// Hook implementations go here
}
}
```
---
### 4. skill-creator技能创建
**路径**: `skills/skill-creator/SKILL.md`
**功能**: 帮助创建新的 OpenCode 技能,包含标准化的脚手架模板。
**最佳使用方式**:
1. 用户先执行一个流程
2. 然后说 "create a skill for this"
3. 使用本技能创建可复用的技能
**创建步骤**:
1. 如果需要配置,创建 `.env.example`(不含凭据)
2. 询问用户是否需要存储凭据
3. 创建 `.gitignore` 忽略 `.env`
4. 添加可复用脚本到 `scripts/` 目录
**触发短语示例**:
```yaml
---
name: my-skill
description: |
[技能一句话描述]
触发条件:
- "[具体短语1]"
- "[具体短语2]"
- "[具体短语3]"
---
```
**文件夹结构**:
```
skill-name/
├── SKILL.md # 技能定义文件(必需)
├── scripts/ # 可复用脚本目录
├── .env # 环境变量和凭据
├── .env.example # 环境变量模板
└── .gitignore # 忽略 .env
```
---
### 5. command-creator命令创建
**路径**: `skills/command-creator/SKILL.md`
**功能**: 创建 OpenCode 自定义命令,用于重复性任务。
**命令存放位置**:
- 项目命令: `.opencode/commands/`
- 全局命令: `~/.config/opencode/commands/`
**命令文件示例**:
```markdown
---
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.
```
**使用方式**: 在 TUI 中输入 `/命令名` 执行
**高级功能**:
- `$ARGUMENTS` - 传递参数
- `$1`, `$2`, `$3` - 位置参数
- `` !`command` `` - 注入 Shell 输出
- `@path/to/file` - 包含文件内容
---
### 6. agent-creator代理创建
**路径**: `skills/agent-creator/SKILL.md`
**功能**: 创建新的 OpenCode 代理,默认使用 gpt-5.2-codex 模型。
**创建命令**:
```bash
opencode agent create
```
**代理存放位置**:
- 项目代理: `.opencode/agents/<name>.md`
- 全局代理: `~/.config/opencode/agents/<name>.md`
**代理模板**:
```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.
```
**配置选项**:
- `mode`: `primary`, `subagent`, 或 `all`
- `model`: 指定使用的模型
- `tools`: 控制代理的工具访问权限
---
### 7. event-publisher活动发布助手
**路径**: `skills/event-publisher/SKILL.md`
**功能**: 完整的一站式活动创建和发布流程:选题 → 文案生成 → 海报生成含Logo→ 活动发布。
**触发条件**:
- "发布活动"、"创建活动"
- "活动海报"、"活动文案"
- "生成海报"、"上传活动"
- "过年游园"、"春节活动"
**工作流程**:
```
用户提供信息
生成文案 (generate_content.sh) → 得到 .md 文件
生成海报 (generate_image.sh)
→ AI生成提示词
→ 生成图片
→ 自动叠加Logo
→ 保存提示词
用户选择图片
发布活动 (upload_event.sh)
→ 上传图片到OSS
→ 读取 .md 文件作为 description
→ 发布 API
返回活动ID ✅
```
**包含的脚本**:
| 脚本 | 功能 |
|------|------|
| `generate_content.sh` | 生成标准化的 Markdown 活动文案 |
| `generate_prompt.sh` | 生成图片提示词 |
| `generate_image.sh` | 生成图片(含 Logo 处理) |
| `add_logo.py` | 自动添加 quant-speed Logo |
| `upload_event.sh` | 上传图片并发布活动 |
**API 配置**:
| 服务 | API | 状态 |
|------|-----|------|
| 豆包图片生成 | doubao-seedream-5-0-260128 | ✅ |
| 豆包文本生成 | doubao-seed-2-0-pro-260215 | ✅ |
| Nanobanana | gemini-3-pro-image-preview | ✅ |
| 图片上传OSS | data.tangledup-ai.com/upload | ✅ |
| 活动发布 | market.quant-speed.com | ✅ |
---
## 通用约定
### Frontmatter 格式
每个 SKILL.md 文件顶部都包含 YAML 格式的元数据:
```yaml
---
name: skill-name # 技能名称(小写,与文件夹名一致)
description: | # 技能描述(触发条件和使用说明)
技能功能描述
触发条件:
- "具体短语1"
- "具体短语2"
---
```
### 快速使用标记
- **Quick Usage (Already Configured)**: 表示该技能已预配置,可直接使用
- **First-Time Setup (If Not Configured)**: 表示首次使用时的设置步骤
---
## 官方文档
更多详细信息请参考 OpenCode 官方文档:
- Skills: https://opencode.ai/docs/skills/
- Plugins: https://opencode.ai/docs/plugins/
- Commands: https://opencode.ai/docs/commands/
- Agents: https://opencode.ai/docs/agents/

15
opencode.jsonc Normal file
View File

@@ -0,0 +1,15 @@
{
"$schema": "https://opencode.ai/config.json",
"default_agent": "openwork",
"mcp": {
"control-chrome": {
"command": [
"chrome-devtools-mcp"
],
"type": "local"
}
},
"plugin": [
"opencode-scheduler"
]
}