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 INLINECODE0
- 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:
INLINECODE2 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
CODEBLOCK1
- - 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:
CODEBLOCK2
Offer to copy the short URL to the clipboard:
CODEBLOCK3
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 缩短联盟/亚马逊 URL
身份验证
此技能仅从 LINKFUSE_TOKEN 环境变量读取 Bearer 令牌。如果未设置,请告知用户:
LINKFUSE_TOKEN 未设置。请从 https://app.linkfuse.net/user/external-token 获取您的令牌,并将其添加到您的环境中:
export LINKFUSETOKEN=yourtoken_here
然后重试。
没有令牌则无法继续。
工作流程
步骤 1 — 获取 URL
如果用户未提供 URL,请先询问后再继续。
步骤 2 — 创建链接
bash
node scripts/create-link.js --url
- - 退出码 0:标准输出包含 JSON { url: ..., title: ... } — 继续执行步骤 3。
- 退出码 2(未授权):告知用户其 LINKFUSE_TOKEN 无效或已过期,需要更新。
- 退出码 1:向用户显示标准错误输出中的错误信息。
步骤 3 — 显示结果
向用户展示:
✓ 链接已创建:<短链接>
标题:<标题>
提供将短链接复制到剪贴板的选项:
bash
echo -n <短链接> | xclip -selection clipboard 2>/dev/null || echo -n <短链接> | pbcopy 2>/dev/null || true
注意事项
- - 每次请求都会发送 allowRecycle: true — 如果之前已缩短过相同的 URL,将返回现有链接,而不会创建重复链接。
- X-API-CLIENT: claude-skill 标头用于向服务器标识此客户端。