MingaAgent.Skills (Minga v0.1.0)

Copy Markdown View Source

Skills system for context-aware prompt injection.

Skills are Markdown files that provide specialized instructions for specific tasks. They live in ~/.config/minga/skills/ (global) and .minga/skills/ (project-local). Each skill is a directory containing a SKILL.md file with YAML-style frontmatter and instruction body.

Skill format

---
name: plan
description: Plan mode for complex tasks
activates_on:
  - plan
  - design
  - scope
  - feature
---

# Planning Instructions

When planning a feature, always...

Loading

Skills can be activated:

  • Explicitly via /skill:name in chat
  • Automatically when user prompts match activates_on keywords

Multiple skills can be active simultaneously.

Summary

Types

A discovered skill with metadata and instructions.

Functions

Returns skills whose activates_on keywords match the given text.

Discovers all available skills from global and project directories.

Finds a skill by name from the discovered skills.

Formats active skills into a system prompt section.

Parses a SKILL.md file into a skill struct.

Returns a human-readable summary of all discovered skills.

Types

skill()

@type skill() :: %{
  name: String.t(),
  description: String.t(),
  activates_on: [String.t()],
  instructions: String.t(),
  path: String.t(),
  source: :global | :project | :extension
}

A discovered skill with metadata and instructions.

Functions

auto_activate(skills, text)

@spec auto_activate([skill()], String.t()) :: [skill()]

Returns skills whose activates_on keywords match the given text.

Performs case-insensitive word boundary matching. A keyword "plan" matches "let's plan this" but not "airplane".

discover(project_root \\ nil)

@spec discover(String.t() | nil) :: [skill()]

Discovers all available skills from global and project directories.

Project-local skills override global skills with the same name.

find(name, project_root \\ nil)

@spec find(String.t(), String.t() | nil) :: {:ok, skill()} | :not_found

Finds a skill by name from the discovered skills.

format_for_prompt(active_skills)

@spec format_for_prompt([skill()]) :: String.t() | nil

Formats active skills into a system prompt section.

parse_skill_file(path, source)

@spec parse_skill_file(String.t(), :global | :project) ::
  {:ok, skill()} | {:error, term()}

Parses a SKILL.md file into a skill struct.

Extracts YAML-style frontmatter (between --- delimiters) for metadata and uses the remainder as instruction text.

summary(project_root \\ nil)

@spec summary(String.t() | nil) :: String.t()

Returns a human-readable summary of all discovered skills.