Basic Skills
Load skills from a local directory with LocalSkills and use them in a code review agent.
Basic Skills Example.
"""
Basic Skills
=============================
Basic Skills Example.
"""
from pathlib import Path
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.skills import LocalSkills, Skills
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Get the skills directory relative to this file
skills_dir = Path(__file__).parent / "sample_skills"
# Create an agent with skills loaded from the directory
agent = Agent(
name="Code Review Agent",
model=OpenAIResponses(id="gpt-5.2"),
skills=Skills(loaders=[LocalSkills(str(skills_dir))]),
instructions=[
"You are a helpful assistant with access to specialized skills.",
],
markdown=True,
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
# Ask the agent to review some code
agent.print_response(
"Review this Python code and provide feedback:\n\n"
"```python\n"
"def calculate_total(items):\n"
" total = 0\n"
" for i in range(len(items)):\n"
" total = total + items[i]['price'] * items[i]['quantity']\n"
" return total\n"
"```"
)Reading and executing skill scripts
LocalSkills loads each folder's SKILL.md, reference files, and scripts. The agent can read script source with get_skill_script (the default execute=False); execute=True runs the script locally. The archived Python helpers put comments before their shebang, which prevents direct execution on Unix. The preparation step below moves each shebang to the first line in your cloned sample files. Calling the helpers with python script.py also works without that edit.
The code-review helper accepts Python source text as its first argument or on stdin, not a filename. The Git helper generates or validates commit-message text; it does not create commits.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openaiExport your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"Clone Agno
Clone the pinned Agno source and run the remaining commands from its root:
git clone https://github.com/agno-agi/agno.git
cd agno
git checkout v3.0.4Prepare direct script execution
Save this as prepare_skill_scripts.py at the cloned Agno repository root:
from pathlib import Path
base = Path("cookbook/02_agents/16_skills/sample_skills")
for relative in (
"code-review/scripts/check_style.py",
"git-workflow/scripts/commit_message.py",
):
path = base / relative
lines = path.read_text().splitlines(keepends=True)
shebang = next(i for i, line in enumerate(lines) if line.startswith("#!"))
lines.insert(0, lines.pop(shebang))
path.write_text("".join(lines))Run it before allowing execute=True:
python prepare_skill_scripts.pyRun the example
Run the example from the repository root:
python cookbook/02_agents/16_skills/basic_skills.pyFull source: cookbook/02_agents/16_skills/basic_skills.py