Class SkillMdParser

java.lang.Object
com.tnsai.skills.SkillMdParser

public final class SkillMdParser extends Object
Parses a Claude Code-compatible SKILL.md document into a Skill (TNS-289).

Format:

 ---
 name: deploy
 description: Production deploy procedure ...
 when_to_use: ...
 allowed-tools: [bash, kubectl]
 disable-model-invocation: false
 user-invocable: true
 argument-hint: "<environment>"
 arguments:
   - environment
 paths:
   - "infra/**"
 ---

 # Deploy procedure

 Step-by-step body content here ...
 

The frontmatter delimiter is exactly three dashes (---) on a line by itself. Anything between the opening and closing delimiter is parsed as YAML; everything after is the markdown body.

Field names follow the agentskills.io convention of kebab-case (allowed-tools, disable-model-invocation, user-invocable, argument-hint); snake_case aliases (when_to_use) are also accepted because Claude Code's docs use both.

Since:
0.10.0 (TNS-289)
  • Method Details

    • parse

      public static Skill parse(String content, String defaultName)
      Parse SKILL.md content into a Skill, defaulting the name to defaultName when the frontmatter does not declare one (e.g. when the directory name is the source of truth).
      Throws:
      IllegalArgumentException - if the document has no frontmatter or the frontmatter cannot be parsed as YAML or violates the Skill contract
    • parse

      public static Skill parse(Path skillMd)
      Same as parse(String, String) but reads the document from disk. The file's parent directory name is used as the default skill name.