fix(skills): quote skill-creator template description (#93517)

Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com>
Co-authored-by: parubets <1392109+parubets@users.noreply.github.com>
This commit is contained in:
Vincent Koc
2026-06-16 14:24:19 +08:00
committed by GitHub
parent 1884cedd35
commit ce6fd93279
2 changed files with 52 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ ALLOWED_RESOURCES = {"scripts", "references", "assets"}
SKILL_TEMPLATE = """---
name: {skill_name}
description: [TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]
description: '[TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]'
---
# {skill_title}

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env python3
"""
Regression tests for skill initialization.
"""
import shutil
import sys
import tempfile
from contextlib import redirect_stdout
from io import StringIO
from pathlib import Path
from unittest import TestCase, main
SCRIPT_DIR = Path(__file__).resolve().parent
if str(SCRIPT_DIR) not in sys.path:
sys.path.insert(0, str(SCRIPT_DIR))
import init_skill
class TestInitSkill(TestCase):
def setUp(self):
self.temp_dir = Path(tempfile.mkdtemp(prefix="test_init_skill_"))
def tearDown(self):
if self.temp_dir.exists():
shutil.rmtree(self.temp_dir)
def test_generated_description_placeholder_is_yaml_string(self):
with redirect_stdout(StringIO()):
skill_dir = init_skill.init_skill("yaml-description-skill", self.temp_dir, [], False)
self.assertIsNotNone(skill_dir)
content = (skill_dir / "SKILL.md").read_text(encoding="utf-8")
frontmatter = content.split("---", 2)[1]
self.assertIn("description: '[TODO:", frontmatter)
try:
import yaml
except ImportError:
self.skipTest("PyYAML is not installed")
parsed = yaml.safe_load(frontmatter)
self.assertIsInstance(parsed["description"], str)
self.assertTrue(parsed["description"].startswith("[TODO: Complete"))
if __name__ == "__main__":
main()