Return the ``description:`` value from a SKILL.md, or ``""``. Missing file, missing frontmatter, or missing field all return the empty string — callers that need to distinguish should check the file themselves first.
(skill_md: Path)
| 86 | |
| 87 | |
| 88 | def extract_description(skill_md: Path) -> str: |
| 89 | """Return the ``description:`` value from a SKILL.md, or ``""``. |
| 90 | |
| 91 | Missing file, missing frontmatter, or missing field all return the |
| 92 | empty string — callers that need to distinguish should check the file |
| 93 | themselves first. |
| 94 | """ |
| 95 | if not skill_md.is_file(): |
| 96 | return "" |
| 97 | text = skill_md.read_text(encoding="utf-8", errors="replace") |
| 98 | fm = extract_frontmatter(text) |
| 99 | if fm is None: |
| 100 | return "" |
| 101 | m = _DESC_RE.search(fm) |
| 102 | return m.group(1).strip() if m else "" |
no test coverage detected