一键导入
betterness-shared
Shared reference: auth, global flags, output formats, and security rules for the Betterness CLI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Shared reference: auth, global flags, output formats, and security rules for the Betterness CLI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Browse and search available lab tests with prices and included markers.
Search the Betterness knowledge library — files and videos via OpenSearch full-text search.
Install, uninstall, and manage Betterness MCP server integrations for AI clients (Claude, Cursor, Windsurf).
Manage authentication — OAuth login, API key login, logout, and verify identity.
Read, update, and explore the user's health profile questionnaire (sections, questions, answers).
Biomarker lab results, LOINC codes, and biological age calculations.
| name | betterness-shared |
| version | 1.0.0 |
| description | Shared reference: auth, global flags, output formats, and security rules for the Betterness CLI. |
| metadata | {"category":"shared","requires":{"bins":["betterness"]}} |
This skill contains authentication, global flags, output formatting, and security rules used by all other Betterness skills.
# OAuth login (default) — opens browser
betterness auth login
# API key login
betterness auth login --key <apiKey>
Only one auth method is active at a time — logging in with one clears the other.
--api-key <key> flag (highest priority)BETTERNESS_API_KEY environment variable~/.betterness/tokens.json (auto-refreshed when expired)~/.betterness/credentials.jsonbetterness auth whoami --json
Every command accepts these flags:
| Flag | Description |
|---|---|
--api-key <key> | Override stored API key |
--api-url <url> | Override backend URL |
--json | Output as JSON (recommended for agents) |
--markdown | Output as Markdown table |
--quiet | Suppress output (exit code only) |
Agent rule: Always use --json for structured, parseable output.
| Format | When to use |
|---|---|
--json | Agent consumption, piping to jq, scripting |
--markdown | Rendering in chat, reports, documents |
| (default) | Human terminal use — formatted ASCII table |
The output format can also be set via the BETTERNESS_OUTPUT environment variable (json or markdown).
All errors are returned as JSON on stderr:
{
"error": {
"code": "AUTH_MISSING",
"message": "No API key found. Run 'betterness auth login' or set BETTERNESS_API_KEY."
}
}
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General / API error |
| 2 | Authentication error |
| Code | Cause |
|---|---|
AUTH_MISSING | No credentials configured |
AUTH_UNAUTHORIZED | Invalid or expired credentials (HTTP 401) |
AUTH_FORBIDDEN | Insufficient permissions (HTTP 403) |
OAUTH_TIMEOUT | OAuth login timed out (120s) |
OAUTH_PORT_IN_USE | Callback port busy (another login running?) |
OAUTH_REFRESH_FAILED | OAuth token refresh failed |
HTTP_404 | Resource not found |
HTTP_429 | Rate limited (auto-retried 3x with backoff) |
VALIDATION_ERROR | Invalid input or unexpected response shape |
NETWORK_ERROR | Connection failure |
TIMEOUT | Request exceeded 30s |
# List all commands and options
betterness schema --json
# Inspect a specific command
betterness schema biomarkers --json
betterness schema lab-orders.book --json
--dry-run on mutating commands to preview before committing.The CLI automatically retries on transient errors: