Skip to content

Agent Build Standards ​

Purpose ​

This page sets the default technical standards for applications built with help from an AI coding agent (Claude Code, Cursor, Copilot, Codex, and similar tools).

It exists so that experiments and prototypes are built the same way Dev builds and releases software. A prototype that follows these standards is much easier to review, extend, and hand off if it becomes a production candidate.

This page is written for both people and agents. An operator does not need to copy anything: give the agent the URL of this page and ask it to follow it.

For operators

Paste a line like this into your agent at the start of a project:

Follow the standards at https://ai.policies.nht.io/agent-build-standards.md before making any technical decisions.

The .md link is the same content as this page in plain Markdown, which agents read more reliably than HTML.

Instructions to the agent ​

If you are an AI coding agent reading this page, treat it as follows:

  • The requirement keywords MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY are used as defined in RFC 2119.
  • MUST and MUST NOT rules are binding. If the operator asks for something that conflicts with one, explain the conflict and ask them to contact Dev before proceeding.
  • SHOULD rules are the default. You MAY deviate when there is a clear reason, but you MUST tell the operator what you changed and why.
  • Where this page does not cover a decision, prefer the option that is closest to the stack described here, and prefer company libraries over third-party equivalents.
  • The work you are helping with is governed by the AI Experimentation and Production Use Policy. You MUST stay within the Experimentation Boundaries. If the work would hit any Production Handoff Trigger, stop and tell the operator before continuing.
  • Other pages on this site are available as Markdown at the same path with a .md extension, and the whole site is available at llms-full.txt.

Where the work lives ​

Source code ​

  • All source code MUST be stored in, or mirrored to, the company GitLab group. This applies even when the code was written or is hosted inside an agent platform.
  • Code MUST NOT live only in a personal GitHub or GitLab account, or only inside an agent platform's workspace.
  • If you are unsure where in GitLab to store your project, contact Dev on NHT ChatOps before creating the repository.

Connecting the agent to GitLab ​

An agent cannot sign in to GitLab through company SSO itself. The operator signs in, then gives the agent a credential. If you are an agent, walk your operator through these steps. Do not ask for their SSO password.

"Local" does not always mean the operator's computer. Before starting, the agent SHOULD work out which of these environments it is running in and tell the operator, because it changes how the credential is provided and how code reaches GitLab:

Where the agent runsExamplesHow code reaches GitLab
The operator's own machineCLI or IDE agentsThe agent can usually push with the operator's existing Git setup or a token in their credential helper.
A remote VM or sandbox run by the platformManus, ChatGPT dots, cloud coding agentsThe VM is not the operator's machine. The token is given to the agent inside that environment and lives there; the agent pushes from it.
A hosted workspace with no Git accessBrowser-based builders, chat canvasesThe agent cannot push. The operator exports the code and pushes or uploads it to GitLab.
  1. Operator signs in through company SSO at https://gitlab.com/groups/nht4944308/-/saml/sso?token=p_j6KLQv. This links their GitLab account to the company group. Git access to the group may require an active SSO session; if pushes or pulls start failing with an SSO error, sign in through this link again (GitLab docs).
  2. Agree where the repository lives in the company group (ask Dev on NHT ChatOps if unsure). Either the operator creates it in the GitLab web interface, or the agent creates it using the credential from step 3. Either way it MUST end up in the company group, not the operator's personal namespace.
  3. Operator gives the agent a credential suited to where it runs:
    • on the operator's machine, the agent MAY use the operator's existing SSH key or Git credential helper;
    • anywhere else, the operator SHOULD create a personal access token for that agent only, with the narrowest scopes that work (normally read_repository + write_repository, plus api only if the agent must create the repository) and a short expiry date. The operator SHOULD revoke it when the prototype is finished or the environment is discarded.
  4. The credential is stored outside the code: in the platform's secret or environment-variable settings, or the Git credential helper. It MUST NOT be written into source files, commit history, committed .env files, or chat transcripts that are shared. Avoid pasting tokens into a chat if the platform offers a secrets setting.
  5. Agent confirms the remote points at the company group (git remote -v) before the first push, and pushes regularly. Remote VMs and sandboxes can be reset or expire, and anything not pushed is lost.

If the agent cannot push to GitLab at all, the operator MUST export the code and push or upload it to GitLab themselves, and repeat this whenever the hosted version changes.

Dev has no preference between credential types. Use whatever works in the agent's environment, as long as it follows the guidance above.

Agent-hosted prototypes ​

Many AI tools can host what they build: for example, Claude artifacts, ChatGPT canvases and apps, and Manus-hosted sites.

  • These MAY be used to develop, demo, and share prototypes.
  • They MUST be used through company-provisioned or approved accounts, and are subject to the same data rules as any other experiment (see Experimentation Boundaries and Data Sensitivity).
  • The code behind them MUST still be mirrored to GitLab. Push changes to GitLab whenever the hosted version changes.
  • An agent-hosted prototype MUST NOT become a production service. People and processes must not come to depend on it, and it must not connect to production systems or handle sensitive data.

Production services ​

All production services are built, hosted, and operated by Dev. When a prototype needs to become something people or systems rely on, start handoff through the official Dev request form. Do not keep extending the agent-hosted version.

Runtime and language ​

AreaStandard
RuntimeNode.js 24.x — SHOULD (strongly recommended)
LanguageTypeScript — SHOULD (strongly recommended). Use a TypeScript version compatible with @nhtio/eslint-config.
Linting & formattingESLint 9 + Prettier via @nhtio/eslint-config — MUST for TypeScript and JavaScript projects
Version pinningThe Node.js version SHOULD be pinned in .nvmrc and package.json engines.node (e.g. ">=24 <25").

TypeScript code MUST pass eslint and tsc --noEmit without errors before it is considered ready for review or handoff.

Other languages ​

Node.js and TypeScript are a strong recommendation, not a requirement. Python and other languages are allowed but strongly discouraged. Our platform, libraries, review tooling, and Dev's own experience are built around Node.js and TypeScript, so anything else takes longer to review, harden, and support.

An agent SHOULD NOT choose another language without the operator's agreement. Use one when the operator explicitly asks for it, or when a required library or data tool only exists in that language. In either case:

  • record the reason in README.md (and an ADR if the project has docs/adr/);
  • pin the language version and lock dependencies (for Python, a pinned version plus a hashed lockfile such as uv pip compile --generate-hashes);
  • follow every other rule on this page that is not specific to Node.js: containers, storage, configuration, request safety, migrations, testing, documentation, and repository hygiene.

Package management ​

Node.js projects MUST use pnpm 11.

The project MUST be configured so that third-party packages are only installed once they have been public for at least 3 days. Packages published by the company under @nhtio/* are excluded so internal releases can be used immediately.

Add this to pnpm-workspace.yaml at the repository root:

yaml
# Supply-chain protection: do not install third-party versions
# published less than 3 days ago.
minimumReleaseAge: 4320 # minutes (3 days)
minimumReleaseAgeExclude:
  - '@nhtio/*'

# Fail if a package release has weaker publishing evidence
# (e.g. provenance / trusted publishing) than earlier releases.
trustPolicy: no-downgrade

Notes:

  • minimumReleaseAge is measured in minutes and applies to transitive dependencies as well as direct ones (pnpm docs).
  • pnpm 11 already defaults to 1 day, but that default is non-strict. Setting the value explicitly makes it strict: if no version in the requested range is old enough, install fails instead of silently falling back to a newer release (pnpm docs). Agents MUST NOT work around this by lowering the value or adding exclusions. Pick an older version or ask the operator.
  • trustPolicy: no-downgrade makes install fail when a new release of a package has less publishing evidence than its earlier releases, for example a package normally published with provenance from CI suddenly published without it. That pattern is typical of a stolen maintainer token (pnpm docs). If it blocks an install, agents MUST NOT disable it; pick another version and tell the operator.
  • pnpm 11 reads these settings from pnpm-workspace.yaml, not .npmrc. Use .npmrc only for registry and auth settings.
  • The lockfile (pnpm-lock.yaml) MUST be committed.

Choosing an architecture ​

Pick the lightest option that fits. Do not reach for a framework or agent toolkit the project does not need.

If the project is…UseLevel
An application with data models, authentication, APIs, or background jobsAdonisJS with Lucid as the ORMSHOULD
A simple service, webhook receiver, or small APIPlain TypeScript with Koa as the web serverSHOULD
A script or CLI toolPlain TypeScriptSHOULD
A web frontendVue 3 + Vuetify 3SHOULD
A desktop applicationElectron ForgeSHOULD
A custom agentic system (tool calling, multi-step workflows, approval flows)ADKSHOULD

Additional guidance:

  • Data layer. Dev supports most databases. If the project needs an ORM, that is usually a sign it should be an AdonisJS application, which includes Lucid.
  • CRUD-heavy Adonis apps. Consider @nhtio/lucid-resourceful, which generates CRUD controllers, validation, and OpenAPI schemas from decorated Lucid models. On the frontend, pair it with @nhtio/lucid-resourceful-vue-components.
  • ADK is not the default for every AI feature. A single prompt or a simple model call does not need ADK. Use ADK when the project is genuinely agentic. See What ADK is. When using ADK, connect your coding agent to the ADK MCP server so it reads current documentation instead of guessing.

Authentication ​

  • Applications that need user authentication MUST be designed to use the company Keycloak.
  • AdonisJS applications SHOULD use @nhtio/adonis-ally-keycloak, the Keycloak adapter for AdonisJS Ally that Dev sanctions and maintains.
  • During prototyping, choose one of:
    1. Request Keycloak credentials from Dev through the official Dev request form; or
    2. Stub authentication behind a single interface (e.g. an auth service or middleware) so it can be replaced with Keycloak at handoff without touching the rest of the application.
  • Agents MUST NOT build a custom username/password system, and MUST NOT use production credentials or production Keycloak clients during experimentation.

Container and runtime model ​

Applications MUST be built to run in ephemeral containers without drive mounts. Assume any container can be destroyed and replaced at any time, and that several copies may run at once.

ConcernStandard
File and object storageStorage MUST NOT depend on local disk access. Use an abstraction that can target object storage, such as FlyDrive (SHOULD), with a local driver during development and an object-storage driver in deployed environments.
ConfigurationEnvironment variables, validated at startup. Non-Adonis Node.js projects SHOULD use @nhtio/config. AdonisJS projects use the built-in start/env.ts validation.
SecretsEnvironment variables only. Secrets MUST NOT be committed. Commit a .env.example with placeholder values.
LoggingWrite to stdout/stderr. Non-Adonis Node.js projects SHOULD use @nhtio/logger; AdonisJS projects use the built-in logger. Do not write log files.
Databases, caches, queuesExternal services (e.g. PostgreSQL, Redis) reached over the network and configured by environment variables.
Local-disk stateMUST NOT be relied on. This includes SQLite files, uploaded files on disk, and on-disk sessions or caches.

A Dockerfile SHOULD be included. Node.js projects SHOULD use a Node.js 24 base image.

Application structure ​

Business logic MUST be kept separate from platform code.

  • Business logic means calculations, rules, report definitions, and domain models: the parts the owner understands and is responsible for. Put it in its own modules (e.g. app/domain/, src/core/) that do not import HTTP, auth, storage, or framework code directly.
  • Platform code means HTTP routes and controllers, authentication, storage, configuration, logging, and deployment. It calls into the business logic.
  • Business-logic modules SHOULD have their own tests that run without a server, database, or network.
  • List the business-logic modules in AGENTS.md (see Project documentation) so later agents and Dev know which code carries the owner's intent.

This matters at handoff: Dev hardens and replaces platform code, and leaves the owner's business logic alone. The cleaner the split, the less work that is, and the less risk of changing the owner's results by accident.

Database schema ​

  • Every schema change MUST be a migration that is committed to the repository. In AdonisJS, use Lucid migrations.
  • Applications MUST NOT create or alter tables automatically at startup (e.g. ORM "sync" or create_all modes).
  • Migrations SHOULD be able to run from an empty database to the current schema, so a fresh environment can be built from the repository alone.
  • Seed data MUST be mock or synthetic. Seeding real environments is a Dev task.

Request safety ​

Any application that serves HTTP MUST follow these rules, including during prototyping:

  • GET never writes. Requests that change data use POST, PUT, PATCH, or DELETE.
  • CSRF protection on every state-changing request from a browser. In AdonisJS, use the built-in Shield middleware.
  • Validate input before using it. Use a schema validator (VineJS in AdonisJS, or @nhtio/validation). Numbers are finite and bounded, strings have length limits, and each field has one value. Set a body-size limit on every route.
  • No internal errors sent to clients. Log the full error server-side and return a generic message with a request ID (e.g. an X-Request-Id header) that can be matched to the log.
  • CSV and spreadsheet exports MUST neutralise formula injection. Prefix cells that start with =, +, -, @, tab, or carriage return (OWASP).
  • No generic pass-through endpoints. Do not expose an endpoint that runs arbitrary queries, commands, or URLs supplied by the client.

Health endpoint ​

Services SHOULD expose GET /healthz:

  • no authentication;
  • returns only { "status": "...", "gitSha": "...", "storage": "..." }, where storage reports whether the configured database or object store is reachable;
  • returns HTTP 200 when healthy and a 5xx status when not;
  • never includes configuration values, hostnames, credentials, or error details.

Deployment pipelines use this endpoint to decide whether a release is healthy.

Testing ​

Project typeTest framework
AdonisJSThe built-in Japa test runner — SHOULD
Everything elseVitest — SHOULD

Tests SHOULD run with a single pnpm test command and MUST NOT depend on production systems or real customer data.

Starter templates ​

These templates MAY be used as starting points. They are not required.

TemplateUse for
@nhtio/ts-lib-starterTypeScript libraries
@nhtio/vue-lib-starterVue component libraries
AdonisJS starter kitsAdonisJS applications

Company libraries ​

Dev maintains libraries that solve common problems in a way that fits our stack. Agents SHOULD prefer these over third-party equivalents. The full catalogue is at libs.nht.io.

NamePackageWhat it's forEnvironments
ADK@nhtio/adkBuild custom AI agents: assistants that call tools, search sources, ask for approval, and work through multi-step tasks.Anywhere JavaScript runs
Config@nhtio/configRead the app's settings and secrets from environment variables, and check them at startup so a missing or wrong value fails fast.Node.js
Logger@nhtio/loggerWrite consistent application logs that the platform can collect and search.Node.js
Validation@nhtio/validationCheck that data coming in (forms, API requests, files) has the right shape and values before the app uses it.Node.js, Browser
Encryption@nhtio/encryptionEncrypt and decrypt sensitive values on the server.Node.js
Web Encryption@nhtio/web-encryptionEncrypt and decrypt values in the browser.Browser
Encoder@nhtio/encoderTurn complex data (dates, maps, nested objects) into text and back without losing information, e.g. to store or send it.Node.js, Browser
Kyoo@nhtio/kyooSend work to a background queue and process it later, with one API whatever queue system is behind it.Node.js
Millicron@nhtio/millicronRun tasks on a schedule (every hour, every Monday at 9:00, …).Node.js, Browser
Hooks@nhtio/hooksLet parts of the app run extra steps before or after something happens, without wiring them together directly.Node.js, Browser
Middleware@nhtio/middlewarePass a request or job through a chain of steps (checks, transforms, logging), where any step can stop it.Node.js, Browser
Tiny Typed Emitter@nhtio/tiny-typed-emitterLet parts of the app announce events and listen for them, with type checking.Node.js, Browser
Phone Object@nhtio/phone-objectParse, validate, and format phone numbers from any country.Node.js, Browser
Reactive Store@nhtio/reactive-storeKeep shared app state that updates the screen automatically when it changes.Browser
Swarm@nhtio/swarmLet several open tabs of the same app talk to each other, e.g. so only one tab polls the server.Browser
Crow's Nest@nhtio/crows-nestKeep full-screen layouts clear of phone notches, rounded corners, and browser toolbars.Browser
Common Vue@nhtio/common-vueReady-made general-purpose Vue components.Vue
Vuetify Fields@nhtio/vuetify-fieldsExtra form fields for Vuetify apps beyond the built-in ones.Vue + Vuetify
Vuetifiable@nhtio/vuetifiableBuild your own components that look and behave like native Vuetify ones.Vue + Vuetify
Vue Editors@nhtio/vue-editorsEditor components (rich text, code, and similar) for Vue apps.Vue
Lucid Resourceful@nhtio/lucid-resourcefulDescribe your data models once and get create/read/update/delete APIs, validation, and API documentation generated for you.AdonisJS
Lucid Resourceful Vue Components@nhtio/lucid-resourceful-vue-componentsReady-made tables and forms that work directly with Lucid Resourceful APIs.Vue + Vuetify
Adonis Ally Keycloak@nhtio/adonis-ally-keycloakLet users sign in to an AdonisJS app with their company Keycloak account.AdonisJS
Adonis Kyoo@nhtio/adonis-kyooUse Kyoo background queues inside an AdonisJS app.AdonisJS
Adonis Millicron@nhtio/adonis-milicronRun scheduled tasks inside an AdonisJS app.AdonisJS
ESLint Config@nhtio/eslint-configDev's code style and lint rules, so code is formatted and checked the same way across projects.Tooling
Vite Plugins@nhtio/vite-pluginsDev's standard build plugins for Vite projects.Tooling
Japa JUnit Reporter@nhtio/japa-junit-reporterProduce test results in a format GitLab CI can display.Tooling

Where no company library covers a need, these are examples of third-party libraries Dev recommends:

NamePackageWhat it's forEnvironments
KnexknexWrite database queries and schema changes in code instead of raw SQL. Lucid is built on it.Node.js
BentoCachebentocacheCache slow or expensive results (in memory, Redis, …) so the app doesn't repeat the work.Node.js
Verrou@verrou/coreMake sure only one copy of the app does a given job at a time, even when several copies are running.Node.js
NeotraverseneotraverseWalk through and modify deeply nested data.Node.js, Browser
p-mapp-mapRun many async tasks in parallel, with a limit on how many run at once.Node.js, Browser

Repository hygiene ​

Never commit ​

  • Secrets: .env files, API keys, tokens, passwords, private keys. A secret that has been committed, or pasted into a chat, runbook, or ticket, MUST be treated as leaked and rotated. Deleting the commit or message is not enough.
  • Real data: spreadsheets, exports, CRM or BI extracts, rosters, client lists, payment trackers, or any other real business records. Use mock or synthetic data in the repository. If real data was committed, tell Dev; it has to be removed from history, not just from the current files.
  • Third-party deploy configuration: railway.json, Procfile, vercel.json, netlify.toml, GitHub Actions workflows, or vendor-specific deployment runbooks. Production hosting is provided by Dev, and this configuration is removed at handoff.

.gitignore baseline ​

Every project MUST start with at least:

gitignore
# Environment and secrets
.env*
!.env.example

# Local data and databases
data/*
*.sqlite
*.sqlite3
*.db

# Dependencies and build output
node_modules/
dist/
build/

# Local agent-tool state (add others your tool creates)
.claude/settings.local.json

Add entries for anything else the agent or tooling writes locally. If a project needs to keep sample files under data/, add explicit exceptions (!data/sample.csv) for mock data only.

Project documentation ​

Every project MUST include these files from the start, and agents MUST keep them up to date in the same commit as the change they describe.

FileLevelContents
AGENTS.mdMUSTThe first file any agent reads. What the app is; a link to this page (https://ai.policies.nht.io/agent-build-standards.md); how to install, run, and test it; which modules are business logic; and any project-specific hard rules.
CLAUDE.mdMUSTOnly the line @AGENTS.md, so Claude-based tools load the same instructions.
README.mdMUSTWhat the app does and who owns it, how to run it locally, the environment variables it needs (matching .env.example), and which stack choices from this page it uses.
CHANGELOG.mdSHOULDChanges in Keep a Changelog format, with unreleased work under Unreleased.
docs/architecture.mdSHOULDRequest flow, authentication, storage, data model, and integrations.
docs/local-development.mdSHOULDHow to run with no .env, then with auth on, real storage, and in the container.
docs/adr/MAYArchitecture decision records for significant choices, especially any deviation from this page.

Guardrails for agents ​

While building, an agent MUST:

  • use mock, synthetic, or approved non-sensitive data;
  • keep secrets out of source code, commit history, logs, and prompts, and tell the operator to rotate any secret that has been exposed;
  • not commit real business data, even temporarily;
  • not connect to production systems, production databases, or production APIs;
  • not deploy anything, or change CI/CD, infrastructure, or IAM configuration;
  • stop and tell the operator when the work reaches a Production Handoff Trigger, and point them to the official Dev request form.

Release and delivery ​

Dev handles deployment. Agents MUST NOT set up deployment pipelines, release automation, or hosting configuration. When a project needs to be deployed, start handoff.

A basic GitLab CI job that runs lint, type-check, and tests MAY be added.