← Documentation home

Build a Skill

A Skill adds tools that the AI agent can discover and call. It does not modify the Agent Code UI or replace application services.

1. Skill folder structure

~/.local/share/agent-code/skills/
└── hello_world/
    ├── skill.py
    └── skill.md

For compatibility with the project-local migration, legacy skills may also be found in a project's skills/ folder. The current global user location is preferred.

2. Required Python exports

The loader imports skill.py and reads these exports:

3. Minimal working example

"""A tiny Agent Code skill."""

SKILL = {
    "name": "hello_world",
    "description": "Returns a friendly greeting.",
}

def greet(name: str = "there") -> str:
    return f"Hello, {name}!"

TOOL_SCHEMAS = [{
    "type": "function",
    "function": {
        "name": "greet",
        "description": "Greet a person by name.",
        "parameters": {
            "type": "object",
            "properties": {
                "name": {"type": "string", "description": "Name to greet"}
            },
            "required": [],
        },
    },
}]

TOOL_CALLABLES = {
    "greet": greet,
}

4. Schema and callable rules

5. Optional commands

def configure(args, log):
    # args is a list of words after the command.
    log("Configuration command received", "dim")

COMMANDS = {
    "configure": {
        "handler": configure,
        "description": "Configure this skill",
        "aliases": ["hello configure"],
    }
}

A slash command is invoked as /configure if its name is not already reserved by another command. Natural aliases are dispatched only when the phrase matches the registered alias; they are not sent to the shell. Use clear, non-conflicting command names. Add-on commands are separately namespaced (for example /addon-name:status).

6. Optional skill.md metadata and help

---
name: hello_world
description: A sample greeting skill
version: 1.0.0
author: Your Name
---

# Hello World

Use this skill to greet a person by name.

The text after the YAML-like frontmatter is shown as the skill's help page. The current loader parses simple key/value frontmatter; do not rely on advanced YAML features.

7. Test locally

  1. Create the skill folder in the user Skills directory.
  2. Run python -m py_compile skill.py from that folder.
  3. Run agent-code skills list to see bundled skills (this command does not list every installed custom skill).
  4. Launch Agent Code and use the Skills interface to enable/reload it.
  5. Use /skills in chat to inspect loaded skills and commands.
  6. Ask the agent to use the tool for a small harmless task.

8. Package and share a Skill

cd ~/.local/share/agent-code/skills
zip -r hello_world-1.0.0.zip hello_world \
  -x '*/__pycache__/*' '*.pyc'

Include only the skill folder, documentation and required assets. Document external dependencies and installation steps. Do not include API keys, tokens, personal data, virtual environments or caches.

9. Execution environments

Set the execution target in the SKILL metadata. The default is host. Per-tool overrides in execution.tools may select different remote targets (Sandbox/SSH), but mixing Host and remote tools in one Skill is rejected so remote-only code is never imported on Host. Remote Skills must define literal SKILL and TOOL_SCHEMAS data. Agent Code routes each call to the declared environment and never silently falls back to Host when a requested environment is unavailable.

SKILL = {
    "name": "desktop_tools",
    "description": "Desktop automation tools",
    "execution": {
        "target": "host",
        "allowed": ["host"],
        "tools": {
            "inspect_remote": {"target": "ssh"}
        },
        "ssh_workspace": "/srv/project"
    }
}
Important: Host is the default. Select the narrowest environment required. Sandbox/SSH failures are fail-closed; Agent Code does not rerun a Skill on the Host to hide an environment error.

10. Current contract boundaries

Native Skills support SKILL, TOOL_SCHEMAS, TOOL_CALLABLES, optional COMMANDS, and optional HELP. Tool names are registered through the global Unified Tool Namespace alongside Core, MCP and Add-on tools. Agent Code does not automatically install Skill dependencies; declare and document them.

Next: Build an Add-on →