@easynet/agent-skill
v1.0.37
Published
Agent Skills discovery, parsing, and prompt injection for Easynet agents
Downloads
2,335
Readme
@easynet/agent-skill
Introduction
@easynet/agent-skill discovers and loads skills, builds a SkillSet, and registers it into the default AgentContext so runtime packages can inject or route skills.
API Reference
| API | What it does | Minimal usage |
| --- | --- | --- |
| createAgentSkills | Load skills from config or a directory and register the resulting SkillSet. | await createAgentSkills("./skill.yaml") |
Usage
Load skills from the default embedded config:
import { createAgentSkills } from "@easynet/agent-skill";
const skillSet = await createAgentSkills();
console.log(skillSet.list());Load skills from a custom config file:
import { createAgentSkills } from "@easynet/agent-skill";
await createAgentSkills("./skill.yaml");YAML config
Example skill.yaml:
apiVersion: easynet.world/v1
kind: SkillConfig
metadata:
name: agent-skill-default
spec:
path: ./skills
mode: prompt
inject_metadata: true
embedding_threshold: 0.85Explanation:
spec.path: directory that contains skill folders withSKILL.md.spec.mode: how matched skills are applied, such aspromptorsubagent.spec.inject_metadata: whether skill metadata is injected into the prompt.spec.embedding_threshold: minimum semantic match score.
SKILL Structure
agent-skill now treats a skill as three progressive layers:
- Level 1: metadata in
SKILL.mdfrontmatter (name,description). - Level 2: the
SKILL.mdMarkdown body, used as detailed instructions. - Level 3: bundled resources loaded on demand, such as
scripts/,references/, andassets/.
Example layout:
skills/
code-review/
SKILL.md
references/
CHECKLIST.md
scripts/
collect-context.sh
assets/
review-template.mdLevel 3 is convention-based, not folder-name-locked:
scripts/: executable helper code or command wrappers.references/: longer background docs, checklists, forms, protocol notes.assets/: templates, sample data, images, or other payload files.
Any file under the skill directory except SKILL.md is treated as a resource. Resource type is inferred by extension:
- Markdown/text/YAML/JSON ->
instructions - Shell/JS/TS/Python/etc. ->
code - everything else ->
data
Level 3 Resource API
SkillSet exposes lazy resource access:
const skillSet = await createAgentSkills({ path: "./skills" });
const resources = await skillSet.listResources?.("code-review");
const docs = await skillSet.getResourcesByType?.("code-review", "instructions");
const script = await skillSet.readResource?.("code-review", "scripts/collect-context.sh");Notes:
listResources(name)returns resource metadata only.getResourcesByType(name, type)filters by inferred type.readResource(name, relativePath)reads the file as aBuffer.- relative paths are constrained to stay inside the skill directory.
