73 lines
2.6 KiB
Plaintext
73 lines
2.6 KiB
Plaintext
---
|
||
description: "Skills 系统微索引 — 两层激活机制和依赖关系"
|
||
alwaysApply: true
|
||
---
|
||
|
||
# Skills 微索引
|
||
|
||
## 两层激活机制
|
||
|
||
本项目的技能分为两层:
|
||
|
||
1. **自动激活层**(`skill-*.mdc`)— Cursor 通过 globs 和 description 自动匹配注入,
|
||
Agent 直接遵循即可,无需手动加载
|
||
2. **按需加载层**(`.cursor/skills/*/SKILL.md`)— 需要 Agent 主动 Read,
|
||
适用于低频技能和深度参考
|
||
|
||
每个 `skill-*.mdc` 是精简执行摘要;对应的 `SKILL.md` 是完整详情。
|
||
Agent 在需要模板、代码示例或深度参考时,Read 对应 SKILL.md。
|
||
|
||
显式调用:`/skill-name` 或 `@skill-name` → 立即 Read 对应 SKILL.md。
|
||
|
||
## 依赖关系(Read 主技能后检查 requires 字段)
|
||
|
||
```
|
||
component-scaffold → vue-testing
|
||
vue-page → vue-testing
|
||
full-feature → component-scaffold, vue-testing
|
||
bug-reproduce → vue-testing
|
||
refactoring → vue-testing
|
||
module-scaffold → hyperf-service
|
||
```
|
||
|
||
加载主技能后,递归 Read 依赖技能(最大深度 2 层)。
|
||
|
||
## 兜底路由(自动激活层未覆盖时)
|
||
|
||
| 信号 | Read 路径 |
|
||
|------|----------|
|
||
| 反爬虫/Bot 防护 | `.cursor/skills/anti-scraping/SKILL.md` |
|
||
| Bug 复现/回归测试 | `.cursor/skills/bug-reproduce/SKILL.md` |
|
||
| 环境配置/项目初始化 | `.cursor/skills/env-setup/SKILL.md` |
|
||
| MCP Server 构建 | `.cursor/skills/mcp-builder/SKILL.md` |
|
||
| WebSocket 实时通信 | `.cursor/skills/websocket-service/SKILL.md` |
|
||
| 消息队列/异步任务 | `.cursor/skills/message-queue/SKILL.md` |
|
||
| Nginx 配置 | `.cursor/skills/nginx-config/SKILL.md` |
|
||
| Redis 缓存策略 | `.cursor/skills/redis-cache/SKILL.md` |
|
||
| 文档生成/更新 | `.cursor/skills/documentation/SKILL.md` |
|
||
| Hyperf 模块化/新建模块 | `.cursor/skills/module-scaffold/SKILL.md` |
|
||
| 创建新技能 | `.cursor/skills/skill-creator/SKILL.md` |
|
||
|
||
## SKILL.md 标准格式
|
||
|
||
```yaml
|
||
---
|
||
name: kebab-case-name
|
||
description: "做什么 + 什么时候用(< 250 字符)"
|
||
requires: [dep-skill] # 可选
|
||
---
|
||
```
|
||
|
||
## skill-*.mdc 编写原则
|
||
|
||
- **通用质量约束**(行数限制、命名规范、设计模式)放在基础编码规则(`01x-*.mdc`)中,
|
||
确保编辑文件时始终生效,不受技能适用性守卫影响
|
||
- `skill-*.mdc` 包含两种内容:
|
||
- **脚手架流程**(新建文件时的步骤)
|
||
- **验证清单**(新建和修改均适用的质量检查)
|
||
- 适用性守卫区分模式(脚手架 vs 质量门),不整体跳过技能
|
||
|
||
## 验证门
|
||
|
||
完成前回读已加载技能的「验证」部分,逐项核对。
|