[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79DEV120KXZ7KPYA3XM9K1Y":3,"skill-same:01M79DEV120KXZ7KPYA3XM9K1Y":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M79DEV120KXZ7KPYA3XM9K1Y","kit-provider-adapters",null,"Add or change a model provider (Anthropic, OpenAI, xAI, OpenAI-compatible\u002Flocal) 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\u002Fkit-providers or crates\u002Fkit-agents.","Zwin-ux\u002Fkit","Zwin-ux","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F64337759?v=4","01M79DBM821SD1S27FGNME1DVF","No Image","01M79DBM8N9HE5QF0YRHPMJPAJ",0,"MIT","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fkit-provider-adapters\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: kit-provider-adapters\ndescription: Add or change a model provider (Anthropic, OpenAI, xAI, OpenAI-compatible\u002Flocal) 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\u002Fkit-providers or crates\u002Fkit-agents.\n---\n\n# Kit provider adapters and harness drivers\n\nThe design is [`docs\u002FPRD.md`](..\u002F..\u002F..\u002Fdocs\u002FPRD.md) §6. Two kinds of adapter, two crates:\n\n| Kind | Crate | Interface | Example |\n|---|---|---|---|\n| Model provider (Kit's own agent) | `crates\u002Fkit-providers` | `Provider` trait: `models()`, `stream(Request) -> EventStream` | `anthropic.rs`, `openai_compatible.rs` |\n| External agent driver (harness) | `crates\u002Fkit-agents` | `Agent` trait: `probe()`, `spawn()` → `AgentHandle`; events become `KitEvent` | `claude.rs`, `codex.rs`, `grok.rs` |\n\n## Rules\n1. **Check the real docs, never guess a flag.** Record the doc URL and the date in a comment above the\n   invocation, and the CLI version you tested against. Upstream flags change: `codex --full-auto` and\n   `codex mcp-server` were removed in 2026.\n2. **One file per provider or driver,** ≤ 600 lines. Shared SSE parsing and retry live in one module.\n3. **Prompts never go on argv** (Windows `cmd` injection and length limits). Use stdin, a prompt file the\n   tool's published docs list, or the protocol (ACP).\n4. **No shells.** Spawn the real executable; on Windows resolve `.cmd` shims to their entry point as the\n   existing adapters do.\n5. **Auth stays where it is.** Providers: env var → OS keychain (`kit:\u003Cprovider>`) → `key_command`. Drivers:\n   the tool's own login, checked with its status command (`claude auth status`, `codex login status`).\n   Never read another tool's credential file. Never log a key; keys never enter a tool's environment.\n6. **Errors map to the closed set:** `Auth`, `RateLimited{retry_after}`, `ContextOverflow`, `Transient`,\n   `BadRequest`, `Fatal`. The user sees the class in words and the fix.\n7. **Cost:** use the provider's reported cost when there is one (xAI ticks, Claude `total_cost_usd`,\n   Grok's reported cost); otherwise compute from usage × `prices.toml` and mark it `≈`. Never sum\n   Claude `total_cost_usd` across resumes (it already includes earlier spend).\n8. **Context window comes from the provider,** never a default guess.\n9. **Published docs beat repo docs.** A flag found only in a tool's repo or user guide, not on its published\n   CLI reference, is unverified: don't depend on it until a live check against the released CLI passes.\n\n## Tests (required)\n- **Recorded streams:** capture real responses once (success, tool call, rate limit, context overflow,\n  auth failure), strip keys and personal data, and commit them under the crate's fixtures folder\n  (`crates\u002Fkit-agents\u002Fsrc\u002Ffixtures\u002F` for drivers). CI replays\n  them; CI never calls a real API.\n- **Live tests** go behind the `live` cargo feature and are run by hand with a budget.\n- **Drivers:** replay a transcript through the parser, and use a fake binary (see\n  `crates\u002Fkit-cli\u002Ftests\u002Fland_cli.rs`) for exit codes, kill, resume and a version whose stream changed shape,\n  which must fail loudly with the version named.\n- Run `cargo test -p kitctl-providers -p kitctl-agents` and the 3-OS CI before calling it done.\n","# Kit provider adapters and harness drivers\n\nThe design is [`docs\u002FPRD.md`](..\u002F..\u002F..\u002Fdocs\u002FPRD.md) §6. Two kinds of adapter, two crates:\n\n| Kind | Crate | Interface | Example |\n|---|---|---|---|\n| Model provider (Kit's own agent) | `crates\u002Fkit-providers` | `Provider` trait: `models()`, `stream(Request) -> EventStream` | `anthropic.rs`, `openai_compatible.rs` |\n| External agent driver (harness) | `crates\u002Fkit-agents` | `Agent` trait: `probe()`, `spawn()` → `AgentHandle`; events become `KitEvent` | `claude.rs`, `codex.rs`, `grok.rs` |\n\n## Rules\n1. **Check the real docs, never guess a flag.** Record the doc URL and the date in a comment above the\n   invocation, and the CLI version you tested against. Upstream flags change: `codex --full-auto` and\n   `codex mcp-server` were removed in 2026.\n2. **One file per provider or driver,** ≤ 600 lines. Shared SSE parsing and retry live in one module.\n3. **Prompts never go on argv** (Windows `cmd` injection and length limits). Use stdin, a prompt file the\n   tool's published docs list, or the protocol (ACP).\n4. **No shells.** Spawn the real executable; on Windows resolve `.cmd` shims to their entry point as the\n   existing adapters do.\n5. **Auth stays where it is.** Providers: env var → OS keychain (`kit:\u003Cprovider>`) → `key_command`. Drivers:\n   the tool's own login, checked with its status command (`claude auth status`, `codex login status`).\n   Never read another tool's credential file. Never log a key; keys never enter a tool's environment.\n6. **Errors map to the closed set:** `Auth`, `RateLimited{retry_after}`, `ContextOverflow`, `Transient`,\n   `BadRequest`, `Fatal`. The user sees the class in words and the fix.\n7. **Cost:** use the provider's reported cost when there is one (xAI ticks, Claude `total_cost_usd`,\n   Grok's reported cost); otherwise compute from usage × `prices.toml` and mark it `≈`. Never sum\n   Claude `total_cost_usd` across resumes (it already includes earlier spend).\n8. **Context window comes from the provider,** never a default guess.\n9. **Published docs beat repo docs.** A flag found only in a tool's repo or user guide, not on its published\n   CLI reference, is unverified: don't depend on it until a live check against the released CLI passes.\n\n## Tests (required)\n- **Recorded streams:** capture real responses once (success, tool call, rate limit, context overflow,\n  auth failure), strip keys and personal data, and commit them under the crate's fixtures folder\n  (`crates\u002Fkit-agents\u002Fsrc\u002Ffixtures\u002F` for drivers). CI replays\n  them; CI never calls a real API.\n- **Live tests** go behind the `live` cargo feature and are run by hand with a budget.\n- **Drivers:** replay a transcript through the parser, and use a fake binary (see\n  `crates\u002Fkit-cli\u002Ftests\u002Fland_cli.rs`) for exit codes, kill, resume and a version whose stream changed shape,\n  which must fail loudly with the version named.\n- Run `cargo test -p kitctl-providers -p kitctl-agents` and the 3-OS CI before calling it done.\n",{"name":5,"description":7},"main","247d14fbfd2c6f3266558d168266b02141477140",".claude\u002Fskills\u002Fkit-provider-adapters",2,"https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit","https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@mzwin\u002Fkit","https:\u002F\u002Fgithub.com\u002FZwin-ux","i like to code","2026-11-02 01:46:54",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Zwin-ux\u002Fkit --skill kit-provider-adapters",{"tool":39,"command":40},"bunx","bunx skills add Zwin-ux\u002Fkit --skill kit-provider-adapters",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Zwin-ux\u002Fkit --skill kit-provider-adapters","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fkit-provider-adapters\u002FSKILL.md",true,[],[48,54,61,68,75,82],{"skillNo":49,"name":50,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M79DG9E74YF71H97VHA4E7FJ","concepts","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002Fwiki\u002Fkit-1.0\u002Fwiki\u002Fconcepts\u002FSkill.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M79DG83S8WTMRAH47T2D0WKE","write-tests","Add focused tests for important project behavior.","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002Fskills\u002Fwrite-tests\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M79DG60377KCK4Y83SQWAE66","workspace-setup","Set up monorepo and multi-package workspaces for agents and humans.","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002Fskills\u002Fworkspace-setup\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M79DG4N07X3KM7F89G7V4T4B","ship-checklist","Run a practical pre-ship checklist for an app release.","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002Fskills\u002Fship-checklist\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79DG2PD1PZG9ZW1YF11X0C3","project-setup","Set up a clean project baseline for agents and humans.","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002Fskills\u002Fproject-setup\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M79DG17XXG8RTZF3YQA3JT2S","pr-ready","Prepare a clear pull request summary, test plan, and risk notes.","https:\u002F\u002Fgithub.com\u002FZwin-ux\u002Fkit\u002Fblob\u002Fmain\u002Fskills\u002Fpr-ready\u002FSKILL.md",[],[]]