agentleFS
aymericzipaymericzip/intlayer-skills/skills/intlayer-backend/SKILL.md

intlayer-backend

Skill5 starsChanged 47 days agoApache-2.0View on GitHub

Integrates Intlayer internationalization with Node.js / Bun backends (Express, Fastify, Hono, NestJS, AdonisJS, Elysia, HTMX). Use when the user asks to "translate API responses", "setup server-side i18n", register the Intlayer middleware, or use "t" / "getIntlayer" in a route handler.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    Every backend integration works the same way:

    line 19

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

Intlayer Backend Usage

Core Philosophy

Every backend integration works the same way:

  1. A middleware / plugin (intlayer()) resolves the locale of each request (cookie, header, Accept-Language) and scopes it to that request.
  2. Helpers (t, getIntlayer, getDictionary) read that request locale, so they are safe to call from services without threading a locale argument through every function.
FrameworkPackageRegistration
Expressexpress-intlayerapp.use(intlayer())
NestJSexpress-intlayerconsumer.apply(intlayer()).forRoutes("*")
Fastifyfastify-intlayerawait fastify.register(intlayer)
Honohono-intlayerapp.use("*", intlayer())
Elysiaelysia-intlayer.use(intlayer()), helpers read from route intlayer
AdonisJSadonis-intlayerRegistered middleware (see the AdonisJS guide)

Declare Content

File: src/index.content.ts

import { t, type Dictionary } from "intlayer";

const content = {
  key: "index",
  content: {
    exampleOfContent: t({
      en: "Example of returned content in English",
      fr: "Exemple de contenu renvoyé en français",
    }),
  },
} satisfies Dictionary;

export default content;

Usage

Register the middleware / plugin from the table above before the routes that read content (see the Express guide), then call the helpers in any handler:

import { t, getIntlayer, getDictionary } from "express-intlayer";
import dictionaryExample from "./index.content";

app.get("/", (_req, res) => {
  res.send(t({ en: "Hello", fr: "Bonjour" })); // Inline translation
});

app.get("/by-key", (_req, res) => {
  res.send(getIntlayer("index").exampleOfContent); // Dictionary by key
});

app.get("/by-import", (_req, res) => {
  res.send(getDictionary(dictionaryExample).exampleOfContent); // Imported dictionary
});

The same helpers are exported by fastify-intlayer, hono-intlayer and adonis-intlayer. On Elysia, read them from the route context: ({ intlayer }) => intlayer!.getIntlayer("index").

For jobs, queues or emails (no incoming request), resolve content for the recipient's stored locale: getIntlayer("index", user.locale).

References

Environments

  • Express
  • Fastify
  • Hono
  • NestJS
  • AdonisJS
  • Elysia
  • HTMX

Concepts

  • Variants
  • Collections

Packages

  • Intlayer Exports
  • Express Intlayer Exports
  • Fastify Intlayer Exports
  • Hono Intlayer Exports
  • Adonis Intlayer Exports
  • Elysia Intlayer Exports
  • adonis-intlayer intlayer
  • adonis-intlayer t
  • elysia-intlayer intlayer
  • express-intlayer intlayer
  • express-intlayer t
  • fastify-intlayer intlayer
  • hono-intlayer intlayer
  • hono-intlayer t

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.