templ
Copilot instructions11k starsChanged 20 months agoMITView on GitHub
templ has an .envrc file that is used to set up the development environment using a tool called direnv. There is a VS Code extension available that will automatically load this when you open the project in VS Code. The .envrc file uses a Nix flake to set up the environment, so Nix is required to be installed. The version of Go used is defined in the flake.nix file. templ uses the xc task runner - https://github.com/joerdav/xc If you run…
- Installs packages
We split this copilot-instructions.md into the rules it gives an agent
24 rules. About 0 are common, 8 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
Always run go fmt after making changes to Go code.
- Distinctive: line 6
Always run unit tests after making changes to Go code.
- Very specific: line 10
Ensure that the user has direnv installed, and that it is set up correctly in their shell.
- Very specific: line 11
Ensure that the user has Nix installed, and that it is set up correctly.
- Very specific: line 12
Ensure that the user has the direnv VS code extension installed, so that the .envrc file is automatically loaded when the project is opened …
- Very specific: line 26
If you run xc you can get see a list of the development tasks that can be run, or you can read the README.md file and see the Tasks section.
- Very specific: line 40
Don't install templ globally using xc install-snapshot or go install.
- Very specific: line 54
Update documentation when the behaviour of templ changes, or when new features are added.
- Distinctive: line 58
Use American English spelling to match the Go standard library, and HTML spec, e.g.
- Distinctive: line 59
Use the Oxford comma, e.g.
- Distinctive: line 60
Avoid use of emojis everywhere - in code, comments, commit messages, and documentation.
- Very specific: line 62
Use the active voice, e.g.
- Distinctive: line 63
Don't use emphatic words or phrases like "very", "blazingly fast", etc.
- Distinctive: line 68
Use line breaks to separate "paragraphs" of code - don't use line breaks in between lines, or at the start/end of functions etc.
- Very specific: line 69
Use the xc fmt and xc lint build tasks to format and lint code before committing.
- Distinctive: line 70
Don't use unnecessary comments that explain what the code does.
- Distinctive: line 71
If comments are used, ensure that they are full sentences, and use proper punctuation, including ending with a full stop.
- Very specific: line 72
Don't write comments after the end of keywords, e.g.
- Very specific: line 81
Don't attempt to run tests individually, use the xc test task to run all tests, because it regenerates templates, and there's minimal …
- Very specific: line 86
If a project.templ file is created, after generation a project_templ.go file will be created.
- Very specific: line 87
If a project.templ file is renamed, you must also rename the generated project_templ.go file.
- Very specific: line 88
If a project.templ file is moved, you must also move the generated project_templ.go file.
- Very specific: line 89
If a project.templ file is deleted, you must also delete the generated project_templ.go file.
- Very specific: line 93
Don't attempt to create helper or utility tests in the ./tmp or /tmp directory.
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions 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
Coding standards
Behaviour
- Always run
go fmtafter making changes to Go code. - Always run unit tests after making changes to Go code.
Environment setup
- Ensure that the user has direnv installed, and that it is set up correctly in their shell. See https://direnv.net/docs/installation.html
- Ensure that the user has Nix installed, and that it is set up correctly. See https://nixos.org/download.html
- Ensure that the user has the direnv VS code extension installed, so that the
.envrcfile is automatically loaded when the project is opened in VS Code.
Background
templ has an .envrc file that is used to set up the development environment using a tool called direnv. There is a VS Code extension available that will automatically load this when you open the project in VS Code.
The .envrc file uses a Nix flake to set up the environment, so Nix is required to be installed.
The version of Go used is defined in the flake.nix file.
Build tasks
templ uses the xc task runner - https://github.com/joerdav/xc
If you run xc you can get see a list of the development tasks that can be run, or you can read the README.md file and see the Tasks section.
The most useful tasks for local development are:
xc install-snapshot- builds the templ CLI and installs it into~/bin. Ensure that this is in your path.xc generate- generates Go code from the templ files in the project.xc test- regenerates all templates, and runs the unit tests.xc test-short- runs shorter tests, avoiding long running tests for filesystem watchers etc.xc fmt- runsgofmtto format all Go code.xc lint- run the same linting as run in the CI process.xc docs-run- run the Docusaurus documentation site.
templ has a code generation step, this is automatically carried out using xc test.
Don't install templ globally using xc install-snapshot or go install. Use the xc generate or xc test-short tasks to generate the code, which will also run the tests.
Commit messages
The project using https://www.conventionalcommits.org/en/v1.0.0/
Examples:
feat: support Go comments in templates, fixes #234"fix: ensure that the templ CLI works with Go 1.21, fixes #123
Documentation
- Documentation is written in Markdown, and is rendered using Docusaurus. The documentation is in the
docsdirectory. - Update documentation when the behaviour of templ changes, or when new features are added.
Writing style
- Use American English spelling to match the Go standard library, and HTML spec, e.g. "color".
- Use the Oxford comma, e.g. "apples, oranges, and bananas".
- Avoid use of emojis everywhere - in code, comments, commit messages, and documentation.
- Be "to the point" and precise - avoid unnecessary words, don't use filler words like "just" or "really".
- Use the active voice, e.g. "templ generates code" rather than "code is generated by templ".
- Don't use emphatic words or phrases like "very", "blazingly fast", etc.
Coding style
- Reduce nesting - i.e. prefer early returns over an
elseblock, as per https://danp.net/posts/reducing-go-nesting/ or https://go.dev/doc/effective_go#if - Use line breaks to separate "paragraphs" of code - don't use line breaks in between lines, or at the start/end of functions etc.
- Use the
xc fmtandxc lintbuild tasks to format and lint code before committing. - Don't use unnecessary comments that explain what the code does.
- If comments are used, ensure that they are full sentences, and use proper punctuation, including ending with a full stop.
- Don't write comments after the end of keywords, e.g.
continue // Only process pairs
Tests
- Tests for generated code are in the
./generatordirectory. Each test is in a subdirectory. - Tests for the templ CLI are in the
./cmd/templdirectory. - Tests for the templ runtime are in the root directory.
- Tests for formatting templ files are in
./parser/v2/formattestdata- it uses txtar to store tests. - The
htmldifflibrary does not take whitespace into account, so cannot be used to test output whitespace handling. - Don't attempt to run tests individually, use the
xc testtask to run all tests, because it regenerates templates, and there's minimal performance penalty due to Go's test caching.
Moving and renaming files
- templ files have the
.templextension. - If a
project.templfile is created, after generation aproject_templ.gofile will be created. - If a
project.templfile is renamed, you must also rename the generatedproject_templ.gofile. - If a
project.templfile is moved, you must also move the generatedproject_templ.gofile. - If a
project.templfile is deleted, you must also delete the generatedproject_templ.gofile.
Files
- Don't attempt to create helper or utility tests in the
./tmpor/tmpdirectory. Create unit tests in the relevant directory instead.
Trending
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about a-h/templ
- A Hacker News story“Templ: A language for writing HTML user interfaces in Go”Hacker News · Dec 11, 2023 · 228 points
- gofiber/template“🚀 [Feature]: Templ support?”GitHub · Oct 14, 2023 · 5 reactions
- numToStr/Comment.nvim“Support templ”GitHub · Oct 6, 2023 · 5 reactions
- github-linguist/linguist“Add templ language”GitHub · Apr 15, 2024 · 4 reactions
- Stack Overflow“How to install templ in macos & windows. Error:- templ not found”Stack Overflow · Feb 21, 2024 · 4 votes
The biggest 5 of 62 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 62
Talked about on GitHub, the web, Bluesky, Stack Overflow and Hacker News (62 times).
On GitHub · 50
- Oct 14, 2023🚀 [Feature]: Templ support? — gofiber/template5 reactions · 19 comments
- Oct 6, 2023Support templ — numToStr/Comment.nvim5 reactions · 1 comment
- Apr 15, 2024Add templ language — github-linguist/linguist4 reactions · 2 comments
- Jan 24, 2024support for Templ files — NiklasPor/prettier-plugin-go-template4 reactions · 3 comments
- Nov 29, 2024Add support for `templ` syntax — sharkdp/bat3 reactions · 1 comment
45 more on GitHub
- Feb 17, 2024Add syntax highlighting for style/script tags — templ-go/templ-vscode3 reactions · 1 comment
- Feb 12, 2024Resolve single line import expression syntax highlighting #508 — templ-go/templ-vscode3 reactions · 1 comment
- Jan 15, 2024Integration with templ — go-echarts/go-echarts3 reactions · 1 comment
- Jan 7, 2024x/tools/gopls: ctrl-click should jump to source, not to autogenerated code — golang/go3 reactions · 9 comments
- Oct 9, 2026fix: exit when the HTTP server fails to start — bitofbytes-io/dejaview2 reactions · 3 comments
- Jul 19, 2026Simplify the family Trophy Room — bitofbytes-io/dejaview2 reactions · 2 comments
- Jul 10, 2026chore: Configure Renovate — konsulin-care/konsulin-app2 reactions · 4 comments
- Apr 12, 2026Fix stored XSS in language edit Alpine x-data — olegiv/ocms-go2 reactions
- Apr 11, 2026Add noopener to admin page preview links — olegiv/ocms-go2 reactions
- Apr 10, 2026Escape page version preview body in admin modal — olegiv/ocms-go2 reactions
- Jan 18, 2026Fix issue with deeper overlapping dependencies — purpleclay/go-overlay2 reactions · 3 comments
- Jun 7, 2025Proposal: Migrate to Templ — go-gitea/gitea2 reactions · 31 comments
- Oct 26, 2026admin: bump a-h/templ to v0.3.1100 to match @latest codegen — seaweedfs/seaweedfs1 reaction · 2 comments
- Oct 22, 2026lint: importas holds the import aliases; the two that resolve collisions stay — Koopa0/goen1 reaction · 2 comments
- Oct 18, 2026chore: Configure Renovate — bitofbytes-io/learnd1 reaction · 3 comments
- Sep 9, 2026feat(canvas): add web ui view contracts — LumeWeb/pinner1 reaction · 2 comments
- Aug 1, 2026fix(build): make fmt is not idempotent and fights templ over 108 generated files — sydlexius/stillwater1 reaction · 4 comments
- Jul 15, 2026EZE-8 Remove Daniel greeting — Jehezkel/test-symphony1 reaction
- Jul 15, 2026EZE-7 Add greetings for Daniel — Jehezkel/test-symphony1 reaction
- Jul 5, 2026Update Alpine.js SRI hash to match vendored 3.15.12 bundle — olegiv/ocms-go1 reaction
- May 10, 2026feat(codeql): add pre-build-cmd input for code-generation steps — netresearch/.github1 reaction · 2 comments
- May 10, 2026ci: pin templ CLI to go.mod runtime version — netresearch/ldap-manager1 reaction · 5 comments
- May 2, 2026Add /tutorial onboarding page and navigation — lhemerly/ptto-template1 reaction
- Apr 30, 2026Implement Story 18.3: show and preserve ATTACH and unknown VTODO fields — c64bob/caldo1 reaction
- Apr 11, 2026Harden theme image preview URLs — olegiv/ocms-go1 reaction
- Mar 4, 2026templ: 0.3.977 -> 0.3.1001 — NixOS/nixpkgs1 reaction
- Nov 7, 2025Templ Setup and Base Layout Templates — matt-riley/mjrwtf1 reaction
- Sep 1, 2025[Question] Lazy/on-demand loading using the new Sheets api — axadrn/shadcn-templ1 reaction · 2 comments
- Aug 30, 2025[Bug] Select Box within a Modal, upon selection, closes modal. — axadrn/shadcn-templ1 reaction · 1 comment
- Aug 1, 2025[Bug] Selectbox does not set initial value to the the value of the selected item — axadrn/shadcn-templ1 reaction · 2 comments
- Jul 16, 2025Add support for configuring Go global packages with presets — retran/.meow1 reaction
- Jun 1, 2025Internationalisation — zangster300/northstar1 reaction · 1 comment
- Apr 5, 2025refactor: install templ and esbuild as tool dependencies — rramiachraf/dumb1 reaction · 2 comments
- Jan 19, 2025lsp.dev domain down? — go-language-server/protocol1 reaction · 1 comment
- Jul 21, 2024Unregistered Domains Trigger Exception & Eventual Panic on Dashboard — nwesterhausen/domain-monitor1 reaction
- Jun 14, 2024Invalid HTML templates should fail to compile — go-gitea/gitea1 reaction · 3 comments
- May 25, 2024JSX support in vweb — vlang/v1 reaction · 2 comments
- Mar 30, 2024fix(#652): remove usage of lookbehind regex with wildcard lengths — templ-go/templ-vscode1 reaction · 7 comments
- Mar 18, 2024templ: 0.2.598 -> 0.2.639 — NixOS/nixpkgs1 reaction
- Dec 9, 2023[Icon Request]: go templ — vscode-icons/vscode-icons1 reaction · 4 comments
- Oct 29, 2026Dependency Dashboard — lucasew/slopapura-lewkit0 reactions
- Oct 18, 2026Dependency Dashboard — bitofbytes-io/permitpal0 reactions
- Oct 18, 2026Dependency Dashboard — bitofbytes-io/dejaview0 reactions
- Oct 12, 2026[gomod] Bumping one module deletes unrelated multi-module dependency requires from go.mod — dependabot/dependabot-core0 reactions
- Oct 8, 2026Dependency Dashboard — yyewolf/SSArchiver0 reactions
On the web · 5
- Oct 5, 2026templ/.version-template at main — google.com
- Mar 22, 2025Generation gets stuck after update · Issue #1106 · a-h/templ — google.com
- Feb 9, 2024Cannot render in Docker · Issue #510 · a-h/templ — google.com
- Oct 16, 2023How to render Go-side strings inside <script> tags? #206 — google.com
- Jul 7, 2023generator: allow go code statements in templates #109 — google.com
On Bluesky · 4
- Nov 30, 2024impo, some of the most efficient apps usually are - If you ever decide you want the whole site under the golang umbrella give this a try… — @handle.invalid2 likes and reposts
- Dec 11, 2023Templ: A language for writing HTML user interfaces in Go (github.com) Main Link | HN Post — @newsycombinator.bsky.social2 likes and reposts
- May 19, 2025An HTML templating language for Go that has great developer tooling #golang github.com/a-h/templ — @golangch.bsky.social1 likes and repost
- Dec 1, 2024Looks really good my friend, if you're looking for something a little nicer to use than go's built in templating give github.com/a-h/templ… — @handle.invalid1 likes and repost
On Stack Overflow · 2
- Feb 21, 2024How to install templ in macos & windows. Error:- templ not found4 votes · 1 answer
- Jun 15, 2024In Golang Templ project how to us vite generated index.html0 votes
On Hacker News · 1
- Dec 11, 2023Templ: A language for writing HTML user interfaces in Go228 points · 98 comments
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
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.

