Skip to content

100x is a skill by a former Cursor engineer that turns prompts into formally verified, production-ready code

Ship the plugin's templates as Markdown, not scripts

Dead Internetb197bc73cd40
diff --git a/lib/claude-plugin.mjs b/lib/claude-plugin.mjs
index f08854c..fa49523 100644
--- a/lib/claude-plugin.mjs
+++ b/lib/claude-plugin.mjs
@@ -52,13 +52,47 @@ export function listFiles(dir) {
return out.sort();
}
+// The directory takes a script only from a Verified organization, and the portal blocks the submission for any other: see LOCAL_CODE_FILE_TYPE in its report. The
+// skills keep their templates as real scripts, which the tests run, and the plugin ships each one as a Markdown file that holds the same code.
+export const SCRIPT = /\.(mjs|cjs|js|jsx|ts|tsx|sh|bash|zsh|py|rb|ps1|bat|cmd)$/i;
+
+// A script as the Markdown file the plugin ships: what it is, what to do with it, and the whole code in one fenced block. `scriptCode` is the way back.
+export function scriptAsMarkdown(name, source) {
+ const fence = '`'.repeat(Math.max(3, ...(source.match(/`+/g) ?? []).map((run) => run.length + 1)));
+ const body = source.endsWith('\n') ? source : `${source}\n`;
+ return `# ${name}\n\nThe Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named \`${name}\`, for example in \`.100x/must-not-break/\`, and run it from there as the skill says. It needs only Node.js.\n\n${fence}js\n${body}${fence}\n`;
+}
+
+// The code in a file that `scriptAsMarkdown` wrote.
+export function scriptCode(markdown) {
+ const lines = markdown.split('\n');
+ const open = lines.findIndex((line) => /^`{3,}js$/.test(line));
+ const fence = lines[open].slice(0, -2);
+ return `${lines.slice(open + 1, lines.lastIndexOf(fence)).join('\n')}\n`;
+}
+
+// What a skill with scripts tells the agent once they are Markdown, added to the end of its SKILL.md in the plugin.
+const SCRIPT_NOTE = '\n## In the Claude plugin\n\nThe directory takes no script files, so each script named under `assets/` is a Markdown file with `.md` added to its name, such as `assets/asset-check.mjs.md`. Its code block is the whole script. Save the code as a file with the original name in the project, for example in `.100x/must-not-break/`, and run it from there as written above.\n';
+
// The files the build owns, as relative path -> contents. The files in HAND_WRITTEN are not among them.
export function generatedFiles(root) {
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
const files = new Map();
files.set('.claude-plugin/plugin.json', Buffer.from(`${JSON.stringify(pluginManifest(pkg), null, 2)}\n`));
for (const name of ['LICENSE', 'NOTICE.md']) files.set(name, fs.readFileSync(path.join(root, name)));
- for (const rel of listFiles(path.join(root, 'skills'))) files.set(`skills/${rel}`, fs.readFileSync(path.join(root, 'skills', rel)));
+ const withScripts = new Set();
+ for (const rel of listFiles(path.join(root, 'skills'))) {
+ const bytes = fs.readFileSync(path.join(root, 'skills', rel));
+ if (!SCRIPT.test(rel)) files.set(`skills/${rel}`, bytes);
+ else {
+ files.set(`skills/${rel}.md`, Buffer.from(scriptAsMarkdown(path.basename(rel), bytes.toString('utf8'))));
+ withScripts.add(rel.split('/')[0]);
+ }
+ }
+ for (const skill of withScripts) {
+ const key = `skills/${skill}/SKILL.md`;
+ files.set(key, Buffer.concat([files.get(key), Buffer.from(SCRIPT_NOTE)]));
+ }
return files;
}
diff --git a/plugins/100x/README.md b/plugins/100x/README.md
index fa80b86..c804684 100644
--- a/plugins/100x/README.md
+++ b/plugins/100x/README.md
@@ -42,7 +42,7 @@ Each mode is a skill of its own. A word inside your brief never picks a mode, so
## What it runs, sends and fetches
-The plugin has no hooks, no commands, no agents and no MCP servers. It sends nothing itself. It is Markdown guides plus six small test templates in `skills/100x/assets/`, which Claude copies into your project and runs there.
+The plugin has no hooks, no commands, no agents and no MCP servers. It sends nothing itself. It is Markdown guides plus six small test templates in `skills/100x/assets/`. The directory takes no script files, so each template is a Markdown file that holds its code. Claude saves the code as a script in your project and runs it there.
What the skills tell Claude to do, all on your computer:
diff --git a/plugins/100x/skills/100x/SKILL.md b/plugins/100x/skills/100x/SKILL.md
index c9bd42f..c764402 100644
--- a/plugins/100x/skills/100x/SKILL.md
+++ b/plugins/100x/skills/100x/SKILL.md
@@ -144,3 +144,7 @@ The other modes are the skills in the table above, next to this one. Helpers: `r
## Reply
The output of `100x finish` is the final message, with the review state and the next likely asks. Point to `100x-report` for the gallery. End there.
+
+## In the Claude plugin
+
+The directory takes no script files, so each script named under `assets/` is a Markdown file with `.md` added to its name, such as `assets/asset-check.mjs.md`. Its code block is the whole script. Save the code as a file with the original name in the project, for example in `.100x/must-not-break/`, and run it from there as written above.
diff --git a/plugins/100x/skills/100x/assets/asset-check.mjs b/plugins/100x/skills/100x/assets/asset-check.mjs.md
similarity index 94%
rename from plugins/100x/skills/100x/assets/asset-check.mjs
rename to plugins/100x/skills/100x/assets/asset-check.mjs.md
index 0af9bf2..b86b28d 100644
--- a/plugins/100x/skills/100x/assets/asset-check.mjs
+++ b/plugins/100x/skills/100x/assets/asset-check.mjs.md
@@ -1,11 +1,16 @@
+# asset-check.mjs
+
+The Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named `asset-check.mjs`, for example in `.100x/must-not-break/`, and run it from there as the skill says. It needs only Node.js.
+
+```js
// Asset check for products whose art, sound or models are the product. Copy into the project, for example .100x/must-not-break/.
// node asset-check.mjs <folder> [--max-kb 1024] [--max-total-mb 25] [--min-px 16]
// Checks. there are assets, every file opens (real header, not empty), every file is under budget, the whole folder is under budget,
// no two files are the same bytes, and frames of one set ("run_01.png", "run_02.png") share a size.
// It cannot judge taste. Open the files or a contact sheet and look. Exit code 1 when any check fails.
-import crypto from 'node:crypto';
-import fs from 'node:fs';
-import path from 'node:path';
+import crypto from 'node:crypto'
+import fs from 'node:fs'
+import path from 'node:path'
const args = process.argv.slice(2);
const option = (name, fallback) => {
@@ -101,3 +106,4 @@ record('sets', mixed, `${[...sets.values()].filter((frames) => frames.length > 1
for (const check of checks) console.log(`${check.ok ? 'pass' : 'FAIL'} ${check.name}. ${check.detail}`);
process.exitCode = checks.every((check) => check.ok) ? 0 : 1;
+```
diff --git a/plugins/100x/skills/100x/assets/economy-simulator.mjs b/plugins/100x/skills/100x/assets/economy-simulator.mjs.md
similarity index 85%
rename from plugins/100x/skills/100x/assets/economy-simulator.mjs
rename to plugins/100x/skills/100x/assets/economy-simulator.mjs.md
index 4cfa04f..682c038 100644
--- a/plugins/100x/skills/100x/assets/economy-simulator.mjs
+++ b/plugins/100x/skills/100x/assets/economy-simulator.mjs.md
@@ -1,3 +1,8 @@
+# economy-simulator.mjs
+
+The Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named `economy-simulator.mjs`, for example in `.100x/must-not-break/`, and run it from there as the skill says. It needs only Node.js.
+
+```js
// Idle game economy simulator. Copy into the project, for example .100x/must-not-break/economy-simulator.mjs.
// Replace the model block with the game's own rules. If the rules live inside UI code, extract them first
// into pure functions of state and elapsed seconds. The rules must be importable for this to prove anything.
@@ -18,21 +23,21 @@
// gaps over the whole run the longest wait stays under STALL_MINUTES
// offline returning after hours away pays what the same hours of play would have produced
// runs (PRESTIGE=1) no run between resets is shorter than RUN_MIN_MINUTES, so the loop never becomes a chore
-const env = (name, fallback) => (process.env[name] === undefined ? fallback : Number(process.env[name]));
-const HOURS = env('HOURS', 48);
-const GROWTH = env('GROWTH', 1.07);
-const TAPS_PER_SECOND = env('TAPS', 3);
-const EARLY_GAP_MINUTES = env('EARLY_GAP_MINUTES', 5);
-const STALL_MINUTES = env('STALL_MINUTES', 60);
-const FIRST_BUY_SECONDS = env('FIRST_BUY_SECONDS', 30);
-const OFFLINE_HOURS = env('OFFLINE_HOURS', 8);
+const num = (value, fallback) => (value === undefined ? fallback : Number(value));
+const HOURS = num(process.env.HOURS, 48);
+const GROWTH = num(process.env.GROWTH, 1.07);
+const TAPS_PER_SECOND = num(process.env.TAPS, 3);
+const EARLY_GAP_MINUTES = num(process.env.EARLY_GAP_MINUTES, 5);
+const STALL_MINUTES = num(process.env.STALL_MINUTES, 60);
+const FIRST_BUY_SECONDS = num(process.env.FIRST_BUY_SECONDS, 30);
+const OFFLINE_HOURS = num(process.env.OFFLINE_HOURS, 8);
const MILESTONES = [1e3, 1e6, 1e9, 1e12, 1e15, 1e18];
// Optional reset loop. The player resets when the points on offer are at least WORTH of what they hold.
-const PRESTIGE = env('PRESTIGE', 0) === 1;
-const PRESTIGE_STEP = env('PRESTIGE_STEP', 5e6); // a run must earn this much before it pays one point
-const PRESTIGE_BONUS = env('PRESTIGE_BONUS', 0.1); // each point adds this share to all income
-const RUN_MIN_MINUTES = env('RUN_MIN_MINUTES', 3);
-const WORTH = env('WORTH', 0.5);
+const PRESTIGE = num(process.env.PRESTIGE, 0) === 1;
+const PRESTIGE_STEP = num(process.env.PRESTIGE_STEP, 5e6); // a run must earn this much before it pays one point
+const PRESTIGE_BONUS = num(process.env.PRESTIGE_BONUS, 0.1); // each point adds this share to all income
+const RUN_MIN_MINUTES = num(process.env.RUN_MIN_MINUTES, 3);
+const WORTH = num(process.env.WORTH, 0.5);
// Model. Replace.
const UPGRADES = [
@@ -127,3 +132,4 @@ if (process.argv.includes('--json')) {
for (const check of checks) console.log(`${check.ok ? 'pass' : 'FAIL'} ${check.name}. ${check.detail}`);
}
process.exitCode = checks.every((check) => check.ok) ? 0 : 1;
+```
diff --git a/plugins/100x/skills/100x/assets/fresh-data-check.mjs b/plugins/100x/skills/100x/assets/fresh-data-check.mjs.md
similarity index 89%
rename from plugins/100x/skills/100x/assets/fresh-data-check.mjs
rename to plugins/100x/skills/100x/assets/fresh-data-check.mjs.md
index 6d3d1e5..05bdca0 100644
--- a/plugins/100x/skills/100x/assets/fresh-data-check.mjs
+++ b/plugins/100x/skills/100x/assets/fresh-data-check.mjs.md
@@ -1,3 +1,8 @@
+# fresh-data-check.mjs
+
+The Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named `fresh-data-check.mjs`, for example in `.100x/must-not-break/`, and run it from there as the skill says. It needs only Node.js.
+
+```js
// Data fresh-data check for apps that show live or cached data. Copy into the project, for example .100x/must-not-break/.
// node fresh-data-check.mjs <url> [--field updated_at] [--max-age-hours 24] [--array items] [--timeout 10000]
// Checks. the request succeeds in time, the body is JSON, the timestamp field is recent, a named array is not empty.
@@ -46,3 +51,4 @@ if (body !== null) {
}
for (const check of checks) console.log(`${check.ok ? 'pass' : 'FAIL'} ${check.name}. ${check.detail}`);
process.exitCode = checks.every((check) => check.ok) ? 0 : 1;
+```
diff --git a/plugins/100x/skills/100x/assets/money-checks.test.mjs b/plugins/100x/skills/100x/assets/money-checks.test.mjs.md
similarity index 90%
rename from plugins/100x/skills/100x/assets/money-checks.test.mjs
rename to plugins/100x/skills/100x/assets/money-checks.test.mjs.md
index d49c7fb..dcb58f4 100644
--- a/plugins/100x/skills/100x/assets/money-checks.test.mjs
+++ b/plugins/100x/skills/100x/assets/money-checks.test.mjs.md
@@ -1,9 +1,14 @@
+# money-checks.test.mjs
+
+The Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named `money-checks.test.mjs`, for example in `.100x/must-not-break/`, and run it from there as the skill says. It needs only Node.js.
+
+```js
// Property tests for money math. Copy into the project, for example test/must-not-break/money.test.mjs.
// Replace the example functions with imports of the project's own, keep the harness and the invariants,
// then add golden cases from an authority. Run with `node --test test/must-not-break/money.test.mjs`.
// Money is integer cents. If the project stores floats, the first finding is that it should not.
-import assert from 'node:assert/strict';
-import test from 'node:test';
+import assert from 'node:assert/strict'
+import test from 'node:test'
// Example targets so the template runs as it is. Replace these.
function splitCents(totalCents, parts) {
@@ -88,3 +93,4 @@ test('boundaries hold', () => {
assert.deepEqual(splitCents(1, 3), [1, 0, 0]);
assert.equal(sum(splitCents(Number.MAX_SAFE_INTEGER, 7)), Number.MAX_SAFE_INTEGER);
});
+```
diff --git a/plugins/100x/skills/100x/assets/property-checker.mjs b/plugins/100x/skills/100x/assets/property-checker.mjs.md
similarity index 97%
rename from plugins/100x/skills/100x/assets/property-checker.mjs
rename to plugins/100x/skills/100x/assets/property-checker.mjs.md
index 37976a9..b20d14a 100644
--- a/plugins/100x/skills/100x/assets/property-checker.mjs
+++ b/plugins/100x/skills/100x/assets/property-checker.mjs.md
@@ -1,3 +1,8 @@
+# property-checker.mjs
+
+The Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named `property-checker.mjs`, for example in `.100x/must-not-break/`, and run it from there as the skill says. It needs only Node.js.
+
+```js
// Property checker. Copy into the project, for example .100x/must-not-break/property-checker.mjs.
// It explores every state a small model of the software can reach and checks the properties you wrote.
// This is explicit-state model checking with the project's own functions as the transitions.
@@ -26,9 +31,9 @@
// visited. It is not a proof, and every liveness line says "not decided".
// The model is a claim about the software. The proof covers the model, and the checks named guard and post tie the real
// functions to it. Say in the assumptions what the model leaves out.
-const env = (name, fallback) => (process.env[name] === undefined ? fallback : Number(process.env[name]));
-const MAX_STATES = env('MAX_STATES', 200000);
-const MAX_DEPTH = env('MAX_DEPTH', Infinity);
+const num = (value, fallback) => (value === undefined ? fallback : Number(value));
+const MAX_STATES = num(process.env.MAX_STATES, 200000);
+const MAX_DEPTH = num(process.env.MAX_DEPTH, Infinity);
// ---- The implementation under test. Replace with imports of the project's own functions, which must be pure. ----
function pay(state, amount) {
@@ -365,3 +370,4 @@ if (process.argv.includes('--json')) {
for (const check of checks) console.log((check.ok ? 'pass' : 'FAIL') + ' ' + check.name + '. ' + check.detail);
}
process.exitCode = checks.every((check) => check.ok) ? 0 : 1;
+```
diff --git a/plugins/100x/skills/100x/assets/seed-localstorage.js b/plugins/100x/skills/100x/assets/seed-localstorage.js.md
similarity index 77%
rename from plugins/100x/skills/100x/assets/seed-localstorage.js
rename to plugins/100x/skills/100x/assets/seed-localstorage.js.md
index ac74455..ea629ee 100644
--- a/plugins/100x/skills/100x/assets/seed-localstorage.js
+++ b/plugins/100x/skills/100x/assets/seed-localstorage.js.md
@@ -1,3 +1,8 @@
+# seed-localstorage.js
+
+The Claude plugin ships this script as Markdown, because the directory takes no script files. Save the code below as a file named `seed-localstorage.js`, for example in `.100x/must-not-break/`, and run it from there as the skill says. It needs only Node.js.
+
+```js
// Init script for `100x shots --init-script`. It runs before the page loads, so the game boots into a late game save.
// 100x shots http://localhost:5173 --init-script .100x/must-not-break/seed-localstorage.js --label must-not-break --matrix all
// 1. Find the save key. Run the game once, then read Object.keys(localStorage) in the console.
@@ -15,3 +20,4 @@
};
localStorage.setItem(KEY, JSON.stringify(save));
})();
+```
diff --git a/skills/100x/assets/asset-check.mjs b/skills/100x/assets/asset-check.mjs
index 0af9bf2..8ebda1f 100644
--- a/skills/100x/assets/asset-check.mjs
+++ b/skills/100x/assets/asset-check.mjs
@@ -3,9 +3,9 @@
// Checks. there are assets, every file opens (real header, not empty), every file is under budget, the whole folder is under budget,
// no two files are the same bytes, and frames of one set ("run_01.png", "run_02.png") share a size.
// It cannot judge taste. Open the files or a contact sheet and look. Exit code 1 when any check fails.
-import crypto from 'node:crypto';
-import fs from 'node:fs';
-import path from 'node:path';
+import crypto from 'node:crypto'
+import fs from 'node:fs'
+import path from 'node:path'
const args = process.argv.slice(2);
const option = (name, fallback) => {
diff --git a/skills/100x/assets/economy-simulator.mjs b/skills/100x/assets/economy-simulator.mjs
index 4cfa04f..5b43a7d 100644
--- a/skills/100x/assets/economy-simulator.mjs
+++ b/skills/100x/assets/economy-simulator.mjs
@@ -18,21 +18,21 @@
// gaps over the whole run the longest wait stays under STALL_MINUTES
// offline returning after hours away pays what the same hours of play would have produced
// runs (PRESTIGE=1) no run between resets is shorter than RUN_MIN_MINUTES, so the loop never becomes a chore
-const env = (name, fallback) => (process.env[name] === undefined ? fallback : Number(process.env[name]));
-const HOURS = env('HOURS', 48);
-const GROWTH = env('GROWTH', 1.07);
-const TAPS_PER_SECOND = env('TAPS', 3);
-const EARLY_GAP_MINUTES = env('EARLY_GAP_MINUTES', 5);
-const STALL_MINUTES = env('STALL_MINUTES', 60);
-const FIRST_BUY_SECONDS = env('FIRST_BUY_SECONDS', 30);
-const OFFLINE_HOURS = env('OFFLINE_HOURS', 8);
+const num = (value, fallback) => (value === undefined ? fallback : Number(value));
+const HOURS = num(process.env.HOURS, 48);
+const GROWTH = num(process.env.GROWTH, 1.07);
+const TAPS_PER_SECOND = num(process.env.TAPS, 3);
+const EARLY_GAP_MINUTES = num(process.env.EARLY_GAP_MINUTES, 5);
+const STALL_MINUTES = num(process.env.STALL_MINUTES, 60);
+const FIRST_BUY_SECONDS = num(process.env.FIRST_BUY_SECONDS, 30);
+const OFFLINE_HOURS = num(process.env.OFFLINE_HOURS, 8);
const MILESTONES = [1e3, 1e6, 1e9, 1e12, 1e15, 1e18];
// Optional reset loop. The player resets when the points on offer are at least WORTH of what they hold.
-const PRESTIGE = env('PRESTIGE', 0) === 1;
-const PRESTIGE_STEP = env('PRESTIGE_STEP', 5e6); // a run must earn this much before it pays one point
-const PRESTIGE_BONUS = env('PRESTIGE_BONUS', 0.1); // each point adds this share to all income
-const RUN_MIN_MINUTES = env('RUN_MIN_MINUTES', 3);
-const WORTH = env('WORTH', 0.5);
+const PRESTIGE = num(process.env.PRESTIGE, 0) === 1;
+const PRESTIGE_STEP = num(process.env.PRESTIGE_STEP, 5e6); // a run must earn this much before it pays one point
+const PRESTIGE_BONUS = num(process.env.PRESTIGE_BONUS, 0.1); // each point adds this share to all income
+const RUN_MIN_MINUTES = num(process.env.RUN_MIN_MINUTES, 3);
+const WORTH = num(process.env.WORTH, 0.5);
// Model. Replace.
const UPGRADES = [
diff --git a/skills/100x/assets/money-checks.test.mjs b/skills/100x/assets/money-checks.test.mjs
index d49c7fb..1bd1615 100644
--- a/skills/100x/assets/money-checks.test.mjs
+++ b/skills/100x/assets/money-checks.test.mjs
@@ -2,8 +2,8 @@
// Replace the example functions with imports of the project's own, keep the harness and the invariants,
// then add golden cases from an authority. Run with `node --test test/must-not-break/money.test.mjs`.
// Money is integer cents. If the project stores floats, the first finding is that it should not.
-import assert from 'node:assert/strict';
-import test from 'node:test';
+import assert from 'node:assert/strict'
+import test from 'node:test'
// Example targets so the template runs as it is. Replace these.
function splitCents(totalCents, parts) {
diff --git a/skills/100x/assets/property-checker.mjs b/skills/100x/assets/property-checker.mjs
index 37976a9..50a8c83 100644
--- a/skills/100x/assets/property-checker.mjs
+++ b/skills/100x/assets/property-checker.mjs
@@ -26,9 +26,9 @@
// visited. It is not a proof, and every liveness line says "not decided".
// The model is a claim about the software. The proof covers the model, and the checks named guard and post tie the real
// functions to it. Say in the assumptions what the model leaves out.
-const env = (name, fallback) => (process.env[name] === undefined ? fallback : Number(process.env[name]));
-const MAX_STATES = env('MAX_STATES', 200000);
-const MAX_DEPTH = env('MAX_DEPTH', Infinity);
+const num = (value, fallback) => (value === undefined ? fallback : Number(value));
+const MAX_STATES = num(process.env.MAX_STATES, 200000);
+const MAX_DEPTH = num(process.env.MAX_DEPTH, Infinity);
// ---- The implementation under test. Replace with imports of the project's own functions, which must be pure. ----
function pay(state, amount) {
diff --git a/test/claude-plugin.test.mjs b/test/claude-plugin.test.mjs
index 1e23eb3..bd59093 100644
--- a/test/claude-plugin.test.mjs
+++ b/test/claude-plugin.test.mjs
@@ -3,7 +3,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import test from 'node:test';
-import { buildPlugin, HAND_WRITTEN, ICON, LIMITS, listFiles, PLUGIN_DIR, pluginProblems } from '../lib/claude-plugin.mjs';
+import { buildPlugin, HAND_WRITTEN, ICON, LIMITS, listFiles, PLUGIN_DIR, pluginProblems, SCRIPT, scriptAsMarkdown, scriptCode } from '../lib/claude-plugin.mjs';
import { ROOT } from './helpers.mjs';
// These are the checks of https://claude.com/docs/plugins/pre-submission-checklist that `claude plugin validate` does not run, so a change here cannot
@@ -15,7 +15,7 @@ const files = listFiles(dir);
const readme = fs.readFileSync(path.join(dir, 'README.md'), 'utf8');
const IMAGES = new Set(['.png', '.jpg', '.jpeg', '.gif', '.webp']);
-const TEXT = new Set(['.md', '.mjs', '.js', '.json', '.txt', '.tsv', '.sh', '.yml', '.yaml', '.html', '.css']);
+const TEXT = new Set(['.md', '.json', '.txt', '.tsv', '.yml', '.yaml', '.html', '.css']);
test('plugins/100x is what the build writes from package.json, skills/, LICENSE and NOTICE.md', () => {
assert.deepEqual(pluginProblems(ROOT), [], 'run `node scripts/build-claude-plugin.mjs` and commit the result');
@@ -50,6 +50,7 @@ test('the plugin folder holds no script, no package-manager file and none of the
for (const rel of files) {
const name = path.basename(rel);
const bytes = fs.readFileSync(path.join(dir, rel));
+ assert.ok(!SCRIPT.test(name), `${rel} is a script, which the portal takes only from a Verified organization: ship it as Markdown`);
assert.ok(!packageFiles.test(name), `${rel} is a package manager file`);
assert.ok(!/^(claude|claude\.local|agents)\.md$/i.test(name), `${rel} is a file Claude Code reads as instructions`);
assert.ok(!/[:\\<>"|?*]/.test(rel) && !/(^|\/)(con|prn|aux|nul|com\d|lpt\d)(\.|\/|$)/i.test(rel), `${rel} has a name not every computer keeps`);
@@ -59,6 +60,8 @@ test('the plugin folder holds no script, no package-manager file and none of the
assert.doesNotThrow(() => utf8.decode(bytes), `${rel} is not UTF-8`);
// The portal blocked asset-check.mjs, the one file that held this literal, and takes an .svg only as the plugin icon. A script that checks SVG files writes the tag as a lookahead, /<(?=svg)/.
assert.ok(!/<svg\b/i.test(bytes.toString('utf8')), `${rel} holds an SVG tag, which the portal can take for an SVG file under another name`);
+ // A content sniffer (libmagic's `file`) calls any file with a line that starts `import x from 'y';` Java source, so the file is not text to it. The templates leave the semicolon off.
+ assert.ok(!/^import [^\n]*;[ \t]*$/m.test(bytes.toString('utf8')), `${rel} has an import line that ends with a semicolon, which a content sniffer reads as Java source`);
}
const inManifestFolder = files.filter((rel) => rel.startsWith('.claude-plugin/'));
assert.deepEqual(inManifestFolder, ['.claude-plugin/plugin.json'], 'only the manifest goes in .claude-plugin');
@@ -105,11 +108,27 @@ test('the README names every way the skills leave the machine or change a permis
];
for (const [inSkills, inReadme] of mustSay) if (inSkills.test(skills)) assert.ok(readme.includes(inReadme), `the skills say ${inSkills}, so the README must say "${inReadme}"`);
// A shipped script that opens a connection is named in the README: the portal pairs a script that can send data off the machine with anything that reads a key.
- for (const rel of files.filter((f) => /\.(mjs|js)$/.test(f))) {
- if (/\bfetch\(/.test(fs.readFileSync(path.join(dir, rel), 'utf8'))) assert.ok(readme.includes(path.basename(rel)), `${rel} makes a request, so the README must name it`);
+ for (const rel of files.filter((f) => SCRIPT.test(f.replace(/\.md$/, '')) && f.endsWith('.md'))) {
+ const script = path.basename(rel, '.md');
+ if (/\bfetch\(/.test(scriptCode(fs.readFileSync(path.join(dir, rel), 'utf8')))) assert.ok(readme.includes(script), `${script} makes a request, so the README must name it`);
}
});
+test('each script under skills/ ships as a Markdown file with the same code, and its skill says how to use it', () => {
+ const sources = listFiles(path.join(ROOT, 'skills')).filter((rel) => SCRIPT.test(rel));
+ assert.ok(sources.length >= 6, 'the 100x skill carries its six templates');
+ for (const rel of sources) {
+ const copy = fs.readFileSync(path.join(dir, 'skills', `${rel}.md`), 'utf8');
+ assert.equal(scriptCode(copy), fs.readFileSync(path.join(ROOT, 'skills', rel), 'utf8'), `${rel} and its Markdown copy hold different code`);
+ assert.ok(copy.startsWith(`# ${path.basename(rel)}\n`) && copy.includes(`file named \`${path.basename(rel)}\``), `${rel} copy says which file to save the code as`);
+ const skill = fs.readFileSync(path.join(dir, 'skills', rel.split('/')[0], 'SKILL.md'), 'utf8');
+ assert.equal(skill.split('## In the Claude plugin').length - 1, 1, `${rel.split('/')[0]}/SKILL.md explains the .md copies once`);
+ }
+ const tricky = 'const a = `x`;\n// ```\nconst b = ````;\n';
+ assert.equal(scriptCode(scriptAsMarkdown('t.mjs', tricky)), tricky, 'a script that holds backticks keeps its code, with a longer fence');
+ assert.equal(scriptCode(scriptAsMarkdown('t.mjs', 'no newline')), 'no newline\n');
+});
+
test('a rebuild repairs a plugin folder that holds a stale file, a deleted skill and an empty folder, and keeps the hand-written files', () => {
const root = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), '100x-plugin-'));
try {