Skip to content

feat(skill): generate-test-data skill for tables that already exist - #63

Merged
pa201608 merged 1 commit into
masterfrom
feat/generate-test-data-skill
Oct 3, 2026
Merged

pa201608 merged 1 commit into
masterfrom
feat/generate-test-data-skill

Conversation

@pa201608

@pa201608 pa201608 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Summary

A second skill in the nanook plugin, generate-test-data. It starts from a decision table that already exists (hand-made, from Nanook 2.x, or from create-equivalence-class-table):

  1. inspect the workbook (inspect-workbook.mts, new)
  2. resolve generators the table calls but nobody registers
  3. write and register own generators (templates in the skill)
  4. generate one JSON fixture per test case (generate-fixtures.mts)
  5. check the count against the minimum from step 1
  6. use the fixtures in Vitest or Playwright tests

Fixes on the way

  • FilterSection: generate-fixtures.mts registered no filter processor, so a workbook with filters exited 1 and ignored the filters. It now registers SimpleArrayFilter and SimpleArrayIgnoreFilter.
  • text generator: several gen::text:… cells in one test case got the same value (the base class caches by instance id only). It now caches per instruction.
  • create-equivalence-class-table: said x in the ExecuteSection is true; the parser treats it as false.

Packaging

  • plugin and skills at 0.4.0, the second skill in plugin.json, README and the slash command point to it
  • tests/skills/scriptsInSync.test.ts keeps the two copies of generate-fixtures.mts identical and the versions consistent

The skill text assumes the next release is 3.2.0 (scripts in node_modules/@xhubio/nanook-table/skills/generate-test-data/); for 3.1.x it describes a way without inspect-workbook.mts.

Test plan

  • format, lint, build, typecheck, vitest (207 tests)
  • both scripts typechecked with --strict
  • inspect-workbook.mts and generate-fixtures.mts over 12 workbooks from tests/processor/fixtures: same exit code everywhere, count ≥ minimum where generation succeeds
  • the skill followed step by step in a fresh project with this branch installed as a tarball: unregistered template reported, generator from the skill template, 20 fixtures, Vitest 20/20
  • Playwright snippet: 4/4 against a demo page, one failure with a broken page
  • npx skills add <repo> --skill generate-test-data installs SKILL.md and both scripts
  • fallback with the published 3.1.3
  • claude plugin validate
  • a real Claude session picks the right one of the two skills
  • /plugin install nanook@nanook after merge

Follow-ups (not in this PR)

  • DataGeneratorBase caches by instance id only; docs/guide/directives.md says gen:: is always new
  • docs/tutorials/create-generator.md writes generatorPerson:firstName without gen:, which Nanook reads as a static string
  • callTree.instanceId of the root never matches the key in data (ids are renewed after the call tree is built)
  • npx skills add xhubio/nanook-table also offers the internal dev skills from .claude/skills
  • the use-with-ai page in the landing-page repo should mention the second skill

🤖 Generated with Claude Code

A second skill in the nanook plugin: start from an existing workbook,
inspect it, write and register the generators it calls, generate one
JSON fixture per test case, check the count and use the fixtures in
Vitest or Playwright tests.

- inspect-workbook.mts: lists tables, Execute/NeverExecute/Multiplicity,
  filters and the minimum fixture count; reports unregistered generators
  and filter processors, unknown faker paths and text instructions,
  broken references and test cases dropped by NeverExecute
- generate-fixtures.mts: registers SimpleArrayFilter and
  SimpleArrayIgnoreFilter, so tables with a FilterSection run; the text
  generator caches per instruction, so several gen::text cells in one
  test case no longer share one value
- create-equivalence-class-table: x in the ExecuteSection is false, not
  true; points to the new skill for existing tables
- plugin 0.4.0, README, test that keeps the script copies in sync

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pa201608
pa201608 merged commit 125045a into master Oct 3, 2026
2 checks passed
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant