Skip to content

Instantly share code, notes, and snippets.

View AutoSponge's full-sized avatar

Paul Grenier AutoSponge

View GitHub Profile
@AutoSponge
AutoSponge / clean.md
Created March 26, 2026 00:26
clean-code

CLAUDE.md — Code Quality Best Practices

30 universal principles distilled from Kent Beck's Smalltalk Best Practice Patterns, generalized for any codebase.

  1. Composed Method Divide every function into sub-functions that each perform one identifiable task. Keep all operations in a method at the same level of abstraction. This naturally produces many small methods, each a few lines long.
  2. Intention-Revealing Names Name methods/functions after what they accomplish, never how they accomplish it. A reader should understand the purpose of a call without reading its body.
  3. Replace Comments with Clear Code
@AutoSponge
AutoSponge / detox.md
Created March 26, 2026 00:23
detox-skill

Read my entire setup before responding. Check my CLAUDE.md, every skill in my skills folder, every file in my context folder, and any other instruction files you can find. Then go through every rule, instruction, and preference you found. For each one, tell me:

  1. Is this something you already do by default without being told?
  2. Does this contradict or conflict with another rule somewhere else in my setup?
  3. Does this repeat something that's already covered by a different rule or file?
  4. Does this read like it was added to fix one specific bad output rather than improve outputs overall?
  5. Is this so vague that you'd interpret it differently every time? (ex: "be more natural" or "use a good tone") Then give me:
  • A list of everything you'd cut, with a one-line reason for each
  • A list of any conflicts you found between files
@AutoSponge
AutoSponge / curve.svg
Last active November 24, 2023 18:11
curve
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AutoSponge
AutoSponge / stream-x.js
Last active May 1, 2020 15:13
streaming custom element
class TextDecoderStream extends TransformStream {
constructor(encoding = 'utf8') {
super({
start() {
this.decoder = new TextDecoder(encoding);
},
transform(chunk, controller) {
controller.enqueue(this.decoder.decode(chunk, { stream: true }));
},
});
@AutoSponge
AutoSponge / shadow-walk-ax.js
Last active April 29, 2020 16:13
shadow heading check
// start scriptwriter (see https://scriptwriter.dev)
function* walkAxTree(node, filter) {
if (filter(node)) {
yield node;
}
const children = node.children || [];
for (const child of children) {
yield* walkAxTree(child, filter);
}
}
@AutoSponge
AutoSponge / index.html
Last active June 9, 2022 12:59
light dom render custom element
<!DOCTYPE html>
<html lang="en">
<head>
<title>Minimal Custom Elements (light &amp; shadow)!</title>
<!-- Import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<!-- Import the webpage's javascript file -->
<script src="/script.js" defer></script>
@AutoSponge
AutoSponge / _axe.md
Last active March 31, 2020 10:53
axe-core custom command for scriptwriter and accompanying Code Tour file.

Axe Custom Command for Scriptwriter

  • install playwright npm i -g playwright.
  • install scriptwriter npm i -g scriptwriter.
  • create a folder to run scriptwriter from and to load and save files.
  • install axe-core npm -i axe-core. You can load the axe-core.command.json file to show you how to build your own commands.
  • start scriptwriter scriptwriter. You can load into -b firefox or -b webkit.
  • copy the axe.command.js file to your folder and .load axe.command or paste it right into the repl.
  • next, navigate to a site using page.goto or if you used scriptwriter --no-headless you can browse.
@AutoSponge
AutoSponge / dupe-dom-ids.js
Last active March 30, 2020 15:41
finds duplicate dom ids
Array.from(document.querySelectorAll('[id]')).reduce((cache, el) => {
const els = cache[el.id] || [];
cache[el.id] = els.concat(el);
return cache;
}, {})
@AutoSponge
AutoSponge / .betterer.ts
Created March 21, 2020 15:41
betterer-test
const got = require('got');
const cheerio = require('cheerio');
const natural = require('natural');
const sentenceTokenizer = new natural.SentenceTokenizer();
const wordTokenizer = new natural.WordTokenizer();
const automatedReadability = require('automated-readability');
const page = 'https://www.24a11y.com/2019/automating-inclusive-documentation/';
const { smaller } = require('@betterer/constraints');
module.exports = {