skills-experimental/edges-function-overloads/SKILL.md
# Edges Function Overloads Skill Edges Function Overloads - edges() function + 4 overload signatures + uniform edges + axis edges + individual edges + function implementation + edges(a,b?,c?,d?) + ZERO_EDGES constant + resolveEdges partial + addEdges addition + Rectangle union + clampRect bounds。 ## 功能概述 从Claude Code的ink/layout/geometry.ts提取的Edges function overloads模式,用于OpenClaw的边距处理。 ## 核心机制 ### edges() Function Overloads ```typescript export function edges(all: number): Edges // Uniform
npx skillsauth add bianhaifeng789-hue/openclaw-config skills-experimental/edges-function-overloadsInstall 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.
Edges Function Overloads - edges() function + 4 overload signatures + uniform edges + axis edges + individual edges + function implementation + edges(a,b?,c?,d?) + ZERO_EDGES constant + resolveEdges partial + addEdges addition + Rectangle union + clampRect bounds。
从Claude Code的ink/layout/geometry.ts提取的Edges function overloads模式,用于OpenClaw的边距处理。
export function edges(all: number): Edges // Uniform edges
export function edges(vertical: number, horizontal: number): Edges // Axis edges
export function edges(top: number, right: number, bottom: number, left: number): Edges // Individual
export function edges(a: number, b?: number, c?: number, d?: number): Edges { // Implementation
if (b === undefined) {
return { top: a, right: a, bottom: a, left: a } // 1 arg: uniform
}
if (c === undefined) {
return { top: a, right: b, bottom: a, left: b } // 2 args: axis
}
return { top: a, right: b, bottom: c, left: d! } // 4 args: individual
}
// 4 overload signatures
# Implementation handles all cases
edges(10) → {top: 10, right: 10, bottom: 10, left: 10}
// All edges same value
# Single argument
edges(10, 20) → {top: 10, right: 20, bottom: 10, left: 20}
// vertical (top/bottom) = 10, horizontal (right/left) = 20
# Two arguments
edges(10, 20, 30, 40) → {top: 10, right: 20, bottom: 30, left: 40}
// Each edge individual value
# Four arguments
export type Edges = {
top: number
right: number
bottom: number
left: number
}
// Edge insets (padding, margin, border)
# CSS-like naming
export const ZERO_EDGES: Edges = { top: 0, right: 0, bottom: 0, left: 0 }
// Zero edges constant
# No padding/margin/border
export function resolveEdges(partial?: Partial<Edges>): Edges {
return {
top: partial?.top ?? 0,
right: partial?.right ?? 0,
bottom: partial?.bottom ?? 0,
left: partial?.left ?? 0,
}
}
// Convert partial edges to full with defaults
# Missing edges → 0
export function addEdges(a: Edges, b: Edges): Edges {
return {
top: a.top + b.top,
right: a.right + b.right,
bottom: a.bottom + b.bottom,
left: a.left + b.left,
}
}
// Add two edge values
# Sum each edge
export function unionRect(a: Rectangle, b: Rectangle): Rectangle {
const minX = Math.min(a.x, b.x)
const minY = Math.min(a.y, b.y)
const maxX = Math.max(a.x + a.width, b.x + b.width)
const maxY = Math.max(a.y + a.height, b.y + b.height)
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }
}
// Union two rectangles
# Bounding box
export function clampRect(rect: Rectangle, size: Size): Rectangle {
const minX = Math.max(0, rect.x)
const minY = Math.max(0, rect.y)
const maxX = Math.min(size.width - 1, rect.x + rect.width - 1)
const maxY = Math.min(size.height - 1, rect.y + rect.height - 1)
return {
x: minX,
y: minY,
width: Math.max(0, maxX - minX + 1),
height: Math.max(0, maxY - minY + 1),
}
}
// Clamp rectangle to size bounds
# Ensure non-negative width/height
{
"edges": {"top": 10, "right": 20, "bottom": 10, "left": 20},
"argsCount": 2
}
edges(all): Edges | edges(v,h): Edges | edges(t,r,b,l): Edges → 3 signatures → 1 implementation
# 多个overload signatures
# 单一implementation
# TypeScript类型安全
b === undefined → uniform | c === undefined → axis | else → individual → argument count pattern
# 根据arguments数量dispatch
# undefined检查
# 不同逻辑
Partial<Edges> → resolveEdges → missing ?? 0 → full Edges → partial handling
# Partial<Edges>输入
# resolveEdges处理
# 缺失值默认0
unionRect(a, b) → minX, minY, maxX, maxY → bounding box → combine rectangles
# unionRect计算bounding box
# 包含两个rectangle的最小外框
ink/layout/geometry.ts (97 lines)business
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