skill-factory-1

English 繁體中文

A scaled-down, Uber-style platform for authoring, evaluating, measuring and improving agent skills (Claude Code first; Codex / OpenCode / Gemini CLI too).

Docs

Quickstart

Requires uv and Claude Code.

uv sync                      # create .venv and install deps from uv.lock
uv run sf --help
uv run sf version            # sf, installed Claude Code, pinned contract version
uv run sf spec validate      # validate skills/*/spec.yaml + SKILL.md frontmatter
uv run sf build              # regenerate plugins/ + .claude-plugin/marketplace.json
uv run sf release lc-add --bump patch   # bump skill + plugin version, rebuild
uv run sf lint               # house rules; --list-rules, --changed, --format github, --strict
uv run sf new my-skill --tier experimental --goal "..."   # scaffold spec.yaml + stub + starter eval
uv run sf compile my-skill   # spec.yaml -> SKILL.md.new + draft evals (Claude Opus 5.5); --apply to accept
uv run sf compile --check    # CI: fail if a compiled skill's spec changed since compiling
uv run sf eval lc-add        # run a skill's evals (via `claude plugin eval`), with a no-skill baseline
uv run sf eval --all --runs 3 -j 8   # every skill; results in runs/<skill>/<timestamp>/
uv run sf ablate lc-add      # with/without the skill + one run per `##` section removed -> verdicts
uv run sf bench lc-coach --models claude-haiku-5-5,claude-sonnet-5-5   # cheapest model that meets the bar
uv run sf judge calibrate lc-coach   # LLM judge vs your labels in evals/_calibration/ (Cohen's kappa)
uv run sf papercuts list     # reports filed by the log-papercut skill; group / show / promote / close
uv run sf search "review python code"   # find an existing skill (+ install command)
uv run sf analyze --since 7d # costliest sessions + wasteful patterns, with a suggested fix each
uv run sf install --agent codex      # also: opencode, gemini; --scope project, --dry-run
uv run sf agent run weekly-skill-digest   # a managed agent: headless run + outcome checks
uvx pre-commit install       # lint changed skills + check generated files on every commit
scripts/probe_otel.sh        # re-capture OTel payloads after upgrading the CLI (~$0.01)
uv run pytest                # unit + Claude Code contract tests
uv run ruff check . && uv run ruff format --check . && uv run mypy
scripts/probe_claude.sh      # re-capture Claude Code payloads after upgrading the CLI (~$0.01)

Install the skills

/plugin marketplace add yennanliu/skill-factory-1
/plugin install sf-core@skill-factory
/plugin install sf-domain-leetcode@skill-factory
Tier (spec.yaml) Plugin
always-on sf-platform
core sf-core
domain + domain: x sf-domain-x
experimental sf-experimental

Telemetry

Two sources, both local-only ($SF_HOME, default ~/.skill-factory/):

  1. Hooks: install sf-platform (/plugin install sf-platform@skill-factory). Each skill call, each tool error (attributed to the active skill) and each session start/end is appended to telemetry/events.jsonl. No prompts, tool input or paths are recorded.
  2. OpenTelemetry: gives the cost per skill.
    uv run sf otel up                 # stdlib collector on 127.0.0.1:4318 -> ~/.skill-factory/otel/
    eval "$(uv run sf otel env)"      # then start claude from this shell
    uv run sf stats --since 1d        # calls, model/user trigger, sessions, cost/call, tool errors
    
  3. Report: uv run sf report writes report/index.html, one self-contained page (no JS, no CDN). It shows, per skill: calls, model/user split, cost/call (mean and p90), tool errors, repos, active weeks, versions in use, skills used alongside, a 14-day sparkline, context cost, and the latest eval with its baseline verdict.
  4. Status line: uv run sf statusline install [--budget 2] shows a diff, then sets statusLine in ~/.claude/settings.json so it displays $0.42 · Opus 5.5 · ctx 31% · lc-add. The cost turns yellow at 50% of the session budget and red at 80%. There are no hard caps.

Authoring

spec.yaml is the source of truth (Uber’s lesson: write the spec first so intent survives model changes). sf compile asks Claude for the description, the body and 3–5 draft eval cases, using structured output. It runs the linter on the result and feeds any failures back (up to 2 retries). It writes SKILL.md.new and shows a diff, so nothing is overwritten unless you pass --apply. The compiled SKILL.md carries <!-- sf:spec-sha256=… -->, so sf lint (SF012) and sf compile --check catch specs edited without recompiling. Backends:

Draft eval cases are tagged draft and are never overwritten once they exist. Review them before trusting them.

Evals

Cases live in skills/<name>/evals/<case>/case.yaml, in Claude Code’s own plugin eval format. Shared scaffold scripts go in evals/_shared/. sf eval stages the skill as a one-skill plugin and runs claude plugin eval with --no-publish, --scaffold, the spec’s tool grants and a no-plugin baseline arm. It then reports, per case and per skill: the pass rate with a 95% Wilson interval, the baseline pass rate, the mean score, and how often the skill actually fired. Each skill’s status is checked against its spec: ok, below-min (exit 1) or too-easy (above max_pass_rate).

Does the skill earn its tokens?

The improvement loop

The always-on sf-platform plugin ships two skills:

The loop: sf papercuts list, then sf papercuts promote <id> (writes a draft regression case). Make the case reproduce the bug and confirm it fails, fix the spec, sf compile --apply, confirm the case passes, then sf papercuts close <id>. sf analyze covers the waste between skills: expensive models on read-only work, large tool results, cache expiry after breaks, heavy preloaded context, polling, search thrash and retry loops.

Other agents

sf install --agent codex|opencode|gemini [--scope user|project] copies built skills into ~/.codex/skills, ~/.config/opencode/skills or ~/.gemini/skills (project scope: .codex/skills, .opencode/skills, .gemini/skills). It strips Claude-only frontmatter (allowed-tools) and installs only skills whose spec lists that agent in targets.agents (--all-skills overrides). It never replaces a skill it didn’t install. Telemetry hooks are Claude Code only.

Managed agents

managed/<name>.yaml defines a skill-backed job that runs headless on a schedule. Each one has a prompt, plugins, model, budget and outcome checks (required strings, every repo skill mentioned, a cost ceiling). sf agent run records the cost, turns and outcome under runs/agents/<name>/. Example: weekly-skill-digest.

CI

Layout

| Path | What | |—|—| | src/skill_factory/ | the sf CLI | | skills/<name>/ | skill sources: spec.yaml (source of truth) + SKILL.md + references | | market.yaml | marketplace name/owner and per-plugin versions | | plugins/, .claude-plugin/ | generated by sf build; never edit by hand | | scripts/probe_claude.sh | records real hook / stream-json payloads into tests/fixtures/claude/<version>/ | | src/skill_factory/lint/rules.py | lint rules SF001–SF014; waive per skill with lint_waivers in spec.yaml | | hooks/ | telemetry hook (stdlib only) + hooks.json, shipped in sf-platform via assets | | src/skill_factory/telemetry/ | OTLP collector, DuckDB ingest, sf stats | | site/ | project site (static page, English + 繁體中文) | | docs/CLAUDE_CODE_CONTRACT.md | Claude Code facts we depend on, confirmed by the probe |

Status

All 10 phases (0-9) of the implementation plan are implemented, plus three experimental skills (commit-message-writer, changelog-writer, cron-explainer). scripts/e2e_local.sh runs an end-to-end check against the real Claude Code CLI.

References