Skip to content

SKILL.md frontmatter is cut at the first "---" inside a value (description truncated or skill fails to load)聽#7725

Open

Description

@alphasafal

馃敶 Required Information

Describe the Bug:
_parse_skill_md_content (src/google/adk/skills/_utils.py) splits SKILL.md with content.split("---", 2), so the frontmatter ends at the first --- anywhere in the file, not at the closing --- line. Any --- inside a frontmatter value (a spaced em-dash in a description, a horizontal rule inside a | block scalar) cuts the frontmatter short. Every skill loader goes through this function (load_skill_from_dir, zip loading, GCS loading, SkillToolset).

Steps to Reproduce:

  1. Create compare-skill/SKILL.md:
    ---
    name: compare-skill
    description: Compare two options --- pros, cons and a verdict.
    ---
    # Instructions
    Do the thing.
    
  2. Load it with google.adk.skills.load_skill_from_dir("compare-skill").
  3. Repeat with the description quoted: description: "Draft release notes --- never publish them."

Expected Behavior:
frontmatter.description is the full string and instructions is # Instructions\nDo the thing. in both cases.

Observed Behavior:

  • Unquoted: description == 'Compare two options', and the rest of the description plus the real closing --- leak into the instructions: 'pros, cons and a verdict.\n---\n# Instructions\nDo the thing.'. The model sees a truncated description when choosing skills.
  • Quoted: the skill fails to load with ValueError: Invalid YAML in frontmatter: while scanning a quoted scalar, although the file is valid.
  • With a description: | block scalar containing a --- line, the description is cut and every key after it (license, metadata, allowed-tools) is silently dropped, including adk_additional_tools in metadata.

Environment Details:

  • ADK Library Version (pip show google-adk): 2.13.0 (main at da35ca7)
  • Desktop OS: Linux
  • Python Version (python -V): 3.12

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A (happens while loading the skill, before any model call)

馃煛 Optional Information

Minimal Reproduction Code:

import pathlib, tempfile
from google.adk.skills import load_skill_from_dir

d = pathlib.Path(tempfile.mkdtemp()) / "compare-skill"
d.mkdir()
(d / "SKILL.md").write_text(
    "---\nname: compare-skill\n"
    "description: Compare two options --- pros, cons and a verdict.\n"
    "---\n# Instructions\nDo the thing.\n"
)
skill = load_skill_from_dir(d)
print(repr(skill.frontmatter.description))  # 'Compare two options'
print(repr(skill.instructions))             # 'pros, cons and a verdict.\n---\n# Instructions\nDo the thing.'

Additional Context:
I have a fix ready that matches the opening and closing --- as whole lines (CRLF still handled), with regression tests in tests/unittests/skills/test__utils.py, and can open a PR referencing this issue.

How often has this issue occurred?:

  • Always (100%)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions