skills-experimental/hooks-system/SKILL.md
Hooks System - Functional hooks adapted from Claude Code's React hooks. Includes permission checking, status management, inbox polling, typeahead, and more. Use when [hooks system] is needed.
npx skillsauth add bianhaifeng789-hue/openclaw-config hooks-systemInstall 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.
函数式 Hooks 系统 - 借鉴 Claude Code 的 React hooks。
| Hook | 功能 |
|------|-----|
| canUseTool() | 工具权限检查 |
| setStatus() | 状态管理 |
| startInboxPoller() | 收件箱轮询 |
| afterFirstRender() | 首次渲染后执行 |
| matchTypeahead() | 自动补全 |
| cancelRequest() | 取消请求 |
| startBlink() | 闪烁效果 |
import { canUseTool, setPermissionContext } from './hooks-system'
// 设置权限模式
setPermissionContext({ permissionMode: 'auto' })
// 检查工具权限
const result = canUseTool('read')
console.log(result.allowed) // true
console.log(result.needsPrompt) // false
import { setStatus, subscribeStatus } from './hooks-system'
// 设置状态
setStatus('executing', 'Running tool', 'read')
// 订阅状态变更
const unsubscribe = subscribeStatus((status) => {
console.log('Status:', status.status)
})
// 取消订阅
unsubscribe()
import { startInboxPoller, registerMessageHandler } from './hooks-system'
// 启动轮询(30秒间隔)
startInboxPoller(30000)
// 注册消息处理器
registerMessageHandler(async (messages) => {
console.log('New messages:', messages.length)
})
| 模式 | 说明 |
|-----|-----|
| auto | 所有工具自动允许 |
| plan | 只允许读取类工具 |
| confirm | 需要用户确认 |
| restricted | 只允许白名单工具 |
| 状态 | 说明 |
|-----|-----|
| idle | 空闲 |
| thinking | 思考中 |
| executing | 执行工具 |
| waiting_input | 等待用户输入 |
| compacting | 压缩上下文 |
| error | 错误 |
| Claude Code | OpenClaw |
|-------------|----------|
| useCanUseTool | canUseTool() |
| useStatus | setStatus() + subscribeStatus() |
| useInboxPoller | startInboxPoller() |
| useAfterFirstRender | afterFirstRender() |
| useTypeahead | matchTypeahead() |
| useCancelRequest | cancelRequest() |
| useBlink | startBlink() |
| useVirtualScroll | calculateVirtualScroll() |
impl/utils/hooks-system.tsbusiness
IAA 日报飞书输出能力。 支持把固定 CSV 模板一键转换成: - 中文运营结论 - 飞书卡片 JSON - 飞书发送载荷 Use when: - 需要把 IAA 日报直接发到飞书 - 需要从 CSV 一键生成运营日报
data-ai
IAA日报分析模型 功能: - 渠道日报自动分析 - 小时级+日级ROI联动判断 - 按地区输出加量/降量/停投建议 - 按产品类型输出阈值 - 自动识别利润区/观察区/止损区 Use when: - 分析每天投放数据 - 生成运营日报结论 - 判断是否加量/降量/停投 - 对比美加澳/日韩表现 Keywords: - 日报模型, 投放日报, 加量, 降量, 停投, ROI日报, 分地区分析
data-ai
IAA固定日报分析模板 功能: - 固定字段模板(可直接贴每天数据) - 自动输出总盘结论 - 自动输出美加澳/日韩结论 - 自动给出加量/降量/停投建议 - 适配文件修复/清理两类产品 Use when: - 需要固定日报格式 - 每天复盘渠道表现 - 给运营团队出统一结论 Keywords: - 固定模板, 日报模板, ROI模板, IAA日报, 运营模板
development
# HyperlinkPool Pattern Skill HyperlinkPool Pattern - HyperlinkPool class + strings array + stringMap + Index 0 no hyperlink + intern(hyperlink) + get(id) + undefined handling + 5-minute reset + OSC8 hyperlink interning。 ## 功能概述 从Claude Code的ink/screen.ts提取的HyperlinkPool模式,用于OpenClaw的OSC8超链接池管理。 ## 核心机制 ### HyperlinkPool Class ```typescript export class HyperlinkPool { private strings: string[] = [''] // Index 0 = no hyperlink private stringMap = new Map<string, number>() // strings