Linkfuse

TotalClaw 作者 totalclaw

从任何 URL 创建 Linkfuse 附属短链接。当用户想要创建 Linkfuse 链接、缩短联属 URL 或说“​​​​/linkfuse”时触发此技能。需要 LINKFUSE_TOKEN 环境变量。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~oliverw-linkfuse
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~oliverw-linkfuse/file -o oliverw-linkfuse.md
# Linkfuse Skill

Creates an affiliate short link via the Linkfuse REST API — same API used by the Chrome and Firefox extensions.

## Trigger Conditions

Use this skill when the user:
- Says `/linkfuse [url]`
- Asks to "create a Linkfuse link" for a URL
- Wants to shorten an affiliate/Amazon URL via Linkfuse

## Authentication

This skill reads the Bearer token exclusively from the `LINKFUSE_TOKEN` environment variable. If it is not set, tell the user:

> `LINKFUSE_TOKEN` is not set. Get your token from `https://app.linkfuse.net/user/external-token` and add it to your environment:
> ```
> export LINKFUSE_TOKEN=your_token_here
> ```
> Then retry.

Do not proceed without a token.

## Workflow

### Step 1 — Get the URL

If the user did not provide a URL, ask for one before proceeding.

### Step 2 — Create the link

```bash
node scripts/create-link.js --url "<url>"
```

- **Exit 0**: stdout contains JSON `{ "url": "...", "title": "..." }` — proceed to Step 3.
- **Exit 2 (Unauthorized)**: Tell the user their `LINKFUSE_TOKEN` is invalid or expired and they should update it.
- **Exit 1**: Display the stderr error message to the user.

### Step 3 — Display result

Show the user:
```
✓ Link created: <short-url>
  Title: <title>
```

Offer to copy the short URL to the clipboard:
```bash
echo -n "<short-url>" | xclip -selection clipboard 2>/dev/null || echo -n "<short-url>" | pbcopy 2>/dev/null || true
```

## Notes

- `allowRecycle: true` is sent with every request — if the same URL was shortened before, the existing link is returned rather than creating a duplicate.
- The `X-API-CLIENT: claude-skill` header identifies this client to the server.

---

## 中文说明

# Linkfuse 技能

通过 Linkfuse REST API 创建联属短链接——与 Chrome 和 Firefox 扩展所用的 API 相同。

## 触发条件

在以下情况使用本技能:
- 用户输入 `/linkfuse [url]`
- 用户请求为某个 URL "创建一个 Linkfuse 链接"
- 用户想通过 Linkfuse 缩短某个联属/Amazon URL

## 身份验证

本技能仅从 `LINKFUSE_TOKEN` 环境变量读取 Bearer 令牌。如果未设置,请告知用户:

> `LINKFUSE_TOKEN` is not set. Get your token from `https://app.linkfuse.net/user/external-token` and add it to your environment:
> ```
> export LINKFUSE_TOKEN=your_token_here
> ```
> Then retry.

没有令牌时不要继续。

## 工作流

### 第 1 步——获取 URL

如果用户未提供 URL,在继续之前先索取一个。

### 第 2 步——创建链接

```bash
node scripts/create-link.js --url "<url>"
```

- **Exit 0**:stdout 包含 JSON `{ "url": "...", "title": "..." }`——继续到第 3 步。
- **Exit 2 (Unauthorized)**:告知用户其 `LINKFUSE_TOKEN` 无效或已过期,应当更新它。
- **Exit 1**:向用户展示 stderr 错误信息。

### 第 3 步——展示结果

向用户展示:
```
✓ Link created: <short-url>
  Title: <title>
```

提供将短 URL 复制到剪贴板的选项:
```bash
echo -n "<short-url>" | xclip -selection clipboard 2>/dev/null || echo -n "<short-url>" | pbcopy 2>/dev/null || true
```

## 说明

- 每个请求都会发送 `allowRecycle: true`——如果同一 URL 之前已被缩短,将返回现有链接而非创建重复项。
- `X-API-CLIENT: claude-skill` 头用于向服务器标识此客户端。