agentleFS
ericwood8ericwood8/skills/codegen-t4-templates/SKILL.md

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.

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
  1. Distinctive:

    Essentials are written once and kept: Do not change what an essentials file must contain to make a page template work.

    line 37
  2. Distinctive:

    Keep default output unchanged: when a setting is off, and prove it with a diff against the last commit.

    line 38

≈ “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.

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

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 itreproducing-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 rightnames-and-output
Put a decision, name list, sentence or model rule where several stacks share itcore-rules
Write a status code, exit code, database error number or an API error answernamed-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 tablesplan-and-new-templates
Add a stack, a database, an access mode or a new kind of schema inputnew-stack-or-database
Write SQL, call a routine, or handle one database differentlysql-dialects
Change paging, search, sorting or grid columns of a screenpaging-and-grids
Generate OpenAPI, Mermaid, Markdown, validators, or test generated textdocuments-and-checks
Regenerate the samples and prove nothing else changedregenerate-and-prove
A generated project fails after new templates, or the first Generate All misbehavesexisting-projects
Touch a user table, password hash column or sign-inuser-table-and-sign-in
Touch required marks, a WinUI3 dialog, a single-row table, a generated key, or walk pages in a browserscreens-and-dialogs
Generation is slow, the cache is stale, or a sample builds with warningsspeed-and-cache

Rules that apply to every change

  1. A template renders; it does not decide. A rule that every stack must share goes in CodeGenNew.Core with a test, and each template calls it (core-rules).
  2. 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.
  3. Stale template first. The CLI seeds its Templates folder once and never overwrites it: delete bin\Debug\net10.0\Templates before a run, and look for *.new files beside a template that "still fails" (t4-traps, existing-projects).
  4. 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-editing skill).
  5. 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).
  6. 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.
  7. 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-app skill).
  8. 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.

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.