Merge PR #170: Add YAML frontmatter to skill builders
Fixed critical bug where unified, GitHub, and PDF skill builders were generating SKILL.md files without required YAML frontmatter, making skills invisible to Claude. All 390 tests passing. No regressions. Credits: @AbdelrahmanHafez (original fix)
This commit is contained in:
@@ -536,7 +536,18 @@ class GitHubToSkillConverter:
|
||||
"""Generate main SKILL.md file."""
|
||||
repo_info = self.data.get('repo_info', {})
|
||||
|
||||
skill_content = f"""# {repo_info.get('name', self.name)}
|
||||
# Generate skill name (lowercase, hyphens only, max 64 chars)
|
||||
skill_name = self.name.lower().replace('_', '-').replace(' ', '-')[:64]
|
||||
|
||||
# Truncate description to 1024 chars if needed
|
||||
desc = self.description[:1024] if len(self.description) > 1024 else self.description
|
||||
|
||||
skill_content = f"""---
|
||||
name: {skill_name}
|
||||
description: {desc}
|
||||
---
|
||||
|
||||
# {repo_info.get('name', self.name)}
|
||||
|
||||
{self.description}
|
||||
|
||||
|
||||
@@ -272,7 +272,19 @@ class PDFToSkillConverter:
|
||||
"""Generate main SKILL.md file"""
|
||||
filename = f"{self.skill_dir}/SKILL.md"
|
||||
|
||||
# Generate skill name (lowercase, hyphens only, max 64 chars)
|
||||
skill_name = self.name.lower().replace('_', '-').replace(' ', '-')[:64]
|
||||
|
||||
# Truncate description to 1024 chars if needed
|
||||
desc = self.description[:1024] if len(self.description) > 1024 else self.description
|
||||
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
# Write YAML frontmatter
|
||||
f.write(f"---\n")
|
||||
f.write(f"name: {skill_name}\n")
|
||||
f.write(f"description: {desc}\n")
|
||||
f.write(f"---\n\n")
|
||||
|
||||
f.write(f"# {self.name.title()} Documentation Skill\n\n")
|
||||
f.write(f"{self.description}\n\n")
|
||||
|
||||
|
||||
@@ -73,7 +73,18 @@ class UnifiedSkillBuilder:
|
||||
"""Generate main SKILL.md file."""
|
||||
skill_path = os.path.join(self.skill_dir, 'SKILL.md')
|
||||
|
||||
content = f"""# {self.name.title()}
|
||||
# Generate skill name (lowercase, hyphens only, max 64 chars)
|
||||
skill_name = self.name.lower().replace('_', '-').replace(' ', '-')[:64]
|
||||
|
||||
# Truncate description to 1024 chars if needed
|
||||
desc = self.description[:1024] if len(self.description) > 1024 else self.description
|
||||
|
||||
content = f"""---
|
||||
name: {skill_name}
|
||||
description: {desc}
|
||||
---
|
||||
|
||||
# {self.name.title()}
|
||||
|
||||
{self.description}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user