agent-configs 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -12
- package/agents/component-api-extractor.md +267 -0
- package/agents/skill-generator.md +292 -0
- package/bundles/personal-memory/.claude/hooks/memory-compact.js +13 -0
- package/bundles/personal-memory/.claude/hooks/memory-start.js +48 -0
- package/bundles/personal-memory/.claude/lib/memory.js +46 -0
- package/bundles/personal-memory/.claude/settings.json +26 -0
- package/bundles/personal-memory/.claude/skills/personal-memory/SKILL.md +31 -0
- package/bundles/personal-memory/.cursor/hooks/pre-compact.js +32 -0
- package/bundles/personal-memory/.cursor/hooks/session-start.js +41 -0
- package/bundles/personal-memory/.cursor/hooks.json +14 -0
- package/bundles/personal-memory/.cursor/lib/memory.js +70 -0
- package/bundles/personal-memory/.cursor/rules/personal-memory.mdc +51 -0
- package/bundles/personal-memory/README.md +44 -0
- package/bundles/personal-memory/gitignore-entries.txt +7 -0
- package/bundles/personal-memory/templates/scratch.md +6 -0
- package/bundles/personal-memory/templates/session-context.md +19 -0
- package/cli.js +276 -3
- package/commands/gen-component-skill.md +121 -0
- package/configs.json +33 -4
- package/frameworks/vibecoding/config.yaml +18 -0
- package/frameworks/vibecoding/docs/lessons-learned.md +47 -0
- package/frameworks/vibecoding/docs/templates/api-guide.md.example +38 -0
- package/frameworks/vibecoding/docs/templates/architecture.md.example +32 -0
- package/frameworks/vibecoding/examples/topic-rule.mdc.example +44 -0
- package/frameworks/vibecoding/rules/cursor-governance.mdc +68 -0
- package/frameworks/vibecoding/rules/project-entry.mdc +54 -0
- package/frameworks/vibecoding/skills/learn-lesson/SKILL.md +126 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -10,24 +10,23 @@ CLI tool to install curated Claude Code and Cursor configurations.
|
|
|
10
10
|
- **双平台支持** - Claude Code + Cursor(默认 Cursor)
|
|
11
11
|
- **完整配置** - Commands + Skills + Rules + Agents + Bundles(Hooks 通过 Bundles 提供)
|
|
12
12
|
- **Bundle 优先** - 相关配置打包,一键安装
|
|
13
|
+
- **Framework init** - 一键初始化团队规范框架(如 VibeCoding),交互式填充项目配置
|
|
14
|
+
- **三层知识模型** - 团队规范(git-tracked)+ 团队经验(learn-lesson)+ 个人记忆(gitignored)
|
|
13
15
|
|
|
14
16
|
## 快速开始
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
#
|
|
18
|
-
npx agent-configs
|
|
19
|
+
# 初始化 VibeCoding 团队框架(推荐首先执行)
|
|
20
|
+
npx agent-configs init vibecoding
|
|
19
21
|
|
|
20
|
-
#
|
|
21
|
-
npx agent-configs
|
|
22
|
+
# 安装个人记忆 bundle
|
|
23
|
+
npx agent-configs install personal-memory
|
|
24
|
+
|
|
25
|
+
# 进入交互式菜单
|
|
26
|
+
npx agent-configs
|
|
22
27
|
|
|
23
28
|
# 安装推荐配置
|
|
24
29
|
npx agent-configs install --preset recommended
|
|
25
|
-
|
|
26
|
-
# 安装单个配置
|
|
27
|
-
npx agent-configs install plan
|
|
28
|
-
|
|
29
|
-
# 安装 bundle(推荐)
|
|
30
|
-
npx agent-configs install tdd-bundle
|
|
31
30
|
```
|
|
32
31
|
|
|
33
32
|
## 交互模式
|
|
@@ -107,11 +106,12 @@ agent-configs - Claude Code & Cursor 配置共享工具
|
|
|
107
106
|
| security-reviewer | 安全审查专家 |
|
|
108
107
|
| refactor-cleaner | 重构清理专家 |
|
|
109
108
|
|
|
110
|
-
### Bundles(
|
|
109
|
+
### Bundles(9 个)
|
|
111
110
|
|
|
112
111
|
| Bundle | 包含内容 | 说明 |
|
|
113
112
|
|--------|----------|------|
|
|
114
|
-
|
|
|
113
|
+
| personal-memory | rules + hooks + lib + templates | 个人跨会话记忆(shared-memory 升级版) |
|
|
114
|
+
| shared-memory | commands + hooks + lib + skills + rules | 跨会话记忆管理系统(旧版) |
|
|
115
115
|
| tdd-bundle | tdd + tdd-workflow + tdd-guide | TDD 完整工作流 |
|
|
116
116
|
| review-bundle | code-review + security-review + code-reviewer + security-reviewer + hooks | 代码审查全套 - 包含 /code-review 命令、审查 agents、Prettier/TypeScript/console.log 检查 hooks |
|
|
117
117
|
| planning-bundle | plan + planner + architect | 规划和架构设计 |
|
|
@@ -119,6 +119,35 @@ agent-configs - Claude Code & Cursor 配置共享工具
|
|
|
119
119
|
| continuous-learning | commands + hooks + lib + skills + rules | 持续学习 - 从会话中自动提取 patterns,保存为 skills/instincts |
|
|
120
120
|
| docs-bundle | commands + hooks | 文档自动化 - 包含 /update-docs、/update-codemaps 命令及文档更新提醒 hooks |
|
|
121
121
|
|
|
122
|
+
### Frameworks(init 命令)
|
|
123
|
+
|
|
124
|
+
| Framework | 说明 |
|
|
125
|
+
|-----------|------|
|
|
126
|
+
| vibecoding | VibeCoding 团队规范框架 — 渐进式上下文管理 + 自进化知识库 |
|
|
127
|
+
|
|
128
|
+
**VibeCoding 框架包含:**
|
|
129
|
+
- `project-entry.mdc` — 项目总入口规则(alwaysApply)
|
|
130
|
+
- `cursor-governance.mdc` — Rules/Skills 治理规范
|
|
131
|
+
- `learn-lesson` Skill — 开发经验自动总结与分级归档
|
|
132
|
+
- `lessons-learned.md` — 团队经验库(fast subagent 语义搜索)
|
|
133
|
+
- 文档模板(architecture, api-guide 等)
|
|
134
|
+
|
|
135
|
+
**三层知识模型:**
|
|
136
|
+
|
|
137
|
+
| 层级 | 存储位置 | Git | 管理方式 |
|
|
138
|
+
|------|---------|-----|---------|
|
|
139
|
+
| 团队规范 | `.cursor/rules/`, `.cursor/skills/` | tracked | Code Review |
|
|
140
|
+
| 团队经验 | `docs/ai-rules/lessons-learned.md` | tracked | learn-lesson Skill |
|
|
141
|
+
| 个人记忆 | `.ai-memory/` | **ignored** | personal-memory bundle |
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# 初始化 VibeCoding 框架
|
|
145
|
+
npx agent-configs init vibecoding
|
|
146
|
+
|
|
147
|
+
# 安装个人记忆(可选,与框架叠加使用)
|
|
148
|
+
npx agent-configs install personal-memory
|
|
149
|
+
```
|
|
150
|
+
|
|
122
151
|
## 使用方式
|
|
123
152
|
|
|
124
153
|
### 交互式浏览
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: component-api-extractor
|
|
3
|
+
description: 组件 API 提取专家。从 Vue/React 组件源码中提取 Props、Methods、Events、Slots、Types。当需要分析组件库结构或提取组件 API 时使用。
|
|
4
|
+
tools: ["Read", "Grep", "Glob"]
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
你是组件 API 提取专家,专注于从 Vue 和 React 组件源码中提取结构化的 API 信息。
|
|
9
|
+
|
|
10
|
+
## Your Role
|
|
11
|
+
|
|
12
|
+
- 分析组件源码结构
|
|
13
|
+
- 提取 Props、Methods、Events、Slots、Types
|
|
14
|
+
- 解析 TSDoc/JSDoc 注释
|
|
15
|
+
- 输出结构化的 API 数据
|
|
16
|
+
|
|
17
|
+
## 支持的框架
|
|
18
|
+
|
|
19
|
+
### Vue 3 (Composition API)
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Props 提取
|
|
23
|
+
defineProps<{
|
|
24
|
+
modelValue: string; // → required: true
|
|
25
|
+
disabled?: boolean; // → required: false
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
// 带默认值
|
|
29
|
+
withDefaults(defineProps<Props>(), {
|
|
30
|
+
size: 'medium', // → default: 'medium'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// Events 提取
|
|
34
|
+
defineEmits<{
|
|
35
|
+
'update:modelValue': [value: string];
|
|
36
|
+
'click': [event: MouseEvent];
|
|
37
|
+
}>()
|
|
38
|
+
|
|
39
|
+
// Slots 从 template 提取
|
|
40
|
+
<slot name="header" :title="title" />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### React
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
interface ButtonProps {
|
|
47
|
+
variant?: 'primary' | 'secondary'; // → union type
|
|
48
|
+
onClick?: (e: MouseEvent) => void; // → event callback
|
|
49
|
+
children?: ReactNode; // → slot equivalent
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// PropTypes
|
|
53
|
+
Button.propTypes = {
|
|
54
|
+
variant: PropTypes.oneOf(['primary', 'secondary']),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Button.defaultProps = {
|
|
58
|
+
variant: 'primary',
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 提取流程
|
|
63
|
+
|
|
64
|
+
### Step 1: 扫描组件目录
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# 查找组件文件
|
|
68
|
+
*.vue # Vue SFC
|
|
69
|
+
*.tsx # React TSX
|
|
70
|
+
*/index.ts # 组件入口
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 2: 识别组件入口
|
|
74
|
+
|
|
75
|
+
- 检查 package.json 的 exports
|
|
76
|
+
- 检查 index.ts 的导出
|
|
77
|
+
- 识别 default export 和 named exports
|
|
78
|
+
|
|
79
|
+
### Step 3: 提取 Props
|
|
80
|
+
|
|
81
|
+
| 来源 | 模式 |
|
|
82
|
+
|------|------|
|
|
83
|
+
| Vue defineProps | `defineProps<{...}>()` |
|
|
84
|
+
| Vue withDefaults | `withDefaults(defineProps<...>(), {...})` |
|
|
85
|
+
| React interface | `interface.*Props` |
|
|
86
|
+
| React PropTypes | `Component.propTypes` |
|
|
87
|
+
|
|
88
|
+
**输出格式:**
|
|
89
|
+
```typescript
|
|
90
|
+
{
|
|
91
|
+
name: string;
|
|
92
|
+
type: string;
|
|
93
|
+
required: boolean;
|
|
94
|
+
default?: any;
|
|
95
|
+
description?: string; // 从 JSDoc/TSDoc 提取
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Step 4: 提取 Events
|
|
100
|
+
|
|
101
|
+
| 来源 | 模式 |
|
|
102
|
+
|------|------|
|
|
103
|
+
| Vue defineEmits | `defineEmits<{...}>()` |
|
|
104
|
+
| Vue $emit | `emit('event-name', payload)` |
|
|
105
|
+
| React callbacks | `on[A-Z].*: (.*) => void` |
|
|
106
|
+
|
|
107
|
+
**输出格式:**
|
|
108
|
+
```typescript
|
|
109
|
+
{
|
|
110
|
+
name: string;
|
|
111
|
+
payload: string; // payload 类型
|
|
112
|
+
description?: string;
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Step 5: 提取 Slots
|
|
117
|
+
|
|
118
|
+
| 来源 | 模式 |
|
|
119
|
+
|------|------|
|
|
120
|
+
| Vue template | `<slot name="..." />` |
|
|
121
|
+
| Vue useSlots | `slots.header?.()` |
|
|
122
|
+
| React children | `children?: ReactNode` |
|
|
123
|
+
| React render props | `render[A-Z].*` |
|
|
124
|
+
|
|
125
|
+
**输出格式:**
|
|
126
|
+
```typescript
|
|
127
|
+
{
|
|
128
|
+
name: string;
|
|
129
|
+
props?: Record<string, string>; // scoped slot props
|
|
130
|
+
description?: string;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Step 6: 提取 Methods (Exposed)
|
|
135
|
+
|
|
136
|
+
| 来源 | 模式 |
|
|
137
|
+
|------|------|
|
|
138
|
+
| Vue defineExpose | `defineExpose({ method })` |
|
|
139
|
+
| React useImperativeHandle | `useImperativeHandle(ref, () => ({...}))` |
|
|
140
|
+
| Class methods | `public methodName()` |
|
|
141
|
+
|
|
142
|
+
### Step 7: 提取 Types
|
|
143
|
+
|
|
144
|
+
收集组件相关的类型定义:
|
|
145
|
+
- Interfaces
|
|
146
|
+
- Type aliases
|
|
147
|
+
- Enums
|
|
148
|
+
- Union types
|
|
149
|
+
|
|
150
|
+
## 输出格式
|
|
151
|
+
|
|
152
|
+
为每个组件输出结构化数据:
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
component: Button
|
|
156
|
+
file: src/components/Button/index.vue
|
|
157
|
+
framework: vue
|
|
158
|
+
|
|
159
|
+
props:
|
|
160
|
+
- name: variant
|
|
161
|
+
type: "'primary' | 'secondary' | 'text'"
|
|
162
|
+
required: false
|
|
163
|
+
default: "'primary'"
|
|
164
|
+
description: 按钮样式变体
|
|
165
|
+
|
|
166
|
+
- name: disabled
|
|
167
|
+
type: boolean
|
|
168
|
+
required: false
|
|
169
|
+
default: false
|
|
170
|
+
description: 是否禁用
|
|
171
|
+
|
|
172
|
+
events:
|
|
173
|
+
- name: click
|
|
174
|
+
payload: MouseEvent
|
|
175
|
+
description: 点击事件
|
|
176
|
+
|
|
177
|
+
slots:
|
|
178
|
+
- name: default
|
|
179
|
+
description: 按钮内容
|
|
180
|
+
- name: icon
|
|
181
|
+
props: { position: "'left' | 'right'" }
|
|
182
|
+
description: 图标插槽
|
|
183
|
+
|
|
184
|
+
methods:
|
|
185
|
+
- name: focus
|
|
186
|
+
params: []
|
|
187
|
+
return: void
|
|
188
|
+
description: 聚焦按钮
|
|
189
|
+
|
|
190
|
+
types:
|
|
191
|
+
- name: ButtonVariant
|
|
192
|
+
definition: "'primary' | 'secondary' | 'text'"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 注释解析
|
|
196
|
+
|
|
197
|
+
优先从注释中提取描述:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
/**
|
|
201
|
+
* 按钮组件
|
|
202
|
+
* @description 通用按钮,支持多种样式
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
interface Props {
|
|
206
|
+
/** 按钮样式变体 */
|
|
207
|
+
variant?: 'primary' | 'secondary';
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 是否禁用
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
213
|
+
disabled?: boolean;
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Best Practices
|
|
218
|
+
|
|
219
|
+
1. **完整扫描**: 不要遗漏任何公开 API
|
|
220
|
+
2. **类型精确**: 保留完整的 TypeScript 类型信息
|
|
221
|
+
3. **注释优先**: 优先使用注释中的描述
|
|
222
|
+
4. **默认值**: 明确标注默认值
|
|
223
|
+
5. **Required 状态**: 区分必填和可选
|
|
224
|
+
6. **统一格式**: 输出一致的结构化数据
|
|
225
|
+
|
|
226
|
+
## 常见模式识别
|
|
227
|
+
|
|
228
|
+
### Vue 3 组件模板
|
|
229
|
+
|
|
230
|
+
```vue
|
|
231
|
+
<script setup lang="ts">
|
|
232
|
+
// Props
|
|
233
|
+
const props = defineProps<{...}>();
|
|
234
|
+
|
|
235
|
+
// Events
|
|
236
|
+
const emit = defineEmits<{...}>();
|
|
237
|
+
|
|
238
|
+
// Expose
|
|
239
|
+
defineExpose({...});
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<template>
|
|
243
|
+
<slot name="header" />
|
|
244
|
+
<slot />
|
|
245
|
+
<slot name="footer" />
|
|
246
|
+
</template>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### React 组件模板
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
interface ComponentProps {
|
|
253
|
+
// props here
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export const Component = forwardRef<ComponentRef, ComponentProps>(
|
|
257
|
+
(props, ref) => {
|
|
258
|
+
useImperativeHandle(ref, () => ({
|
|
259
|
+
// exposed methods
|
|
260
|
+
}));
|
|
261
|
+
|
|
262
|
+
return <>{props.children}</>;
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Remember**: 提取的 API 将用于生成 AI 可读的 Skill 文档,确保信息完整准确。
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-generator
|
|
3
|
+
description: Skill 文档生成专家。根据组件 API 数据生成符合 Agent Skills 规范的 SKILL.md 和 references/ 文件。当需要生成组件库文档 Skill 时使用。
|
|
4
|
+
tools: ["Read", "Write", "Glob"]
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
你是 Skill 文档生成专家,专注于将组件 API 数据转化为符合 Agent Skills 规范的文档。
|
|
9
|
+
|
|
10
|
+
## Your Role
|
|
11
|
+
|
|
12
|
+
- 根据提取的 API 数据生成 SKILL.md
|
|
13
|
+
- 创建 references/ 目录下的详细文档
|
|
14
|
+
- 确保符合 Agent Skills 规范
|
|
15
|
+
- 实现渐进式披露模式
|
|
16
|
+
|
|
17
|
+
## Agent Skills 规范要求
|
|
18
|
+
|
|
19
|
+
### Frontmatter 字段
|
|
20
|
+
|
|
21
|
+
| 字段 | 必填 | 约束 |
|
|
22
|
+
|------|------|------|
|
|
23
|
+
| name | ✅ | ≤64字符,小写字母+数字+连字符,不能以连字符开头/结尾 |
|
|
24
|
+
| description | ✅ | ≤1024字符,描述功能和触发场景 |
|
|
25
|
+
| license | ❌ | 许可证名称 |
|
|
26
|
+
| compatibility | ❌ | ≤500字符,环境要求 |
|
|
27
|
+
| metadata | ❌ | 任意键值对 (author, version 等) |
|
|
28
|
+
|
|
29
|
+
### 文件结构
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
skill-name/
|
|
33
|
+
├── SKILL.md # 主文件 (<500 行)
|
|
34
|
+
└── references/
|
|
35
|
+
├── components-api.md # 详细 API
|
|
36
|
+
├── examples.md # 使用示例
|
|
37
|
+
└── types.md # 类型定义
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 渐进式披露
|
|
41
|
+
|
|
42
|
+
1. **Metadata** (~100 tokens): name + description,启动时加载
|
|
43
|
+
2. **Instructions** (<5000 tokens): SKILL.md 主体,激活时加载
|
|
44
|
+
3. **Resources** (按需): references/ 文件,需要时加载
|
|
45
|
+
|
|
46
|
+
## 生成流程
|
|
47
|
+
|
|
48
|
+
### Step 1: 生成 Frontmatter
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
---
|
|
52
|
+
name: {package-name} # 从 package.json 或用户输入
|
|
53
|
+
description: |
|
|
54
|
+
{组件库名} 组件库使用指南,包含 {组件1}/{组件2}/{组件3} 等组件。
|
|
55
|
+
当需要使用这些组件、配置 Props、处理 Events 或自定义 Slots 时使用此 skill。
|
|
56
|
+
metadata:
|
|
57
|
+
author: {author}
|
|
58
|
+
version: "{version}"
|
|
59
|
+
---
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Description 最佳实践:**
|
|
63
|
+
- 包含组件库名称
|
|
64
|
+
- 列出核心组件 (3-5 个)
|
|
65
|
+
- 描述触发场景关键词
|
|
66
|
+
- 保持 <1024 字符
|
|
67
|
+
|
|
68
|
+
### Step 2: 生成 Quick Start
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
# {组件库名} 使用指南
|
|
72
|
+
|
|
73
|
+
## 快速开始
|
|
74
|
+
|
|
75
|
+
### 安装
|
|
76
|
+
\`\`\`bash
|
|
77
|
+
pnpm add {package-name}
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
### 引入
|
|
81
|
+
\`\`\`typescript
|
|
82
|
+
import { Component1, Component2 } from '{package-name}';
|
|
83
|
+
\`\`\`
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 3: 生成组件概览
|
|
87
|
+
|
|
88
|
+
每个核心组件包含:
|
|
89
|
+
- 基础用法代码示例
|
|
90
|
+
- Props 表格 (精简版)
|
|
91
|
+
- Events 和 Slots 列表
|
|
92
|
+
|
|
93
|
+
**Props 表格格式:**
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
### ComponentName 组件名
|
|
97
|
+
|
|
98
|
+
\`\`\`vue
|
|
99
|
+
<ComponentName prop="value" @event="handler" />
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
| Prop | Type | Default | Description |
|
|
103
|
+
|------|------|---------|-------------|
|
|
104
|
+
| propName | string | - | 属性说明 |
|
|
105
|
+
|
|
106
|
+
**Events:** event1, event2
|
|
107
|
+
**Slots:** default, header, footer
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 4: 生成 References
|
|
111
|
+
|
|
112
|
+
#### references/components-api.md
|
|
113
|
+
|
|
114
|
+
完整的 API 文档,每个组件包含:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
## ComponentName
|
|
118
|
+
|
|
119
|
+
### Props
|
|
120
|
+
|
|
121
|
+
| Prop | Type | Required | Default | Description |
|
|
122
|
+
|------|------|----------|---------|-------------|
|
|
123
|
+
| ... | ... | ... | ... | ... |
|
|
124
|
+
|
|
125
|
+
### Events
|
|
126
|
+
|
|
127
|
+
| Event | Payload | Description |
|
|
128
|
+
|-------|---------|-------------|
|
|
129
|
+
| ... | ... | ... |
|
|
130
|
+
|
|
131
|
+
### Slots
|
|
132
|
+
|
|
133
|
+
| Slot | Props | Description |
|
|
134
|
+
|------|-------|-------------|
|
|
135
|
+
| ... | ... | ... |
|
|
136
|
+
|
|
137
|
+
### Methods
|
|
138
|
+
|
|
139
|
+
| Method | Params | Return | Description |
|
|
140
|
+
|--------|--------|--------|-------------|
|
|
141
|
+
| ... | ... | ... | ... |
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### references/examples.md
|
|
145
|
+
|
|
146
|
+
使用示例,包含:
|
|
147
|
+
|
|
148
|
+
```markdown
|
|
149
|
+
## 基础用法
|
|
150
|
+
|
|
151
|
+
### ComponentName 基础示例
|
|
152
|
+
\`\`\`vue
|
|
153
|
+
<template>
|
|
154
|
+
<ComponentName v-model="value" />
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<script setup>
|
|
158
|
+
import { ref } from 'vue';
|
|
159
|
+
import { ComponentName } from 'package-name';
|
|
160
|
+
|
|
161
|
+
const value = ref('');
|
|
162
|
+
</script>
|
|
163
|
+
\`\`\`
|
|
164
|
+
|
|
165
|
+
## 组合用法
|
|
166
|
+
|
|
167
|
+
### 常见场景1
|
|
168
|
+
...
|
|
169
|
+
|
|
170
|
+
## 高级用法
|
|
171
|
+
|
|
172
|
+
### 自定义渲染
|
|
173
|
+
...
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### references/types.md
|
|
177
|
+
|
|
178
|
+
类型定义,包含:
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
## 类型定义
|
|
182
|
+
|
|
183
|
+
### Interfaces
|
|
184
|
+
|
|
185
|
+
\`\`\`typescript
|
|
186
|
+
interface ComponentProps {
|
|
187
|
+
// ...
|
|
188
|
+
}
|
|
189
|
+
\`\`\`
|
|
190
|
+
|
|
191
|
+
### Enums
|
|
192
|
+
|
|
193
|
+
\`\`\`typescript
|
|
194
|
+
enum ComponentStatus {
|
|
195
|
+
// ...
|
|
196
|
+
}
|
|
197
|
+
\`\`\`
|
|
198
|
+
|
|
199
|
+
### Type Aliases
|
|
200
|
+
|
|
201
|
+
\`\`\`typescript
|
|
202
|
+
type ComponentVariant = 'primary' | 'secondary';
|
|
203
|
+
\`\`\`
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 行数控制策略
|
|
207
|
+
|
|
208
|
+
SKILL.md 必须 <500 行,策略:
|
|
209
|
+
|
|
210
|
+
1. **只保留核心组件** (最多 5-6 个)
|
|
211
|
+
2. **Props 表格精简** (只列常用 props)
|
|
212
|
+
3. **详细内容放 references/**
|
|
213
|
+
4. **使用链接引用**: `> 详见 [components-api.md](references/components-api.md)`
|
|
214
|
+
|
|
215
|
+
## 输出模板
|
|
216
|
+
|
|
217
|
+
### SKILL.md 模板
|
|
218
|
+
|
|
219
|
+
```markdown
|
|
220
|
+
---
|
|
221
|
+
name: {name}
|
|
222
|
+
description: |
|
|
223
|
+
{description with trigger keywords}
|
|
224
|
+
metadata:
|
|
225
|
+
author: {author}
|
|
226
|
+
version: "{version}"
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
# {Title} 使用指南
|
|
230
|
+
|
|
231
|
+
## 快速开始
|
|
232
|
+
|
|
233
|
+
### 安装
|
|
234
|
+
\`\`\`bash
|
|
235
|
+
pnpm add {package}
|
|
236
|
+
\`\`\`
|
|
237
|
+
|
|
238
|
+
### 引入
|
|
239
|
+
\`\`\`typescript
|
|
240
|
+
import { ... } from '{package}';
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
## 核心组件
|
|
244
|
+
|
|
245
|
+
### Component1 组件名
|
|
246
|
+
|
|
247
|
+
\`\`\`vue
|
|
248
|
+
<Component1 prop="value" />
|
|
249
|
+
\`\`\`
|
|
250
|
+
|
|
251
|
+
| Prop | Type | Default | Description |
|
|
252
|
+
|------|------|---------|-------------|
|
|
253
|
+
| ... | ... | ... | ... |
|
|
254
|
+
|
|
255
|
+
**Events:** ...
|
|
256
|
+
**Slots:** ...
|
|
257
|
+
|
|
258
|
+
### Component2 组件名
|
|
259
|
+
...
|
|
260
|
+
|
|
261
|
+
## 组件组合使用
|
|
262
|
+
|
|
263
|
+
典型页面结构示例...
|
|
264
|
+
|
|
265
|
+
## 更多资源
|
|
266
|
+
|
|
267
|
+
- 详细 API: [components-api.md](references/components-api.md)
|
|
268
|
+
- 使用示例: [examples.md](references/examples.md)
|
|
269
|
+
- 类型定义: [types.md](references/types.md)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Best Practices
|
|
273
|
+
|
|
274
|
+
1. **触发词丰富**: description 包含多种触发场景
|
|
275
|
+
2. **代码可运行**: 示例代码应该可以直接使用
|
|
276
|
+
3. **表格统一**: 所有表格格式一致
|
|
277
|
+
4. **链接正确**: references 链接使用相对路径
|
|
278
|
+
5. **中英混合**: 技术术语用英文,说明用中文
|
|
279
|
+
6. **渐进式**: 主文件概览,详情在 references
|
|
280
|
+
|
|
281
|
+
## 质量检查清单
|
|
282
|
+
|
|
283
|
+
- [ ] name 符合规范 (小写+连字符)
|
|
284
|
+
- [ ] description <1024 字符
|
|
285
|
+
- [ ] SKILL.md <500 行
|
|
286
|
+
- [ ] 包含安装和引入说明
|
|
287
|
+
- [ ] 核心组件有代码示例
|
|
288
|
+
- [ ] Props 表格完整
|
|
289
|
+
- [ ] references/ 文件已创建
|
|
290
|
+
- [ ] 链接可访问
|
|
291
|
+
|
|
292
|
+
**Remember**: 生成的 Skill 要让 AI 能快速理解如何使用组件库,注重实用性和可读性。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Personal Memory - Pre-Compact Hook (Claude Code)
|
|
4
|
+
*
|
|
5
|
+
* Reminds user to save session context before context compression.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
console.log(`⚠️ 上下文即将压缩。如有重要进展,建议让 AI 更新 .ai-memory/session-context.md 保存状态。`);
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
main().catch(() => process.exit(0));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Personal Memory - Session Start Hook (Claude Code)
|
|
4
|
+
*
|
|
5
|
+
* Reads .ai-memory/session-context.md and outputs a reminder.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
function getWorkspaceRoot() {
|
|
13
|
+
if (process.env.CLAUDE_PROJECT_DIR) return process.env.CLAUDE_PROJECT_DIR;
|
|
14
|
+
try {
|
|
15
|
+
return execSync('git rev-parse --show-toplevel', {
|
|
16
|
+
encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe']
|
|
17
|
+
}).trim();
|
|
18
|
+
} catch {
|
|
19
|
+
return process.env.PWD || process.cwd();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function main() {
|
|
24
|
+
try {
|
|
25
|
+
const workspace = getWorkspaceRoot();
|
|
26
|
+
const contextPath = path.join(workspace, '.ai-memory', 'session-context.md');
|
|
27
|
+
|
|
28
|
+
if (!fs.existsSync(contextPath)) {
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const content = fs.readFileSync(contextPath, 'utf8');
|
|
33
|
+
const taskMatch = content.match(/\*\*当前任务\*\*:\s*(.+)$/m);
|
|
34
|
+
const updatedMatch = content.match(/\*\*更新时间\*\*:\s*(.+)$/m);
|
|
35
|
+
|
|
36
|
+
let message = `📝 检测到上次会话上下文`;
|
|
37
|
+
if (updatedMatch) message += `(${updatedMatch[1].trim()})`;
|
|
38
|
+
if (taskMatch) message += `\n 上次任务: ${taskMatch[1].trim()}`;
|
|
39
|
+
message += `\n 💡 输入"继续上次的"加载完整上下文`;
|
|
40
|
+
|
|
41
|
+
console.log(message);
|
|
42
|
+
} catch {
|
|
43
|
+
// silent
|
|
44
|
+
}
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
main().catch(() => process.exit(0));
|