Skip to content

m3taz-ahmed/aizee / skills/bmad-toolsmith

bmad-toolsmith

Verified

Smithy 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`).

FileKindSize
SKILL.mdskill md3.6 KB
approaches/eval-first.mdmarkdown1.3 KB
approaches/eval-loop.mdmarkdown2.4 KB
approaches/from-logs.mdmarkdown1.7 KB
approaches/lean.mdmarkdown1.7 KB
approaches/scaffold.mdmarkdown1.3 KB
approaches/skill-creator-loop.mdmarkdown1.2 KB
bmod.tomlconfig118 B
canon.mdmarkdown10.5 KB
customize.tomlconfig4.8 KB
discover.mdmarkdown5.5 KB
evals/triggers.jsonconfig3.3 KB
lenses/lens-architecture.mdmarkdown2.9 KB
lenses/lens-contract.mdmarkdown1.4 KB
lenses/lens-customization.mdmarkdown2.4 KB
lenses/lens-determinism.mdmarkdown1.8 KB
lenses/lens-leanness.mdmarkdown3.1 KB
lenses/lens-trigger.mdmarkdown2.4 KB
lenses/standards.mdmarkdown5.2 KB
modes/convert.mdmarkdown2.1 KB
modes/cut-roles.mdmarkdown3.3 KB
modes/cut.mdmarkdown3.3 KB
modes/edit.mdmarkdown1.3 KB
modes/migrate.mdmarkdown3.3 KB
modes/package.mdmarkdown2.6 KB
modes/review.mdmarkdown1.3 KB
modes/validate.mdmarkdown1.8 KB
scripts/count_tokens.pyscript3.6 KB
scripts/cut_check.pyscript5.1 KB
scripts/init_skill.pyscript13.3 KB
scripts/prepass.pyscript7.5 KB
scripts/process_template.pyscript4.8 KB
scripts/read_session_log.pyscript9.8 KB
scripts/registry.pyscript5.9 KB
scripts/scan_legacy_module.pyscript7.7 KB
scripts/scan_paths.pyscript9.2 KB
scripts/scan_scripts.pyscript6.6 KB
scripts/tests/test_count_tokens.pyscript4.1 KB
scripts/tests/test_cut_check.pyscript3.1 KB
scripts/tests/test_init_skill.pyscript9.7 KB
scripts/tests/test_memory_agent_scripts.pyscript8.6 KB
scripts/tests/test_prepass.pyscript8.3 KB
scripts/tests/test_process_template.pyscript4.7 KB
scripts/tests/test_read_session_log.pyscript7.3 KB
scripts/tests/test_registry.pyscript6.0 KB
scripts/tests/test_scan_legacy_module.pyscript8.2 KB
scripts/tests/test_scan_paths.pyscript7.7 KB
scripts/tests/test_scan_scripts.pyscript4.1 KB
shapes/agent/assets/SKILL-template.mdmarkdown2.0 KB
shapes/agent/assets/capability-template.mdmarkdown582 B
shapes/agent/assets/customize-template.tomlconfig1.9 KB
shapes/agent/assets/sample-capability.mdmarkdown887 B
shapes/agent/shape.mdmarkdown3.2 KB
shapes/memory-agent/assets/BOND-template.mdmarkdown392 B
shapes/memory-agent/assets/CAPABILITIES-template.mdmarkdown1017 B
shapes/memory-agent/assets/CREED-template.mdmarkdown2.1 KB
shapes/memory-agent/assets/HOW-I-REMEMBER-template.mdmarkdown3.3 KB
shapes/memory-agent/assets/PERSONA-template.mdmarkdown705 B
shapes/memory-agent/assets/PULSE-template.mdmarkdown849 B
shapes/memory-agent/assets/SKILL-template-bootloader.mdmarkdown4.2 KB
shapes/memory-agent/assets/customize-template.tomlconfig1.2 KB
shapes/memory-agent/assets/first-breath-config-template.mdmarkdown4.5 KB
shapes/memory-agent/assets/first-breath-template.mdmarkdown9.3 KB
shapes/memory-agent/assets/init-sanctum-template.pyscript5.7 KB
shapes/memory-agent/assets/intake-capability-template.mdmarkdown975 B
shapes/memory-agent/assets/wake-template.pyscript6.8 KB
shapes/memory-agent/shape.mdmarkdown5.0 KB
shapes/multi-skill-module/assets/help-template.mdmarkdown623 B
shapes/multi-skill-module/assets/member-bmod-template.tomlconfig490 B
shapes/multi-skill-module/assets/record-SKILL-template.mdmarkdown374 B
shapes/multi-skill-module/assets/record-bmod-template.tomlconfig802 B
shapes/multi-skill-module/assets/retired-template.tomlconfig287 B
shapes/multi-skill-module/assets/roster-template.tomlconfig567 B
shapes/multi-skill-module/shape.mdmarkdown4.3 KB
shapes/plain-skill/assets/SKILL-template.mdmarkdown2.0 KB
shapes/plain-skill/assets/customize-template.tomlconfig1.0 KB
shapes/plain-skill/shape.mdmarkdown2.9 KB
shapes/rendered-agent/assets/SKILL-template.mdmarkdown1.0 KB
shapes/rendered-agent/assets/capability.mdmarkdown1.1 KB
shapes/rendered-agent/assets/customize-template.tomlconfig2.6 KB
shapes/rendered-agent/assets/workflow.mdmarkdown1.8 KB
shapes/rendered-agent/shape.mdmarkdown3.8 KB
shapes/rendered-skill/assets/SKILL-template.mdmarkdown1.0 KB
shapes/rendered-skill/assets/customize-template.tomlconfig990 B
shapes/rendered-skill/assets/step.mdmarkdown688 B
shapes/rendered-skill/assets/workflow.mdmarkdown1004 B
shapes/rendered-skill/shape.mdmarkdown2.2 KB
shapes/script-utility/assets/SKILL-template.mdmarkdown859 B
shapes/script-utility/assets/script-template.pyscript1.5 KB
shapes/script-utility/assets/test-template.pyscript1.2 KB
shapes/script-utility/shape.mdmarkdown1.6 KB
shapes/single-skill-module/assets/bmod-template.tomlconfig696 B
shapes/single-skill-module/assets/help-template.mdmarkdown177 B
shapes/single-skill-module/shape.mdmarkdown2.5 KB
ship.mdmarkdown6.4 KB

scripts/tests/test_init_skill.py

View on GitHub
"""Tests for init_skill.py: scaffolding each shape and checking skills for the frontmatter and bmod rules."""

import json
import subprocess
import sys
import tempfile
import tomllib
import unittest
from pathlib import Path

SCRIPT = Path(__file__).resolve().parents[1] / "init_skill.py"

GOOD_DESCRIPTION = "Counts things in a folder. Use when the user asks how big a skill is."


def run(*args):
    res = subprocess.run([sys.executable, str(SCRIPT), *[str(a) for a in args]], capture_output=True, text=True)
    data = json.loads(res.stdout) if res.stdout.strip().startswith("{") else None
    return res.returncode, data, res.stderr


def rules(data):
    return sorted(f["rule"] for f in data["findings"])


class CreateTest(unittest.TestCase):
    def test_plain_skill_with_dirs_and_skill_table(self):
        with tempfile.TemporaryDirectory() as tmp:
            code, data, err = run(
                "--name",
                "bmad-demo",
                "--dest",
                tmp,
                "--shape",
                "plain-skill",
                "--dirs",
                "references,scripts",
                "--bmod",
                "bmod-example",
                "--source",
                "github:acme/example/skills",
                "--description",
                GOOD_DESCRIPTION,
            )
            self.assertEqual(code, 0, err)
            skill = Path(tmp) / "bmad-demo"
            self.assertEqual(data["created"], ["SKILL.md", "bmod.toml", "references/", "scripts/"])
            self.assertEqual(data["shape"], "plain-skill")
            text = (skill / "SKILL.md").read_text(encoding="utf-8")
            self.assertTrue(text.startswith("---\nname: bmad-demo\ndescription: '"))
            self.assertIn("# bmad-demo", text)
            bmod = tomllib.loads((skill / "bmod.toml").read_text(encoding="utf-8"))
            self.assertEqual(bmod, {"skill": {"bmod": "bmod-example", "source": "github:acme/example/skills"}})
            self.assertTrue((skill / "references").is_dir())
            # The new skill passes its own check.
            code, data, _ = run("--check", skill)
            self.assertEqual(code, 0, data)
            self.assertEqual(data["bmod"], "ok")

    def test_no_bmod_without_flag(self):
        with tempfile.TemporaryDirectory() as tmp:
            target = Path(tmp) / "bmad-demo"
            code, data, err = run(
                "--name", "bmad-demo", "--dest", tmp, "--shape", "plain-skill", "--description", GOOD_DESCRIPTION
            )
            self.assertEqual(code, 0, err)
            self.assertEqual(data["created"], ["SKILL.md"])
            self.assertFalse((target / "bmod.toml").exists())
            code, data, _ = run("--check", target)
            self.assertEqual(code, 0, data)
            self.assertEqual(data["bmod"], "absent")

    def test_placeholder_description_fails_check(self):
        with tempfile.TemporaryDirectory() as tmp:
            code, _, _ = run("--name", "bmad-demo", "--dest", tmp, "--shape", "script-utility")
            self.assertEqual(code, 0)
            code, data, _ = run("--check", Path(tmp) / "bmad-demo")
            self.assertEqual(code, 1)
            # The placeholder carries "Use when", so only the TODO marker fails the check.
            self.assertEqual(rules(data), ["todo-left"])

    def test_single_skill_module(self):
        with tempfile.TemporaryDirectory() as tmp:
            code, _, _ = run(
                "--name",
                "bmad-changelog",
                "--dest",
                tmp,
                "--shape",
                "single-skill-module",
                "--source",
                "github:acme/changelog",
                "--description",
                GOOD_DESCRIPTION,
            )
            self.assertEqual(code, 0)
            bmod = tomllib.loads((Path(tmp) / "bmad-changelog" / "bmod.toml").read_text(encoding="utf-8"))
            self.assertEqual(
                bmod["bmod"], {"code": "changelog", "version": "0.1.0", "update_source": "github:acme/changelog"}
            )
            self.assertEqual(bmod["skill"], {})
            code, data, _ = run("--check", Path(tmp) / "bmad-changelog")
            self.assertEqual(code, 0, data)

    def test_multi_skill_module_record(self):
        with tempfile.TemporaryDirectory() as tmp:
            code, _, _ = run(
                "--name",
                "bmod-acme",
                "--dest",
                tmp,
                "--shape",
                "multi-skill-module",
                "--source",
                "github:acme/x/skills",
            )
            self.assertEqual(code, 0)
            skill = Path(tmp) / "bmod-acme"
            bmod = tomllib.loads((skill / "bmod.toml").read_text(encoding="utf-8"))
            self.assertEqual(
                bmod,
                {"bmod": {"code": "acme", "version": "0.1.0", "update_source": "github:acme/x/skills", "skills": []}},
            )
            self.assertIn(
                "Required bmod metadata. Never invoke this skill.", (skill / "SKILL.md").read_text(encoding="utf-8")
            )
            code, data, _ = run("--check", skill)
            self.assertEqual(code, 0, data)
            code, _, _ = run("--name", "bmad-acme", "--dest", tmp, "--shape", "multi-skill-module")
            self.assertEqual(code, 1)

    def test_refuses_bad_name_existing_folder_and_unknown_dir(self):
        with tempfile.TemporaryDirectory() as tmp:
            code, data, _ = run("--name", "Bad_Name", "--dest", tmp, "--shape", "plain-skill")
            self.assertEqual(code, 1)
            self.assertFalse(data["ok"])
            (Path(tmp) / "bmad-taken").mkdir()
            code, _, _ = run("--name", "bmad-taken", "--dest", tmp, "--shape", "plain-skill")
            self.assertEqual(code, 1)
            code, _, _ = run("--name", "bmad-new", "--dest", tmp, "--shape", "plain-skill", "--dirs", "steps")
            self.assertEqual(code, 1)
            code, _, _ = run("--name", "bmad-new", "--dest", tmp)
            self.assertEqual(code, 2)


class CheckTest(unittest.TestCase):
    def write_skill(self, tmp, name, skill_md, bmod="[skill]\n", extra=None):
        skill = Path(tmp) / name
        skill.mkdir()
        (skill / "SKILL.md").write_text(skill_md, encoding="utf-8")
        if bmod is not None:
            (skill / "bmod.toml").write_text(bmod, encoding="utf-8")
        for rel, text in (extra or {}).items():
            path = skill / rel
            path.parent.mkdir(parents=True, exist_ok=True)
            path.write_text(text, encoding="utf-8")
        return skill

    def test_good_skill_with_multiline_description(self):
        with tempfile.TemporaryDirectory() as tmp:
            skill = self.write_skill(
                tmp,
                "bmad-good",
                "---\nname: bmad-good\ndescription: >-\n  Does a thing.\n  Use when asked.\n---\n\nBody.\n",
                extra={".memlog.md": "- (note) [TODO: hidden files are not scanned]\n"},
            )
            code, data, _ = run("--check", skill)
            self.assertEqual(code, 0, data)
            self.assertEqual(data, {"ok": True, "skill": "bmad-good", "bmod": "ok", "findings": []})

    def test_every_rule(self):
        with tempfile.TemporaryDirectory() as tmp:
            skill = self.write_skill(
                tmp,
                "my-skill",
                "---\nname: other-name\ndescription: '" + "x" * 1025 + "'\nversion: 1\n---\n\n   \n",
                bmod="[skill\nbroken",
                extra={"references/a.md": "[TODO: write]\n"},
            )
            code, data, _ = run("--check", skill)
            self.assertEqual(code, 1)
            self.assertEqual(
                rules(data),
                [
                    "bmod-invalid",
                    "body-empty",
                    "description-length",
                    "description-trigger",
                    "frontmatter-keys",
                    "name-folder-mismatch",
                    "name-format",
                    "todo-left",
                ],
            )
            todo = next(f for f in data["findings"] if f["rule"] == "todo-left")
            self.assertEqual((todo["path"], todo["line"]), ("references/a.md", 1))

    def test_any_name_and_missing_pieces(self):
        with tempfile.TemporaryDirectory() as tmp:
            skill = self.write_skill(
                tmp,
                "acme-notes",
                "---\nname: acme-notes\ndescription: 'Notes. Use when writing.'\n---\n\nBody.\n",
                bmod=None,
            )
            code, data, _ = run("--check", skill)
            self.assertEqual(rules(data), ["name-format"])
            self.assertEqual(data["bmod"], "absent")
            code, data, _ = run("--check", skill, "--any-name")
            self.assertEqual(code, 0, data)
            empty = Path(tmp) / "bmad-empty"
            empty.mkdir()
            code, data, _ = run("--check", empty)
            self.assertEqual(rules(data), ["skill-md-missing"])
            no_fm = self.write_skill(tmp, "bmad-nofm", "# Just a heading\n", bmod="[other]\n")
            code, data, _ = run("--check", no_fm)
            self.assertEqual(rules(data), ["bmod-tables", "frontmatter-missing"])
            self.assertEqual(data["bmod"], "invalid")

    def test_record_rules(self):
        with tempfile.TemporaryDirectory() as tmp:
            record = self.write_skill(
                tmp,
                "bmod-acme",
                "---\nname: bmod-acme\ndescription: 'Acme tools. Use when needed.'\n---\n\nBody.\n",
                bmod='[bmod]\ncode = "acme"\nversion = "1.0.0"\nupdate_source = "github:acme/x"\n',
            )
            code, data, _ = run("--check", record)
            self.assertEqual(rules(data), ["description-trigger"])


if __name__ == "__main__":
    unittest.main()
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall