code-gen
Skill0 starsChanged 16 days agoApache-2.0View on GitHub
Regenerate the committed generated files, such as the JSON Schemas under docs/schemas/, the rulebook pages under docs/rulebook/ and the rule index under src/lorecraft/rules/index.py, after changing the package types or the rule declarations and docstrings they are rendered from, or a gen-* recipe in the justfile or a generator in gen/src/lorecraft_gen/. Use after editing such a type, recipe or generator, before running tests or committing, or when CI's `gen-check` job fails with "Generated code is out of date". Not for formatting or linting; see /code-format and /code-check.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- wuyining0130/c-roomtheir own version, first seen Oct 15, 2026
- botlearn-ai/botlearn-skillstheir own version, first seen Mar 2, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- botlearn-ai/botlearn-skills★ 9same name
- wuyining0130/c-room★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- code-checkSkill
- code-formatSkill
- code-integrateSkill
- code-restackSkill
- code-reviewSkill
- code-syncSkill
- code-testSkill
- commitSkill
- feat-discoverySkill
- feat-statusSkill
- feat-validateSkill
- releaseSkill
- code-rules-checkSkill
- code-rulesSkill
- docs-rules-checkSkill
- docs-rules-creatorSkill
- docs-rulesSkill
- skills-checkSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 18
Run just gen when a change touches:
- Very specific: line 79
Run it after /code-format and /code-check, and before /code-test: the schema tests read the committed schemas, so a stale one fails them …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Generation Skill
Some files in this repository are generated and committed: the JSON Schemas under docs/schemas/, which
editors validate the spec files against, the rulebook pages under docs/rulebook/, one per rule
code, and the rule index, src/lorecraft/rules/index.py, the identity of every rule as strings and tuples. Each is
rendered from what the package declares, so a change to it leaves the committed file stale until it
is regenerated.
When to Run
Run just gen when a change touches:
A type a generator imports. The generators are the modules of the private
lorecraft_genpackage ingen/src/lorecraft_gen/, each run by agen-*recipe of thejustfile, which installs it on the fly:just syncdoes not. A generator imports what it renders from the packages, so its imports are its inputs:grep -nE '^from lorecraft[. ]' gen/src/lorecraft_gen/*.pyA change to a module those lines import, or to anything that module's types are built from, changes the output. Their field docstrings and their
SchemaInfometadata are rendered too, so a reworded docstring is a change to the output.- A rule. The rulebook generator renders every rule's class: its code, name, release and aliases, and the sections of its docstring. A new, renamed or removed rule, or a reworded docstring, changes a page. The rule index, written by its own generator, records each rule's code, name, kind, level or severity, aliases and group, so a change to any of them changes it too.
- A generator or its recipe itself: a module of
gen/src/lorecraft_gen/, or agen-*recipe.
Nothing else needs it. When unsure, run it: a generator with nothing to change leaves the tree as it was.
Commands
just sync # first, when the environment may be stale: the generators import the package
just gen # every generator; `just gen-schemas`, `just gen-rulebook` and `just gen-rule-index` run one aloneThen look at what changed, and read the diff as a review of the change that caused it:
git status --short docs/schemas docs/rulebook src/lorecraft/rules/index.py
git diff docs/schemas docs/rulebook src/lorecraft/rules/index.pyA description that reads badly in the diff reads badly in an editor too: fix the docstring, not the output. A
rulebook page is generated output too: fix its rule's docstring and regenerate, never the page. No spec
governs the pages, so just check-docs does not read them; gen-check keeps them current.
Rules
- Commit the output with the change that caused it. CI's
gen-checkjob runsjust genand fails on any difference from the committed tree, a new file included. - Never edit a generated file by hand. The next
just genundoes it, and CI rejects it before that. - A generator restates nothing. It imports the types it renders; a field, a description or an example written into a generator is a second copy that drifts. Add it to the package's type instead.
- Generation code lives in
lorecraft_gen, never inlorecraft. A recipe is oneuv run --with-editable ./gen python -m lorecraft_gen.<module> --outdir <dir>line, where thejustfilevariable names the directory and the module keeps the same path as the default of--outdir. Nothing inlorecraftimports the generators, so none ships in the wheel. The package's responsibility isdocs/code/package-lorecraft-gen.md. - A generator carries no tests. The check on a generator is
just genleaving the tree clean, which CI'sgen-checkjob enforces. Ruff and ty covergen/; pytest and coverage do not. - A schema is rendered from the model that validates the file. The package deserializes each file with the
same pydantic model the generator renders, so the schema an editor applies and the check's validation cannot
disagree about a shape. A test beside each model, such as
tests/it/test_structure_spec_schema.py, holds the committed schema to every file this repository writes. When it fails, fix the model or the file. Never loosen the test.
Where It Fits
Run it after /code-format and /code-check, and before /code-test: the schema tests read the committed
schemas, so a stale one fails them for a reason that has nothing to do with the code under test.
Common Mistakes to Avoid
- Fixing a failed
gen-checkjob by hand-editing the file to match what CI printed. Runjust gen. - Running a generator's code another way, such as a copy of it in a scratch script. The recipe is the one place that writes the output, and the one CI checks.
- Adding a generator to
lorecraftbecause it is the package that holds the types. Add a module tolorecraft_genand agen-*recipe that runs it.
Next Steps
After regenerating:
- Run targeted tests → use
/code-test; the schema tests are in the integration tier,just test-it - Commit the generated files with the change → use
/commit
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
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.

