gretchenfitze/anti-slop / skills/anti-slop-rollout
anti-slop-rollout
VerifiedCarry out the next step of an anti-AI-slop rollout plan (anti-slop/todo.md, with the reasoning in anti-slop/plan.md) as one pull request: add a single check in whatever stack the plan records (a strict TypeScript flag, sonarjs, unnecessary-effect, or test lint rules, layer boundaries, a custom lint rule from a past bug, an agent hook, Stryker mutation testing, knip and dead-file scripts, jscpd, react-doctor, a CI gate, a scheduled report, and the final trim of the agent rules file), fix or baseline what it finds, document its commands in the agent rules file, verify it, and open the PR. Use when the user says "next anti-slop step", "do step N of the plan", asks which rules in AGENTS.md or CLAUDE.md the linters now cover, or asks to set up knip, jscpd, react-doctor, Stryker, sonarjs, or boundaries the gradual way (warnings first, CI gate last) in a repo that has an anti-slop plan. Needs the plan from anti-slop-audit; without one, run the audit first.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.4 KB |
| assets/agent-check.shexecutable | script | 3.0 KB |
| assets/lint-rules/index.cjs | script | 1.6 KB |
| assets/lint-rules/lint-rules.test.mjs | script | 2.2 KB |
| assets/scripts/changed-mutants.mjs | script | 1.2 KB |
| assets/scripts/find-dead-code.mjs | script | 2.1 KB |
| assets/scripts/find-dead-mocks.mjs | script | 6.2 KB |
| assets/scripts/jscpd-top.mjs | script | 4.3 KB |
| assets/scripts/mutation-pr-report.mjs | script | 4.1 KB |
| assets/scripts/pr-comment.mjs | script | 1.8 KB |
| assets/scripts/resolve-module.mjs | script | 4.8 KB |
| references/recipes.md | markdown | 54.6 KB |
assets/scripts/resolve-module.mjs
View on GitHub// From ts-workbench (https://github.com/mikhin/ts-workbench) by Yuri Mikhin (https://github.com/mikhin), MIT.
// Generalized for existing repos: knip.json or knip.jsonc, source globs from knip's `project` (with
// `!` negations, `ignoreFiles`, and git-ignored files skipped), aliases from tsconfig `paths`, `.js`
// specifiers that point at `.ts`, and Vite `?query` suffixes.
import { execFileSync } from "node:child_process";
import { globSync, readFileSync, statSync } from "node:fs";
import path from "node:path";
export const ROOT = path.resolve(import.meta.dirname, "..");
const stripJsonc = (text) => {
let out = "";
let inString = false;
for (let i = 0; i < text.length; i += 1) {
const char = text[i];
if (inString) {
out += char;
if (char === "\\") out += text[++i] ?? "";
else if (char === '"') inString = false;
} else if (char === '"') {
inString = true;
out += char;
} else if (char === "/" && text[i + 1] === "/") {
while (i < text.length && text[i] !== "\n") i += 1;
out += "\n";
} else if (char === "/" && text[i + 1] === "*") {
i = text.indexOf("*/", i + 2);
if (i === -1) break;
i += 1;
} else {
out += char;
}
}
return out.replaceAll(/,(\s*[}\]])/g, "$1");
};
const readConfig = (file) => {
try {
return JSON.parse(stripJsonc(readFileSync(path.resolve(ROOT, file), "utf8")));
} catch {
return null;
}
};
const knipConfig =
["knip.json", "knip.jsonc", ".knip.json", ".knip.jsonc"].map(readConfig).find(Boolean) ?? {};
const asList = (value) => (value === undefined ? [] : [value].flat());
const tsPaths = () => {
let file = "tsconfig.json";
for (let depth = 0; depth < 5; depth += 1) {
const config = readConfig(file);
const options = config?.compilerOptions ?? {};
if (options.paths) {
return { baseUrl: path.resolve(ROOT, path.dirname(file), options.baseUrl ?? "."), paths: options.paths };
}
const parent = asList(config?.extends).find((entry) => entry.startsWith("."));
if (!parent) break;
file = path.join(path.dirname(file), parent.endsWith(".json") ? parent : `${parent}.json`);
}
return { baseUrl: ROOT, paths: { "@/*": ["./src/*"] } };
};
const { baseUrl, paths } = tsPaths();
const aliases = Object.entries(paths).map(([key, [target]]) => ({
prefix: key.replace(/\*$/, ""),
wildcard: key.endsWith("*"),
target: path.resolve(baseUrl, target.replace(/\*$/, "")),
}));
const ignoredByKnip = (file) =>
[...asList(knipConfig.ignore), ...asList(knipConfig.ignoreFiles)].some((pattern) =>
path.matchesGlob(file, pattern),
);
// Knip skips what git ignores (build output, caches), so the walk does too.
const gitFiles = new Set(
execFileSync("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
cwd: ROOT,
encoding: "utf8",
maxBuffer: 256 * 1024 * 1024,
}).split("\0"),
);
// Knip patterns: a leading `!` negates.
const expand = (patterns) => {
const negated = patterns.filter((pattern) => pattern.startsWith("!")).map((pattern) => pattern.slice(1));
return globSync(
patterns.filter((pattern) => !pattern.startsWith("!")),
{ cwd: ROOT, exclude: (file) => file.includes("node_modules") },
)
.map(String)
.filter((file) => gitFiles.has(file) && !negated.some((pattern) => path.matchesGlob(file, pattern)));
};
export const knipEntries = () => expand(asList(knipConfig.entry)).map((entry) => path.resolve(ROOT, entry));
export const sourceFiles = () =>
expand(asList(knipConfig.project ?? "src/**/*.{ts,tsx}"))
.filter((file) => !/\.(spec|test)\.[cm]?[jt]sx?$/.test(file) && !file.endsWith(".d.ts"))
.filter((file) => !ignoredByKnip(file))
.toSorted();
const CANDIDATE_SUFFIXES = [
"",
".ts",
".tsx",
".js",
".jsx",
".mjs",
"/index.ts",
"/index.tsx",
"/index.js",
"/index.jsx",
];
const basePath = (specifier, fromFile) => {
if (specifier.startsWith(".")) return path.resolve(path.dirname(fromFile), specifier);
for (const { prefix, wildcard, target } of aliases) {
if (wildcard ? specifier.startsWith(prefix) : specifier === prefix) {
return path.join(target, specifier.slice(prefix.length));
}
}
return null;
};
const isFile = (candidate) => statSync(candidate, { throwIfNoEntry: false })?.isFile();
// null: a package or something outside the repo; false: a local path that resolves to nothing.
export const resolveModule = (rawSpecifier, fromFile) => {
const specifier = rawSpecifier.replace(/\?.*$/, "");
const base = basePath(specifier, fromFile);
if (base === null) return null;
const found = CANDIDATE_SUFFIXES.map((suffix) => base + suffix).find(isFile);
if (found) return found;
const typescriptTwin = base.replace(/\.([cm]?)js(x?)$/, ".$1ts$2");
return typescriptTwin !== base && isFile(typescriptTwin) ? typescriptTwin : false;
};
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |