fix(kyberforge): align skill factory with agentskills.io spec on directory rules
Move test infrastructure (validate.bats, new-skill.bats) from scripts/ to tests/ — the spec defines scripts/ as executable code agents can run, so test files don't belong there. Add tests/README.md placeholders with bats-support dependency declaration. Update skill-audit to permit tests/ and flag other unlisted directories, add scripts/ purpose check, and add /skill-improve near-miss exclusion. Update skill-improve and skill-write to cover tests/ in directory lists, scaffold template, and authoring guidance. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
4d36251b57
commit
3290b93640
10 files changed
+73
-8
No files matched your search
@@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../../../../" && pwd)"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-support/load"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-assert/load"
|
||||
|
||||
SCRIPT="$(cd "$(dirname "$BATS_TEST_FILENAME")" && pwd)/new-skill.sh"
|
||||
DEST="$(mktemp -d)"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "$DEST"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Passing cases
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "--help exits 0" {
|
||||
run bash "$SCRIPT" --help
|
||||
assert_success
|
||||
assert_output --partial "Usage:"
|
||||
}
|
||||
|
||||
@test "creates scaffold directory at destination" {
|
||||
run bash "$SCRIPT" my-tool "$DEST"
|
||||
assert_success
|
||||
assert [ -d "$DEST/my-tool" ]
|
||||
}
|
||||
|
||||
@test "scaffold contains SKILL.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
assert [ -f "$DEST/my-tool/SKILL.md" ]
|
||||
}
|
||||
|
||||
@test "scaffold contains README.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
assert [ -f "$DEST/my-tool/README.md" ]
|
||||
}
|
||||
|
||||
@test "scaffold contains scripts/, references/, assets/ directories" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
assert [ -d "$DEST/my-tool/scripts" ]
|
||||
assert [ -d "$DEST/my-tool/references" ]
|
||||
assert [ -d "$DEST/my-tool/assets" ]
|
||||
}
|
||||
|
||||
@test "substitutes skill name in SKILL.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
run grep "my-tool" "$DEST/my-tool/SKILL.md"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "substitutes skill name in README.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
run grep "my-tool" "$DEST/my-tool/README.md"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "skill name with numbers is valid" {
|
||||
run bash "$SCRIPT" my-tool-2 "$DEST"
|
||||
assert_success
|
||||
assert [ -d "$DEST/my-tool-2" ]
|
||||
}
|
||||
|
||||
@test "next-steps output references /skill-audit not validate.sh" {
|
||||
run bash "$SCRIPT" my-tool "$DEST"
|
||||
assert_output --partial "/skill-audit"
|
||||
refute_output --partial "validate.sh"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Failing cases
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "fails when no arguments given" {
|
||||
run bash "$SCRIPT"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name contains uppercase" {
|
||||
run bash "$SCRIPT" MyTool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name has consecutive hyphens" {
|
||||
run bash "$SCRIPT" my--tool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name has a leading hyphen" {
|
||||
run bash "$SCRIPT" -my-tool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name has a trailing hyphen" {
|
||||
run bash "$SCRIPT" my-tool- "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when destination directory does not exist" {
|
||||
run bash "$SCRIPT" my-tool "/nonexistent/path"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when target already exists" {
|
||||
mkdir -p "$DEST/my-tool"
|
||||
run bash "$SCRIPT" my-tool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
Reference in new issue
Block a user