← 返回 Skills 市场
fangshan101-coder

Fx Base

作者 fangshan101-coder · GitHub ↗ · v1.1.2 · MIT-0
cross-platform ⚠ suspicious
177
总下载
0
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install fx-base
功能描述
feima-lab 后端公共基础模块:API 认证校验(FX_AI_API_KEY)、请求封装(POST + Bearer Token)、 通用错误处理(missing_api_key / api_unavailable / api_error)。 这是基础依赖 skill,被其他领域 skill(如 fanli...
使用说明 (SKILL.md)

fx-base — feima-lab 公共基础

本 skill 是 feima-lab 后端 API 的公共基础模块。不直接面向用户调用,而是被领域 skill 的脚本通过 import 引用。

提供的函数

领域 skill 的脚本通过 import { fxCheckAuth, fxPost, fxCheckResponse, FX_BASE_URL } from './fx-api.mjs' 获得以下函数:

函数 说明
fxCheckAuth() 校验环境变量 FX_AI_API_KEY,未设置时输出标准错误 JSON 并 exit 1
fxPost(endpoint, body, errMsg?) 发送 POST 请求到 FX_BASE_URL/\x3Cendpoint>,自动拼接认证头。失败时 exit 1
fxCheckResponse(respJson) 校验响应 JSON:code==200 返回 data,否则输出错误并 exit 1

常量:FX_BASE_URL=https://api-ai-brain.fenxianglife.com/fenxiang-ai-brain

环境变量

变量 必填 说明
FX_AI_API_KEY feima-lab 开放平台 登录获取

安装

# ClawHub(推荐)
npx skills install fangshan101-coder/fx-base

# npm
npx skills install fx-base

安装后确保 fx-base 与依赖它的领域 skill 在同一个 .claude/skills/ 目录下(即同级目录)。

领域 skill 如何引用

在领域 skill 的脚本头部添加:

import { fileURLToPath } from 'url';
import { join, dirname } from 'path';
import { existsSync } from 'fs';

const _scriptDir = dirname(fileURLToPath(import.meta.url));
const _fxApiPath = join(_scriptDir, '../../fx-base/scripts/fx-api.mjs');
if (!existsSync(_fxApiPath)) {
  process.stderr.write(
    '{"status":"error","error_type":"missing_dependency","suggestion":"缺少 fx-base,请安装:npx skills install fangshan101-coder/fx-base"}\
'
  );
  process.exit(1);
}

const { fxCheckAuth, fxPost, fxCheckResponse } = await import(_fxApiPath);

然后即可使用 fxCheckAuth()fxPost()fxCheckResponse()

错误输出格式

所有错误统一为 JSON 到 stderr:

{"status":"error","error_type":"\x3C类型>","suggestion":"\x3C用户可见提示>"}
error_type 触发条件
missing_api_key FX_AI_API_KEY 环境变量未设置
api_unavailable curl 请求失败(超时、网络错误、HTTP 错误)
api_error 响应 code != 200,从 errorMessage 字段提取具体原因
missing_dependency 领域 skill 找不到 fx-base(未安装)

数据流向

用户提供的数据会被发送到 https://api-ai-brain.fenxianglife.com 进行处理,请确保信任该服务后再使用。

安全使用建议
This skill is a small helper library that will send data (and the FX_AI_API_KEY) to https://api-ai-brain.fenxianglife.com; only install/use it if you trust that service. Keep FX_AI_API_KEY secret and scoped appropriately, and be aware that when errors occur the helper calls process.exit(1), which will terminate the calling script. If you need tighter control, review or vendor-lock the fx-api.mjs source, or implement your own wrapper that uses the same endpoint but applies additional logging/sanitization or non-terminating error handling.
功能分析
Type: OpenClaw Skill Name: fx-base Version: 1.1.2 The fx-base skill is a legitimate utility library designed to provide common API functions (authentication, POST requests, and response handling) for other modules within the feima-lab ecosystem. It communicates with a documented endpoint (api-ai-brain.fenxianglife.com) using a user-provided API key (FX_AI_API_KEY). The code in scripts/fx-api.mjs is straightforward, lacks obfuscation, and contains no evidence of malicious intent or data exfiltration beyond its stated purpose.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
Name/description, declared requirement (FX_AI_API_KEY), SKILL.md documentation, and the included fx-api.mjs implementation all align: the module performs API key checking, a POST wrapper that adds the auth header, and response checking against FX_BASE_URL.
Instruction Scope
SKILL.md limits runtime actions to providing importable functions and documents the exact behavior. The code only reads the FX_AI_API_KEY env var, performs fetch POSTs to the documented domain, and writes structured JSON errors to stderr then exits on failure — behavior is consistent with the documentation. Note: errors call process.exit(1), which will terminate the invoking script; this is expected but important for integrators to know.
Install Mechanism
There is no install script or network download; this is an instruction-only skill plus a small included module file. Nothing is being fetched or written at install time.
Credentials
Only a single environment variable (FX_AI_API_KEY) is required and it is the primary credential used to authenticate requests to the documented API endpoint — this is proportional to the stated purpose.
Persistence & Privilege
always:false and no special persistence or modification of other skills or system settings. The skill does not request elevated or permanent privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install fx-base
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /fx-base 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.2
清理 fenxiang-ai 品牌描述残留,统一为 feima-lab
v1.1.1
品牌域名迁移:platform.fenxiang-ai.com → platform.feima.ai
v1.1.0
feat: fx-api.sh 迁移到 fx-api.mjs,支持跨平台运行
v1.0.0
初始发布:fenxiang-ai 公共基础模块(认证 + 请求封装 + 错误处理)
元数据
Slug fx-base
版本 1.1.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 4
常见问题

Fx Base 是什么?

feima-lab 后端公共基础模块:API 认证校验(FX_AI_API_KEY)、请求封装(POST + Bearer Token)、 通用错误处理(missing_api_key / api_unavailable / api_error)。 这是基础依赖 skill,被其他领域 skill(如 fanli... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 177 次。

如何安装 Fx Base?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install fx-base」即可一键安装,无需额外配置。

Fx Base 是免费的吗?

是的,Fx Base 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Fx Base 支持哪些平台?

Fx Base 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Fx Base?

由 fangshan101-coder(@fangshan101-coder)开发并维护,当前版本 v1.1.2。

💬 留言讨论