1. Skill folder structure
~/.local/share/agent-code/skills/
└── hello_world/
├── skill.py
└── skill.mdFor 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:
SKILL: metadata dictionary (at least a name and description are recommended).TOOL_SCHEMAS: list of OpenAI-compatible function tool schemas.TOOL_CALLABLES: mapping from each schema function name to a Python callable.COMMANDS: optional slash/natural-command mapping.HELP: optional help text fallback.
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
- Every
function.namemust exactly match a key inTOOL_CALLABLES. - Use short local names. Agent Code automatically prefixes each tool with its source namespace (for example
filesystem_write_file); identical local names in different Skills are safe. - Use JSON Schema types supported by your provider (string, number, integer, boolean, object, array).
- Validate arguments inside the Python function too; model-provided JSON is untrusted input.
- Return concise, useful text or JSON-serializable values.
- Catch expected errors and return a helpful error message rather than crashing the loader.
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
- Create the skill folder in the user Skills directory.
- Run
python -m py_compile skill.pyfrom that folder. - Run
agent-code skills listto see bundled skills (this command does not list every installed custom skill). - Launch Agent Code and use the Skills interface to enable/reload it.
- Use
/skillsin chat to inspect loaded skills and commands. - 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"
}
}host: runs in the Agent Code process; use for desktop APIs and local GUI automation.sandbox: runs inside the managed Alpine Podman container. The Skills directory is mounted read-only. The container must be recreated once to gain this mount.ssh: transfers a bounded temporary Skill snapshot over the established SSH connection, executes it remotely, then removes the temporary files.auto: uses the configured default target and still obeys the Skill'sallowedlist.
- Never use
evalorexecon model-supplied strings. - Validate file paths and restrict operations to the intended workspace.
- Keep secrets in the OS credential store or user configuration, not in the skill source.
- Use network timeouts and bounded retries.
- Explain what data is sent to external services.
- Review dependencies and pin versions where practical.
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.