Local-first skill infrastructure for multi-agent projects
Turn scattered SKILL.md directories into a reusable · composable · syncable · callable shared capability library
| 🤖 Agent Apps | 🧩 Agent Frameworks |
| Claude Code · Cursor · Windsurf · Aider · Codex Any agent app that can read `AGENTS.md` |
AutoGen · CrewAI · LangChain · LangGraph · Haystack Semantic Kernel · smolagents · LlamaIndex Any agent framework with tool / function integration support |
Initiated and maintained by Narwhal-Lab, Peking University
English | 简体中文
Overview · Quick Start · How It Works · CLI · Python API · Tips
MagicSkills is a local-first skill infrastructure layer for multi-agent projects.
It turns scattered SKILL.md directories into something you can:
- install into one shared skill pool
- compose into per-agent
Skillscollections - sync into
AGENTS.md - expose as a tool through one stable API
The core model is simple:
Skill: one concrete skill directoryALL_SKILLS(): access the current built-inAllskillsviewSkills: the subset an agent or workflow actually usesREGISTRY: the global named-collection registry persisted across runs
MagicSkills is most useful when:
- you maintain multiple agents that should reuse one skill library
- you already have
SKILL.mdcontent but no install, selection, or sync workflow - some agents read
AGENTS.md, while others need direct tool integration
A common real-world scenario is: you have one reusable shared skill, and many different agent apps and agent frameworks all need to use it.
For example, the same c_2_ast skill may need to be shared across Claude Code, Cursor, Windsurf, Aider, Codex, AutoGen, CrewAI, LangChain, LangGraph, Haystack, Semantic Kernel, smolagents, and LlamaIndex.
In that case, the recommended approach is not to copy that skill into every agent project separately. Instead, keep it in one shared skill pool, build one or more named Skills collections from that same underlying skill, and expose those collections differently depending on whether the target runtime reads AGENTS.md or integrates through tools / functions.
Without a skill layer, multi-agent projects usually drift into one of these states:
- the same skill is copied into multiple agent folders and quickly diverges
SKILL.mdexists, but it is still just a document, not an operational unit- every agent loads too many irrelevant skills
AGENTS.md, prompt glue, and framework tools evolve independently- changing frameworks means redoing the whole integration
MagicSkills solves that by separating:
- the total installed skill pool
- the subset each agent should actually see
- the persistence layer that stores named collections
The shortest recommended workflow is:
- Install MagicSkills.
- Install one or more skills into the local pool.
- Create a named
Skillscollection for one agent. - Sync that collection to
AGENTS.mdif the runtime readsAGENTS.md. - Or expose that collection through the CLI tool interface.
- Or expose that collection from Python.
From source:
git clone https://github.com/Narwhal-Lab/MagicSkills.git
cd MagicSkills
python -m pip install -e .
magicskills -hOr from PyPI:
pip install MagicSkills
magicskills -h# remote repository example
magicskills install anthropics/skills -t ~/allskills
# local directory example (if you cloned this repo)
magicskills install skill_template -t ~/allskillsThe first command shows installing from a GitHub repository. The second command uses this repo's local skill_template/ directory to simulate the common case where you have already downloaded skills locally and now want to install them into the shared pool.
MagicSkills supports four standard install locations by default:
- current project:
./.claude/skills/ --global:~/.claude/skills/--universal:./.agent/skills/--global --universal:~/.agent/skills/
You can also use -t / --target to install into any explicit path.
In practice, we recommend using one shared skills root such as ~/allskills, so all agents and frameworks can reuse the same local skill pool and discover them from the built-in Allskills view.
Here pdf and docx are example skill names. Replace them with the skills currently available in your own Allskills view. If you only installed this repo's local skill_template/, use c_2_ast here instead.
magicskills addskills agent1_skills --skill-list pdf docx --agent-md-path /agent_workdir/AGENTS.mdThis means:
- find the
pdfanddocxskills fromAllskills - create a named collection called
agent1_skills - remember
/agent_workdir/AGENTS.mdas its default sync target
magicskills syncskills agent1_skillssyncskills supports two AGENTS.md sync modes:
none: keep the standard<usage> + <available_skills>structure; use this for agents that can directly discover and use skills from the skill information list inAGENTS.mdcli_description: write only<usage>using the collection'scli_description; use this for agents that cannot directly use skills from the skill information list inAGENTS.mdand instead need CLI guidance throughmagicskills skill-tool
Examples:
magicskills syncskills agent1_skills --mode none
magicskills syncskills agent1_skills --mode cli_descriptionIf the target file already contains a skills section, it is replaced. If not, a new one is appended.
For agents that do not read AGENTS.md, use the unified CLI tool entrypoint:
magicskills skill-tool listskill --name agent1_skills
magicskills skill-tool readskill --name agent1_skills --arg pdf
magicskills skill-tool execskill --name agent1_skills --arg "echo hello"If you are integrating MagicSkills into an agent framework, there are two common Python-side patterns.
Option A: reuse a collection already created by the CLI
If you already created the collection with:
magicskills addskills agent1_skills --skill-list pdf docx --agent-md-path /agent_workdir/AGENTS.mdthen Python can reuse that same named collection directly through REGISTRY.get_skills("agent1_skills"):
import json
from langchain_core.tools import tool
from magicskills import REGISTRY
agent1_skills = REGISTRY.get_skills("agent1_skills")
@tool("_skill_tool", description=agent1_skills.tool_description)
def _skill_tool(action: str, arg: str = "") -> str:
return json.dumps(agent1_skills.skill_tool(action, arg), ensure_ascii=False)Option B: build a temporary collection directly in Python
If you do not want to depend on a pre-created registry entry, you can also construct a Skills(...) object manually:
import json
from langchain_core.tools import tool
from magicskills import ALL_SKILLS, Skills
skill_a = ALL_SKILLS().get_skill("pdf")
skill_b = ALL_SKILLS().get_skill("docx")
agent1_skills = Skills(
name="agent1_skills",
skill_list=[skill_a, skill_b],
)
@tool("_skill_tool", description=agent1_skills.tool_description)
def _skill_tool(action: str, arg: str = "") -> str:
return json.dumps(agent1_skills.skill_tool(action, arg), ensure_ascii=False)This second form stays in memory only. A plain Skills(...) object is not persisted into the registry automatically, so it does not conflict with CLI-created collections unless you explicitly register and save it through REGISTRY.
Use syncskills if your runtime consumes AGENTS.md. Use the CLI tool interface or the Python API directly if it does not.
MagicSkills provides integration examples for both agent / IDE products that can directly read AGENTS.md and mainstream agent frameworks that integrate through tools or functions.
A common real-world scenario is: you have one reusable skill, and many different agent products or agent frameworks all need to use it.
For example, the same c_2_ast skill may need to be shared across Claude Code, Cursor, Windsurf, Aider, Codex, AutoGen, CrewAI, LangChain, LangGraph, Haystack, Semantic Kernel, smolagents, and LlamaIndex.
In that case, the recommended approach is not to copy the skill into every agent project separately. Instead:
- Maintain or install the skill once in a shared skill pool.
- Build one or more named
Skillscollections from that same underlying skill. - Expose those collections differently depending on how the target agent integrates.
This repository's examples show the two main integration paths:
- for agent apps that can read
AGENTS.md, useaddskills + syncskillsto sync the chosen skill subset into each target agent'sAGENTS.md - for agent frameworks that integrate through tools or functions, expose the same collection through
magicskills skill-toolorskills.skill_tool()
So although the examples target different products and frameworks, they are all implementations of the same core scenario: one shared skill, reused across many different runtimes.
- How It Works: architecture and object model
- CLI: command-by-command reference
- Python API: object and function reference
- Tips: integration guidance
The core of MagicSkills is not "a pile of commands", but a stable three-layer model for skill management:
Skill: describes one skill directory and its metadataSkills: describes an operable collection of skills- the global registry layer centered on
REGISTRY: describes how multiple namedSkillscollections are registered, loaded, and persisted
CLI and Python API are just different entry points to these three layers. Whether you call readskill, install, syncskills, or skill_tool, everything eventually goes through the same core objects and command implementations.
From the recommended runtime workflow, MagicSkills is closest to the following chain:
- Use
installto install relevant skills into a local skills directory - During installation, MagicSkills scans those skill directories, parses
SKILL.mdfrontmatter, and constructsSkillobjects - All installed and discovered skills are first aggregated into the built-in
Allskillsview - Then you select a subset from that view through
ALL_SKILLS()orREGISTRY.get_skills("Allskills")and compose a specificSkillscollection for an agent - Finally, that named
Skillscollection is registered intoREGISTRY, optionally persisted, and synced toAGENTS.md
In MagicSkills, the minimum requirement for a valid skill is simple: it must be a directory, and that directory must contain SKILL.md.
A typical structure looks like this:
demo-skill/
├── SKILL.md
├── references/
├── scripts/
└── assets/
Where:
SKILL.mdis the entry document of the skill and also the metadata sourcereferences/,scripts/, andassets/are common convention folders, but they are not mandatory
In code, one skill is represented as a Skill object. Its core fields include:
name: the skill name, usually the directory namedescription: extracted from theSKILL.mdfrontmatterpath: the skill directory pathbase_dir: the skills root directory that contains this skillsource: where the skill comes from, such as a local path or Git repositoryis_global/universal: marks which installation scope it comes from
This layer solves the question "what is a single skill". It does not manage groups of skills and does not handle registry persistence.
Common capabilities around a single skill include:
readskill: read a skill'sSKILL.mdshowskill: inspect the full contents of a skill directorycreateskill_template: create a standard skill skeletonaddskill: register an existing skill into a collection
The Skills layer solves the problem of organizing multiple skills into one operable working set.
A Skills object can be built in two ways:
- pass
skill_listdirectly - pass
paths, and let the system automatically scan those paths for skill directories
Once constructed, the collection exposes a unified set of higher-level capabilities:
listskill(): list all skills in the collectionreadskill(target): read skill file contentsshowskill(target): display the full skill contentsexecskill(command, ...): run a command and return a structured resultuploadskill(target): upload a skill through the default repository workflowdeleteskill(target): remove a skill from the collection; when applied toAllskills, it also removes the on-disk directorychange_tool_description(description): update the collection's tool-oriented descriptionchange_cli_description(description): update the collection's CLI-oriented descriptionsyncskills(output_path=None, mode="none"): write the collection intoAGENTS.mdskill_tool(action, arg=""): dispatch list/read/exec in a tool-function style
There are two key design points in this layer:
Skillssupports both name-based and path-based skill lookup; when names collide, the path is the final disambiguatorSkillsis a runtime view, not the installation directory itself; the same skill can be referenced by multiple named collections
One important detail: execskill() runs commands in the current process working directory, not automatically inside the skill directory. That means MagicSkills unifies the execution entry point, but does not silently change your runtime context.
The global registry layer centered on REGISTRY solves the problem of saving and restoring multiple named skills collections.
Its responsibilities include:
- maintaining the global registry singleton
REGISTRY - ensuring the built-in collection
Allskillsalways exists - creating, querying, and deleting named skills collections
- writing collection metadata into a JSON file and reloading it later
By default, the registry is stored at:
~/.magicskills/collections.json
What is stored there is not the full file contents of each skill, but only the minimum information needed to restore collections:
pathstool_descriptioncli_descriptionagent_md_path
In other words, the Registry stores "collection configuration" and "skill path references", not full copies of skill contents. The actual skill content remains in the filesystem.
The typical workflow for this layer is:
- Create a named collection with
addskills - Persist it with
saveskillsorREGISTRY.saveskills() - Restore those collections with
loadskills, or through default loading on process startup - Sync a specific collection to the target
AGENTS.mdwithsyncskills
So in essence, the Registry layer is the project-level configuration center of MagicSkills. Skill defines a single item, Skills organizes a working set, and REGISTRY makes those collections survive across different runtime cycles.
The full CLI reference has moved to doc/cli.md. Chinese version: doc/cli.zh-CN.md.
| Command | Use case | Main capability |
|---|---|---|
listskill |
See which skills exist in the current built-in set | List skill names, descriptions, and SKILL.md paths |
readskill |
Read a skill description or any local text file | Output content by skill name or file path |
execskill |
Run commands in the current working directory | Supports streaming, JSON output, no-shell mode, custom paths |
syncskills |
Sync a named skills collection into AGENTS.md |
Generate or replace the <skills_system> block |
install |
Install skills from local paths, Git repos, or default | Copy skill files and register them into Allskills |
addskill |
Register one existing skill into one collection | Register metadata without copying files |
uploadskill |
Submit a local skill to the default MagicSkills repo | Automate fork, push, and PR flow |
deleteskill |
Delete one skill from one collection or globally | Remove from one named collection, or delete the skill directory from Allskills |
showskill |
Review the full contents of a skill package | Show metadata and all files inside the skill directory |
addskills |
Create a named skills collection | Build an isolated skill set for an agent or team |
listskills |
List all named skills collections | Human-readable output or JSON output |
deleteskills |
Delete one or more named skills collections | Delete only collection registrations, not the skill files |
changetooldescription |
Modify the collection's tool_description metadata |
Update tool-oriented description for later querying and integration |
changeclidescription |
Modify the collection's cli_description metadata |
Update CLI-oriented description for later querying and integration |
skill-tool |
Invoke skill capabilities in a tool-function style | Use unified JSON output to dispatch list/read/exec |
The full Python API reference has moved to doc/python-api.md. Chinese version: doc/python-api.zh-CN.md.
If you want to call MagicSkills directly from scripts, tests, agent runtimes, or higher-level frameworks instead of going through the CLI, use the Python API. The content below follows the current __all__ in /root/LLK/MagicSkills/src/magicskills/__init__.py.
from pathlib import Path
from magicskills import (
ALL_SKILLS,
REGISTRY,
Skills,
listskill,
readskill,
execskill,
)Exports
- types:
Skill,Skills - accessors and constants:
REGISTRY,ALL_SKILLS(),DEFAULT_SKILLS_ROOT - single-skill and execution functions:
listskill,readskill,showskill,execskill,addskill,createskill_template,install,uploadskill,deleteskill - skills collection and registry functions:
addskills,listskills,deleteskills,syncskills,loadskills,saveskills - description and dispatch functions:
change_tool_description,changetooldescription,change_cli_description,changeclidescription,skill_tool
Usage advice
- If you already have a
Skillsobject, prefer instance methods such asskills.readskill(),skills.execskill(), andskills.syncskills(). - If you want to directly reuse CLI-equivalent capabilities, top-level functions are more direct.
changetooldescriptionis a compatibility alias ofchange_tool_description; they are equivalent.changeclidescriptionis a compatibility alias ofchange_cli_description; they are equivalent.
It is recommended to first install or maintain all skills under one shared skills root, then select only the subset a given agent actually needs, build a named skills collection from it, and finally sync that collection into the target AGENTS.md.
This has several benefits:
- the physical storage location of skills stays unified, making maintenance, upgrades, and debugging easier
- different agents can reuse the same underlying skills while exposing only the subset each one actually needs
AGENTS.mdkeeps only the skills that the current agent truly needs to see, reducing context noise
The recommended flow is:
- Install skills into a shared directory, such as
~/allskills/,./.claude/skills, or~/.claude/skills - Use
addskillsto create a named collection that contains only a subset of skills - Use
syncskillsto write that collection into the targetAGENTS.md - Choose the sync mode based on the target runtime:
nonefor agents that can directly use the skill information list inAGENTS.md,cli_descriptionfor agents that need CLI guidance throughmagicskills skill-toolinstead - Let the agent read only that target
AGENTS.md
Example:
magicskills install anthropics/skills -t ~/allskills/
magicskills addskills agent1_skills --skill-list pdf docx --agent-md-path /agent_workdir/AGENTS.md
magicskills syncskills agent1_skillsIf you want finer-grained exposure control, install all skills into one shared directory first, then generate different AGENTS.md files for different agents through multiple named collections.
Some agents or frameworks do not read AGENTS.md proactively. In that case, you can expose MagicSkills' unified dispatch interface directly to them instead of relying on document syncing.
CLI entrypoint:
magicskills skill-tool <action> --arg "<arg>" --name <skills-name>For example:
magicskills skill-tool listskill --name agent1_skills
magicskills skill-tool readskill --name agent1_skills --arg "<path>"
magicskills skill-tool execskill --name agent1_skills --arg "<command>"Python API entrypoint:
agent1_skills.skill_tool(action: str, arg: str = "")Example A, reuse a CLI-created named collection:
import json
from langchain_core.tools import tool
from magicskills import REGISTRY
agent1_skills = REGISTRY.get_skills("agent1_skills")
print(agent1_skills.skill_tool("listskill"))
print(agent1_skills.skill_tool("readskill", "<path>"))
print(agent1_skills.skill_tool("execskill", "<command>"))
@tool("_skill_tool", description=agent1_skills.tool_description)
def _skill_tool(action: str, arg: str = "") -> str:
return json.dumps(agent1_skills.skill_tool(action, arg), ensure_ascii=False)Example B, build a temporary in-memory collection directly:
import json
from langchain_core.tools import tool
from magicskills import ALL_SKILLS, Skills
skill_a = ALL_SKILLS().get_skill("pdf")
skill_b = ALL_SKILLS().get_skill("docx")
agent1_skills = Skills(
skill_list=[skill_a, skill_b],
name="agent1_skills",
)
print(agent1_skills.skill_tool("listskill"))
print(agent1_skills.skill_tool("readskill", "<path>"))
print(agent1_skills.skill_tool("execskill", "<command>"))
@tool("_skill_tool", description=agent1_skills.tool_description)
def _skill_tool(action: str, arg: str = "") -> str:
return json.dumps(agent1_skills.skill_tool(action, arg), ensure_ascii=False)If agent1_skills was already created through the CLI, Example A is the most direct Python-side entrypoint. Example B is useful when you only want a temporary collection in the current process. It does not enter the persistent registry unless you explicitly register and save it through REGISTRY.
This approach fits two kinds of scenarios:
- the agent supports tool-call / function-call mechanisms, but cannot read
AGENTS.md - you want the upper-level program itself to control when to list skills, when to read skills, and when to execute commands
The simplified rule of thumb is:
- for agents that read
AGENTS.md, preferaddskills + syncskills - for agents that do not read
AGENTS.md, preferskill-toolorskills.skill_tool()
MagicSkills is not only a local skill management tool. It also aims to support a growing skill ecosystem where reusable capabilities can be accumulated, shared, and installed across projects.
If you have implemented a reusable local skill, you can use uploadskill to upload it into this project's skills/ directory through the default fork / push / PR workflow.
If you want to reuse skills contributed by others, you can use install to download them locally and integrate them into your own agents or workflows.
The recommended flow is:
- Build a reusable local skill and make sure the directory contains
SKILL.md - Use
uploadskillto submit that skill into the open-source MagicSkills skill library - Other users install those skills with
installand compose them into their ownSkillscollections orAGENTS.md
Example:
magicskills uploadskill ./skills/my-skill
magicskills install my-skillIssues and pull requests are welcome.
For feature ideas, workflow proposals, or larger behavior changes, please start with a GitHub Discussion or an issue first so the motivation and implementation direction can be discussed before code is submitted.
See CONTRIBUTING.md for the contribution workflow, branch naming suggestions, commit message guidance, and pull request expectations. You can use GitHub Discussions for early-stage ideas, and the repository also provides issue and PR templates under .github/.
At minimum, a skill must satisfy two conditions:
- it is a directory
- the directory contains
SKILL.md
Folders such as references/, scripts/, and assets/ are common conventions, but they are optional.
Choose based on how your agent integrates:
- if your agent reads
AGENTS.md, preferaddskills + syncskills - if your agent does not read
AGENTS.mdand instead integrates through tool-call / function-call, preferskill-toolorskills.skill_tool()
The former is better for document-driven integration; the latter is better for direct programmatic integration.
By default, skills are installed into ./.claude/skills/ under the current project.
If you use:
--global, the default becomes~/.claude/skills--universal, the default becomes./.agent/skillsin the current project--global --universal, the default becomes~/.agent/skills--target, the explicitly specified directory is used instead
Many commands accept either a skill name or a skill path.
If multiple skills share the same name, stop passing the name and use an explicit path instead, for example:
magicskills readskill ./skills/demo/SKILL.md
magicskills deleteskill ./skills/demoIn short: names are for convenience, paths are for disambiguation.
No. execskill() runs in the current process working directory. It does not automatically switch into a skill directory.
This means:
- MagicSkills gives you a unified execution entrypoint
- but it does not silently change your runtime context
If your command depends on a specific directory, cd into it yourself in the command, or invoke MagicSkills from the correct working directory.
If you want to contribute a local skill into the open-source ecosystem, use uploadskill to submit it into this project's skills/ directory. Other users can then download and reuse it with install.
A typical flow looks like this:
magicskills uploadskill ./skills/my-skill
magicskills install my-skillThe first command shares the skill; the second reuses it.
- Python 3.10 / 3.11 / 3.12 / 3.13
- Git (used to install skills from remote repositories)
Open-sourced and maintained by Narwhal-Lab, Peking University