Learn a Skill from Sources

Point your agent at a repo, docs, PDFs, configs, or this chat — and it authors one grounded, reusable SKILL.md in a single command.

Learn-skill turns real source material — code, docs, PDFs, configs, or this chat — into one grounded, reusable SKILL.md in a single command.

python
from praisonaiagents import Agent

agent = Agent(name="SkillAuthor", instructions="Distil sources into reusable skills")
agent.learn_skill("Read ./my-repo and author a deploy-flow skill")

The user points at repos or docs; the agent authors one grounded SKILL.md they can reuse later.

Diagram

Learn a Skill from Sources

📂 Sources
repo / docs / PDFs / chat

🤖 Agent

🔍 Gather

🧠 Distil

✅ SKILL.md

Quick Start

  1. Learn from a repo
    python
    from praisonaiagents import Agent
    
    agent = Agent()
    agent.learn_skill(
        "Read ./my-repo and make a 'deploy-flow' skill"
    )
  2. Learn from multiple sources
    python
    from praisonaiagents import Agent
    
    agent = Agent()
    agent.learn_skill(
        "Read ./my-repo and the docs in ./docs/*.pdf and make a 'deploy-flow' skill"
    )
  3. Learn from the current chat
    python
    from praisonaiagents import Agent
    
    agent = Agent()
    agent.start("Walk me through deploying this service: …")
    agent.learn_skill("Save what we just figured out as a 'deploy-flow' skill")

How It Works

Diagram
skill_manageFile / PDF / FetchAgentUserskill_manageFile / PDF / FetchAgentUseragent.learn_skill(“read ./repo, make ‘deploy-flow’ skill”)gather only the named sourcessource content (verbatim)distil SKILL.md (verbatim flags/paths only, ~100-200 lines)skill_manage(action=”create”, name=”deploy-flow”, content=…)status: pending (approval gate) or live“✅ Authored ‘deploy-flow’ skill — <summary>”

The agent follows three rules when authoring a skill:

RuleWhat it means
Verbatim onlyOnly flags, paths, commands, env vars, and API names that appear verbatim in the gathered sources end up in the skill. Never invented.
Tight bodySKILL.md is kept to ~100–200 lines. Long material moves to supporting files referenced by relative path.
Named sources onlyThe agent reads only the sources you name. It does not browse unrelated material.
YAML frontmatterEvery generated skill has at least name + description.

Three Surfaces

Python SDK

python
from praisonaiagents import Agent

agent = Agent()
agent.learn_skill("Read ./my-repo and make a 'deploy-flow' skill")

CLI

bash
praisonai skills learn "the API in ./openapi.yaml as a 'stripe-billing' skill"

Bot Chat

/learn deploy steps from this repo and the runbook PDF

Async

python
from praisonaiagents import Agent

agent = Agent()
result = await agent.alearn_skill(
    "Read ./my-repo and make a 'deploy-flow' skill"
)

Approval Gate


Common Patterns

From a single repo

python
from praisonaiagents import Agent

agent = Agent()
agent.learn_skill("Read ./my-repo and make a 'deploy-flow' skill")

Multi-source (repo + PDFs + URL)

The agent picks the right tool per source — file read, PDF read, or fetch — automatically.

python
from praisonaiagents import Agent

agent = Agent()
agent.learn_skill(
    "Read ./my-repo, the runbook at ./docs/runbook.pdf, "
    "and https://docs.example.com/api — make a 'deploy-flow' skill"
)

From the current chat

Phrases like "what we just figured out" or "this conversation" route the agent to use the chat as the source.

python
from praisonaiagents import Agent

agent = Agent()
agent.start("Walk me through deploying this service to AWS…")
agent.learn_skill("Save what we just figured out as a 'deploy-flow' skill")

CLI with model override

bash
praisonai skills learn "the API in ./openapi.yaml as a 'stripe-billing' skill" --llm gpt-4o

Best Practices

Name sources explicitly

Saying “read ./my-repo and ./docs/*.pdf” beats “learn about deploys” because the agent only reads what you name. Explicit paths give better, more grounded skills.

Pick a kebab-case skill name in the request

Include a quoted name like "… make a 'deploy-flow' skill". If you omit it, the agent derives one from the content — which may be less predictable.

Prefer learn_skill over learn in new code

learn / alearn are kept as backward-compat aliases. The canonical names are learn_skill / alearn_skill to avoid confusion with the memory learn= constructor param on Agent.

Don't pre-wire skill_manage yourself

learn_skill automatically adds skill_manage, read_skill_file, and list_skill_scripts to agent.tools if they are missing. The call is idempotent — running it multiple times does not double-register tools.


Backward-compat Aliases

learn and alearn are aliases for learn_skill and alearn_skill:

python
agent.learn("Read ./my-repo and make a 'deploy-flow' skill")
await agent.alearn("Read ./my-repo and make a 'deploy-flow' skill")

Prefer learn_skill / alearn_skill in new code.


Related