Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a href="#limits">Limits</a>
</p>

One commit gate and fourteen skill files for coding agents.
One commit gate and fifteen skill files for coding agents.

The gate is the part that cannot be ignored: it rejects a commit or a pull request whose message does not carry the five-key slice report. The skills describe how to produce one.

Expand Down Expand Up @@ -40,17 +40,18 @@ or copy `gate/steerloop-gate.mjs` into your own tooling and call it from a `comm

## Profiles

Not every project needs fourteen skills. `stack.json` is the machine-readable list; these are the same groups as commands:
Not every project needs fifteen skills. `stack.json` is the machine-readable list; these are the same groups as commands:

| Profile | What it covers | Install |
| --- | --- | --- |
| core | Gates, method, deepening | `npx skills add lukavtz/steerloop --skill steerloop --skill craftloop --skill be-ambitious` |
| git | Commits, branches, PRs, conflicts, recovery | `npx skills add lukavtz/steerloop --skill gitkeeper` |
| web | Core plus performance and a landing page | `npx skills add lukavtz/steerloop --skill steerloop --skill craftloop --skill webperf --skill landing-page-design` |
| design | Page, Figma, anti-slop pass, figures, README | `npx skills add lukavtz/steerloop --skill landing-page-design --skill figma-designer --skill hallmark --skill anatomy --skill beautify-github-readme` |
| text | English and Russian prose | `npx skills add lukavtz/steerloop --skill stop-slop --skill ru-text --skill ru-check --skill ru-score --skill humanizer-ru` |
| full | All fourteen | `npx skills add lukavtz/steerloop` |
| full | All fifteen | `npx skills add lukavtz/steerloop` |

`npm test` validates every `SKILL.md` frontmatter and checks that `stack.json` matches the tree, so a skill cannot be added without being listed.
`npm test` validates every `SKILL.md` against the Agent Skills rules — frontmatter, a 500-line body budget, one-level references that all resolve, no placeholders — and checks that `stack.json` matches the tree, so a skill cannot be added without being listed.

## The gate

Expand All @@ -73,6 +74,7 @@ npm run gate:check -- pr-body.md
| Group | Skills | Fires when |
| --- | --- | --- |
| Process | `steerloop`, `craftloop`, `be-ambitious` | Every coding task; substantial work; a request worth deepening rather than enlarging |
| Git | `gitkeeper` | Any git or GitHub operation: committing, branching, conflicts, rebasing, worktrees, recovery, PRs, reviews, releases, `gh` |
| Web | `webperf` | A slow page, or a change touching loading, bundles, images, queries |
| Design | `landing-page-design`, `figma-designer`, `hallmark`, `anatomy`, `beautify-github-readme` | A landing page, a Figma file, an anti-slop visual pass, an isometric figure, a repository README |
| Prose | `stop-slop`, `ru-text`, `ru-check`, `ru-score`, `humanizer-ru` | Drafting, editing or reviewing text, in English or Russian; typography that applies to every Russian output |
Expand Down Expand Up @@ -155,8 +157,8 @@ skills/craftloop/SKILL.md the method
skills/craftloop/references/ security rules, loaded on demand
skills/webperf/SKILL.md web performance router
skills/webperf/references/ 31 recipes, one per symptom
skills/* fourteen skills, five original
scripts/validate-skills.mjs frontmatter and stack.json check
skills/* fifteen skills, four original
scripts/validate-skills.mjs skill structure and stack.json check
stack.json skills, profiles, origins, licenses
THIRD_PARTY_LICENSES/ MIT texts for the vendored skills
gate/steerloop-gate.mjs the report validator
Expand Down
8 changes: 4 additions & 4 deletions THIRD_PARTY_NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Skills vendored from other repositories. All are MIT; the license text for each
| --- | --- | --- | --- |
| `landing-page-design`, `figma-designer` | elayadesign/ai-design-skills | `456d9e0` | `elaya-ai-design-skills.txt` |
| `be-ambitious` | DannyMac180/skills | `7dc63b7` | `dannymac180-skills.txt` |
| `hallmark` | nutlope/hallmark | `407fa68` | `nutlope-hallmark.txt` |
| `hallmark` | nutlope/hallmark | `04977e1` | `nutlope-hallmark.txt` |
| `stop-slop` | hardikpandya/stop-slop | `8da1f03` | `hardikpandya-stop-slop.txt` |
| `anatomy` | wheresryan22/anatomy | `1482e84` | `wheresryan22-anatomy.txt` |
| `beautify-github-readme` | oil-oil/beautify-github-readme | `d6562a5` | `oil-oil-beautify-github-readme.txt` |
| `beautify-github-readme` | oil-oil/beautify-github-readme | `fcdb950` | `oil-oil-beautify-github-readme.txt` |
| `ru-text`, `ru-check`, `ru-score` | talkstream/ru-text | `e398aec` | `talkstream-ru-text.txt` |
| `humanizer-ru` | ilyautov/humanizer-ru | `b6df5d9` | `ilyautov-humanizer-ru.txt` |
| `humanizer-ru` | ilyautov/humanizer-ru | `7374133` | `ilyautov-humanizer-ru.txt` |

Files are copied verbatim and not modified here.

Expand All @@ -25,4 +25,4 @@ Two skills carry code that this repository does not run in CI:
- `humanizer-ru` ships its Python scanner and metrics package verbatim. The skill falls back to manual editing when the scanner is unavailable.
- `anatomy` ships its Node audit scripts verbatim; they need Chrome, as its own documentation states.

`steerloop`, `webperf` and the gate are original to this repository. `craftloop` belongs to its author and is included with two sentences changed, noted in the README.
`steerloop`, `webperf`, `gitkeeper` and the gate are original to this repository. `craftloop` belongs to its author and is included with two sentences changed, noted in the README.
4 changes: 2 additions & 2 deletions assets/readme/build_hero.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def hero() -> None:
canvas.paste(panel, (500, 16), panel)

d = ImageDraw.Draw(canvas)
d.text((72, 104), "AGENT SKILLS · FOURTEEN FILES", font=font("consola.ttf", 17), fill=MUTED)
d.text((72, 104), "AGENT SKILLS · FIFTEEN FILES", font=font("consola.ttf", 17), fill=MUTED)
d.text((72, 146), "steerloop", font=font("segoeuib.ttf", 92), fill=FG)
d.text((74, 262), "One slice at a time. The agent asks", font=font("segoeui.ttf", 25), fill=(201, 205, 210))
d.text((74, 296), "before it writes code.", font=font("segoeui.ttf", 25), fill=(201, 205, 210))
Expand All @@ -55,7 +55,7 @@ def hero() -> None:
d.text((90, 362), cmd, font=cf, fill=ACCENT)

d.line([(72, 420), (72 + tw + 36, 420)], fill=(58, 58, 58))
d.text((72, 430), "14 SKILLS · MIT · npx skills add lukavtz/steerloop", font=font("consola.ttf", 14), fill=DIM)
d.text((72, 430), "15 SKILLS · MIT · npx skills add lukavtz/steerloop", font=font("consola.ttf", 14), fill=DIM)
canvas.save(HERE / "hero.png", optimize=True)


Expand Down
Binary file modified assets/readme/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"steerloop-gate": "./gate/steerloop-gate.mjs"
},
"scripts": {
"test": "node --test gate/steerloop-gate.test.mjs && node scripts/validate-skills.mjs",
"test": "node --test gate/steerloop-gate.test.mjs scripts/validate-skills.test.mjs && node scripts/validate-skills.mjs",
"gate:install": "git config core.hooksPath .githooks",
"gate:check": "node gate/steerloop-gate.mjs --body-file",
"validate": "node scripts/validate-skills.mjs"
Expand Down
151 changes: 135 additions & 16 deletions scripts/validate-skills.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,51 @@
#!/usr/bin/env node
// Validates every skills/<name>/SKILL.md against the Agent Skills frontmatter rules,
// Validates every skills/<name>/SKILL.md against the Agent Skills frontmatter and body rules,
// and checks stack.json against the tree.
// Usage: node scripts/validate-skills.mjs
// Usage: node scripts/validate-skills.mjs [root]

import { existsSync, readFileSync, readdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
const SKILLS = join(ROOT, "skills");
const DEFAULT_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
const NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
const LIMITS = { name: 64, description: 1024, compatibility: 500 };
// Spec keys plus the Claude Code skills frontmatter reference fields this repo already uses.
const KEYS = [
"name",
"description",
"license",
"compatibility",
"metadata",
"allowed-tools",
"argument-hint",
"disallowed-tools",
"context",
"model",
"effort",
"user-invocable",
"version",
];
const BODY_LIMIT = 500;
const PLACEHOLDER = /\b(TODO|TBD|FIXME|XXX)\b/g;
const HOST_PATH = /(?:[A-Za-z]:\\|\/Users\/|\/home\/)/g;
// A skill-relative path only: `**/x/references/a.md` and `../x/references/a.md` are search or foreign paths.
const REFERENCE = /(?<![\w*/-])(?:\.\/)?references\/[A-Za-z0-9._-]+\.md/g;
// A glob naming reference files, e.g. `review-*.md`, `references/review-*.md`, `*.md`.
const REFERENCE_GLOB = /[A-Za-z0-9._/*-]*\*[A-Za-z0-9._/-]*\.md/g;

function frontmatter(raw) {
const lines = raw.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n").split("\n");
if (lines[0]?.trim() !== "---") return null;
const end = lines.findIndex((line, index) => index > 0 && line.trim() === "---");
return end < 0 ? null : parseBlock(lines.slice(1, end));
if (end < 0) return null;
const block = lines.slice(1, end);
return {
data: parseBlock(block),
keys: topKeys(block),
body: lines.slice(end + 1).join("\n"),
bodyLine: end + 2,
};
}

function parseBlock(lines) {
Expand All @@ -37,11 +66,74 @@ function parseBlock(lines) {
return out;
}

function skillProblems(dir) {
const file = join(SKILLS, dir, "SKILL.md");
function topKeys(lines) {
return lines.flatMap((line, index) => {
const match = line.match(/^([A-Za-z0-9_-]+):/);
return match ? [{ key: match[1], line: index + 2 }] : [];
});
}

function hits(text, pattern, firstLine) {
return text.split("\n").flatMap((line, index) =>
[...line.matchAll(pattern)].map((match) => ({ text: match[0], line: firstLine + index })),
);
}

function esc(text) {
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

// A file counts as mentioned when its name appears as a whole token, bare or behind `references/`.
function mentions(body, file) {
return new RegExp(`(?:^|[^\\w.-])${esc(file)}(?![\\w.-])`).test(body);
}

// Exact mention, or a glob in the body that matches the file name or its references/ path.
function mentioned(body, file) {
if (mentions(body, file)) return true;
const paths = [file, `references/${file}`];
return [...body.matchAll(REFERENCE_GLOB)].some(([glob]) => {
const pattern = new RegExp(`^${esc(glob).replace(/\\\*/g, "[^/]*")}$`);
return paths.some((path) => pattern.test(path));
});
}

function bodyLines(body) {
return body.endsWith("\n") ? body.split("\n").length - 1 : body.split("\n").length;
}

function referenceProblems(dir, body, bodyLine, skillsDir) {
const base = join(skillsDir, dir);
const rel = `skills/${dir}/SKILL.md`;
const problems = [];
for (const { text, line } of hits(body, REFERENCE, bodyLine)) {
if (!existsSync(join(base, text))) problems.push(`${rel}:${line}: mentions ${text}, which does not exist`);
}
const refs = join(base, "references");
if (!existsSync(refs)) return problems;
const files = readdirSync(refs, { withFileTypes: true })
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
.map((entry) => entry.name)
.sort();
for (const name of files) {
if (!mentioned(body, name)) problems.push(`${rel}: references/${name} exists but SKILL.md never mentions it`);
const nested = readFileSync(join(refs, name), "utf8").replace(/\r\n?/g, "\n");
for (const { text, line } of hits(nested, REFERENCE, 1)) {
if (!mentioned(body, text.split("/").pop())) {
problems.push(`skills/${dir}/references/${name}:${line}: nested reference ${text} is not mentioned in SKILL.md`);
}
}
}
return problems;
}

function skillProblems(dir, skillsDir) {
const rel = `skills/${dir}/SKILL.md`;
const file = join(skillsDir, dir, "SKILL.md");
if (!existsSync(file)) return [`${dir}: SKILL.md is missing`];
const data = frontmatter(readFileSync(file, "utf8"));
if (!data) return [`${dir}: no frontmatter block`];
const meta = frontmatter(readFileSync(file, "utf8"));
if (!meta) return [`${dir}: no frontmatter block`];
const { data, keys, body, bodyLine } = meta;
const problems = [];
if (!data.name) problems.push(`${dir}: name is missing`);
else if (data.name !== dir) problems.push(`${dir}: name "${data.name}" does not match the folder`);
Expand All @@ -50,7 +142,28 @@ function skillProblems(dir) {
for (const [key, max] of Object.entries(LIMITS)) {
if (data[key] && data[key].length > max) problems.push(`${dir}: ${key} is ${data[key].length} chars, limit ${max}`);
}
return problems;
for (const { key, line } of keys) {
if (!KEYS.includes(key)) problems.push(`${rel}:${line}: frontmatter key "${key}" is not allowed (allowed: ${KEYS.join(", ")})`);
}
const lines = bodyLines(body);
if (lines > BODY_LIMIT) problems.push(`${rel}: body is ${lines} lines after frontmatter, limit ${BODY_LIMIT}`);
for (const { text, line } of hits(body, PLACEHOLDER, bodyLine)) problems.push(`${rel}:${line}: placeholder ${text} in the body`);
for (const { text, line } of hits(body, HOST_PATH, bodyLine)) problems.push(`${rel}:${line}: absolute host path ${text}`);
return [...problems, ...referenceProblems(dir, body, bodyLine, skillsDir)];
}

function duplicateDescriptions(skills, skillsDir) {
const seen = new Map();
for (const dir of skills) {
const file = join(skillsDir, dir, "SKILL.md");
if (!existsSync(file)) continue;
const description = frontmatter(readFileSync(file, "utf8"))?.data.description;
if (!description) continue;
seen.set(description, [...(seen.get(description) ?? []), `skills/${dir}`]);
}
return [...seen.values()]
.filter((dirs) => dirs.length > 1)
.map((dirs) => `duplicate description: ${dirs.join(", ")}`);
}

function listingProblems(skills, stack) {
Expand All @@ -66,19 +179,25 @@ function profileProblems(skills, stack) {
);
}

function stackProblems(skills) {
const file = join(ROOT, "stack.json");
function stackProblems(skills, root) {
const file = join(root, "stack.json");
if (!existsSync(file)) return ["stack.json is missing"];
const stack = JSON.parse(readFileSync(file, "utf8"));
return [...listingProblems(skills, stack), ...profileProblems(skills, stack)];
}

function main() {
const skills = readdirSync(SKILLS, { withFileTypes: true })
const root = process.argv[2] ? resolve(process.argv[2]) : DEFAULT_ROOT;
const skillsDir = join(root, "skills");
const skills = readdirSync(skillsDir, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
.map((entry) => entry.name)
.sort();
const problems = [...skills.flatMap(skillProblems), ...stackProblems(skills)];
const problems = [
...skills.flatMap((dir) => skillProblems(dir, skillsDir)),
...duplicateDescriptions(skills, skillsDir),
...stackProblems(skills, root),
];
if (problems.length === 0) {
console.log(`skills: ${skills.length} valid, stack.json consistent`);
return 0;
Expand All @@ -88,4 +207,4 @@ function main() {
return 1;
}

process.exit(main());
process.exit(main());
Loading
Loading