Skip to content

rolecraft test ​

Test a SKILL.md quality with built-in assertions. Scans frontmatter, content structure, security patterns, and completeness — then assigns a score and grade.

Usage ​

bash
rolecraft test <skill-path>     # Test a single skill
rolecraft test --all             # Test all installed skills
rolecraft test --all --json      # JSON output for CI

Options ​

FlagDescription
--allTest all installed skills from lockfile
--jsonMachine-readable JSON output
--verbose, -vDetailed assertion results
--min-score <N>Fail if score below N (default: 50)
--only <names>Run specific assertions only (comma-separated)
--no-colorDisable ANSI colors
--no-emojiReplace emojis with ASCII ([OK], [FAIL], [WARN])

Assertions ​

AssertionWeightDescription
name-defined10frontmatter.name must exist
description-defined10frontmatter.description must exist
description-length5Description >= 20 characters
frontmatter-valid10YAML delimiters (---) must be present and parseable
slug-defined5frontmatter.slug must exist
content-not-empty10Body must contain >= 50 words
code-block-lang10Code fences must have language tags (```js not ```)
dangerous-patterns15No rm -rf, eval, exec, sudo, /etc/passwd patterns
line-length5No lines exceeding 120 characters
example-commands10Must contain $ command or ```bash block
mcp-referenced5If MCP servers referenced in body, they must be in frontmatter
agent-targets5Must specify agents: or scope: in frontmatter
has-sections5Must have at least 2 ## sections

Grades ​

ScoreGradeMeaning
90-100AExcellent
75-89BGood
50-74CAdequate
25-49DPoor
0-24FUnusable

Examples ​

bash
# Test a single skill
$ rolecraft test ./my-skill/SKILL.md

🔬 Testing: my-skill

  ✅ name defined
  ✅ description defined and sufficient length (45 chars)
  ✅ Frontmatter valid YAML
  ❌ slug not defined
  ✅ Content not empty (245 words)
  ❌ Code block missing language tag (``` instead of ```javascript)
  ✅ No dangerous patterns found
  ⚠️  Long lines (>120 chars) -- 3 lines
  ❌ MCP server referenced but not defined in frontmatter
  ✅ Example commands present
  ❌ No agent targets specified

Score: 73/100 -> C (Adequate)

Suggestions:
  -> Add "slug" field to frontmatter
  -> Use language tags in code blocks
  -> Specify which agents this skill is for
bash
# Test all installed skills
$ rolecraft test --all

Testing all installed skills...

  ✅ react-rules       92/100  A
  ✅ testing-guide     88/100  B
  ❌ legacy-rules      34/100  D  -> needs review
  ✅ my-skill          73/100  C

📋 Summary: 3/4 passed, 1 failed
bash
# CI usage with min-score threshold
$ rolecraft test --all --min-score 80 --json
bash
# Run only specific assertions
$ rolecraft test ./skill.SKILL.md --only name-defined,slug-defined

Node.js API ​

js
import { test } from 'rolecraft'

const result = await test('./my-skill/SKILL.md')
// { skill: 'my-skill', score: 73, grade: 'C', label: 'Adequate',
//   assertions: [{ name: 'name-defined', pass: true, weight: 10 }, ...],
//   suggestions: ['Add "slug" field to frontmatter'] }

const all = await test(null, { all: true, minScore: 80 })
// { results: [...], summary: { total: 4, passed: 3, failed: 1 } }

See also ​