codegen-t4-templates
Skill1 starsChanged 13 days agoMITView on GitHub
Use when adding or changing a CodeGenNew T4 (Mono.TextTemplating) template (SP_, API_, CS_, TS_, TSX_, WinUI3_, BLZ_, PY_, RS_), its .tt.config, DefaultAssetSeeder or ProjectSettings; when adding a setting, stack, database or access mode; when regenerating a sample or an already generated project; or when deciding whether generated output may overwrite hand-written code. Trigger words - T4, .tt, @@@FILE, essentials, Core helper, Regenerate.sh, stale template, ListProtocol, ImpliedPlanTemplates.
In this repository30 other files it gives its agents.
- angular-crud-gotchasSkill
- aws-lightsail-container-deploySkill
- bannerlord-decompileSkill
- csharpSkill
- delphi-code-smellsSkill
- delphi-firedacSkill
- delphiSkill
- delphi-types-and-unitsSkill
- difftasticSkill
- dockerSkill
- efcore-aspnet-reviewSkill
- git-bash-editingSkill
- github-issue-creatorSkill
- microsoft-docsSkill
- minimal-comments-and-docsSkill
- msbuildSkill
- mssqlSkill
- mstest-assertionsSkill
- mysqlSkill
- nginx-config-testingSkill
- odata-generated-gridsSkill
- postgresSkill
- powershellSkill
- react-crud-gotchasSkill
- sanitize-for-open-sourceSkill
- self-contained-deploymentSkill
- skill-writerSkill
- ui-conventionsSkill
- verify-in-running-appSkill
- winui3Skill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Essentials are written once and kept: Do not change what an essentials file must contain to make a page template work.
- Distinctive: line 38
Keep default output unchanged: when a setting is off, and prove it with a diff against the last commit.
≈ “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
CodeGenNew templates
This file is the short core. Find your task in the table, read that one file in reference/, and read a second only when the first points to it. Each reference file starts with a "Read this when" line.
Pick the file
| You are about to... | Read |
| Reproduce hand-written code, or decide whether generated code may replace it | reproducing-code |
Fix a template that will not compile, has wrong line endings, quotes or -- | t4-traps |
| Emit several files, or get a route, JSON name, navigation name or SQL name right | names-and-output |
| Put a decision, name list, sentence or model rule where several stacks share it | core-rules |
| Write a status code, exit code, database error number or an API error answer | named-numbers-and-problems |
Move repeated per-table code onto a base class, or change a wire contract (ListProtocol) | essentials-and-bases |
Add or change a template, .tt.config key, project setting, or a template that fits only some tables | plan-and-new-templates |
| Add a stack, a database, an access mode or a new kind of schema input | new-stack-or-database |
| Write SQL, call a routine, or handle one database differently | sql-dialects |
| Change paging, search, sorting or grid columns of a screen | paging-and-grids |
| Generate OpenAPI, Mermaid, Markdown, validators, or test generated text | documents-and-checks |
| Regenerate the samples and prove nothing else changed | regenerate-and-prove |
| A generated project fails after new templates, or the first Generate All misbehaves | existing-projects |
| Touch a user table, password hash column or sign-in | user-table-and-sign-in |
| Touch required marks, a WinUI3 dialog, a single-row table, a generated key, or walk pages in a browser | screens-and-dialogs |
| Generation is slow, the cache is stale, or a sample builds with warnings | speed-and-cache |
Rules that apply to every change
- A template renders; it does not decide. A rule that every stack must share goes in
CodeGenNew.Corewith a test, and each template calls it (core-rules). - Fix the template, not the sample. A bug fixed only in one generated project comes back at the next regeneration, and every table must get the fix.
- Stale template first. The CLI seeds its
Templatesfolder once and never overwrites it: deletebin\Debug\net10.0\Templatesbefore a run, and look for*.newfiles beside a template that "still fails" (t4-traps, existing-projects). - Never write two hyphens in template text, and edit templates with the Edit tool or an exact-one-match script, never a shell string (t4-traps; see also the
git-bash-editingskill). - Essentials are written once and kept. Do not change what an essentials file must contain to make a page template work; put the new UI in the page template (essentials-and-bases).
- Keep default output unchanged when a setting is off, and prove it with a diff against the last commit. Optional extras default off and are tested in both states.
- Prove with the real tool, not only the template tests: build the generated code, run the API, click through the screen. A green unit test of template text misses real defects (regenerate-and-prove, and the
verify-in-running-appskill). - Report what you could not generate or prove (columns left out, files kept hand-maintained, a stack with no sample) instead of hiding it.
Related skills
odata-generated-grids (grid columns, $select, owner scope), verify-in-running-app (scratch database and click-through), winui3 (WinUI3 patterns), angular-crud-gotchas, react-crud-gotchas, efcore-aspnet-review, mssql, mysql, postgres, git-bash-editing.
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.

