agentleFS
gandolhgandolh/my-personal-skills/skills/house-style/SKILL.md

house-style

Skill0 starsChanged 14 days agoMITView on GitHub

The estate's house style for TypeScript repos, written as numbered rules with the reason for each and the lint rule (or review) that enforces it, plus how a repo adopts the quality harness that checks them - the configs vendored from the library's house-style folder (Prettier at 120 columns, one tsconfig base, a thin ESLint config with six typed rules), one reformat commit, npm run check and check:fast, and this plugin's Stop and formatter hooks. Use when the user says "code style", "lint rules", "formatting", "house style", "set up the harness", "add Prettier", "why does lint flag this", or a repo brief says to adopt the house-style harness.

  • Reads credentials

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After any eslint --fix run tsc: no-unnecessary-type-assertion's autofix broke code in four ways, and vitest/valid-expect's can hang a …

    line 78
  2. Distinctive:

    Measure: Run the house configs on a scratch copy and record the counts.

    line 136
  3. Distinctive:

    Put the knip preset's config in before the first measurement.

    line 139
  4. Very specific:

    Prettier: Add the config, .prettierignore, format and format:check, and commit that alone.

    line 148
  5. Very specific:

    The gate: Add check, check:fast, check:conventions, house-style:sync, and test:clean or pretest where needed.

    line 161
  6. Very specific:

    After Edit or Write: if the repo has a Prettier config and an installed Prettier, the saved file is formatted with that Prettier, from …

    line 174

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

House style

The house style is how the estate's TypeScript is already written. It was measured across 23 repos on 2026-11-09 and 2026-11-10 (the numbers are in the library's corpus/wiki/house-style.md): strict compilers, double quotes, semicolons, trailing commas, no enums, factories over classes, comments that explain why. The harness makes that style mechanical, so nobody hand-formats and nobody argues about it in review.

It has two layers:

  • The repo's own gate. npm run check holds for a human, any agent and the deploy. npm run check:fast is its fast subset.
  • The Claude Code layer. This plugin's hooks format each saved file and run check:fast before an agent can end its turn. .claude/rules/web.md and server.md carry the area rules (the names are examples: a repo names its rules files after its own folders), and a short root CLAUDE.md names the commands.

The configs live in the library's house-style/ folder, with its own version (house-style/package.json) and tags house-style-v<version>. Each repo holds a generated copy at vendor/house-style/, refreshed by npm run house-style:sync -- <ref>. Nobody edits the copy by hand.

The rules

The base is @eslint/js and typescript-eslint recommended, untyped. The compiler is the first gate, and the lint config adds only what a type checker can't see: a rule that duplicates the compiler is worse than absent. Every rule's entry in the shipped config carries its reason as a comment.

#RuleWhyEnforced by
1Every package extends one tsconfig.base.json: strict, noUncheckedIndexedAccess, noImplicitOverride, isolatedModules, noUnusedLocals, noFallthroughCasesInSwitch, NodeNextThe compiler catches the most for the least configtsc, from vendor/house-style/tsconfig.base.json
2Only erasable TypeScript: no enum (a string-literal union or an as const object), no namespace, no parameter properties (declare the field)Every file can run under Node's type stripping; unions narrowtsc (erasableSyntaxOnly), no-restricted-syntax (TSEnumDeclaration)
3Type-only imports say type; relative imports carry their real suffixErased imports must be visible to the reader and the bundlertsc (verbatimModuleSyntax), @typescript-eslint/consistent-type-imports, @typescript-eslint/no-import-type-side-effects (an all-inline import { type X } still leaves import {} behind)
4Prettier at 120 columns, trailing commas everywhere, double quotes, semicolons. Markdown stays outThe house already writes this; a formatter makes it freeprettier --check (format:check), the formatter hook
5_-prefixed names are deliberately unused; nothing else isSays "unused on purpose" without a comment@typescript-eslint/no-unused-vars
6Every promise is awaited, returned or voided, and no async function goes where a void callback is expectedA handler that forgets await returns before its write lands@typescript-eslint/no-floating-promises, @typescript-eslint/no-misused-promises
7Await only what is awaitableAn await on a sync call (Drizzle on better-sqlite3) misleads the reader@typescript-eslint/await-thenable
8A switch over a union handles every member, or has a deliberate defaultA new union member must not fall through silently@typescript-eslint/switch-exhaustiveness-check
9No type assertion the compiler already knowsA dead cast hides the next real type change@typescript-eslint/no-unnecessary-type-assertion
10No any: take unknown and narrowany switches the compiler off for everything it touches@typescript-eslint/no-explicit-any
11No non-null ! in source: narrow with a guard. Tests may use it! is an unchecked claim; a guard is a checked one@typescript-eslint/no-non-null-assertion (warning in tests)
12No @ts-ignore; @ts-expect-error only, with its reasonA suppression must fail once the error is gone, and say why@typescript-eslint/ban-ts-comment
13No TODO or FIXME commentsTodos live in corpus/todos/, where someone reads themno-warning-comments
14No console outside scripts and CLIs. Tests stub and assert on it, so they mayServices log through their loggerno-console (off in tests, scripts and the console files)
15App code reads process.env only in its env reader (config.ts, or the files the env option and conventions.json's env key name, kept the same). Tests, tool configs (*.config.*) and scripts aren't app code and may read it. A file allowed to print (a server entry, a seed CLI inside the app) still reads it through the readerOne place says what the app needs and fails earlyn/no-process-env (off in tests, *.config.*, scripts and the env files; on in the console globs)
16Named exports. A default export only where a framework or a runtime contract needs one (configs, route modules, scenes read as mod.default)Names survive renames and search; imports agreeimport-x/no-default-export
17React follows the rules of hooks and the compiler rulesMirrored state and impure renders are bugs the type checker can't seereact-hooks recommended (on web only)
18Tailwind classes exist in the theme and aren't deprecated; class order is consistent once a repo has migratedA typo'd class renders nothing and fails nowhere elsebetter-tailwindcss/no-unknown-classes, better-tailwindcss/no-deprecated-classes, better-tailwindcss/enforce-consistent-class-order (with tailwind.order)
19Tests: no committed .only, every test asserts, expect(value, "why") is fine, and so is an expect inside a catch or a hookA focused or empty test passes for nothing@vitest/eslint-plugin recommended, vitest/valid-expect (maxArgs: 2), vitest/expect-expect (helpers named in assertFunctionNames), vitest/no-standalone-expect (hooks count as test blocks; an assertion helper is a plain function, not a class method), without vitest/no-conditional-expect
20Stores and services are factory functions returning a documented interface; classes only for Error subclassesThe interface is the contract, and a fake is a plain objectreview
21interface for object shapes, type for unions and mapped typesOne way to say each thingreview
22PascalCase component files; lowercase or kebab-case modulesA file name says what it holdsreview
23Tests sit beside their source as *.test.ts, on vitest (atrium: test/ on node:test)The test is found where the code isreview
24Comments are prose that explains why, in full sentences; every exported member is documented; a decision carries its date; no commented-out codeThe code says what; only the comment can say whyreview
25Exact pins: .npmrc with save-exact=true (and engine-strict=true)An upgrade happens on purpose, and a too-old Node fails loudlyreview

Rules 20-25 have exceptions, so they stay out of lint and out of hooks. references/review-checklist.md is the list a reviewer works through; plan-split-dispatch's review gate points its finders at it. A reviewer skips anything rules 1-19 already enforce.

Escapes are rare and say why: // eslint-disable-next-line <rule> -- <reason>, or // @ts-expect-error <reason>. A tsconfig flag a repo can't take yet is turned off in its own tsconfig with a dated comment that says what turns it on (never a brief number: the estate's corpus rules keep those out of code). A repo without noUncheckedIndexedAccess (the house base turns it on) also turns @typescript-eslint/no-unnecessary-type-assertion off until the flag lands: without the flag the rule flags every ! on an indexed read, and its autofix strips them, so the flag's brief would have to put them back. After any eslint --fix run tsc: no-unnecessary-type-assertion's autofix broke code in four ways, and vitest/valid-expect's can hang a fake-timer test (the adoption reference lists them). imbatranimOS's NestJS backend keeps parameter properties and emitDecoratorMetadata this way.

What an adopted repo has

  • vendor/house-style/: the generated copy, with README.md as its header (version, source commit, and where the upgrade notes are). ESLint, Prettier and knip ignore it.
  • Root configs that extend the copy: prettier.config.js (.mjs in a root without "type": "module"), tsconfig.base.json, eslint.config.js (calling the copy's named export houseStyle, a function of the repo's folders), a knip.config.js that spreads the knip preset (knip has no extends), .dependency-cruiser.cjs extending its preset, and a .prettierignore listing *.md and vendor/house-style/. A Tailwind stylesheet has @source not for vendor/.
  • scripts/conventions.json: the source folders the two checkers walk, and any finding the repo accepts, each with its reason.
  • .git-blame-ignore-revs with the one reformat commit.
  • These scripts in the root package.json:
ScriptWhat it runs
checknode vendor/house-style/bin/check.mjs typecheck lint format:check check:conventions test: every step runs, the output is in node_modules/.cache/check/last.log. Run once, after the last code change
check:fastnpm run typecheck, then ESLint on the changed and untracked files, from a small Node script in scripts/ (npm run typecheck && node scripts/check-fast.mjs: tsc -b alone misses web type errors when the web project sits outside its graph). Never tests. Target 15 s, up to about 30 s
format, format:checkprettier --write ., prettier --check . --cache --cache-location node_modules/.cache/prettier-check/.prettier-cache (the formatter hook deletes the default cache)
check:conventionsknip, depcruise <roots> --cache node_modules/.cache/dependency-cruiser, then node vendor/house-style/bin/check-base-ui.mjs and node vendor/house-style/bin/check-structure.mjs, each --warn-only until the repo's own Base UI or server brief drops it. Roots come from conventions.json
house-style:syncnode vendor/house-style/bin/sync.mjs
test:cleanOnly where the tests would read a production .env: the tests, in a copy without .env*. check calls it instead of test
  • A short root CLAUDE.md (under about 60 lines): what the repo is, "read corpus/index.md first", the commands, the places that mislead, the hard rules.
  • .claude/rules/web.md and .claude/rules/server.md, each with a paths: glob (web/src/**, server/src/**), under about 40 lines, carrying the base-ui and code-structure rules where they apply. web.md also carries the browser line (Chrome on Android decides what to build; Safari on iPhone, Firefox and desktop Safari must keep working; read the web-platform skill before a feature newer than Baseline Widely available). A .gitignore that ignores .claude or .claude/* gets a !.claude/rules/ line.
  • A repo with two npm projects keeps the tool pins in the package.json of the folder that holds vendor/house-style/ (the vendored ESLint config resolves its plugins from where it sits), and a project inside that folder with its own package.json gives knip ignoreBinaries for eslint, prettier and knip. The Stop hook finds each project's check:fast from the files saved in it.

Adopting it

One commit per step, on main, each with typecheck, tests, lint and build green. references/adoption.md has the commands and the traps each step hit in the repo briefs, and references/recipes.md the recipes the house leaves to a repo's own block: a folder's no-console or n/no-process-env, a NestJS folder on recommendedTypeChecked, react-refresh, and an Astro repo.

  1. Measure. Run the house configs on a scratch copy and record the counts. A rule with more than about 20 real findings, or mostly false ones, goes to the owner with its counts before it is turned on. Don't loosen it quietly. Put the knip preset's config in before the first measurement.
  2. Vendor. npm run house-style:sync -- house-style-v1.3.0 copies the library's house-style/ folder at that tag into vendor/house-style/ (the first time, before the copy exists, run the library checkout's house-style/bin/sync.mjs house-style-v1.3.0 from the repo root, or from the app's folder in a multi-project repo: the copy goes to the nearest package.json). Pin the devDependencies the house-style README lists; the sync reports any pin that differs.
  3. Prettier. Add the config, .prettierignore, format and format:check, and commit that alone.
  4. The reformat. npm run format, committed alone as style: format with Prettier. Its acceptance is the esbuild bundle compare: bundle every file before and after (CSS through esbuild's css loader, JSON and YAML compared parsed), and list and explain each difference. The expected one is JSX text Prettier splits with {" "}, which renders the same. Then put the commit's full hash in .git-blame-ignore-revs, in its own commit. git config blame.ignoreRevsFile .git-blame-ignore-revs is an owner step.
  5. tsconfig. Extend the vendored base and fix what the new flags find.
  6. ESLint. Extend the vendored config with the repo's roots, then fix each finding or list it in the outcome note with its reason.
  7. The gate. Add check, check:fast, check:conventions, house-style:sync, and test:clean or pretest where needed. Time check:fast warm with one changed file, and check in full. The dependency-cruiser preset and check:conventions land in one commit: knip reports dependency-cruiser as unused until a script runs it.
  8. The Claude Code layer. The root CLAUDE.md, the two rules files, the .gitignore line.

The hooks

This plugin ships them in hooks/hooks.json; a repo opts in by having the files they look for, and nothing is committed to .claude/settings.json.

  • After Edit or Write: if the repo has a Prettier config and an installed Prettier, the saved file is formatted with that Prettier, from the config's folder (the nearest one up from the file, which may be the root's), so that folder's .prettierignore applies. A formatter error never fails the edit.
  • At Stop: for each code file this session saved, the nearest package.json with a check:fast script, from the file's folder up to the repo root, is run (each distinct one once), but only for a package where this session saved a code file since its last green run. Only when no saved file leads to one does it fall back to the session's folder, as it always did. On a failure the tail of the output goes back to Claude, which keeps working. It blocks again only while the failure changes, at most four times a turn; then the turn ends with a note to the user. It never runs a check:fast whose scripts run tests.

So check:fast must stay a typecheck and a lint: just-a-bot's tests read its production .env. A repo with no check:fast and no Prettier config costs nothing.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.