Agent skill

Kit SDK

by mark3labs in mark3labs/kit

Guide for building Go applications with the Kit SDK. An agent skill from mark3labs/kit.

MITAuto-check passedAI & LLM Engineering

Install Kit SDK

skills CLI
$ npx skills add mark3labs/kit --skill kit-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mark3labs/kit kit-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mark3labs/kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/kit-sdk .claude/skills/kit-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
kit-sdk
GitHub stars
140
Token cost
~2.6k tokens
SKILL.md length
883 words
Files
13 (incl. references)
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

Guide for building Go applications with the Kit SDK. An agent skill from mark3labs/kit.

  • Works in 3 steps: Create: kit.New(ctx, opts) — loads… → Interact: host.Prompt(ctx, msg) — send… → Close: host.Close() — cleans up MCP…
  • The user asks to create a program
  • SKILL.md covers Installation, Quick Start, Core Lifecycle and API Map, plus 3 more sections
  • Calls go; needs ANTHROPIC_API_KEY

What it does

Kit SDK is an agent skill from mark3labs/kit. Guide for building Go applications with the Kit SDK. Use when the user asks to create a program, service, script, or application that uses Kit programmatically as a Go library — e.g. embedding LLM interactions, building agents, creating CLI tools powered by Kit, or integrating Kit into backend services. Do NOT use for Kit extensions (use kit-extensions skill instead).

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 13 other files, including reference files (for example `references/common-patterns.md`, `references/configuration.md` and `references/context-compaction-subagents.md`).

It sits in AI & LLM Engineering, covering Embeddings and Building AI agents. It works with Model Context Protocol. The repository describes itself as: KIT (Knowledge Inference Tool) — A lightweight AI agent for coding. The licence is MIT.

When your agent uses it

  • The user asks to create a program
  • Application that uses Kit programmatically as a Go library — e.g
  • Kit extensions (use kit-extensions skill instead)

Example prompts

  • “/kit-sdk”

Requirements

  • A credential in ANTHROPIC_API_KEY

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Create: kit.New(ctx, opts) — loads config, initializes MCP servers, creates LLM provider, sets up agent
  2. Interact: host.Prompt(ctx, msg) — send messages, agent uses tools as needed
  3. Close: host.Close() — cleans up MCP connections, model resources, session file handle

What it can do on your machine

Read from SKILL.md and the folder at commit 1eb0cb9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ANTHROPIC_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Kit SDK loads about 2.6k tokens when it runs, and up to ~17k if it reads all its reference files. Until then it costs about 95 tokens; SKILL.md has 883 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~95
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~17k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mark3labs/kit at commit 1eb0cb9, republished under its MIT licence (© mark3labs). 883 words, ~2,634 tokens.

Download SKILL.mdSave it as .claude/skills/kit-sdk/SKILL.md (or your agent's skills folder). This skill also uses 12 other files; get the full folder from GitHub.
name
kit-sdk
description
Guide for building Go applications with the Kit SDK. Use when the user asks to create a program, service, script, or application that uses Kit programmatically as a Go library — e.g. embedding LLM interactions, building agents, creating CLI tools powered by Kit, or integrating Kit into backend services. Do NOT use for Kit extensions (use kit-extensions skill instead).

Kit SDK Development Guide

The Kit SDK (pkg/kit) lets you embed Kit's full agent capabilities — LLM interactions, tool execution, session management, streaming, hooks — into any Go application. Unlike extensions (which are interpreted scripts running inside Kit's TUI), SDK programs are standalone compiled Go binaries.

This file is the entry point. It gives the installation, a quick start, the core lifecycle, and the rules you must never miss. Detailed material lives in the references/ directory (see Reference files below). Read only the reference files that apply to your task.

Installation

bash
go get github.com/mark3labs/kit

Import path (alias recommended):

go
import kit "github.com/mark3labs/kit/pkg/kit"

Quick Start

go
package main

import (
    "context"
    "fmt"
    "log"

    kit "github.com/mark3labs/kit/pkg/kit"
)

func main() {
    ctx := context.Background()

    host, err := kit.New(ctx, nil) // nil = load .kit.yml (cwd) then ~/.kit.yml defaults
    if err != nil {
        log.Fatal(err)
    }
    defer func() { _ = host.Close() }()

    response, err := host.Prompt(ctx, "What is 2+2?")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(response)
}

Core Lifecycle

  1. Create: kit.New(ctx, opts) — loads config, initializes MCP servers, creates LLM provider, sets up agent
  2. Interact: host.Prompt(ctx, msg) — send messages, agent uses tools as needed
  3. Close: host.Close() — cleans up MCP connections, model resources, session file handle

Always defer Close():

go
defer func() { _ = host.Close() }()

API Map

AreaEntry pointsReference
Configure the instancekit.Options{Model, SystemPrompt, MaxSteps, Tools, ExtraTools, NoSession, ...}, kit.NewIsolatedAgent / kit.Isolated() for hermetic embedsreferences/options.md
Talk to the agentPrompt, PromptResult, PromptResultWithFiles, PromptWithOptions, Steer, FollowUp, PromptResultWithMessagesreferences/prompt-methods.md
Observe (read-only)host.OnToolCall(...), host.OnMessageUpdate(...), host.Subscribe(...)references/events.md
Intercept (read-write)host.OnBeforeToolCall(priority, fn), OnAfterToolResult, OnBeforeTurn, OnPrepareStep, OnContextPrepare, OnBeforeCompactreferences/hooks.md
Add capabilitieskit.NewTool(name, desc, fn), kit.TextResult, built-in tool constructors and bundlesreferences/tools.md
Persist conversationsSessionPath, Continue, NoSession, instance and package-level session methodsreferences/sessions.md
Models and MCPhost.SetModel, model registry, custom provider backends (kit.RegisterProvider, Options.Providers), AddMCPServer, in-process servers, MCP OAuthreferences/models-and-mcp.md
Manage the context windowEstimateContextTokens, Compact, AutoCompact, host.Subagentreferences/context-compaction-subagents.md

A minimal custom tool, which is the most common extension point:

go
type WeatherInput struct {
    City string `json:"city" description:"City name, e.g. 'San Francisco'"`
}

weatherTool := kit.NewTool("get_weather", "Get current weather for a city",
    func(ctx context.Context, input WeatherInput) (kit.ToolOutput, error) {
        return kit.TextResult("72°F, sunny in " + input.City), nil
    },
)

host, _ := kit.New(ctx, &kit.Options{
    ExtraTools: []kit.Tool{weatherTool},
})

Critical Rules (never skip)

  1. Tools replaces, ExtraTools adds. Options.Tools replaces ALL default tools (core + MCP + extension). Options.ExtraTools adds tools alongside the defaults. Use Tools to restrict the agent's capabilities; use ExtraTools to extend them.
  2. Register events and hooks before calling Prompt. Subscribers and hooks return an unsubscribe function — defer unsub() if the handler must not outlive a scope.
  3. Events are read-only; hooks are read-write. Use host.On<Event> to observe. Use host.On<Hook>(priority, fn) to block, modify, or inject. In hooks, return nil to allow/pass through; the first non-nil result wins. Lower priority values run first (kit.HookPriorityHigh = 0, Normal = 50, Low = 100).
  4. Pointer fields mean "unset". Generation parameters like Temperature, TopP, TopK are pointers so an explicit 0.0 differs from "leave the provider default". Zero-value MaxTokens auto-resolves; a non-zero value suppresses right-sizing.
  5. Sessions persist automatically as JSONL tree files. No explicit save call exists or is needed. Use NoSession: true for ephemeral, in-memory agents (scripts, subagents, tests).
  6. Context-window fill is not InputTokens alone. With prompt caching, sum InputTokens + CacheReadTokens + CacheCreationTokens + OutputTokens from result.FinalUsage.
  7. Reactive compaction is always on. A context-overflow error triggers one compact-and-replay. AutoCompact: true adds proactive compaction before turns that near the limit. If the replay still overflows, the turn fails with kit.ErrContextOverflow.
  8. MCP OAuth is opt-in. If MCPAuthHandler is nil, remote MCP servers that require OAuth fail with an authorization-required error. They do not open a browser silently.
  9. No dependency-name leakage. Use the kit.LLM* type aliases (LLMMessage, LLMUsage, ...) and kit.ConvertToLLM* helpers. Do not import the underlying LLM library into SDK-facing code.
  10. Configuration precedence is explicit ConfigFile → .kit.yml in cwd → ~/.kit.yml → KIT_* env vars → provider env vars (ANTHROPIC_API_KEY, ...). kit.New handles this; call kit.InitConfig only for special cases.

Show full SKILL.md (350 more words)Show less

Reference files

Read the file that matches the task. Paths are relative to this skill's root directory.

FileRead it when you need...
references/options.mdEvery kit.Options field with comments (model, behavior, generation parameters, provider overrides, session, tools, skills, feature toggles, compaction, MCP OAuth, in-process MCP), the generation/provider cheat-sheet table, and isolated agents (NewIsolatedAgent, Isolated, opt-in options).
references/prompt-methods.mdAll prompt variants: simple string, full result with usage stats, multimodal file attachments, per-call system message injection, system-level steering, continue without new input, multiple user messages in one turn.
references/events.mdTyped convenience subscribers, the generic subscriber, the full list of event types with their fields, and tool-kind constants.
references/hooks.mdEach hook (BeforeToolCall, AfterToolResult, BeforeTurn, AfterTurn, PrepareStep, ContextPrepare, BeforeCompact) with result types, plus hook priorities.
references/tools.mdCreating custom tools with kit.NewTool (schema auto-generation, struct tags, output helpers), built-in tool constructors, tool bundles, tool options, using tools in Options, querying tools at runtime.
references/sessions.mdSession modes, instance methods, package-level session operations, and implementing a custom SessionManager.
references/models-and-mcp.mdModel management at creation and runtime, the model registry, model string format, per-model system prompts and generation parameters, custom provider backends (ProviderFactory); dynamic MCP server management, in-process MCP servers, MCP prompts, MCP resources, MCP OAuth authorization and token storage.
references/context-compaction-subagents.mdContext token estimation, GetContextStats, manual and automatic compaction, reactive compaction; in-process subagents, subscribing to subagent events, named agents.
references/extension-api-auth-skills.mdThe ExtensionAPI (kit.Extensions()), credential management (auth), and skill loading/prompt building.
references/types.mdThe full list of re-exported types (LLMMessage, LLMUsage, tool types, event types, errors, ...).
references/common-patterns.mdRecipes: scripting/CLI pipe, long-running autonomous agent, streaming output to terminal, multi-turn conversation with memory, tool execution monitoring, guard rails with hooks, parallel subagents, read-only analysis agent.
references/configuration.mdConfig file discovery order, ${ENV_VAR} expansion, kit.InitConfig and kit.InitConfigWithOptions.

Key Files for Reference

© mark3labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 12 other files (references) in skills/kit-sdk of mark3labs/kit.

  • SKILL.md
  • references/common-patterns.md
  • references/configuration.md
  • references/context-compaction-subagents.md
  • references/events.md
  • references/extension-api-auth-skills.md
  • references/hooks.md
  • references/models-and-mcp.md
  • references/options.md
  • references/prompt-methods.md
  • references/sessions.md
  • references/tools.md
  • references/types.md

Open the folder on GitHubat commit 1eb0cb9

Compare with similar skills

Kit SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Kit SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Kit SDK this skillmark3labs/kit140—~2.6kAutomated safety check: PassMIT
Codebase Managementgiancarloerra/SocratiCode3.3k1 repos~1.8kAutomated safety check: PassAGPL-3.0
Sandbaseiflytek/skillhub5.2k2 repos~2.1kAutomated safety check: PassApache-2.0
Ms Agent Framework RAGshuyu-labs/WebCode278—~1.1kAutomated safety check: PassCustom licence
Pgvector Semantic Searchtimescale/pg-aiguide1.9k1 repos~3.8kAutomated safety check: PassApache-2.0
KtxKaelio/ktx1.6k—~3.2kAutomated safety check: PassApache-2.0

Similar skills

  • Codebase Management

    giancarloerra/SocratiCode

    Set up, index, and manage SocratiCode codebase indexing. An agent skill from giancarloerra/SocratiCode.

    3.3k GitHub starsUsed in 1 repo~1.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Sandbase

    iflytek/skillhub

    Access 2,000+ AI models and API tools through one MCP interface for inference, media generation, search, scraping, embeddings, social data, and structured retrieval.

    5.2k GitHub starsUsed in 2 repos~2.1k tokens
    AI & LLM EngineeringAuto-check passed
  • Ms Agent Framework RAG

    shuyu-labs/WebCode

    Comprehensive guide for building Agentic RAG systems using Microsoft Agent Framework in C.

    278 GitHub stars~1.1k tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Pgvector Semantic Search

    timescale/pg-aiguide

    A skill your agent uses for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search.

    1.9k GitHub starsUsed in 1 repo~3.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Ktx

    Kaelio/ktx

    Installs and configures ktx, the open-source context layer for data agents — runs ktx setup non-interactively with hidden CLI flags, configures database connections and embeddings, installs agent…

    1.6k GitHub stars~3.2k tokensUpdated 27 days ago
    AI & LLM EngineeringAuto-check passed
  • Qmd Search

    HurricaHjz/second-yourself

    OPTIONAL, DORMANT semantic-search layer over the wiki, powered by qmd (local hybrid BM25 + vector + rerank).

    113 GitHub stars~1.9k tokensUpdated 6 days ago
    AI & LLM EngineeringAuto-check passed

More from mark3labs/kit

  • Kit Extensions

    mark3labs/kit

    Guide for creating Kit extensions. An agent skill from mark3labs/kit.

    140 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check passed

Questions about Kit SDK

What does Kit SDK do?

Guide for building Go applications with the Kit SDK. An agent skill from mark3labs/kit. Kit SDK is an agent skill from mark3labs/kit. Guide for building Go applications with the Kit SDK.

When should I use Kit SDK?

Kit SDK fits situations like: the user asks to create a program; application that uses Kit programmatically as a Go library — e.g; kit extensions (use kit-extensions skill instead).

How do I install Kit SDK in Claude Code?

Run `npx skills add mark3labs/kit --skill kit-sdk -a claude-code`. Or copy the skill folder (skills/kit-sdk in mark3labs/kit) into .claude/skills/kit-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Kit SDK in Codex?

Run `npx skills add mark3labs/kit --skill kit-sdk -a codex`. Or copy the skill folder (skills/kit-sdk in mark3labs/kit) into .agents/skills/kit-sdk in your project. Codex loads it when a task matches its description.

Can I use Kit SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mark3labs/kit --skill kit-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/kit-sdk, .gemini/skills/kit-sdk, .github/skills/kit-sdk and .opencode/skills/kit-sdk in your project.

What does Kit SDK need to run?

Going by SKILL.md and its folder, Kit SDK needs the command-line tools its instructions call (go) and credentials named ANTHROPIC_API_KEY. Our summary lists: A credential in ANTHROPIC_API_KEY.

Does Kit SDK access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Kit SDK safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Kit SDK use?

Kit SDK is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Kit SDK use?

About 2.6k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 14k tokens, read only when the agent opens those files.

What are the alternatives to Kit SDK?

Skills that share tags, products or a category with Kit SDK: Codebase Management (giancarloerra/SocratiCode, 3.3k stars), Sandbase (iflytek/skillhub, 5.2k stars), Ms Agent Framework RAG (shuyu-labs/WebCode, 278 stars) and Pgvector Semantic Search (timescale/pg-aiguide, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Kit SDK?

mark3labs (a GitHub organization) maintains it in mark3labs/kit, which has 140 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 6, 2026.

Source: mark3labs/kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.