agentleFS
a-ha-h/templ/.github/copilot-instructions.md

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
  1. Very specific:

    Always run go fmt after making changes to Go code.

    line 5
  2. Distinctive:

    Always run unit tests after making changes to Go code.

    line 6
  3. Very specific:

    Ensure that the user has direnv installed, and that it is set up correctly in their shell.

    line 10
  4. Very specific:

    Ensure that the user has Nix installed, and that it is set up correctly.

    line 11
  5. Very specific:

    Ensure that the user has the direnv VS code extension installed, so that the .envrc file is automatically loaded when the project is opened …

    line 12
  6. Very specific:

    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.

    line 26
  7. Very specific:

    Don't install templ globally using xc install-snapshot or go install.

    line 40
  8. Very specific:

    Update documentation when the behaviour of templ changes, or when new features are added.

    line 54
  9. Distinctive:

    Use American English spelling to match the Go standard library, and HTML spec, e.g.

    line 58
  10. Distinctive:

    Use the Oxford comma, e.g.

    line 59
  11. Distinctive:

    Avoid use of emojis everywhere - in code, comments, commit messages, and documentation.

    line 60
  12. Very specific:

    Use the active voice, e.g.

    line 62
  13. Distinctive:

    Don't use emphatic words or phrases like "very", "blazingly fast", etc.

    line 63
  14. Distinctive:

    Use line breaks to separate "paragraphs" of code - don't use line breaks in between lines, or at the start/end of functions etc.

    line 68
  15. Very specific:

    Use the xc fmt and xc lint build tasks to format and lint code before committing.

    line 69
  16. Distinctive:

    Don't use unnecessary comments that explain what the code does.

    line 70
  17. Distinctive:

    If comments are used, ensure that they are full sentences, and use proper punctuation, including ending with a full stop.

    line 71
  18. Very specific:

    Don't write comments after the end of keywords, e.g.

    line 72
  19. Very specific:

    Don't attempt to run tests individually, use the xc test task to run all tests, because it regenerates templates, and there's minimal …

    line 81
  20. Very specific:

    If a project.templ file is created, after generation a project_templ.go file will be created.

    line 86
  21. Very specific:

    If a project.templ file is renamed, you must also rename the generated project_templ.go file.

    line 87
  22. Very specific:

    If a project.templ file is moved, you must also move the generated project_templ.go file.

    line 88
  23. Very specific:

    If a project.templ file is deleted, you must also delete the generated project_templ.go file.

    line 89
  24. Very specific:

    Don't attempt to create helper or utility tests in the ./tmp or /tmp directory.

    line 93

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

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

Coding standards

Behaviour

  • Always run go fmt after 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 .envrc file 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 - runs gofmt to 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 docs directory.
  • 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 else block, 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 fmt and xc lint build 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 ./generator directory. Each test is in a subdirectory.
  • Tests for the templ CLI are in the ./cmd/templ directory.
  • 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 htmldiff library 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 test task 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 .templ extension.
  • If a project.templ file is created, after generation a project_templ.go file will be created.
  • If a project.templ file is renamed, you must also rename the generated project_templ.go file.
  • If a project.templ file is moved, you must also move the generated project_templ.go file.
  • If a project.templ file is deleted, you must also delete the generated project_templ.go file.

Files

  • Don't attempt to create helper or utility tests in the ./tmp or /tmp directory. Create unit tests in the relevant directory instead.

Download now (ZIP)

Trending

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Aug 30: 0 new projectsWeek of Sep 6: 0 new projectsWeek of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projects
Aug 2026Sep 2026Oct 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about a-h/templ

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

45 more on GitHub

On Hacker News · 1

  • 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
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.