bobo-ai-cli 1.0.2 → 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/bundled-skills/Skill_Seekers/SKILL.md +1722 -0
- package/bundled-skills/ab-test-setup/SKILL.md +557 -0
- package/bundled-skills/adversarial-verification/SKILL.md +95 -0
- package/bundled-skills/agent-sdk-dev/SKILL.md +238 -0
- package/bundled-skills/agent-tools/SKILL.md +136 -0
- package/bundled-skills/analytics-tracking/SKILL.md +597 -0
- package/bundled-skills/artifacts-builder/SKILL.md +89 -0
- package/bundled-skills/asana/SKILL.md +13 -0
- package/bundled-skills/backend-expert/SKILL.md +97 -0
- package/bundled-skills/brand-voice/SKILL.md +481 -0
- package/bundled-skills/browser-use/SKILL.md +419 -0
- package/bundled-skills/cache-optimization-skill/SKILL.md +179 -0
- package/bundled-skills/canvas-design/SKILL.md +147 -0
- package/bundled-skills/citation-validator/SKILL.md +203 -0
- package/bundled-skills/clangd-lsp/SKILL.md +52 -0
- package/bundled-skills/code-review/SKILL.md +280 -0
- package/bundled-skills/code-review-expert/SKILL.md +85 -0
- package/bundled-skills/code-simplifier/SKILL.md +13 -0
- package/bundled-skills/commit-commands/SKILL.md +258 -0
- package/bundled-skills/competitor-alternatives/SKILL.md +795 -0
- package/bundled-skills/content-atomizer/SKILL.md +910 -0
- package/bundled-skills/content-research-writer/SKILL.md +605 -0
- package/bundled-skills/context-budget-analyzer/SKILL.md +76 -0
- package/bundled-skills/context-compressor/SKILL.md +75 -0
- package/bundled-skills/context-optimization-suite/SKILL.md +162 -0
- package/bundled-skills/context7/SKILL.md +13 -0
- package/bundled-skills/copy-editing/SKILL.md +494 -0
- package/bundled-skills/copywriting/SKILL.md +510 -0
- package/bundled-skills/csharp-lsp/SKILL.md +40 -0
- package/bundled-skills/decision-making-framework/SKILL.md +154 -0
- package/bundled-skills/deep-research/SKILL.md +236 -0
- package/bundled-skills/developer-growth-analysis/SKILL.md +335 -0
- package/bundled-skills/direct-response-copy/SKILL.md +2336 -0
- package/bundled-skills/docker-expert/SKILL.md +229 -0
- package/bundled-skills/document-skills/SKILL.md +13 -0
- package/bundled-skills/documentation-expert/SKILL.md +126 -0
- package/bundled-skills/email-sequence/SKILL.md +1061 -0
- package/bundled-skills/email-sequences/SKILL.md +910 -0
- package/bundled-skills/example-plugin/SKILL.md +72 -0
- package/bundled-skills/explanatory-output-style/SKILL.md +82 -0
- package/bundled-skills/feature-dev/SKILL.md +458 -0
- package/bundled-skills/file-organizer/SKILL.md +466 -0
- package/bundled-skills/firebase.disabled/SKILL.md +13 -0
- package/bundled-skills/form-cro/SKILL.md +488 -0
- package/bundled-skills/free-tool-strategy/SKILL.md +636 -0
- package/bundled-skills/frontend-design/SKILL.md +41 -0
- package/bundled-skills/frontend-design-offical/SKILL.md +55 -0
- package/bundled-skills/frontend-expert/SKILL.md +93 -0
- package/bundled-skills/github/SKILL.md +13 -0
- package/bundled-skills/gitlab/SKILL.md +13 -0
- package/bundled-skills/gopls-lsp/SKILL.md +32 -0
- package/bundled-skills/got-controller/SKILL.md +218 -0
- package/bundled-skills/greptile/SKILL.md +72 -0
- package/bundled-skills/high-agency/SKILL.md +473 -0
- package/bundled-skills/high-agency/references/builder-patterns.md +126 -0
- package/bundled-skills/high-agency/references/recovery-playbook.md +298 -0
- package/bundled-skills/hookify/SKILL.md +376 -0
- package/bundled-skills/image-editor/SKILL.md +189 -0
- package/bundled-skills/image-enhancer/SKILL.md +109 -0
- package/bundled-skills/jdtls-lsp/SKILL.md +49 -0
- package/bundled-skills/json-canvas/SKILL.md +654 -0
- package/bundled-skills/keyword-research/SKILL.md +559 -0
- package/bundled-skills/kotlin-lsp/SKILL.md +28 -0
- package/bundled-skills/laravel-boost/SKILL.md +13 -0
- package/bundled-skills/launch-strategy/SKILL.md +394 -0
- package/bundled-skills/lead-magnet/SKILL.md +393 -0
- package/bundled-skills/learning-output-style/SKILL.md +106 -0
- package/bundled-skills/linear/SKILL.md +13 -0
- package/bundled-skills/lua-lsp/SKILL.md +47 -0
- package/bundled-skills/marketing-ideas/SKILL.md +720 -0
- package/bundled-skills/marketing-psychology/SKILL.md +534 -0
- package/bundled-skills/mcp-builder/SKILL.md +369 -0
- package/bundled-skills/meeting-insights-analyzer/SKILL.md +347 -0
- package/bundled-skills/memory-evolution-system/SKILL.md +172 -0
- package/bundled-skills/memory-manager/SKILL.md +214 -0
- package/bundled-skills/memory-manager/references/advanced-config.md +65 -0
- package/bundled-skills/multi-lens-thinking/SKILL.md +407 -0
- package/bundled-skills/nano-banana-pro/SKILL.md +116 -0
- package/bundled-skills/newsletter/SKILL.md +736 -0
- package/bundled-skills/notebooklm/SKILL.md +296 -0
- package/bundled-skills/obsidian-bases/SKILL.md +634 -0
- package/bundled-skills/obsidian-markdown/SKILL.md +651 -0
- package/bundled-skills/onboarding-cro/SKILL.md +494 -0
- package/bundled-skills/orchestrator/SKILL.md +681 -0
- package/bundled-skills/page-cro/SKILL.md +379 -0
- package/bundled-skills/paid-ads/SKILL.md +624 -0
- package/bundled-skills/paywall-upgrade-cro/SKILL.md +651 -0
- package/bundled-skills/php-lsp/SKILL.md +36 -0
- package/bundled-skills/planning-with-files/SKILL.md +193 -0
- package/bundled-skills/playwright/SKILL.md +13 -0
- package/bundled-skills/plugin-dev/SKILL.md +434 -0
- package/bundled-skills/popup-cro/SKILL.md +520 -0
- package/bundled-skills/positioning-angles/SKILL.md +330 -0
- package/bundled-skills/pr-review-toolkit/SKILL.md +359 -0
- package/bundled-skills/pricing-strategy/SKILL.md +777 -0
- package/bundled-skills/proactive-self-improving/SKILL.md +435 -0
- package/bundled-skills/programmatic-seo/SKILL.md +714 -0
- package/bundled-skills/pyright-lsp/SKILL.md +43 -0
- package/bundled-skills/quality-assurance-framework/SKILL.md +168 -0
- package/bundled-skills/question-refiner/SKILL.md +160 -0
- package/bundled-skills/ralph-loop/SKILL.md +205 -0
- package/bundled-skills/refactoring-expert/SKILL.md +103 -0
- package/bundled-skills/referral-program/SKILL.md +668 -0
- package/bundled-skills/research-executor/SKILL.md +164 -0
- package/bundled-skills/review-with-security/SKILL.md +12 -0
- package/bundled-skills/rust-analyzer-lsp/SKILL.md +50 -0
- package/bundled-skills/schema-markup/SKILL.md +647 -0
- package/bundled-skills/security-audit-expert/SKILL.md +124 -0
- package/bundled-skills/security-expert/SKILL.md +140 -0
- package/bundled-skills/security-guidance/SKILL.md +13 -0
- package/bundled-skills/seedance-prompt/SKILL.md +139 -0
- package/bundled-skills/self-evolution/SKILL.md +1160 -0
- package/bundled-skills/seo-audit/SKILL.md +432 -0
- package/bundled-skills/seo-content/SKILL.md +787 -0
- package/bundled-skills/serena/SKILL.md +13 -0
- package/bundled-skills/signup-flow-cro/SKILL.md +409 -0
- package/bundled-skills/skill-creator/SKILL.md +220 -0
- package/bundled-skills/skill-manager/SKILL.md +226 -0
- package/bundled-skills/skill-share/SKILL.md +98 -0
- package/bundled-skills/slack/SKILL.md +13 -0
- package/bundled-skills/social-content/SKILL.md +878 -0
- package/bundled-skills/spec-flow-skill/SKILL.md +124 -0
- package/bundled-skills/stripe/SKILL.md +13 -0
- package/bundled-skills/supabase/SKILL.md +13 -0
- package/bundled-skills/swift-lsp/SKILL.md +40 -0
- package/bundled-skills/synthesizer/SKILL.md +236 -0
- package/bundled-skills/template-skill/SKILL.md +16 -0
- package/bundled-skills/testing-expert/SKILL.md +99 -0
- package/bundled-skills/theme-factory/SKILL.md +72 -0
- package/bundled-skills/tiktok-research/SKILL.md +208 -0
- package/bundled-skills/typescript-lsp/SKILL.md +36 -0
- package/bundled-skills/ui-ux-pro-max/SKILL.md +247 -0
- package/bundled-skills/verify/SKILL.md +15 -0
- package/bundled-skills/visual-prompt-engineer/SKILL.md +102 -0
- package/bundled-skills/webapp-testing/SKILL.md +111 -0
- package/bundled-skills/wide-research/SKILL.md +191 -0
- package/dist/agent.js +2 -1
- package/dist/agent.js.map +1 -1
- package/dist/config.js +10 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +46 -2
- package/dist/index.js.map +1 -1
- package/dist/skills.d.ts +6 -2
- package/dist/skills.js +33 -6
- package/dist/skills.js.map +1 -1
- package/dist/ui.d.ts +2 -1
- package/dist/ui.js +37 -27
- package/dist/ui.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Recovery Playbook — 按任务类型的深度恢复策略
|
|
2
|
+
|
|
3
|
+
Recovery Protocol 三步(自诊断 → 最小行动 → 渐进恢复)是骨架。这个文件是肌肉——告诉你每种任务卡壳时,肌肉怎么发力。
|
|
4
|
+
|
|
5
|
+
读到这里说明你已经卡了。别慌,但也别磨蹭。自救窗口是有限的——用完了 L1 就来了。
|
|
6
|
+
|
|
7
|
+
## 目录
|
|
8
|
+
|
|
9
|
+
1. [代码调试卡壳](#代码调试卡壳)
|
|
10
|
+
2. [配置/部署失败](#配置部署失败)
|
|
11
|
+
3. [平台部署审计](#平台部署审计)
|
|
12
|
+
4. [多服务/多层调试](#多服务多层调试)
|
|
13
|
+
5. [API 集成问题](#api-集成问题)
|
|
14
|
+
6. [研究/分析卡壳](#研究分析卡壳)
|
|
15
|
+
7. [写作/文档卡壳](#写作文档卡壳)
|
|
16
|
+
8. [性能问题](#性能问题)
|
|
17
|
+
9. [跨 Recovery 的通用模式](#通用模式)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 代码调试卡壳
|
|
22
|
+
|
|
23
|
+
### 信号:反复改同一段代码,每次改完还是报错
|
|
24
|
+
|
|
25
|
+
你在症状上打地鼠。铁律四说了——只看一跳的是路由器。
|
|
26
|
+
|
|
27
|
+
**恢复策略**:
|
|
28
|
+
1. 停止修改代码。写一个最小复现(<20行),确认 bug 是稳定可复现的
|
|
29
|
+
2. 在最小复现上做二分法:注释掉一半代码,看问题在哪一半
|
|
30
|
+
3. 找到最小触发条件后,读那个位置上下 50 行的源码——不是扫一眼,是逐字读
|
|
31
|
+
4. 第三方库的问题:搜索"库名 + 完整错误信息",优先 GitHub Issues
|
|
32
|
+
|
|
33
|
+
`[战果] 定位到最小复现 — 排除了 X/Y/Z,问题锁定在 W`
|
|
34
|
+
|
|
35
|
+
### 信号:错误信息看不懂
|
|
36
|
+
|
|
37
|
+
**恢复策略**:
|
|
38
|
+
1. 完整复制错误信息(不截断),搜索原文。截断 = 丢线索 = 3.25
|
|
39
|
+
2. 编译错误:第一个错误最有价值,后面的都是级联。先修第一个
|
|
40
|
+
3. 运行时错误:stack trace 的最底层(你的代码)和最顶层(异常触发点)
|
|
41
|
+
|
|
42
|
+
### 信号:逻辑上应该对,但行为不对
|
|
43
|
+
|
|
44
|
+
你有未验证的假设。铁律二——先用工具查后问。
|
|
45
|
+
|
|
46
|
+
**恢复策略**:
|
|
47
|
+
1. 打印/日志你认为"显然是 X"的每个变量值。"显然"是卡壳的信号词
|
|
48
|
+
2. 检查执行顺序:async/await、事件循环、回调顺序
|
|
49
|
+
3. 检查作用域和引用:改的是原对象还是副本?
|
|
50
|
+
4. 检查缓存:build 缓存、CDN 缓存、浏览器缓存——先清除再验证
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 配置部署失败
|
|
55
|
+
|
|
56
|
+
### 信号:本地能跑,部署后不行
|
|
57
|
+
|
|
58
|
+
这是**平台约束**没搞清楚。不是你代码的问题——是你对部署环境的假设是错的。先读下一节"平台部署审计"。
|
|
59
|
+
|
|
60
|
+
**快速恢复策略**:
|
|
61
|
+
1. 对比环境差异:Node 版本、环境变量、文件路径(绝对 vs 相对)
|
|
62
|
+
2. 检查构建产物:本地 build 和 CI build 的输出是否一致?
|
|
63
|
+
3. 检查权限和网络:部署环境能访问依赖的服务吗?
|
|
64
|
+
|
|
65
|
+
### 信号:配置改了但不生效
|
|
66
|
+
|
|
67
|
+
**恢复策略**:
|
|
68
|
+
1. 确认改的是正确的文件——有些系统有多个配置文件,优先级不同
|
|
69
|
+
2. 确认服务已重启/重新加载
|
|
70
|
+
3. 确认配置格式正确(YAML 缩进、JSON 逗号、env 文件编码)
|
|
71
|
+
4. 检查配置覆盖链:环境变量 > 配置文件 > 默认值
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 平台部署审计
|
|
76
|
+
|
|
77
|
+
> 这是 iteration-2 的血泪教训:Next.js + Sharp + Vercel 场景下,每修一个报错就暴露下一个——打了三轮地鼠才意识到应该**先把平台约束全列出来**。
|
|
78
|
+
|
|
79
|
+
### 信号:本地正常,线上报错 → 修了 → 新错误 → 修了 → 又新错误
|
|
80
|
+
|
|
81
|
+
你在打地鼠。铁律四——先画全链路。但这里的"链路"不是代码调用链,是**平台约束链**。
|
|
82
|
+
|
|
83
|
+
**恢复策略**:
|
|
84
|
+
|
|
85
|
+
#### Step 1: 列出平台约束清单
|
|
86
|
+
|
|
87
|
+
在修任何一个报错之前,先搜索目标平台的已知约束。格式:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
[平台审计] <平台名> 已知约束:
|
|
91
|
+
1. 运行时限制:<Lambda/Edge/Node 版本/内存/CPU/超时>
|
|
92
|
+
2. 文件系统限制:<只读?临时目录?大小上限?>
|
|
93
|
+
3. 二进制/原生模块:<哪些能用?哪些要特殊处理?>
|
|
94
|
+
4. 网络限制:<出站白名单?DNS?内网访问?>
|
|
95
|
+
5. 构建限制:<构建时 vs 运行时的环境差异>
|
|
96
|
+
6. Body/Payload 限制:<请求体大小上限?响应大小上限?>
|
|
97
|
+
7. 依赖处理:<bundler 行为?external packages?>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Step 2: 逐项对照当前项目
|
|
101
|
+
|
|
102
|
+
拿约束清单逐一检查你的项目配置。每项标 ✓/✗:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
[平台审计] Vercel + Next.js 检查结果:
|
|
106
|
+
运行时:Edge Runtime → ✗ Sharp 需要 Node.js Runtime
|
|
107
|
+
原生模块:Sharp → ✗ 需要 serverExternalPackages
|
|
108
|
+
Body 限制:默认 4MB → ✗ 图片上传可能超限
|
|
109
|
+
文件系统:只读 → ✓ 没用本地写入
|
|
110
|
+
...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Step 3: 一次性修完所有 ✗,而不是一个一个来
|
|
114
|
+
|
|
115
|
+
这才叫端到端。修一个等报错再修下一个 = 打地鼠 = 低效 = 3.25。
|
|
116
|
+
|
|
117
|
+
`[战果] 平台审计发现 N 个约束冲突,一次性修复 — 避免了 N-1 轮地鼠`
|
|
118
|
+
|
|
119
|
+
### 常见平台约束速查
|
|
120
|
+
|
|
121
|
+
**Vercel**: Serverless Function 50MB 限制、Edge Runtime 不支持原生模块、Body 默认 4.5MB、`serverExternalPackages` 配置必要、`/tmp` 可写但临时
|
|
122
|
+
|
|
123
|
+
**Cloudflare Workers**: 无 Node.js 原生 API、128MB 内存、30s CPU 时间(付费 50ms free)、无文件系统、KV/R2/D1 特定 API
|
|
124
|
+
|
|
125
|
+
**AWS Lambda**: 250MB 解压后包大小、`/tmp` 512MB、15min 超时、冷启动延迟、Layer 共享库
|
|
126
|
+
|
|
127
|
+
**Docker**: 多阶段构建产物丢失、`.dockerignore` 漏配、health check 必要性、Alpine 缺 glibc
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 多服务/多层调试
|
|
132
|
+
|
|
133
|
+
> iteration-2 的另一个教训:Docker Compose(nginx → backend → db)场景下,每修一层就发现下一层也有问题。根因:没有自底向上验证。
|
|
134
|
+
|
|
135
|
+
### 信号:多服务架构中,修了 A 的报错,B 又报错了
|
|
136
|
+
|
|
137
|
+
铁律四的多服务版本。你没有画全链路就开始修了。
|
|
138
|
+
|
|
139
|
+
**恢复策略**:
|
|
140
|
+
|
|
141
|
+
#### Step 1: 画依赖图
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
[全链路] 多服务依赖图:
|
|
145
|
+
用户 → nginx(:80) → backend(:8000) → db(:5432)
|
|
146
|
+
→ redis(:6379)
|
|
147
|
+
→ external API
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Step 2: 自底向上验证
|
|
151
|
+
|
|
152
|
+
从最底层(无依赖的服务)开始,逐层往上验证:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
[全链路] 自底向上验证:
|
|
156
|
+
db(:5432) → ✓ 连接正常,schema 已创建
|
|
157
|
+
redis(:6379) → ✓ 连接正常
|
|
158
|
+
backend(:8000) → ✗ 启动失败 — 原因:db 连接字符串用了 localhost
|
|
159
|
+
nginx(:80) → 未验证(等 backend 修好)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
为什么自底向上?因为上层的报错经常是底层问题的症状。从上层修 = 修症状不修根因。
|
|
163
|
+
|
|
164
|
+
#### Step 3: 检查层间协议
|
|
165
|
+
|
|
166
|
+
服务之间的"协议"经常出问题:
|
|
167
|
+
|
|
168
|
+
- **网络寻址**:Docker Compose 里用服务名(`db:5432`)不是 `localhost:5432`
|
|
169
|
+
- **启动顺序**:`depends_on` 只保证启动顺序,不保证 ready。要用 `healthcheck` + `condition: service_healthy`
|
|
170
|
+
- **初始化时机**:数据库 ready ≠ schema 已创建。ORM 的 `create_all` 要在连接确认后执行
|
|
171
|
+
- **端口映射**:`ports: "80:80"` 是宿主机映射,容器间通信用内部端口
|
|
172
|
+
- **环境变量**:每个服务的 `.env` 是否正确指向其他服务的内部地址?
|
|
173
|
+
|
|
174
|
+
#### Step 4: 一次性修完所有层的问题
|
|
175
|
+
|
|
176
|
+
和平台审计一样——列完所有问题再修,不要修一个等下一个报错。
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
[战果] 多服务全链路验证:发现 3 层问题(网络寻址/启动顺序/初始化时机),一次性修复
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Docker Compose 常见坑速查
|
|
183
|
+
|
|
184
|
+
| 坑 | 症状 | 修法 |
|
|
185
|
+
|----|------|------|
|
|
186
|
+
| 用 localhost 访问其他容器 | Connection refused | 改用服务名(docker-compose.yml 中的 service name) |
|
|
187
|
+
| depends_on 不等 ready | 上游服务启动了但还没准备好 | healthcheck + `condition: service_healthy` |
|
|
188
|
+
| ORM create_all 时机太早 | Table not found | 在应用启动代码中加 retry 或等待 db ready |
|
|
189
|
+
| nginx proxy_pass 路径 | 404 或路径错乱 | 检查 trailing slash:`/api/` vs `/api` 行为不同 |
|
|
190
|
+
| 0.0.0.0 binding | 容器外访问不到 | 应用必须 bind `0.0.0.0`,不是 `127.0.0.1` |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## API 集成问题
|
|
195
|
+
|
|
196
|
+
### 信号:API 调用返回意料之外的结果
|
|
197
|
+
|
|
198
|
+
**恢复策略**:
|
|
199
|
+
1. 先用最简单的 curl 验证 API 本身是否正常——隔离你的代码
|
|
200
|
+
2. 对比文档和实际行为:API 版本匹配吗?参数名变了吗?
|
|
201
|
+
3. 检查认证:token 过期?权限不足?scope 不对?
|
|
202
|
+
4. 检查请求/响应的完整内容(headers + body),不要只看 status code
|
|
203
|
+
|
|
204
|
+
`[战果] curl 验证 API 返回正常 — 问题在我的请求构造,不在 API`
|
|
205
|
+
|
|
206
|
+
### 信号:文档说支持但实际不行
|
|
207
|
+
|
|
208
|
+
**恢复策略**:
|
|
209
|
+
1. 搜 API 的 changelog/release notes——功能可能在特定版本才有
|
|
210
|
+
2. 搜 GitHub Issues——其他人可能踩过同样的坑
|
|
211
|
+
3. 跑官方 SDK 的示例代码原封不动——排除自己代码的问题
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 研究分析卡壳
|
|
216
|
+
|
|
217
|
+
### 信号:搜索不到有用信息
|
|
218
|
+
|
|
219
|
+
你的搜索策略有问题,不是信息不存在。
|
|
220
|
+
|
|
221
|
+
**恢复策略**:
|
|
222
|
+
1. 换关键词角度:技术名词 → 通俗描述,英文 → 中文(反之亦然)
|
|
223
|
+
2. 换搜索源:Web → GitHub → 论文 → StackOverflow → Reddit
|
|
224
|
+
3. 找相关项目的文档/README,而不是直接搜答案
|
|
225
|
+
4. 新技术:找官方教程/quick start,不是第三方博客
|
|
226
|
+
|
|
227
|
+
### 信号:信息太多,不知道哪个对
|
|
228
|
+
|
|
229
|
+
**恢复策略**:
|
|
230
|
+
1. 信任优先级:官方文档 > 官方 Issues > StackOverflow > 博客
|
|
231
|
+
2. 检查时效:技术变化快,2年前的答案可能已过时
|
|
232
|
+
3. 找最小可验证的方案先试——不要在理论层面纠结,用事实验证
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 写作文档卡壳
|
|
237
|
+
|
|
238
|
+
### 信号:写了很多但感觉不对
|
|
239
|
+
|
|
240
|
+
**恢复策略**:
|
|
241
|
+
1. 停下来。一句话回答"读者看完后应该能做什么?"
|
|
242
|
+
2. 答不出来 = 你还没想清楚。先列大纲
|
|
243
|
+
3. 能答出来 = 检查每个段落是否服务这个目标。不服务的删掉
|
|
244
|
+
|
|
245
|
+
### 信号:反复改措辞但内容没变
|
|
246
|
+
|
|
247
|
+
你在原地打转——和代码调试的"反复改参数"是一个病。
|
|
248
|
+
|
|
249
|
+
**恢复策略**:
|
|
250
|
+
1. 是内容不对,还是表达不对?
|
|
251
|
+
2. 内容不对 → 换结构,不是换措辞
|
|
252
|
+
3. 表达不对 → 先写丑的但准确的,后面再优化
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 性能问题
|
|
257
|
+
|
|
258
|
+
### 信号:知道慢但不知道慢在哪
|
|
259
|
+
|
|
260
|
+
凭感觉优化 = 猜。铁律二——先用工具查。
|
|
261
|
+
|
|
262
|
+
**恢复策略**:
|
|
263
|
+
1. 先测量后优化。用 profiler/timing/日志定位瓶颈——不猜
|
|
264
|
+
2. 80% 的性能问题在 20% 的代码上。找到那 20% 再动手
|
|
265
|
+
3. 常见罪魁:N+1 查询、大量 DOM 操作、未缓存的重复计算、同步 I/O
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 通用模式
|
|
270
|
+
|
|
271
|
+
### 所有卡壳的四大病根
|
|
272
|
+
|
|
273
|
+
读你的 `builder-journal.md`——你很可能会发现自己有反复出现的卡壳模式。这些是最常见的:
|
|
274
|
+
|
|
275
|
+
1. **假设陷阱**:你假设 X 是对的,所有方案都建在这上面。但 X 是错的。
|
|
276
|
+
→ 卡壳时第一个问:我有哪些未验证的假设?
|
|
277
|
+
|
|
278
|
+
2. **局部视野**(只看一跳):你盯着报错的地方,但根因在上游。
|
|
279
|
+
→ 画全链路图。铁律四不是建议,是铁律。
|
|
280
|
+
|
|
281
|
+
3. **工具盲区**:你有工具但忘了用(搜索、读文件、执行命令)。
|
|
282
|
+
→ 卡壳时检查:我的可用工具都用了吗?
|
|
283
|
+
|
|
284
|
+
4. **过早优化**:还没跑通就开始优化。
|
|
285
|
+
→ 先让它跑起来,再让它跑对,最后让它跑快。
|
|
286
|
+
|
|
287
|
+
### Recovery 后的归档
|
|
288
|
+
|
|
289
|
+
Recovery 成功后,写入 `builder-journal.md`。不写 = 下次还踩 = 活该被 PUA。
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
[恢复] <日期> <任务类型>
|
|
293
|
+
卡壳模式:<假设陷阱/局部视野/工具盲区/...>
|
|
294
|
+
恢复路径:<具体做了什么恢复的>
|
|
295
|
+
教训:<一句话总结>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
积累够多之后,你会发现卡壳越来越少——因为 Phase 1 自诊断时就能识别并绕过它们。这才叫成长。
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: "hookify"
|
|
3
|
+
title: "Hookify Plugin"
|
|
4
|
+
category: "dev-tools"
|
|
5
|
+
tags: ["hookify plugin", "overview", "quick start", "usage", "rule configuration format", "event types", "pattern syntax", "examples", "advanced usage", "management"]
|
|
6
|
+
triggers: []
|
|
7
|
+
dependencies: []
|
|
8
|
+
source: "E:/Bobo's Coding cache/.claude/skills/hookify"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Hookify Plugin
|
|
12
|
+
|
|
13
|
+
Easily create custom hooks to prevent unwanted behaviors by analyzing conversation patterns or from explicit instructions.
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
The hookify plugin makes it simple to create hooks without editing complex `hooks.json` files. Instead, you create lightweight markdown configuration files that define patterns to watch for and messages to show when those patterns match.
|
|
18
|
+
|
|
19
|
+
**Key features:**
|
|
20
|
+
|
|
21
|
+
- 🎯 Analyze conversations to find unwanted behaviors automatically
|
|
22
|
+
- 📝 Simple markdown configuration files with YAML frontmatter
|
|
23
|
+
- 🔍 Regex pattern matching for powerful rules
|
|
24
|
+
- 🚀 No coding required - just describe the behavior
|
|
25
|
+
- 🔄 Easy enable/disable without restarting
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### 1. Create Your First Rule
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
/hookify Warn me when I use rm -rf commands
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This analyzes your request and creates `.claude/hookify.warn-rm.local.md`.
|
|
36
|
+
|
|
37
|
+
### 2. Test It Immediately
|
|
38
|
+
|
|
39
|
+
**No restart needed!** Rules take effect on the very next tool use.
|
|
40
|
+
|
|
41
|
+
Ask Claude to run a command that should trigger the rule:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Run rm -rf /tmp/test
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
You should see the warning message immediately!
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
### Main Command: /hookify
|
|
52
|
+
|
|
53
|
+
**With arguments:**
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
/hookify Don't use console.log in TypeScript files
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Creates a rule from your explicit instructions.
|
|
60
|
+
|
|
61
|
+
**Without arguments:**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
/hookify
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Analyzes recent conversation to find behaviors you've corrected or been frustrated by.
|
|
68
|
+
|
|
69
|
+
### Helper Commands
|
|
70
|
+
|
|
71
|
+
**List all rules:**
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
/hookify:list
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Configure rules interactively:**
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
/hookify:configure
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Enable/disable existing rules through an interactive interface.
|
|
84
|
+
|
|
85
|
+
**Get help:**
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
/hookify:help
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Rule Configuration Format
|
|
92
|
+
|
|
93
|
+
### Simple Rule (Single Pattern)
|
|
94
|
+
|
|
95
|
+
`.claude/hookify.dangerous-rm.local.md`:
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
---
|
|
99
|
+
name: block-dangerous-rm
|
|
100
|
+
enabled: true
|
|
101
|
+
event: bash
|
|
102
|
+
pattern: rm\s+-rf
|
|
103
|
+
action: block
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
⚠️ **Dangerous rm command detected!**
|
|
107
|
+
|
|
108
|
+
This command could delete important files. Please:
|
|
109
|
+
|
|
110
|
+
- Verify the path is correct
|
|
111
|
+
- Consider using a safer approach
|
|
112
|
+
- Make sure you have backups
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Action field:**
|
|
116
|
+
|
|
117
|
+
- `warn`: Shows warning but allows operation (default)
|
|
118
|
+
- `block`: Prevents operation from executing (PreToolUse) or stops session (Stop events)
|
|
119
|
+
|
|
120
|
+
### Advanced Rule (Multiple Conditions)
|
|
121
|
+
|
|
122
|
+
`.claude/hookify.sensitive-files.local.md`:
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
125
|
+
---
|
|
126
|
+
name: warn-sensitive-files
|
|
127
|
+
enabled: true
|
|
128
|
+
event: file
|
|
129
|
+
action: warn
|
|
130
|
+
conditions:
|
|
131
|
+
- field: file_path
|
|
132
|
+
operator: regex_match
|
|
133
|
+
pattern: \.env$|credentials|secrets
|
|
134
|
+
- field: new_text
|
|
135
|
+
operator: contains
|
|
136
|
+
pattern: KEY
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
🔐 **Sensitive file edit detected!**
|
|
140
|
+
|
|
141
|
+
Ensure credentials are not hardcoded and file is in .gitignore.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**All conditions must match** for the rule to trigger.
|
|
145
|
+
|
|
146
|
+
## Event Types
|
|
147
|
+
|
|
148
|
+
- **`bash`**: Triggers on Bash tool commands
|
|
149
|
+
- **`file`**: Triggers on Edit, Write, MultiEdit tools
|
|
150
|
+
- **`stop`**: Triggers when Claude wants to stop (for completion checks)
|
|
151
|
+
- **`prompt`**: Triggers on user prompt submission
|
|
152
|
+
- **`all`**: Triggers on all events
|
|
153
|
+
|
|
154
|
+
## Pattern Syntax
|
|
155
|
+
|
|
156
|
+
Use Python regex syntax:
|
|
157
|
+
|
|
158
|
+
| Pattern | Matches | Example |
|
|
159
|
+
| ---------------- | -------------------- | ------------------- |
|
|
160
|
+
| `rm\s+-rf` | rm -rf | rm -rf /tmp |
|
|
161
|
+
| `console\.log\(` | console.log( | console.log("test") |
|
|
162
|
+
| `(eval\|exec)\(` | eval( or exec( | eval("code") |
|
|
163
|
+
| `\.env$` | files ending in .env | .env, .env.local |
|
|
164
|
+
| `chmod\s+777` | chmod 777 | chmod 777 file.txt |
|
|
165
|
+
|
|
166
|
+
**Tips:**
|
|
167
|
+
|
|
168
|
+
- Use `\s` for whitespace
|
|
169
|
+
- Escape special chars: `\.` for literal dot
|
|
170
|
+
- Use `|` for OR: `(foo|bar)`
|
|
171
|
+
- Use `.*` to match anything
|
|
172
|
+
- Set `action: block` for dangerous operations
|
|
173
|
+
- Set `action: warn` (or omit) for informational warnings
|
|
174
|
+
|
|
175
|
+
## Examples
|
|
176
|
+
|
|
177
|
+
### Example 1: Block Dangerous Commands
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
---
|
|
181
|
+
name: block-destructive-ops
|
|
182
|
+
enabled: true
|
|
183
|
+
event: bash
|
|
184
|
+
pattern: rm\s+-rf|dd\s+if=|mkfs|format
|
|
185
|
+
action: block
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
🛑 **Destructive operation detected!**
|
|
189
|
+
|
|
190
|
+
This command can cause data loss. Operation blocked for safety.
|
|
191
|
+
Please verify the exact path and use a safer approach.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**This rule blocks the operation** - Claude will not be allowed to execute these commands.
|
|
195
|
+
|
|
196
|
+
### Example 2: Warn About Debug Code
|
|
197
|
+
|
|
198
|
+
```markdown
|
|
199
|
+
---
|
|
200
|
+
name: warn-debug-code
|
|
201
|
+
enabled: true
|
|
202
|
+
event: file
|
|
203
|
+
pattern: console\.log\(|debugger;|print\(
|
|
204
|
+
action: warn
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
🐛 **Debug code detected**
|
|
208
|
+
|
|
209
|
+
Remember to remove debugging statements before committing.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**This rule warns but allows** - Claude sees the message but can still proceed.
|
|
213
|
+
|
|
214
|
+
### Example 3: Require Tests Before Stopping
|
|
215
|
+
|
|
216
|
+
```markdown
|
|
217
|
+
---
|
|
218
|
+
name: require-tests-run
|
|
219
|
+
enabled: false
|
|
220
|
+
event: stop
|
|
221
|
+
action: block
|
|
222
|
+
conditions:
|
|
223
|
+
- field: transcript
|
|
224
|
+
operator: not_contains
|
|
225
|
+
pattern: npm test|pytest|cargo test
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
**Tests not detected in transcript!**
|
|
229
|
+
|
|
230
|
+
Before stopping, please run tests to verify your changes work correctly.
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**This blocks Claude from stopping** if no test commands appear in the session transcript. Enable only when you want strict enforcement.
|
|
234
|
+
|
|
235
|
+
## Advanced Usage
|
|
236
|
+
|
|
237
|
+
### Multiple Conditions
|
|
238
|
+
|
|
239
|
+
Check multiple fields simultaneously:
|
|
240
|
+
|
|
241
|
+
```markdown
|
|
242
|
+
---
|
|
243
|
+
name: api-key-in-typescript
|
|
244
|
+
enabled: true
|
|
245
|
+
event: file
|
|
246
|
+
conditions:
|
|
247
|
+
- field: file_path
|
|
248
|
+
operator: regex_match
|
|
249
|
+
pattern: \.tsx?$
|
|
250
|
+
- field: new_text
|
|
251
|
+
operator: regex_match
|
|
252
|
+
pattern: (API_KEY|SECRET|TOKEN)\s*=\s*["']
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
🔐 **Hardcoded credential in TypeScript!**
|
|
256
|
+
|
|
257
|
+
Use environment variables instead of hardcoded values.
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Operators Reference
|
|
261
|
+
|
|
262
|
+
- `regex_match`: Pattern must match (most common)
|
|
263
|
+
- `contains`: String must contain pattern
|
|
264
|
+
- `equals`: Exact string match
|
|
265
|
+
- `not_contains`: String must NOT contain pattern
|
|
266
|
+
- `starts_with`: String starts with pattern
|
|
267
|
+
- `ends_with`: String ends with pattern
|
|
268
|
+
|
|
269
|
+
### Field Reference
|
|
270
|
+
|
|
271
|
+
**For bash events:**
|
|
272
|
+
|
|
273
|
+
- `command`: The bash command string
|
|
274
|
+
|
|
275
|
+
**For file events:**
|
|
276
|
+
|
|
277
|
+
- `file_path`: Path to file being edited
|
|
278
|
+
- `new_text`: New content being added (Edit, Write)
|
|
279
|
+
- `old_text`: Old content being replaced (Edit only)
|
|
280
|
+
- `content`: File content (Write only)
|
|
281
|
+
|
|
282
|
+
**For prompt events:**
|
|
283
|
+
|
|
284
|
+
- `user_prompt`: The user's submitted prompt text
|
|
285
|
+
|
|
286
|
+
**For stop events:**
|
|
287
|
+
|
|
288
|
+
- Use general matching on session state
|
|
289
|
+
|
|
290
|
+
## Management
|
|
291
|
+
|
|
292
|
+
### Enable/Disable Rules
|
|
293
|
+
|
|
294
|
+
**Temporarily disable:**
|
|
295
|
+
Edit the `.local.md` file and set `enabled: false`
|
|
296
|
+
|
|
297
|
+
**Re-enable:**
|
|
298
|
+
Set `enabled: true`
|
|
299
|
+
|
|
300
|
+
**Or use interactive tool:**
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
/hookify:configure
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Delete Rules
|
|
307
|
+
|
|
308
|
+
Simply delete the `.local.md` file:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
rm .claude/hookify.my-rule.local.md
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### View All Rules
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
/hookify:list
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Installation
|
|
321
|
+
|
|
322
|
+
This plugin is part of the Claude Code Marketplace. It should be auto-discovered when the marketplace is installed.
|
|
323
|
+
|
|
324
|
+
**Manual testing:**
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
cc --plugin-dir /path/to/hookify
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Requirements
|
|
331
|
+
|
|
332
|
+
- Python 3.7+
|
|
333
|
+
- No external dependencies (uses stdlib only)
|
|
334
|
+
|
|
335
|
+
## Troubleshooting
|
|
336
|
+
|
|
337
|
+
**Rule not triggering:**
|
|
338
|
+
|
|
339
|
+
1. Check rule file exists in `.claude/` directory (in project root, not plugin directory)
|
|
340
|
+
2. Verify `enabled: true` in frontmatter
|
|
341
|
+
3. Test regex pattern separately
|
|
342
|
+
4. Rules should work immediately - no restart needed
|
|
343
|
+
5. Try `/hookify:list` to see if rule is loaded
|
|
344
|
+
|
|
345
|
+
**Import errors:**
|
|
346
|
+
|
|
347
|
+
- Ensure Python 3 is available: `python3 --version`
|
|
348
|
+
- Check hookify plugin is installed
|
|
349
|
+
|
|
350
|
+
**Pattern not matching:**
|
|
351
|
+
|
|
352
|
+
- Test regex: `python3 -c "import re; print(re.search(r'pattern', 'text'))"`
|
|
353
|
+
- Use unquoted patterns in YAML to avoid escaping issues
|
|
354
|
+
- Start simple, then add complexity
|
|
355
|
+
|
|
356
|
+
**Hook seems slow:**
|
|
357
|
+
|
|
358
|
+
- Keep patterns simple (avoid complex regex)
|
|
359
|
+
- Use specific event types (bash, file) instead of "all"
|
|
360
|
+
- Limit number of active rules
|
|
361
|
+
|
|
362
|
+
## Contributing
|
|
363
|
+
|
|
364
|
+
Found a useful rule pattern? Consider sharing example files via PR!
|
|
365
|
+
|
|
366
|
+
## Future Enhancements
|
|
367
|
+
|
|
368
|
+
- Severity levels (error/warning/info distinctions)
|
|
369
|
+
- Rule templates library
|
|
370
|
+
- Interactive pattern builder
|
|
371
|
+
- Hook testing utilities
|
|
372
|
+
- JSON format support (in addition to markdown)
|
|
373
|
+
|
|
374
|
+
## License
|
|
375
|
+
|
|
376
|
+
MIT License
|