agents/wopal/skills/crafting-opencode-rules/SKILL.md
创建或修改 OpenCode 规则文件时使用。帮助从对话历史中提取模式、分析项目约定(AGENTS.md、linter、package.json),并生成格式正确的规则。触发条件:用户想创建规则、固化重复指令、跨会话持久化指导、或为特定文件/主题定制 Agent 行为。
npx skillsauth add sampx/agent-tools crafting-rulesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
规则是注入到系统提示中的 Markdown 文件,用于引导 Agent 行为。
基本结构:
---
globs:
- '**/*.ts'
keywords:
- 'vitest'
---
# 规则标题
- 规则内容:具体、可执行的指令。
| 字段 | 类型 | 用途 |
|------|------|------|
| globs | string[] | 上下文中任一文件匹配时触发 |
| keywords | string[] | 用户最新提示匹配关键词时触发 |
| alwaysApply | boolean | 始终应用 |
匹配规则:
globs 和 keywords 同时存在时,任一匹配即触发(OR 逻辑)globs AND keywords;需要此行为请拆分为多条规则| 场景 | 推荐方式 |
|------|----------|
| 针对特定文件/目录的代码规则 | globs |
| 针对某个主题(可能不涉及文件) | keywords |
| 两种情况都应触发 | globs + keywords |
| 全局标准(语气、结构、安全、提交规范) | 无条件 |
重要约束: 关键词匹配是大小写不敏感的词边界前缀匹配。例如 test 会匹配 tests 和 testing。
~/.config/opencode/rules/ - 个人偏好,跨项目生效.opencode/rules/ - 项目/团队约定,仓库级行为应该创建规则的信号:
分析问题:
创建流程:
匹配机制: 关键词使用大小写不敏感的词边界前缀匹配。短/泛化关键词容易过度匹配。
| 类别 | 示例 |
|------|------|
| 泛化名词 | code, file, project, repo, bug, issue, change |
| 常见动词 | add, update, remove, fix, make, create, implement |
| 过宽主题 | testing, performance, security, deployment, database, api |
| 单词缩写 | ci, cd, db, ui, ux |
| 类别 | 示例 |
|------|------|
| 工具/框架名 | vitest, jest, pytest, playwright, cypress, eslint, prettier, typescript, terraform, kubernetes |
| 复合短语 | unit test, integration test, snapshot test, lint rule, error boundary, api endpoint, rest api |
| 高意图动词 | refactor, rollback, migrate, deprecate |
考虑 denylist 关键词时的替代方案:
关键词自检:
---
globs:
- '**/*.ts'
- '**/*.tsx'
---
# TypeScript
- 优先用 `type` 而非 `interface`(除非需要声明合并)
- 避免 `any`;使用 `unknown` 并收窄类型
---
keywords:
- 'unit test'
- 'integration test'
- 'vitest'
- 'jest'
---
# Unit Tests
- 遵循 Arrange-Act-Assert 模式
- 测试命名:`it('should <expected> when <condition>')`
# Code Style
- 优先早返回而非深层嵌套
- 将魔法数字提取为命名常量
---
globs:
- '**/deploy/**'
- '**/*.tf'
keywords:
- 'terraform'
- 'kubernetes'
- 'production'
- 'rollback'
---
# Deployment
- 禁止硬编码密钥;使用环境变量或密钥管理器
- 任何生产变更计划必须包含回滚步骤
tools
Configure ellamaka, a fork of OpenCode with wopal-space mode. MUST use for any task about ellamaka config, agent frontmatter, permission rules, model/provider selection, formatter settings, config loading order, or why config changes are ignored. Trigger on requests about ellamaka or opencode config files, agent permission overrides, restricting subagents, custom/plugin tool permissions (e.g. wopal_task_*), disabling tools, configuring providers or models, formatter setup, config precedence or layering, or debugging settings that do not take effect. Use this skill even when the user says "opencode" if the actual runtime, config path, or behavior is ellamaka. Prefer this skill whenever the answer depends on the difference between ellamaka and upstream opencode, including wopal-space config loading, plugin tool permissions, or agent frontmatter precedence.
development
Plan quality verification for dev-flow. Goal-backward analysis ensures plans WILL achieve their stated goal before execution burns context. ⚠️ MUST use when: (1) Reviewing Plan quality before approve (2) Wopal completes Plan writing and needs quality gate (3) User asks to "check plan", "verify plan", "review plan" (4) Plan enters planning status and needs pre-execution validation 🔴 Trigger automatically when Plan is ready for review, even if user doesn't explicitly say "review". Agent: rook (read-only verification subagent) Mode: verification, not execution
development
Review implementation results for goal achievement and code quality. Supports both Plan-backed review and planless diff review. ⚠️ MUST use when: (1) Wopal delegates rook to review fae implementation output, (2) Prompt contains "review_type: implementation", (3) Prompt contains changed code file list or Plan path + implementation scope, (4) Any code review request from Wopal. 🔴 Trigger even when user does not explicitly mention "review" if the task involves verifying implementation results. This skill is rook-exclusive (only rook agent can load it).
tools
Foundation rules for how Wopal collaborates with sub-agents such as fae and rook. ⚠️ MUST load before ANY delegation — covers delegation tool APIs, task lifecycle, notifications, status handling, and recovery. 🔴 Trigger: "delegate", "let fae implement", "fae task", "rook review", "check task status", "cancel task", "abort task", "agent collaboration", "委派", "让 fae 执行", "fae 任务", "rook 审查", "检查状态", or any intent to hand work to a sub-agent. 🔴 Never delegate without loading this skill first. Skipping it is serious negligence. Note: this skill does not include workflow-specific prompt templates such as dev-flow templates. Those belong to the corresponding workflow skills.