instill

package module
v0.0.0-...-16550ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 12 Imported by: 0

README

instill

A Go library for installing Agent Skills into AI coding agents and detecting which agent is running your code.

40 agents can't agree on where to put a markdown file or which env var to set. instill deals with it so you don't have to.

your-tool/
└── skills/
    └── your-skill/
        ├── SKILL.md              # instructions + frontmatter
        └── references/           # optional detailed docs
            └── commands.md

No SDK, no runtime, no protocol. Markdown files in the right directories. Env vars in the right if statements.

Looking for a standalone tool to manage skills? Use vercel-labs/skills instead. instill is a Go library for CLI tools that want to bundle and install their own agent skills as part of their distribution.

Install skills

import (
    "embed"
    "fmt"
    "log"

    "github.com/tiulpin/instill"
)

//go:embed skills
var skills embed.FS

func main() {
    // Detect which agents are present
    agents, _ := instill.Detect(".", false)
    names := make([]string, len(agents))
    for i, a := range agents {
        names[i] = a.Name
    }

    // Install skill files to each agent's expected location
    results, err := instill.Install(skills, instill.Options{
        Agents:     names,
        ProjectDir: ".",
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, r := range results {
        fmt.Printf("%s: %s (existed=%v)\n", r.Agent, r.Path, r.Existed)
    }
}

Detect the running agent

if agent := instill.DetectRuntime(); agent != nil {
    fmt.Printf("running inside %s (detected via %s)\n", agent.DisplayName, agent.EnvVar)
    // → "running inside Claude Code (detected via CLAUDECODE)"
}

Detection priority:

  1. AI_AGENT — the emerging universal standard that everyone will adopt any day now
  2. AGENT — used by Amp, Goose
  3. CLAUDE_CODE_IS_COWORK — Claude Code cowork sessions
  4. Agent-specific env vars (CLAUDECODE, CURSOR_TRACE_ID, CODEX_SANDBOX, etc.)
  5. Filesystem markers (/opt/.devin)

Returns nil when no agent is detected (a.k.a. a human is typing).

API

Skill management
Function Description
Detect(projectDir, global) Find which agents have config dirs present
Install(fsys, opts) Copy skill files to each agent's skills directory
Remove(name, opts) Delete an installed skill by name
InstalledVersion(name, opts) Read version from an installed skill's frontmatter; returns (string, error)
SkillVersion(fsys) Read version from a skill FS (e.g. embedded)
AgentNames() List all supported agent names
Runtime detection
Function Description
DetectRuntime() Returns *RuntimeAgent for the agent running this process, or nil

RuntimeAgent has three fields: Name (e.g. "claude-code"), DisplayName (e.g. "Claude Code"), and EnvVar (the variable that matched, e.g. "CLAUDECODE").

Upstream sync

Agent directories are sourced from vercel-labs/skills. Runtime env vars are cross-referenced with vercel/vercel detect-agent. A weekly agentic workflow keeps both in sync.

40 agents supported. Run instill.AgentNames() for the full list, or see agents.go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentNames

func AgentNames() []string

AgentNames returns all known agent names in sorted order.

func InstalledVersion

func InstalledVersion(skillName string, opts Options) (string, error)

InstalledVersion returns the version from an installed skill's SKILL.md frontmatter. Returns "" if the skill is not installed or has no version field.

func SkillVersion

func SkillVersion(fsys fs.FS) string

SkillVersion returns the version from the first SKILL.md found in fsys. Returns "" if no version field is present.

Types

type Agent

type Agent struct {
	Name        string
	DisplayName string
	ProjectDir  string // project-level skills dir (relative)
	GlobalDir   string // global skills dir (absolute)
}

Agent represents a detected AI coding agent

func Detect

func Detect(projectDir string, global bool) ([]Agent, error)

Detect returns agents whose config directories exist in projectDir (or globally)

type Options

type Options struct {
	Agents     []string // required: agent names to target
	Skills     []string // if set, only install/update these skill names (by frontmatter name)
	ProjectDir string   // project root (for project-level operations)
	Global     bool     // operate on global dirs instead of project-level
}

Options configure Install and Remove

type Result

type Result struct {
	Agent        string
	Skill        string
	Path         string
	Existed      bool     // true if the skill was already present before this operation
	PriorVersion string   // version from previously installed SKILL.md ("" if new)
	Commands     []string // command files installed (e.g., from _commands/)
	Subagents    []string // subagent files installed (e.g., from _agents/)
}

Result reports what happened for each agent

func Install

func Install(fsys fs.FS, opts Options) ([]Result, error)

Install writes skill files from fsys to each target agent's skills directory. Files under _commands/ and _agents/ in the skill are installed as commands and subagents for agents that support them (e.g., Claude Code).

func Remove

func Remove(skillName string, opts Options) ([]Result, error)

Remove deletes installed skill files by name, including any commands and subagents that were installed alongside the skill.

type RuntimeAgent

type RuntimeAgent struct {
	Name        string
	DisplayName string
	EnvVar      string // env var that matched, or "fs:/opt/.devin" for filesystem detection
}

func DetectRuntime

func DetectRuntime() *RuntimeAgent

DetectRuntime returns the AI agent currently executing this process, or nil.

type SkillMeta

type SkillMeta struct {
	Name        string
	Version     string
	Description string
}

SkillMeta holds metadata parsed from a SKILL.md frontmatter.

func ListSkills

func ListSkills(fsys fs.FS) []SkillMeta

ListSkills returns metadata for every skill found in fsys.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL