← Back to Skills Marketplace
fangshan101-coder

Fx Base

by fangshan101-coder · GitHub ↗ · v1.1.2 · MIT-0
cross-platform ⚠ suspicious
177
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install fx-base
Description
feima-lab 后端公共基础模块:API 认证校验(FX_AI_API_KEY)、请求封装(POST + Bearer Token)、 通用错误处理(missing_api_key / api_unavailable / api_error)。 这是基础依赖 skill,被其他领域 skill(如 fanli...
README (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 进行处理,请确保信任该服务后再使用。

Usage Guidance
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.
Capability Analysis
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.
Capability Tags
requires-oauth-tokenrequires-sensitive-credentials
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install fx-base
  3. After installation, invoke the skill by name or use /fx-base
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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 公共基础模块(认证 + 请求封装 + 错误处理)
Metadata
Slug fx-base
Version 1.1.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is Fx Base?

feima-lab 后端公共基础模块:API 认证校验(FX_AI_API_KEY)、请求封装(POST + Bearer Token)、 通用错误处理(missing_api_key / api_unavailable / api_error)。 这是基础依赖 skill,被其他领域 skill(如 fanli... It is an AI Agent Skill for Claude Code / OpenClaw, with 177 downloads so far.

How do I install Fx Base?

Run "/install fx-base" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Fx Base free?

Yes, Fx Base is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Fx Base support?

Fx Base is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Fx Base?

It is built and maintained by fangshan101-coder (@fangshan101-coder); the current version is v1.1.2.

💬 Comments