agentleFS
Zwin-uxZwin-ux/kit/.claude/skills/kit-provider-adapters/SKILL.md

kit-provider-adapters

Skill0 starsChanged 15 days agoMITView on GitHub

Add or change a model provider (Anthropic, OpenAI, xAI, OpenAI-compatible/local) or an external agent driver (Claude Code, Codex, Grok, ACP) in Kit — streaming, tool calls, errors, cost and tests. Use for any work in crates/kit-providers or crates/kit-agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never read another tool's credential file.

    line 26
  2. Very specific:

    Cost: use the provider's reported cost when there is one (xAI ticks, Claude total_cost_usd, Grok's reported cost).

    line 29
  3. Distinctive:

    Context window comes from the provider,: never a default guess.

    line 32
  4. Very specific:

    Run cargo test -p kitctl-providers -p kitctl-agents and the 3-OS CI before calling it done.

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Kit provider adapters and harness drivers

The design is docs/PRD.md §6. Two kinds of adapter, two crates:

KindCrateInterfaceExample
Model provider (Kit's own agent)crates/kit-providersProvider trait: models(), stream(Request) -> EventStreamanthropic.rs, openai_compatible.rs
External agent driver (harness)crates/kit-agentsAgent trait: probe(), spawn() → AgentHandle; events become KitEventclaude.rs, codex.rs, grok.rs

Rules

  1. Check the real docs, never guess a flag. Record the doc URL and the date in a comment above the invocation, and the CLI version you tested against. Upstream flags change: codex --full-auto and codex mcp-server were removed in 2026.
  2. One file per provider or driver, ≤ 600 lines. Shared SSE parsing and retry live in one module.
  3. Prompts never go on argv (Windows cmd injection and length limits). Use stdin, a prompt file the tool's published docs list, or the protocol (ACP).
  4. No shells. Spawn the real executable; on Windows resolve .cmd shims to their entry point as the existing adapters do.
  5. Auth stays where it is. Providers: env var → OS keychain (kit:<provider>) → key_command. Drivers: the tool's own login, checked with its status command (claude auth status, codex login status). Never read another tool's credential file. Never log a key; keys never enter a tool's environment.
  6. Errors map to the closed set: Auth, RateLimited{retry_after}, ContextOverflow, Transient, BadRequest, Fatal. The user sees the class in words and the fix.
  7. Cost: use the provider's reported cost when there is one (xAI ticks, Claude total_cost_usd, Grok's reported cost); otherwise compute from usage × prices.toml and mark it ≈. Never sum Claude total_cost_usd across resumes (it already includes earlier spend).
  8. Context window comes from the provider, never a default guess.
  9. Published docs beat repo docs. A flag found only in a tool's repo or user guide, not on its published CLI reference, is unverified: don't depend on it until a live check against the released CLI passes.

Tests (required)

  • Recorded streams: capture real responses once (success, tool call, rate limit, context overflow, auth failure), strip keys and personal data, and commit them under the crate's fixtures folder (crates/kit-agents/src/fixtures/ for drivers). CI replays them; CI never calls a real API.
  • Live tests go behind the live cargo feature and are run by hand with a budget.
  • Drivers: replay a transcript through the parser, and use a fake binary (see crates/kit-cli/tests/land_cli.rs) for exit codes, kill, resume and a version whose stream changed shape, which must fail loudly with the version named.
  • Run cargo test -p kitctl-providers -p kitctl-agents and the 3-OS CI before calling it done.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.