feat(skill): add agent skills loader #453

Merged
aditya merged 6 commits from feature/m3-agent-skills-loader into master 2026-02-27 10:22:02 +00:00
Member

Description

Implements the Agent Skills Standard loader (AgentSkillSpec) that parses SKILL.md frontmatter and progressive disclosure sections into structured tool definitions. Agent Skills are mapped to Tool/Validation definitions with namespaced naming, resource binding slots, and read-only defaults.

Changes

Core Implementation

  • src/cleveragents/skills/agent_skill_loader.py — Full AgentSkillSpec loader (~780 lines)
    • AgentSkillSpec, AgentSkillStep, AgentSkillSupportDir Pydantic models
    • AgentSkillLoadError exception with actionable messages
    • load_agent_skill_spec() — full SKILL.md parser (frontmatter + steps + support dirs)
    • scan_support_directories() — scripts/references/assets scanning
    • map_agent_skill_to_tool() — maps to Tool domain model with resource slots + read-only defaults
    • map_agent_skill_to_tool_spec() — maps to ToolSpec for registry
    • validate_skill_spec() — post-load validation
  • src/cleveragents/skills/__init__.py — Updated imports and __all__ with 9 new exports

Tests

  • features/agent_skill_loader.feature — 35 Behave scenarios covering:
    • Valid/invalid SKILL.md parsing
    • Step ordering and heading level handling
    • Support directory scanning
    • Namespaced tool mapping
    • Missing frontmatter field errors
    • Path traversal prevention
  • features/steps/agent_skill_loader_steps.py — Step implementations
  • robot/agent_skill_loader.robot — 10 Robot integration test cases
  • robot/helper_agent_skill_loader.py — Robot helper

Benchmarks & Documentation

  • benchmarks/agent_skills_loader_bench.py — 6 ASV benchmark suites
  • docs/reference/agent_skills.md — Full reference documentation

Acceptance Criteria

  • AgentSkillSpec loader parses SKILL.md frontmatter + progressive disclosure sections
  • Map Agent Skills to Tool/Validation definitions with namespaced naming
  • Support scripts/, references/, and assets/ folders with path normalization
  • Explicit validation for missing frontmatter fields with actionable errors
  • Docs: docs/reference/agent_skills.md
  • Behave tests: valid/invalid SKILL.md parsing, namespaced naming, step ordering
  • Robot tests: Load sample Agent Skills folder and verify tool metadata
  • ASV benchmarks: benchmarks/agent_skills_loader_bench.py
  • nox -s lint passes
  • nox -s typecheck passes

Closes #160

## Description Implements the Agent Skills Standard loader (`AgentSkillSpec`) that parses `SKILL.md` frontmatter and progressive disclosure sections into structured tool definitions. Agent Skills are mapped to Tool/Validation definitions with namespaced naming, resource binding slots, and read-only defaults. ## Changes ### Core Implementation - `src/cleveragents/skills/agent_skill_loader.py` — Full `AgentSkillSpec` loader (~780 lines) - `AgentSkillSpec`, `AgentSkillStep`, `AgentSkillSupportDir` Pydantic models - `AgentSkillLoadError` exception with actionable messages - `load_agent_skill_spec()` — full SKILL.md parser (frontmatter + steps + support dirs) - `scan_support_directories()` — scripts/references/assets scanning - `map_agent_skill_to_tool()` — maps to Tool domain model with resource slots + read-only defaults - `map_agent_skill_to_tool_spec()` — maps to ToolSpec for registry - `validate_skill_spec()` — post-load validation - `src/cleveragents/skills/__init__.py` — Updated imports and `__all__` with 9 new exports ### Tests - `features/agent_skill_loader.feature` — 35 Behave scenarios covering: - Valid/invalid SKILL.md parsing - Step ordering and heading level handling - Support directory scanning - Namespaced tool mapping - Missing frontmatter field errors - Path traversal prevention - `features/steps/agent_skill_loader_steps.py` — Step implementations - `robot/agent_skill_loader.robot` — 10 Robot integration test cases - `robot/helper_agent_skill_loader.py` — Robot helper ### Benchmarks & Documentation - `benchmarks/agent_skills_loader_bench.py` — 6 ASV benchmark suites - `docs/reference/agent_skills.md` — Full reference documentation ## Acceptance Criteria - [x] AgentSkillSpec loader parses SKILL.md frontmatter + progressive disclosure sections - [x] Map Agent Skills to Tool/Validation definitions with namespaced naming - [x] Support scripts/, references/, and assets/ folders with path normalization - [x] Explicit validation for missing frontmatter fields with actionable errors - [x] Docs: docs/reference/agent_skills.md - [x] Behave tests: valid/invalid SKILL.md parsing, namespaced naming, step ordering - [x] Robot tests: Load sample Agent Skills folder and verify tool metadata - [x] ASV benchmarks: benchmarks/agent_skills_loader_bench.py - [x] nox -s lint passes - [x] nox -s typecheck passes Closes #160
aditya added 1 commit 2026-02-26 09:29:10 +00:00
Implemented AgentSkillSpec loader that parses SKILL.md frontmatter and
progressive disclosure sections (discover/activate/deactivate) into
structured SkillStep objects with stable 1-based ordering.

Mapped Agent Skills to AgentSkillToolDescriptor with namespaced naming
(namespace/short_name), source="agent_skill", read-only defaults, and
AgentSkillResourceSlot bindings for scripts/, references/, and assets/
directories. All resource slots are unconditionally read_only.

Added explicit validation for missing frontmatter fields (name,
description) and invalid namespace format with actionable error messages.

Added docs/reference/agent_skills.md covering folder layout, SKILL.md
parsing rules, progressive disclosure model, and tool mapping.

Added Behave scenarios covering valid/invalid SKILL.md parsing,
namespaced naming, step ordering, missing frontmatter errors, progressive
disclosure lifecycle, tool mapping, and resource binding slots.

Added Robot Framework integration tests using the deploy-to-staging
example skill folder (robot/agent_skills_loader.robot).

Added ASV benchmarks for parsing throughput, folder load, progressive
disclosure lifecycle, and resource listing
(benchmarks/agent_skills_loader_bench.py).

ISSUES CLOSED: #160
aditya requested review from CoreRasurae 2026-02-26 09:29:21 +00:00
Member

What It Does

Adds the Agent Skills Standard loader (AgentSkillSpec / AgentSkillLoader) that parses SKILL.md frontmatter into structured tool definitions with a three-tier progressive disclosure model (discover / activate / deactivate). Includes Pydantic v2 models, resource binding slots for scripts/, references/, assets/ directories, full Behave test suite (50 scenarios), Robot integration tests (8 cases), ASV benchmarks, and reference docs.

Blocking Issues

  1. PR title not matching the the standard naming convention
  2. PR has zero labels — Needs exactly one Type/Feature label.
  3. Any used in function signatures — agent_skills_loader.py has dict[str, Any] in multiple signatures and Pydantic fields. Must eliminate Any.
  4. CHANGELOG commit missing issue footer — The chore: update CHANGELOG... commit has no Refs: #160 footer.
    Non-Blocking Issues
  5. Three files exceed 500-line limit — agent_skills_loader.py (~792), step defs (786), feature file (695). Should be split as a follow-up.

What Looks Good

  • Clean architecture: spec (data) / loader (lifecycle) / descriptor (registry view)
  • Frozen Pydantic models, strong validation with actionable error messages
  • Thorough test coverage across all layers (Behave, Robot, ASV)
  • No mocks in production code, proper temp dir cleanup
  • Path safety enforced via Path.resolve() + rglob()
## What It Does Adds the Agent Skills Standard loader (AgentSkillSpec / AgentSkillLoader) that parses SKILL.md frontmatter into structured tool definitions with a three-tier progressive disclosure model (discover / activate / deactivate). Includes Pydantic v2 models, resource binding slots for scripts/, references/, assets/ directories, full Behave test suite (50 scenarios), Robot integration tests (8 cases), ASV benchmarks, and reference docs. ## Blocking Issues 0. PR title not matching the the standard naming convention 1. PR has zero labels — Needs exactly one Type/Feature label. 2. Any used in function signatures — agent_skills_loader.py has dict[str, Any] in multiple signatures and Pydantic fields. Must eliminate Any. 3. CHANGELOG commit missing issue footer — The chore: update CHANGELOG... commit has no Refs: #160 footer. Non-Blocking Issues 4. Three files exceed 500-line limit — agent_skills_loader.py (~792), step defs (786), feature file (695). Should be split as a follow-up. ## What Looks Good - Clean architecture: spec (data) / loader (lifecycle) / descriptor (registry view) - Frozen Pydantic models, strong validation with actionable error messages - Thorough test coverage across all layers (Behave, Robot, ASV) - No mocks in production code, proper temp dir cleanup - Path safety enforced via Path.resolve() + rglob()
aditya added this to the v3.1.0 milestone 2026-02-26 13:36:12 +00:00
aditya force-pushed feature/m3-agent-skills-loader from 476823dd1a to f8bc02869a 2026-02-26 14:47:16 +00:00 Compare
aditya added 1 commit 2026-02-26 14:53:24 +00:00
Merge branch 'master' into feature/m3-agent-skills-loader
CI / lint (pull_request) Successful in 22s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 29s
CI / build (pull_request) Successful in 27s
CI / security (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 1m1s
CI / integration_tests (pull_request) Successful in 4m35s
CI / unit_tests (pull_request) Successful in 23m50s
CI / docker (pull_request) Successful in 50s
CI / benchmark-regression (pull_request) Successful in 26m46s
CI / coverage (pull_request) Successful in 55m34s
76db58414a
aditya changed title from feature/m3-agent-skills-loader to feat(skill): add agent skills loader 2026-02-26 14:53:47 +00:00
aditya added the
Type
Feature
label 2026-02-26 14:54:33 +00:00
hamza.khyari requested review from hamza.khyari 2026-02-26 15:16:57 +00:00
hamza.khyari declined to review 2026-02-26 15:26:40 +00:00
hamza.khyari requested review from hamza.khyari 2026-02-26 15:26:52 +00:00
hamza.khyari approved these changes 2026-02-26 16:04:30 +00:00
Dismissed
hamza.khyari left a comment
Member

CI passing, one thing to consider is to split the files above 500 lines agent_skills_loader.py, agent_skills_loader_steps.py, agent_skills_loader.feature

CI passing, one thing to consider is to split the files above 500 lines agent_skills_loader.py, agent_skills_loader_steps.py, agent_skills_loader.feature
brent.edwards force-pushed feature/m3-agent-skills-loader from 76db58414a to ba46f53b5d 2026-02-26 20:46:23 +00:00 Compare
brent.edwards dismissed hamza.khyari's review 2026-02-26 20:46:23 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

aditya force-pushed feature/m3-agent-skills-loader from ba46f53b5d to 4c4bd74d94 2026-02-27 09:41:14 +00:00 Compare
aditya merged commit 9fd29b2748 into master 2026-02-27 10:22:02 +00:00
aditya deleted branch feature/m3-agent-skills-loader 2026-02-27 10:22:02 +00:00
freemo added the
State
Completed
label 2026-03-04 00:58:41 +00:00
Sign in to join this conversation.
No Reviewers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#453