Sure Finance Skill
This skill provides a reliable workflow to interact with Sure's API.
Scope
Use this skill for:
- - Listing and analyzing accounts, categories, tags, imports, chats, and transactions.
- Creating and updating transactions, tags, chats, and imports.
- Building financial summaries from Sure data.
- Helping users connect self-hosted Sure environments (Docker, compose, external assistant) with API usage.
Do not use this skill for:
- - Guessing undocumented endpoints or request shapes.
- Running destructive operations without explicit user confirmation.
- Fabricating financial figures when the API is unavailable.
Compatibility Contract
Follow these rules strictly to maximize compatibility:
- - The skill is instruction-only. Core runtime actions are limited to
curl requests against $SURE_BASE_URL using X-Api-Key. - Optional self-hosting and external-assistant flows (documented in
docs/) may reference additional URLs and env vars. These flows run only when the user explicitly requests them and never during normal API usage. - Always use plain Markdown. Do not include HTML entities like
. - Keep shell commands copy-paste ready.
- Use only ASCII in examples unless API data requires otherwise.
- Do not require tools beyond
curl for core operations. - Read credentials only from environment variables.
- Never print API keys or tokens in output.
- Do not instruct reading unrelated local files, keychains, or secret stores.
- If
SURE_BASE_URL has no scheme, normalize to http:// before use. - For all list endpoints, support pagination via
page and per_page. - Provide short, deterministic outputs when users request automation-friendly responses.
Environment Setup
Required variables:
CODEBLOCK0
Optional sensitive variables used only for specific self-hosted or external-assistant scenarios:
CODEBLOCK1
These optional variables are intentionally not listed in metadata.clawdbot.requires.env because the core skill runtime does not require them.
Do not request or provide these optional secrets for normal API usage.
Use them only when the user explicitly asks to run self-hosting or external-assistant validation flows.
Validation check:
CODEBLOCK2
If this fails:
- - Verify the base URL and API key.
- Confirm Sure server is running and reachable.
- If self-hosted with Docker, verify containers are healthy.
Authentication
All requests must include:
CODEBLOCK3
Core API Quick Reference
Accounts
List accounts:
CODEBLOCK4
Categories
List categories:
CODEBLOCK5
Retrieve category:
CODEBLOCK6
Chats
List chats:
CODEBLOCK7
Create chat:
CODEBLOCK8
Retrieve chat:
CODEBLOCK9
Update chat:
CODEBLOCK10
Delete chat:
CODEBLOCK11
Create chat message:
CODEBLOCK12
Retry last assistant response:
CODEBLOCK13
Imports
List imports:
CODEBLOCK14
Create import:
CODEBLOCK15
Retrieve import:
CODEBLOCK16
Tags
List tags:
CODEBLOCK17
Create tag:
CODEBLOCK18
Retrieve tag:
CODEBLOCK19
Update tag:
CODEBLOCK20
Delete tag:
CODEBLOCK21
Transactions
List transactions:
CODEBLOCK22
Create transaction:
CODEBLOCK23
Retrieve transaction:
CODEBLOCK24
Update transaction:
CODEBLOCK25
Delete transaction:
CODEBLOCK26
Recommended Agent Workflow
When asked to perform analytics:
- 1. List accounts and transactions with pagination.
- Aggregate monthly totals by category and account.
- Validate suspicious outliers against raw transactions.
- Return clear assumptions and confidence level.
When asked to mutate data:
- 1. Confirm target resource ID and intended change.
- Execute create or update call.
- Re-fetch the resource to verify success.
- Summarize fields changed.
Self-Hosted Sure Notes
Scope note: The commands below fetch compose files from the Sure project repository on GitHub. Review any downloaded file before running docker compose up. These flows are optional and only relevant when the user explicitly requests self-hosting setup.
For Docker-based self-hosting:
- - Official image tags include
latest and stable. - Default local URL is
http://localhost:3000. - API key is generated in Sure account settings.
For AI and external assistant mode:
- - Sure supports external assistant integration.
- Pipelock can proxy and inspect AI and MCP traffic.
- In AI compose mode, external agents should target the Pipelock reverse proxy when applicable.
Error Handling
For HTTP 401 or 403:
- - Verify
SURE_API_KEY. - Confirm the key belongs to the active Sure user.
For HTTP 404:
- - Verify resource ID and base URL.
For HTTP 422:
- - Validate JSON payload shape and enum values.
For network errors:
- - Confirm host reachability.
- If self-hosted, verify
docker compose ps status.
Data Safety
- - Treat all finance data as sensitive.
- Do not expose full account numbers or secrets in logs.
- Prefer redacting personally identifiable information in shared outputs.
Additional Files
Use the supporting files in this skill package:
- - INLINECODE17
- INLINECODE18
- INLINECODE19
Sure Finance 技能
该技能提供了一套可靠的工作流程,用于与 Sure 的 API 进行交互。
适用范围
使用此技能的场景:
- - 列出并分析账户、分类、标签、导入、聊天记录和交易。
- 创建和更新交易、标签、聊天记录和导入。
- 基于 Sure 数据构建财务摘要。
- 帮助用户将自托管 Sure 环境(Docker、compose、外部助手)与 API 使用相连接。
不应使用此技能的场景:
- - 猜测未记录的端点或请求格式。
- 未经用户明确确认执行破坏性操作。
- 在 API 不可用时编造财务数据。
兼容性约定
严格遵守以下规则以最大化兼容性:
- - 该技能仅包含指令。核心运行时操作仅限于使用 X-Api-Key 对 $SUREBASEURL 发起 curl 请求。
- 可选的自我托管和外部助手流程(记录在 docs/ 中)可能引用其他 URL 和环境变量。这些流程仅在用户明确请求时运行,在正常 API 使用期间绝不运行。
- 始终使用纯 Markdown。不要包含像 这样的 HTML 实体。
- 保持 shell 命令可直接复制粘贴。
- 除非 API 数据另有要求,否则示例中仅使用 ASCII 字符。
- 核心操作不需要除 curl 之外的工具。
- 仅从环境变量读取凭据。
- 切勿在输出中打印 API 密钥或令牌。
- 不要指示读取无关的本地文件、钥匙串或密钥存储。
- 如果 SUREBASEURL 没有协议,在使用前规范化为 http://。
- 对于所有列表端点,通过 page 和 per_page 支持分页。
- 当用户请求适合自动化的响应时,提供简短、确定性的输出。
环境设置
必需变量:
bash
export SUREAPIKEY=YOURAPIKEY
export SUREBASEURL=https://app.sure.am
仅用于特定自托管或外部助手场景的可选敏感变量:
bash
外部助手验证(可选)
export MCP
APITOKEN=...
export MCP
USEREMAIL=you@example.com
export EXTERNAL
ASSISTANTURL=https://your-agent/v1/chat/completions
export EXTERNAL
ASSISTANTTOKEN=...
自托管引导(可选)
export SECRET
KEYBASE=...
export POSTGRES_PASSWORD=...
这些可选变量有意未在 metadata.clawdbot.requires.env 中列出,因为核心技能运行时不需要它们。
对于正常的 API 使用,不要请求或提供这些可选的秘密信息。
仅在用户明确要求运行自托管或外部助手验证流程时使用它们。
验证检查:
bash
curl --silent --show-error --fail \
--request GET \
--url $SUREBASEURL/api/v1/accounts?page=1&per_page=1 \
--header X-Api-Key: $SUREAPIKEY
如果失败:
- - 验证基础 URL 和 API 密钥。
- 确认 Sure 服务器正在运行且可访问。
- 如果使用 Docker 自托管,验证容器是否健康。
身份验证
所有请求必须包含:
bash
--header X-Api-Key: $SUREAPIKEY
核心 API 快速参考
账户
列出账户:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/accounts?page=1&per_page=25 \
--header X-Api-Key: $SUREAPIKEY
分类
列出分类:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/categories \
--header X-Api-Key: $SUREAPIKEY
获取分类:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/categories/{id} \
--header X-Api-Key: $SUREAPIKEY
聊天记录
列出聊天记录:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/chats \
--header X-Api-Key: $SUREAPIKEY
创建聊天记录:
bash
curl --request POST \
--url $SUREBASEURL/api/v1/chats \
--header Content-Type: application/json \
--header X-Api-Key: $SUREAPIKEY \
--data {
title: 月度预算审查,
message: 总结我的消费趋势。,
model: default
}
获取聊天记录:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/chats/{id} \
--header X-Api-Key: $SUREAPIKEY
更新聊天记录:
bash
curl --request PATCH \
--url $SUREBASEURL/api/v1/chats/{id} \
--header Content-Type: application/json \
--header X-Api-Key: $SUREAPIKEY \
--data {
title: 更新的聊天标题
}
删除聊天记录:
bash
curl --request DELETE \
--url $SUREBASEURL/api/v1/chats/{id} \
--header X-Api-Key: $SUREAPIKEY
创建聊天消息:
bash
curl --request POST \
--url $SUREBASEURL/api/v1/chats/{chat_id}/messages \
--header Content-Type: application/json \
--header X-Api-Key: $SUREAPIKEY \
--data {
content: 本月与上月相比有什么变化?,
model: default
}
重试最后一条助手回复:
bash
curl --request POST \
--url $SUREBASEURL/api/v1/chats/{chat_id}/messages/retry \
--header X-Api-Key: $SUREAPIKEY
导入
列出导入:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/imports \
--header X-Api-Key: $SUREAPIKEY
创建导入:
bash
curl --request POST \
--url $SUREBASEURL/api/v1/imports \
--header Content-Type: application/json \
--header X-Api-Key: $SUREAPIKEY \
--data {
rawfilecontent: date,amount,name\n2026-01-01,25.00,Coffee,
type: TransactionImport,
accountid: id>,
publish: true,
datecollabel: date,
amountcollabel: amount,
namecollabel: name,
categorycollabel: category,
tagscollabel: tags,
notescollabel: notes,
date_format: YYYY-MM-DD,
number_format: 1,234.56,
signageconvention: inflowspositive,
col_sep: ,
}
获取导入:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/imports/{id} \
--header X-Api-Key: $SUREAPIKEY
标签
列出标签:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/tags \
--header X-Api-Key: $SUREAPIKEY
创建标签:
bash
curl --request POST \
--url $SUREBASEURL/api/v1/tags \
--header Content-Type: application/json \
--header X-Api-Key: $SUREAPIKEY \
--data {
tag: {
name: 旅行,
color: #3B82F6
}
}
获取标签:
bash
curl --request GET \
--url $SUREBASEURL/api/v1/tags/{id} \
--header X-Api-Key: $SUREAPIKEY
更新标签:
bash
curl --request PATCH \
--url $SUREBASEURL/api/v1/tags/{id} \
--header Content-Type: application/json \
--header X-Api-Key: $SUREAPIKEY \
--data {
tag: {
name: 旅行-已更新,
color: #2563EB
}
}
删除标签:
bash
curl --request DELETE \
--url $SUREBASEURL/api/v1/tags/{id} \
--header X-Api-Key: $SUREAPIKEY
交易
列出交易:
bash
curl --request GET \
--url