Skip to content

docs(skills): lint TWD tests with twd-lint, and trim the rules it now enforces - #19

Merged
kevinccbsg merged 2 commits into
mainfrom
docs/twd-lint
Oct 12, 2026
Merged

kevinccbsg merged 2 commits into
mainfrom
docs/twd-lint

Conversation

@kevinccbsg

Copy link
Copy Markdown
Member

Wires twd-lint 1.0.0 into the three common skills. The skills now teach each rule once, in positive form with an example, and the linter checks it, instead of the same rule repeated three times.

twd skill

  • Self-check step 3: npx twd-lint <files> --fix, next to the type check. It works with or without ESLint in the project, so twd-patterns.md is not consulted. allowed-tools and the execution scope gain npx twd-lint.
  • Hard constraints: 7 → 6, rewritten in positive form, with the NEVER repeats removed. The API knowledge stays: the mockRequest signature, that rule.request is the body, and Chai-style expect.
  • test-writing.md:
    • The WRONG/RIGHT Jest block is gone.
    • The 9-item "Mistakes the type checker will not catch" list became "What the checks catch, and what they do not": the type check, then lint, then the 4 things neither catches.
  • One top-level describe per file is now a convention, not a hard constraint. The runner loops over every root suite, so "break the test runner" was false.
  • Angular: the self-check keeps the real requirement that every test file is listed in the entry file's tests object.
  • Un-awaited assertions: a note that --fix on an existing file can make an un-awaited assertion run for the first time.

setup skill

  • Step 1, item 13: detects an ESLint flat config with ESLint ≥ 9.
  • New sub-step 8:
    • ESLint flat config: installs twd-lint and appends twd.configs.recommended to the config, including when it is wrapped in defineConfig/tseslint.config.
    • Otherwise (no ESLint, .eslintrc, Biome, oxlint): installs twd-lint and adds a lint:twd script.
    • Pinning: follows twd-js.
    • Tailwind 4: a warning about the npm 11.6 @emnapi lockfile bug.
  • Verification: lints the scaffold before the run.
  • twd-patterns.md: gets a Test lint line and npx twd-lint --fix under Runner Commands.

ci-setup skill

  • "Lint TWD tests" step: added right after npm ci, in the Action template and both custom templates. The command is npm run lint:twd, or npx twd-lint when there is no script.
  • When the step is left out:
    • when twd-lint is an ESLint plugin and a workflow already runs eslint;
    • when there are no TWD tests yet, because the linter exits 2.
  • Step 1:
    • new item 9 globs the TWD tests;
    • new item 10 detects the lint wiring;
    • Step 2.6 had pointed at item 5 (the workflows glob) for "tests found"; it now points at item 9.

Evals

  • New twd-lint-fix: a test file with Vitest imports, missing awaits, it.only and rule.request.body. The skill must run twd-lint and leave the file clean.
  • twd-flow-test:
    • the one-describe grader is replaced by lint-attempted;
    • the flow-shape judge criteria now name which calls are async. The judge had failed a correct file, reading twd.should/twd.clear* as missing await.
  • setup-vite-react-query: the scaffold gains an ESLint 9 config (as in the Vite template), with a grader for twd.configs.recommended.
Case Score
twd-lint-fix 1.00
twd-flow-test 1.00
setup-vite-react-query 1.00

1 run each. plugin validate --strict passes. Plugin 1.3.3 → 1.3.4.

Once twd#381 is merged, a follow-up can link https://twd.dev/linting from the skills.

… enforces

The twd skill runs npx twd-lint --fix on the files it writes, next to the
type check, and states each rule once in positive form instead of repeating
it as hard constraint, WRONG/RIGHT block and mistakes list. One top-level
describe per file becomes a convention: the runner accepts several.

setup adds twd-lint as an ESLint plugin when the project has a flat config,
otherwise as a lint:twd script. ci-setup lints before any server starts.

New eval twd-lint-fix; setup eval gains an ESLint config.
@kevinccbsg
kevinccbsg merged commit 30eff4b into main Oct 12, 2026
1 check passed
@kevinccbsg
kevinccbsg deleted the docs/twd-lint branch October 12, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant