用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/stoa-platform/stoa --skill analytics命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Force a full-file rewrite (Write) instead of patch (Edit) when Edit keeps failing or diff is large. Context rot mitigation — use when Edit has failed ≥2× on same file, or when estimated diff >30% of file size.
STOA PR Guardian — advisory three-axis review (ADR compliance, security, AI code smell) with binary GO/NO-GO verdict + confidence. Never approves, never blocks merge.
Analyze cycle capacity gap and propose backlog items to fill the sprint to ~80% of proven velocity.
基于 SOC 职业分类
正在显示 SKILL.md
| name | analytics |
| description | Query platform data — PostgreSQL (prod), token costs, Prometheus metrics, GitHub CI stats, K8s pod status. |
| argument-hint | <query-name or free-form question> |
Query STOA platform data across 5 sources. All queries are read-only.
| # | Source | Access | Auth |
|---|---|---|---|
| 1 | PostgreSQL (OVH Managed) | psql direct | Infisical /prod/database |
| 2 | Token Observatory | Local files | None (filesystem) |
| 3 | Pushgateway / Prometheus | HTTP API | None (IP-whitelisted) |
| 4 | GitHub CI | gh CLI | GitHub token (ambient) |
| 5 | Kubernetes | kubectl | kubeconfig (ambient) |
eval $(infisical-token)
DB_URL=$(infisical secrets get DATABASE_URL --env=prod --path=/database --plain 2>/dev/null)
psql "$DB_URL" -c "<QUERY>"
Fallback (direct):
psql "<POSTGRES_CONNECTION_STRING>"
# Today's stats
cat ~/.claude/stats-cache.json | python3 -m json.tool
# Historical (metrics.log)
grep "TOKEN-SPEND" ~/.claude/projects/-Users-torpedo-hlfh-repos-stoa/memory/metrics.log
curl -s https://pushgateway.gostoa.dev/metrics | grep gateway_arena
gh run list --limit 10 --json name,status,conclusion,startedAt,updatedAt
gh run view <run-id> --log-failed
kubectl get pods -n stoa-system -o wide
kubectl top pods -n stoa-system
tenant-count — Total tenantsSELECT COUNT(*) AS total_tenants FROM tenants WHERE deleted_at IS NULL;
api-count — APIs by tenantSELECT t.name AS tenant, COUNT(a.id) AS apis
FROM apis a JOIN tenants t ON a.tenant_id = t.id
WHERE a.deleted_at IS NULL
GROUP BY t.name ORDER BY apis DESC;
user-count — Active usersSELECT COUNT(*) AS total_users FROM users WHERE is_active = true;
gateway-instances — Registered gatewaysSELECT name, gateway_type, status, base_url, last_health_check
FROM gateway_instances ORDER BY last_health_check DESC;
recent-deployments — Last 10 API deploymentsSELECT a.name AS api, d.status, d.gateway_type, d.created_at
FROM deployments d JOIN apis a ON d.api_id = a.id
ORDER BY d.created_at DESC LIMIT 10;
subscription-stats — Subscriptions by statusSELECT status, COUNT(*) FROM subscriptions GROUP BY status ORDER BY count DESC;
token-cost-7d — Token costs last 7 daysgrep "TOKEN-SPEND" ~/.claude/projects/-Users-torpedo-hlfh-repos-stoa/memory/metrics.log | tail -7
ci-health — CI pass rate last 20 runsgh run list --limit 20 --json conclusion | python3 -c "
import json,sys; runs=json.load(sys.stdin)
total=len(runs); ok=sum(1 for r in runs if r['conclusion']=='success')
print(f'{ok}/{total} passed ({100*ok//total}%)')
"
arena-scores — Gateway Arena latest scorescurl -s https://pushgateway.gostoa.dev/metrics | grep 'gateway_arena_score{' | sort
pod-status — All pods healthkubectl get pods -n stoa-system --no-headers | awk '{print $1, $2, $3}'
db-size — Database sizeSELECT pg_size_pretty(pg_database_size(current_database())) AS db_size;
table-sizes — Top 10 tables by sizeSELECT relname AS table, pg_size_pretty(pg_total_relation_size(relid)) AS size
FROM pg_catalog.pg_statio_user_tables
ORDER BY pg_total_relation_size(relid) DESC LIMIT 10;
User: /analytics tenant-count
User: /analytics How many APIs are deployed on Kong?
User: /analytics token-cost-7d
User: /analytics What's the CI pass rate this week?
For free-form questions, map to the closest pre-built query or compose a custom one.
LIMIT 50 to unbounded queries