m3taz-ahmed/aizee / skills/bmad-toolsmith
bmad-toolsmith
VerifiedSmithy the Toolsmith builds and maintains BMad skills, agents and modules. Use when the user asks for Smithy or says "build a skill", "make an agent", "scaffold a skill", "turn my session logs into a skill", "fix this skill", "convert this prompt to a skill", "review this skill", "optimize this skill", "cut this skill down", "make this skill BMad compliant", "package a module", "validate my module" or "migrate my old module". Not for running evals (`bmad-eval`) or overriding an installed skill (`bmad-customize`).
scripts/tests/test_cut_check.py
View on GitHub"""Tests for cut_check.py: what a rewrite dropped, file by file."""
import json
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
SCRIPT = Path(__file__).resolve().parents[1] / "cut_check.py"
OLD = (
"---\nname: x\ndescription: 'Does x.'\n---\n# X\n\n"
'{{ rendered("a.md") }} then {% if workflow.mode %}y{% endif %}.\n'
"Run `{skill-root}/scripts/x.py`.\n\n## Keep\n\nWord for word.\n\n## Other\n\nLong prose here.\n"
)
def run(*args):
return subprocess.run([sys.executable, str(SCRIPT), *map(str, args)], capture_output=True, text=True)
class CutCheckTest(unittest.TestCase):
def setUp(self):
self._tmp = tempfile.TemporaryDirectory()
tmp = Path(self._tmp.name)
self.before, self.after = tmp / "before", tmp / "after"
for root in (self.before, self.after):
(root / "references").mkdir(parents=True)
(root / "scripts").mkdir()
(root / "SKILL.md").write_text(OLD, encoding="utf-8")
(root / "references" / "r.md").write_text("Some reference.\n", encoding="utf-8")
(root / "scripts" / "notes.md").write_text("Not a prompt file.\n", encoding="utf-8")
(root / "bmod.toml").write_text("x = 1\n", encoding="utf-8")
def tearDown(self):
self._tmp.cleanup()
def check(self, *extra):
res = run(self.before, self.after, *extra)
self.assertEqual(res.returncode, 0, res.stderr)
return json.loads(res.stdout)
def test_unchanged_skill_loses_nothing(self):
data = self.check("--protect", "SKILL.md#Keep")
self.assertEqual([f["path"] for f in data["files"]], ["SKILL.md", "references/r.md"])
self.assertEqual((data["lost"], data["missing"]), ([], []))
def test_reports_what_a_rewrite_dropped(self):
(self.after / "SKILL.md").write_text(
"---\nname: x\ndescription: 'Changed.'\n---\n# X\n\n{% if workflow.mode %}y{% endif %}.\n\n## Keep\n\nShorter.\n",
encoding="utf-8",
)
(self.after / "references" / "r.md").unlink()
data = self.check("--protect", "SKILL.md#Keep", "--protect", "references/r.md")
lost = {f["path"]: f["lost"] for f in data["files"]}
self.assertEqual(
lost["SKILL.md"],
['{{ rendered("a.md") }}', "{skill-root}/scripts/x.py", "frontmatter", "protected: Keep"],
)
self.assertEqual((data["lost"], data["missing"]), (["SKILL.md"], ["references/r.md"]))
def test_whole_protected_file_must_match(self):
(self.after / "references" / "r.md").write_text("Some reference, reworded.\n", encoding="utf-8")
data = self.check("--protect", "references/r.md")
self.assertEqual({f["path"]: f["lost"] for f in data["files"]}["references/r.md"], ["protected"])
def test_bad_protect_fails(self):
for entry in ("SKILL.md#Nowhere", "typo.md"):
res = run(self.before, self.after, "--protect", entry)
self.assertNotEqual(res.returncode, 0)
self.assertIn(entry.split("#")[-1], res.stderr)
if __name__ == "__main__":
unittest.main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |