Skip to main content

Module skill

Module skill 

Source
Expand description

User-invocable + auto-loadable skill definitions (Claude-Code parity).

PMAT-CODE-SKILLS-001: Claude Code loads .claude/skills/<name>/SKILL.md (and ~/.claude/skills/ at user scope). Each SKILL.md carries markdown frontmatter declaring a name, description, optional when_to_use heuristic, and optional allowed-tools allowlist. The body is treated as the skill’s instructions — injected into the model’s system context when the skill is invoked either (a) explicitly by the user via /<skill-name> in the REPL, or (b) automatically by matching when_to_use against the pending turn.

apr code mirrors the same pattern at .apr/skills/ with identical frontmatter schema so Claude-native projects can share skills with apr code unchanged.

§Example — .apr/skills/rust-test.md

---
name: rust-test
description: Run the Rust test suite and interpret failures
when_to_use: User asks about failing cargo tests
allowed-tools: shell, grep
---

Run `cargo test -p <crate> --lib <pattern>` from the repo root.
When a test fails, read the span around the assertion and report
the minimal reproduction.

After discovery, registry.resolve("rust-test") returns the Skill whose instructions field can be appended to the system prompt of the active agent turn.

Structs§

Skill
A parsed Skill definition.
SkillRegistry
Registry of discovered skills, keyed by name (alphabetical iteration).

Enums§

SkillError
Errors that can arise while parsing or loading a skill file.

Constants§

CLAUDE_COMPAT_DIR
Legacy / cross-compat directory — share skills tree with Claude Code.
DEFAULT_PROJECT_DIR
Default project-scope skills directory (relative to cwd).

Functions§

discover_skills
Discover skills from the standard locations: user scope (~/.config/apr/skills/) then project scope (.apr/skills/ or, as fallback, .claude/skills/ — cross-compat). Project scope wins on name collision.
load_skills_from
Scan a directory for skill .md files. Both layouts supported:
parse_skill_md
Parse a SKILL.md document into a Skill.
register_discovered_skills_into
Register all discovered skills into the given SkillRegistry. Returns the number of skills added.