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 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 19:16:47 +00:00
parent 4d36251b57
commit 3290b93640
10 changed files with 73 additions and 8 deletions

View File

@@ -35,7 +35,8 @@ This skill produces its best output when you arrive with rich context:
| `assets/templates/scripts/README.md` | Placeholder for bundled scripts |
| `assets/templates/references/README.md` | Placeholder for reference docs |
| `assets/templates/assets/README.md` | Placeholder for static assets |
| `scripts/new-skill.bats` | Bats test suite for new-skill.sh — dev tooling, not shipped with the plugin |
| `assets/templates/tests/README.md` | Placeholder for test files |
| `tests/new-skill.bats` | Bats test suite for new-skill.sh — requires bats-support and bats-assert under `tests/test_helper/` |
## Placement

View File

@@ -138,7 +138,7 @@ If the skill needs scripts with external package dependencies or language-specif
If no scripts are needed, delete `scripts/README.md` and the `scripts/` directory.
## Step 4 — Add references and assets (if needed)
## Step 4 — Add references, assets, and tests (if needed)
**`references/`** — additional documentation loaded on demand. One topic per file.
Reference conditionally from SKILL.md: `If <condition>, read references/<file>.md`.
@@ -146,6 +146,10 @@ Reference conditionally from SKILL.md: `If <condition>, read references/<file>.m
**`assets/`** — static resources: templates, schemas, lookup tables.
Reference by relative path from SKILL.md.
**`tests/`** — test files for scripts in `scripts/`. Use when scripts are complex
enough to break silently. Test infrastructure (`.bats`, `*_test.*`) belongs here,
not in `scripts/`. See `tests/README.md` for setup instructions.
If not needed, delete the placeholder READMEs and their directories.
## Step 5 — Validate

View File

@@ -0,0 +1,30 @@
# tests/
Test files for scripts bundled with this skill.
## When to add tests
Add tests here when the skill has scripts in `scripts/` that are complex enough
to break silently — validators, parsers, generators, anything with branching
logic or edge cases. Test infrastructure (`.bats`, `*_test.*`, `test_*.sh`)
belongs here, not in `scripts/`.
## Test runner
Tests are run with [Bats](https://bats-core.readthedocs.io) for shell scripts.
Install support libraries under `tests/test_helper/`:
```bash
git clone https://github.com/bats-core/bats-support tests/test_helper/bats-support
git clone https://github.com/bats-core/bats-assert tests/test_helper/bats-assert
```
Run all tests:
```bash
bats tests/
```
## If no tests are needed
Delete this README and the `tests/` directory entirely.

View File

@@ -84,4 +84,5 @@ echo " 1. Fill in $TARGET/SKILL.md — replace all FILL IN: placeholders"
echo " 2. Add scripts to scripts/ if needed (or delete the directory)"
echo " 3. Add docs to references/ if needed (or delete the directory)"
echo " 4. Add resources to assets/ if needed (or delete the directory)"
echo " 5. Validate: run /skill-audit on $TARGET"
echo " 5. Add tests to tests/ if the skill has scripts (or delete the directory)"
echo " 6. Validate: run /skill-audit on $TARGET"