Skip to content

fix(skill): normalize multiline frontmatter descriptions#30692

Open
ulises-jeremias wants to merge 1 commit into
anomalyco:devfrom
ulises-jeremias:fix/opencode-skill-loader-multiline-description
Open

fix(skill): normalize multiline frontmatter descriptions#30692
ulises-jeremias wants to merge 1 commit into
anomalyco:devfrom
ulises-jeremias:fix/opencode-skill-loader-multiline-description

Conversation

@ulises-jeremias
Copy link
Copy Markdown
Contributor

@ulises-jeremias ulises-jeremias commented Jun 4, 2026

Issue for this PR

Closes #30674

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Normalizes skill frontmatter descriptions during skill discovery/load.

When SKILL.md uses multiline YAML description styles (for example description: |), description text can carry newlines/extra whitespace. This PR canonicalizes description text on ingest so it is consistently represented in available_skills output and downstream matching surfaces.

Changes:

  • packages/opencode/src/skill/index.ts
    • add normalizeDescription()
    • collapse multiline/extra whitespace into a single line
    • preserve undefined for empty descriptions
  • packages/opencode/test/skill/skill.test.ts
    • add regression test for multiline YAML description parsing/normalization

How did you verify your code works?

  • Added regression test: normalizes multiline YAML descriptions in SKILL.md frontmatter
  • Attempted to run:
    • bun test test/skill/skill.test.ts (from packages/opencode) — blocked in this environment by existing workspace/module resolution issues (@opencode-ai/llm, etc.)
    • bun typecheck (from packages/opencode) — blocked by existing repository-wide unresolved dependency/type issues in packages/core and unrelated server handlers

Screenshots / recordings

Not included.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added contributor needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@ulises-jeremias
Copy link
Copy Markdown
Contributor Author

Self-review summary:

  • ✅ Scope is minimal and directly tied to Bug Report: Skill Loader Fails to Parse Multiline YAML Descriptions in SKILL.md #30674.
  • normalizeDescription() is applied at skill load time, so all consumers get canonicalized text without per-caller handling.
  • ✅ Empty/whitespace-only descriptions correctly become undefined.
  • ✅ Regression test covers multiline YAML (description: |) and validates normalized single-line output.
  • ✅ No unrelated changes included.

Potential follow-up (optional, not required for this fix):

  • Add a second test for folded YAML (description: >) to ensure equivalent normalization behavior.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: Skill Loader Fails to Parse Multiline YAML Descriptions in SKILL.md

1 participant