fix(skills): quote skill-creator template description (#93517) · openclaw/openclaw@ce6fd93
vincentkoc
·
2026-06-16
·
via Recent Commits to openclaw:main
File tree
skills/skill-creator/scripts
| Original file line number | Diff line number | Diff line change |
|---|
@@ -22,7 +22,7 @@
|
22 | 22 | |
23 | 23 | SKILL_TEMPLATE = """--- |
24 | 24 | name: {skill_name} |
25 | | -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.] |
| 25 | +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.]' |
26 | 26 | --- |
27 | 27 | |
28 | 28 | # {skill_title} |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/usr/bin/env python3 |
| 2 | +""" |
| 3 | +Regression tests for skill initialization. |
| 4 | +""" |
| 5 | + |
| 6 | +import shutil |
| 7 | +import sys |
| 8 | +import tempfile |
| 9 | +from contextlib import redirect_stdout |
| 10 | +from io import StringIO |
| 11 | +from pathlib import Path |
| 12 | +from unittest import TestCase, main |
| 13 | + |
| 14 | +SCRIPT_DIR = Path(__file__).resolve().parent |
| 15 | +if str(SCRIPT_DIR) not in sys.path: |
| 16 | +sys.path.insert(0, str(SCRIPT_DIR)) |
| 17 | + |
| 18 | +import init_skill |
| 19 | + |
| 20 | + |
| 21 | +class TestInitSkill(TestCase): |
| 22 | +def setUp(self): |
| 23 | +self.temp_dir = Path(tempfile.mkdtemp(prefix="test_init_skill_")) |
| 24 | + |
| 25 | +def tearDown(self): |
| 26 | +if self.temp_dir.exists(): |
| 27 | +shutil.rmtree(self.temp_dir) |
| 28 | + |
| 29 | +def test_generated_description_placeholder_is_yaml_string(self): |
| 30 | +with redirect_stdout(StringIO()): |
| 31 | +skill_dir = init_skill.init_skill("yaml-description-skill", self.temp_dir, [], False) |
| 32 | + |
| 33 | +self.assertIsNotNone(skill_dir) |
| 34 | +content = (skill_dir / "SKILL.md").read_text(encoding="utf-8") |
| 35 | +frontmatter = content.split("---", 2)[1] |
| 36 | + |
| 37 | +self.assertIn("description: '[TODO:", frontmatter) |
| 38 | + |
| 39 | +try: |
| 40 | +import yaml |
| 41 | +except ImportError: |
| 42 | +self.skipTest("PyYAML is not installed") |
| 43 | + |
| 44 | +parsed = yaml.safe_load(frontmatter) |
| 45 | + |
| 46 | +self.assertIsInstance(parsed["description"], str) |
| 47 | +self.assertTrue(parsed["description"].startswith("[TODO: Complete")) |
| 48 | + |
| 49 | + |
| 50 | +if __name__ == "__main__": |
| 51 | +main() |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。