Harness Agent for Backend: The First Pillar — Context from AGENTS.md with OpenCode

This article is the direct continuation of Building a Harness Agent for Backend: Step-by-Step Guide with Pi. In that first part we installed the agent, configured tools, skills, and automation. Now we put it into practice — real project, real context, real code.


In the first installment we talked about the four pillars of harness engineering: Constrain, Inform, Verify, Correct. But we stayed on the surface — theory, generic examples, best practices.

This article is different. Here we build. We’re going to:

  1. Create a real backend project with NestJS 11 and pnpm
  2. Use OpenCode to craft a custom AGENTS.md with harness workflow
  3. Install the harness skillsgrill-me, nestjs-best-practices, qa
  4. Enrich that AGENTS.md with context — the first pillar of the harness

Everything you do here, your agent will do on its own later.


Why Context is the First Pillar

The four pillars of harness engineering have a order for a reason:

OrderPillarQuestion it answers
1Context (Inform)What does the agent need to know to work?
2ConstraintsWhat can’t the agent do?
3VerificationHow do we know it did it right?
4CorrectionWhat happens when it makes a mistake?

Without context, the other pillars have no foundation. Context is the bedrock of the harness.

If your agent doesn’t know:

  • What stack you use (Express vs FastAPI vs NestJS)
  • What folder structure your project has
  • What coding rules you follow
  • What commands it needs to run, test, and build

…then it doesn’t matter how good your skills are or how robust your tests are. The agent will be operating blind.

The golden rule of harness engineering: From the agent’s perspective, anything it can’t access in context doesn’t exist. The repository must be the single source of truth.


Creating the NestJS Project

NestJS 11 is a progressive Node.js framework for building efficient, reliable, and scalable backend applications. It uses TypeScript by default, has a modular architecture, and supports dependency injection — ideal for a harness agent. We’ll use pnpm as our package manager for its speed and strict dependency resolution.

Prerequisites

Make sure you have Node.js 18+ and the NestJS CLI installed:

node --version   # ≥ 18
pnpm --version   # ≥ 9

# Install NestJS CLI globally
pnpm add -g @nestjs/cli

Create the project

# Create a new NestJS project with pnpm
npx @nestjs/cli new --package-manager pnpm harness-nestjs

Once created, the base structure looks like this:

harness-nestjs/
├── src/
│   ├── app.controller.spec.ts
│   ├── app.controller.ts
│   ├── app.module.ts
│   ├── app.service.ts
│   └── main.ts
├── test/
│   ├── app.e2e-spec.ts
│   └── jest-e2e.json
├── nest-cli.json
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
├── tsconfig.build.json
├── eslint.config.mjs
└── .gitignore

Verify it works:

cd harness-nestjs
pnpm run start:dev

You should see:

[Nest] 12345  - 06/02/2026, 12:00:00 PM     LOG [NestApplication] Nest application successfully started

Now we have a real backend project. But our agent knows nothing about it — not the structure, not the rules, not even that it exists. It’s time to build the context.


Generating AGENTS.md with OpenCode

OpenCode is an AI agent that runs in your terminal, and its /init command is a quick way to generate a baseline AGENTS.md. But here’s the thing — the baseline is just a skeleton. It gives you stack detection, a file tree, and some commands, but it doesn’t know how your agent should work.

That’s where the harness philosophy comes in. Instead of leaving the AGENTS.md generic, we’re going to craft it intentionally. We’ll use OpenCode as the tool, but we decide what goes in.

Step 1: Launch OpenCode

Make sure OpenCode is installed:

opencode --version

If you don’t have it: pnpm add -g opencode or visit opencode.ai.

Now navigate to the project root and launch OpenCode:

cd harness-nestjs
opencode

Step 2: Run /init as a starting point

Inside OpenCode, type:

/init

OpenCode scans the project and generates a basic AGENTS.md with the stack, file tree, and npm commands. It’s a decent starting point — but it’s not the final product. The commands will say npm (because NestJS CLI defaults to npm) even though we use pnpm. The workflow will be absent. The skills won’t be referenced.

So we take that file and we make it our own.

What we actually put in AGENTS.md

Instead of keeping the generic output, we write an AGENTS.md that answers the real questions an agent needs to work effectively in this harness:

# Harness NestJS Template

Backend with NestJS, strict typing, Swagger documentation, and production practices enforced by the `nestjs-best-practices` skill.

## Workflow

1. **Grill the design** — Use `grill-me` skill to stress-test requirements
2. **Review context** — Check project patterns, dependencies, Docker setup
3. **Implement** — Use `nestjs-best-practices` skill during code generation
4. **Persist** — Save functional requirements via engram MCP
5. **Test** — QA phases: requirements validation, security audit, scenario execution

## Commands

```sh
pnpm run build         # nest build -> dist/
pnpm run start:dev     # watch mode
pnpm run test          # jest (unit: src/**/*.spec.ts)
pnpm run test:e2e      # jest (e2e: test/**/*.e2e-spec.ts)
pnpm run test:cov      # jest --coverage
pnpm run lint          # eslint --fix
pnpm run format        # prettier --write

Conventions

  • Package manager: pnpm (lockfile v9). Do NOT use npm or yarn.
  • Testing: Jest + ts-jest. E2e uses supertest.
  • Lint: ESLint v9 flat config, type-aware via projectService: true.
  • Format: Prettier — single quotes, trailing commas.
  • Port: process.env.PORT or 3000.

Notice what's different from the `/init` output:

1. **We fixed the commands** — `/init` detects what's in `package.json` as-is, but it doesn't know your conventions. We changed `npm` to `pnpm` and added explicit test patterns.
2. **We added a workflow** — The agent now knows the **order of operations**: grill → review → implement → persist → test. This is the harness.
3. **We referenced skills by name** — `grill-me`, `nestjs-best-practices` — the agent knows what tools to use and when.
4. **We documented conventions** — ESLint version, Prettier config, port conventions. The agent doesn't have to guess.

This is the **base context**. But we can go deeper.

---

## Enriching AGENTS.md: Context as the Single Source of Truth

The `AGENTS.md` is the first thing your agent reads. It defines **everything it knows about your code and your workflow**.

Most tutorials stop at documenting the tech stack: "you use Prisma, PostgreSQL, JWT." That's table stakes. The real power is in documenting **how the agent should work** — the process, the order of operations, the tools it needs to reach for at each step.

That's what we're going to do here. Instead of filling `AGENTS.md` with hypothetical dependencies (Prisma, Redis, Docker — which we don't have yet), we enrich it with:

1. **Dimensionality** — What kind of project is this? How big is it?
2. **Workflow** — What are the step-by-step phases the agent follows?
3. **Skills** — Which skills fire at each phase and why
4. **Conventions** — The real rules of this project

### 1. Dimensionality

First, describe the project's scope so the agent understands the playing field:

```markdown
## Dimensionality

Application with workers, queues, and Redis caching. Clean API contracts
for both payload and response. Swagger documentation. High test coverage.

This tells the agent: we care about infrastructure patterns (workers, queues, cache), API quality (contracts, Swagger), and reliability (coverage). The agent now knows what GOOD looks like in this project.

2. Workflow Definition

This is the heart of harness enrichment. We define an exact step-by-step process:

## Paso a paso de implementación

1. **Grill the requirement** — Use the `grill-me` skill to determine
   or deepen the requirement before writing any code
2. **Review context** — Check current project patterns, dependencies,
   and execution tools (Docker, etc.)
3. **Implement** — Use the `nestjs-best-practices` skill during
   code generation
4. **Persist** — Use engram MCP to save functional requirements,
   not implementation details
5. **Test** — QA session with two phases:
   - Phase 1: Determine requirements the implementation must satisfy
   - Phase 2: Find gaps (security, SQL injection, web vulnerabilities)
   - Phase 3: Execute QA scenarios via `qa-nestjs`
   - Phase 4: Feedback loop — repeat 3+ if issues found

Every line serves a purpose:

  • Grill-me prevents the agent from coding the wrong thing. It forces a design conversation before implementation.
  • nestjs-best-practices ensures every line of generated code follows production patterns — dependency injection, error handling, security, performance.
  • Engram MCP persists what was learned. The agent saves what it built and why, not the raw code.
  • QA + qa-nestjs creates a structured verification loop. The agent audits its own work for functional gaps and security issues.

3. Command Reference

Fix the commands to match reality. The /init output had npm — we use pnpm:

## Commands

pnpm run build         # nest build -> dist/
pnpm run start:dev     # watch mode
pnpm run test          # jest (unit: src/**/*.spec.ts)
pnpm run test:e2e      # jest (e2e: test/**/*.e2e-spec.ts)
pnpm run test:cov      # jest --coverage
pnpm run lint          # eslint --fix
pnpm run format        # prettier --write

- No `tsc --noEmit``pnpm run build` is the typecheck command
- Codegen: `nest g module <name>`, `nest g controller <name>`, etc.

4. Conventions

Document the non-negotiables:

## Conventions

- **Package manager**: pnpm (lockfile v9). Do NOT use npm or yarn.
- **Testing**: Jest + ts-jest. E2e uses supertest.
- **Lint**: ESLint v9 flat config, type-aware via projectService: true.
- **Format**: Prettier — single quotes, trailing commas.
- **Port**: `process.env.PORT` or `3000`.
- **Build**: deleteOutDir: true — cleans dist/ before each build.

5. Architecture

Keep it simple at this stage — the project is a single module:

## Architecture

main.ts -> AppModule -> AppController -> AppService (GET /)

Single module, no database, no auth.
Module organization: src/<domain>/ when adding features.

Installing the Harness Skills

The enrichment above references four skills. Here’s how to install them:

grill-me

Stress-tests requirements before implementation. Forces a design conversation:

npx skills@latest add mattpocock/skills

This installs grill-me (and potentially other skills) under .claude/skills/. When the agent enters the project, it can activate this skill to grill the user about any new feature before writing code.

nestjs-best-practices

40+ rules across 10 categories — architecture, dependency injection, error handling, security, performance, testing, database, API design, microservices, DevOps:

npx skills@latest add kadajett/agent-nestjs-skills --skill nestjs-best-practices

The agent loads this skill during implementation and references the rules automatically. No more manual “remember to validate inputs” — the skill enforces it.

qa & qa-nestjs

QA skills define how the agent validates its own work. Create .agents/skills/qa/SKILL.md and .agents/skills/qa-nestjs/SKILL.md:

  • qa: Interactive QA session — the user reports bugs conversationally, the agent explores the codebase for context, and files GitHub issues
  • qa-nestjs: Executes QA scenarios specifically for NestJS implementations, checking functional requirements, security gaps, and execution correctness

These skills close the verification loop. The agent builds → the agent tests → the agent reports → the agent fixes.


The Final AGENTS.md

After enrichment, your AGENTS.md is not a generic scan output — it’s a harness instruction manual. It tells the agent:

  1. What this project is — Dimensionality, scope, quality bar
  2. How to work here — The exact 5-step workflow with skill references
  3. What commands to use — pnpm, not npm. Specific test and build patterns
  4. What rules to follow — ESLint config, Prettier settings, port conventions
  5. What skills to load and when — grill-me, nestjs-best-practices, qa, qa-nestjs

When your agent enters this project, it will:

  1. Read AGENTS.md — understands the project scope and quality expectations
  2. Load the workflow — knows the order: grill → context → implement → persist → test
  3. Activate skills at the right moment — uses nestjs-best-practices during coding, qa after
  4. Run the correct commands — pnpm, not npm. Knows the difference between unit and e2e
  5. Persist learnings — saves functional requirements to engram for future sessions

The Harness in Action: A Real Flow

Let me show you what this looks like in practice. When a developer asks the agent to “add a new module for user management,” here’s what happens:

  1. Grill phase: The agent activates grill-me and interviews the developer. “What fields does a user have? Are there roles? What auth strategy? Do we need pagination? Soft deletes?” By the end, requirements are crystal clear.

  2. Context review: The agent checks AGENTS.md — convention says kebab-case files, PascalCase classes. It checks the architecture — single module, add under src/<domain>/. It checks commands — no Prisma here yet, so it asks or infers.

  3. Implementation: The agent loads nestjs-best-practices. It generates UsersModule, UsersController, UsersService. The skill enforces constructor injection, exception filters, proper DTOs. The code is production-ready from line 1.

  4. Persistence: The agent calls engram MCP to save: “Created UsersModule with CRUD endpoints. Requirements: name, email, role fields. Authorization via JWT guard.”

  5. QA: The agent runs qa-nestjs. It checks: Are there security gaps? SQL injection vectors? Validation missing on any endpoint? Does the response format match conventions? If issues are found, the agent loops back to step 3.

This is the harness in action. The developer doesn’t micromanage — the agent follows the documented workflow automatically.


Workflow: Grilling Your Design

Context isn’t just about static documentation — it’s also about validating your decisions. Before implementing a new module or changing the architecture, use the Grill Me skill to stress-test your design.

This skill interviews you relentlessly about every aspect of your plan, walking down each branch of the decision tree until you reach a shared understanding. It’s the perfect complement to the AGENTS.md — the document provides the context, and Grill Me ensures the design is solid before you write a single line of code.

Install it with:

npx skills@latest add mattpocock/skills

By combining a well-structured AGENTS.md with active design validation, you’re not just informing your agent — you’re building a workflow that prevents costly mistakes early.


What We Accomplished

BeforeAfter
Agent enters the project and knows nothingAgent knows scope, workflow, and conventions
You have to explain the process each timeAgent follows the documented workflow
Skills are optional, used randomlySkills are activated at the right phase
Context is just a tech stack listContext is an instruction manual for the agent
Every session starts from zeroEvery session retakes existing context + engram history

In the Next Article…

The first pillar is in place. The agent has context and skills. In the next article we’ll cover:

  • Pillar 2: Constraints — Rules that tell the agent what NOT to do
  • How to write dependency rules that prevent architecture violations
  • Structural tests that enforce conventions automatically
  • Preventing the agent from generating code outside the defined scope
  • Using the qa skill to catch violations before they reach production

The harness is built layer by layer. Context is the foundation. Give your agent the right instructions, and it builds itself.


Do you have a NestJS project started? The process is the same — create the project, craft the AGENTS.md, install the skills. The stack doesn’t matter as much as the workflow. Try it and let me know how it goes.

Share
D
Diego Duran
@fxckcode

Backend engineer who ships agentic CLI tooling. NestJS, Go, Django, AWS.

Harness Agent para Backend: El Primer Pilar — Contexto desde AGENTS.md con OpenCode

Este artículo es la continuación directa de Creando un Harness Agent para Backend: Guía Paso a Paso con Pi. En esa primera parte instalamos el agente, configuramos herramientas, skills y automatización. Ahora vamos a ponerlo en práctica — proyecto real, contexto real, código real.


En la primera entrega hablamos de los cuatro pilares del harness engineering: Restringir, Informar, Verificar y Corregir. Pero nos quedamos en la superficie — teoría, ejemplos genéricos, buenas prácticas.

Este artículo es diferente. Aquí construimos. Vamos a:

  1. Crear un proyecto backend real con NestJS 11 y pnpm
  2. Usar OpenCode para crear un AGENTS.md personalizado con workflow del harness
  3. Instalar las skills del harnessgrill-me, nestjs-best-practices, qa
  4. Enriquecer ese AGENTS.md con contexto — el primer pilar del harness

Todo lo que hagas aquí, lo hará tu agente después por sí solo.


¿Por Qué el Contexto es el Primer Pilar?

Los cuatro pilares del harness engineering tienen un orden por una razón:

OrdenPilarPregunta que responde
1Contexto (Informar)¿Qué necesita saber el agente para trabajar?
2Restricciones¿Qué no puede hacer el agente?
3Verificación¿Cómo sabemos que lo hizo bien?
4Corrección¿Qué pasa cuando se equivoca?

Sin contexto, los otros pilares no tienen base. El contexto es el cimiento del harness.

Si tu agente no sabe:

  • Qué stack usas (Express vs FastAPI vs NestJS)
  • Qué estructura de carpetas tiene el proyecto
  • Qué reglas de código sigues
  • Qué comandos necesita para correr, testear y compilar

…entonces no importa qué tan buenas sean tus skills o qué tan robustos sean tus tests. El agente va a operar a ciegas.

La regla de oro del harness engineering: Desde la perspectiva del agente, cualquier cosa que no pueda acceder en contexto no existe. El repositorio debe ser la única fuente de verdad.


Creando el Proyecto NestJS

NestJS 11 es un framework progresivo de Node.js para construir aplicaciones backend eficientes, confiables y escalables. Usa TypeScript por defecto, tiene una arquitectura modular, y soporta inyección de dependencias — ideal para un harness agent. Vamos a usar pnpm como gestor de paquetes por su velocidad y resolución estricta de dependencias.

Requisitos

Asegurate de tener Node.js 18+ y el CLI de NestJS instalado:

node --version   # ≥ 18
pnpm --version   # ≥ 9

# Instalar NestJS CLI globalmente
pnpm add -g @nestjs/cli

Crear el proyecto

# Crea un nuevo proyecto NestJS con pnpm
npx @nestjs/cli new --package-manager pnpm harness-nestjs

Una vez creado, la estructura base se ve así:

harness-nestjs/
├── src/
│   ├── app.controller.spec.ts
│   ├── app.controller.ts
│   ├── app.module.ts
│   ├── app.service.ts
│   └── main.ts
├── test/
│   ├── app.e2e-spec.ts
│   └── jest-e2e.json
├── nest-cli.json
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
├── tsconfig.build.json
├── eslint.config.mjs
└── .gitignore

Verifica que funciona:

cd harness-nestjs
pnpm run start:dev

Deberías ver:

[Nest] 12345  - 06/02/2026, 12:00:00 PM     LOG [NestApplication] Nest application successfully started

Ahora tenemos un proyecto backend real. Pero nuestro agente no sabe nada de él — ni la estructura, ni las reglas, ni siquiera que existe. Es hora de construir el contexto.


Generando el AGENTS.md con OpenCode

OpenCode es un agente de IA que corre en tu terminal, y su comando /init es una forma rápida de generar un AGENTS.md base. Pero acá está el tema — la base es solo un esqueleto. Te da la detección del stack, un árbol de archivos y algunos comandos, pero no sabe cómo debería trabajar tu agente.

Ahí entra la filosofía del harness. En vez de dejar el AGENTS.md genérico, lo vamos a construir intencionalmente. Usamos OpenCode como herramienta, pero nosotros decidimos qué contiene.

Paso 1: Entrar a OpenCode

Asegurate de tener OpenCode instalado:

opencode --version

Si no lo tenés: pnpm add -g opencode o visitá opencode.ai.

Ahora navegá a la raíz del proyecto y arrancá OpenCode:

cd harness-nestjs
opencode

Paso 2: Usá /init como punto de partida

Dentro de OpenCode, escribí:

/init

OpenCode escanea el proyecto y genera un AGENTS.md básico con el stack, el árbol de archivos y comandos npm. Está bien como arranque — pero no es el producto final. Los comandos van a decir npm (porque el CLI de NestJS defaultea a npm) aunque nosotros usemos pnpm. El workflow no va a estar. Las skills no van a estar referenciadas.

Así que tomamos ese archivo y lo hacemos nuestro.

Lo que realmente pusimos en AGENTS.md

En vez de quedarnos con la salida genérica, escribimos un AGENTS.md que responde las preguntas reales que un agente necesita para trabajar efectivamente en este harness:

# Harness NestJS Template

Backend con NestJS, tipado estricto, documentación Swagger y prácticas de producción
enforcedas por la skill `nestjs-best-practices`.

## Workflow

1. **Grillá el diseño** — Usá la skill `grill-me` para poner a prueba los requisitos
2. **Revisá el contexto** — Verificá patrones del proyecto, dependencias, Docker
3. **Implementá** — Usá la skill `nestjs-best-practices` durante la generación de código
4. **Persistí** — Guardá los requisitos funcionales via engram MCP
5. **Testeá** — Fases QA: validación de requisitos, auditoría de seguridad, ejecución de escenarios

## Commands

```sh
pnpm run build         # nest build -> dist/
pnpm run start:dev     # watch mode
pnpm run test          # jest (unit: src/**/*.spec.ts)
pnpm run test:e2e      # jest (e2e: test/**/*.e2e-spec.ts)
pnpm run test:cov      # jest --coverage
pnpm run lint          # eslint --fix
pnpm run format        # prettier --write

Conventions

  • Package manager: pnpm (lockfile v9). NO usar npm ni yarn.
  • Testing: Jest + ts-jest. E2e usa supertest.
  • Lint: ESLint v9 flat config, type-aware via projectService: true.
  • Format: Prettier — single quotes, trailing commas.
  • Port: process.env.PORT o 3000.

Notá la diferencia con la salida de `/init`:

1. **Corregimos los comandos** — `/init` detecta lo que está en `package.json` pero no sabe tus convenciones. Cambiamos `npm` a `pnpm` y agregamos patrones de test explícitos.
2. **Agregamos un workflow** — El agente ahora sabe el **orden de operaciones**: grill → review → implement → persist → test. Eso es el harness.
3. **Referenciamos skills por nombre** — `grill-me`, `nestjs-best-practices` — el agente sabe qué herramientas usar y cuándo.
4. **Documentamos convenciones** — Versión de ESLint, config de Prettier, convenciones de puerto. El agente no tiene que adivinar.

Este es el **contexto base**. Pero podemos ir más profundo.

---

## Enriqueciendo el AGENTS.md: El Contexto como Fuente de Verdad

El `AGENTS.md` es lo primero que lee tu agente. Define **todo lo que sabe sobre tu código y tu workflow**.

La mayoría de los tutoriales se quedan en documentar el stack tecnológico: "usás Prisma, PostgreSQL, JWT." Eso es el mínimo. El poder real está en documentar **cómo debería trabajar el agente** — el proceso, el orden de operaciones, las herramientas que necesita usar en cada paso.

Eso es lo que vamos a hacer acá. En vez de llenar el `AGENTS.md` con dependencias hipotéticas (Prisma, Redis, Docker — que todavía no tenemos), lo enriquecemos con:

1. **Dimensionamiento** — ¿Qué tipo de proyecto es? ¿Qué tan grande?
2. **Workflow** — ¿Cuáles son las fases paso a paso que sigue el agente?
3. **Skills** — Qué skills se disparan en cada fase y por qué
4. **Convenciones** — Las reglas reales de este proyecto

### 1. Dimensionamiento

Primero, describí el alcance del proyecto para que el agente entienda el terreno de juego:

```markdown
## Dimensionamiento

Aplicación con implementación de sistema de workers, colas y caché en Redis.
Usando un correcto contrato de APIs tanto en el payload como en salida.
Documentación en Swagger y alto porcentaje en coverage.

Esto le dice al agente: nos importan los patrones de infraestructura (workers, colas, caché), la calidad de APIs (contratos, Swagger) y la confiabilidad (coverage). El agente ahora sabe qué es lo que CONSIDERAMOS BUENO en este proyecto.

2. Workflow Definition

Este es el corazón del enriquecimiento del harness. Definimos un proceso paso a paso exacto:

## Paso a paso de implementación

1. **Grillá el requerimiento** — Usá la skill `grill-me` para determinar
   o profundizar en el requerimiento antes de escribir código
2. **Revisá el contexto** — Verificá patrones actuales del proyecto,
   dependencias y herramientas de ejecución (Docker, etc.)
3. **Implementá** — Usá la skill `nestjs-best-practices` durante
   la generación de código
4. **Persistí** — Usá engram MCP para guardar los requerimientos
   funcionales, no los detalles de implementación
5. **Testeá** — Sesión QA con dos fases:
   - Fase 1: Determiná los requerimientos que debe cumplir la implementación
   - Fase 2: Encontrá vacíos (seguridad, SQL injection, vulnerabilidades web)
   - Fase 3: Ejecutá escenarios QA via `qa-nestjs`
   - Fase 4: Feedback loop — repetí paso 3+ si se encuentran problemas

Cada línea tiene un propósito:

  • Grill-me evita que el agente codee lo incorrecto. Fuerza una conversación de diseño antes de la implementación.
  • nestjs-best-practices asegura que cada línea de código generado siga patrones de producción — inyección de dependencias, manejo de errores, seguridad, rendimiento.
  • Engram MCP persiste lo aprendido. El agente guarda qué construyó y por qué, no el código crudo.
  • QA + qa-nestjs crea un loop de verificación estructurado. El agente audita su propio trabajo buscando gaps funcionales y problemas de seguridad.

3. Comandos de Referencia

Corregí los comandos para que reflejen la realidad. La salida de /init tenía npm — nosotros usamos pnpm:

## Commands

pnpm run build         # nest build -> dist/
pnpm run start:dev     # watch mode
pnpm run test          # jest (unit: src/**/*.spec.ts)
pnpm run test:e2e      # jest (e2e: test/**/*.e2e-spec.ts)
pnpm run test:cov      # jest --coverage
pnpm run lint          # eslint --fix
pnpm run format        # prettier --write

- No hay `tsc --noEmit``pnpm run build` es el comando de typecheck
- Codegen: `nest g module <name>`, `nest g controller <name>`, etc.

4. Convenciones

Documentá los no-negociables:

## Conventions

- **Package manager**: pnpm (lockfile v9). NO usar npm ni yarn.
- **Testing**: Jest + ts-jest. E2e usa supertest.
- **Lint**: ESLint v9 flat config, type-aware via projectService: true.
- **Format**: Prettier — single quotes, trailing commas.
- **Port**: `process.env.PORT` o `3000`.
- **Build**: deleteOutDir: true — limpia dist/ antes de cada build.

5. Arquitectura

Mantenela simple en esta etapa — el proyecto es un módulo único:

## Architecture

main.ts -> AppModule -> AppController -> AppService (GET /)

Single module, no database, no auth.
Module organization: src/<domain>/ when adding features.

Instalando las Skills del Harness

El enriquecimiento de arriba referencia cuatro skills. Acá te muestro cómo instalarlas:

grill-me

Pone a prueba los requisitos antes de la implementación. Fuerza una conversación de diseño:

npx skills@latest add mattpocock/skills

Esto instala grill-me (y potencialmente otras skills) en .claude/skills/. Cuando el agente entre al proyecto, puede activar esta skill para interrogar al usuario sobre cualquier feature nuevo antes de escribir código.

nestjs-best-practices

40+ reglas en 10 categorías — arquitectura, inyección de dependencias, manejo de errores, seguridad, rendimiento, testing, base de datos, diseño de APIs, microservicios, DevOps:

npx skills@latest add kadajett/agent-nestjs-skills --skill nestjs-best-practices

El agente carga esta skill durante la implementación y referencia las reglas automáticamente. No más “acordate de validar los inputs” manuales — la skill lo enforcea.

qa & qa-nestjs

Las skills de QA definen cómo el agente valida su propio trabajo. Creá .agents/skills/qa/SKILL.md y .agents/skills/qa-nestjs/SKILL.md:

  • qa: Sesión QA interactiva — el usuario reporta bugs conversacionalmente, el agente explora el codebase para contexto y crea GitHub issues
  • qa-nestjs: Ejecuta escenarios QA específicos para implementaciones NestJS, verificando requerimientos funcionales, gaps de seguridad y corrección de ejecución

Estas skills cierran el loop de verificación. El agente construye → el agente testea → el agente reporta → el agente corrige.


El AGENTS.md Final

Después del enriquecimiento, tu AGENTS.md no es un escaneo genérico — es un manual de instrucciones del harness. Le dice al agente:

  1. Qué es este proyecto — Dimensionamiento, alcance, estándar de calidad
  2. Cómo trabajar acá — El workflow exacto de 5 pasos con referencias a skills
  3. Qué comandos usar — pnpm, no npm. Patrones específicos de test y build
  4. Qué reglas seguir — Config de ESLint, settings de Prettier, convenciones de puerto
  5. Qué skills cargar y cuándo — grill-me, nestjs-best-practices, qa, qa-nestjs

Cuando tu agente entre a este proyecto, va a:

  1. Leer AGENTS.md — entiende el alcance del proyecto y las expectativas de calidad
  2. Cargar el workflow — sabe el orden: grill → contexto → implementar → persistir → testear
  3. Activar skills en el momento correcto — usa nestjs-best-practices al codea, qa después
  4. Ejecutar los comandos correctos — pnpm, no npm. Sabe la diferencia entre unit y e2e
  5. Persistir lo aprendido — guarda requerimientos funcionales en engram para sesiones futuras

El Harness en Acción: Un Flujo Real

Dejame mostrarte cómo se ve esto en la práctica. Cuando un desarrollador le pide al agente “agregá un nuevo módulo para gestión de usuarios”, esto es lo que pasa:

  1. Fase Grill: El agente activa grill-me y entrevista al desarrollador. “¿Qué campos tiene un usuario? ¿Hay roles? ¿Qué estrategia de auth? ¿Necesitamos paginación? ¿Soft deletes?” Al final, los requisitos están clarísimos.

  2. Revisión de contexto: El agente revisa AGENTS.md — la convención dice archivos kebab-case, clases PascalCase. Revisa la arquitectura — módulo único, agregar bajo src/<domain>/. Revisa comandos — no hay Prisma todavía, así que pregunta o infiere.

  3. Implementación: El agente carga nestjs-best-practices. Genera UsersModule, UsersController, UsersService. La skill enforcea constructor injection, exception filters, DTOs correctos. El código es produccionable desde la línea 1.

  4. Persistencia: El agente llama a engram MCP para guardar: “Created UsersModule with CRUD endpoints. Requirements: name, email, role fields. Authorization via JWT guard.”

  5. QA: El agente ejecuta qa-nestjs. Verifica: ¿Hay gaps de seguridad? ¿Vectores de SQL injection? ¿Falta validación en algún endpoint? ¿El formato de respuesta sigue las convenciones? Si encuentra issues, el agente vuelve al paso 3.

Este es el harness en acción. El desarrollador no microgestiona — el agente sigue el workflow documentado automáticamente.


Workflow: Poniendo tu Diseño a Prueba

El contexto no se trata solo de documentación estática — también se trata de validar tus decisiones. Antes de implementar un nuevo módulo o cambiar la arquitectura, usá el skill Grill Me para poner a prueba tu diseño.

Este skill te entrevista sin pausa sobre cada aspecto de tu plan, recorriendo cada rama del árbol de decisiones hasta llegar a un entendimiento compartido. Es el complemento perfecto para el AGENTS.md — el documento provee el contexto, y Grill Me asegura que el diseño sea sólido antes de escribir una sola línea de código.

Instalalo con:

npx skills@latest add mattpocock/skills

Al combinar un AGENTS.md bien estructurado con validación activa del diseño, no solo estás informando a tu agente — estás construyendo un workflow que previene errores costosos desde el inicio.


Lo que Logramos

AntesDespués
El agente entra al proyecto y no sabe nadaEl agente conoce alcance, workflow y convenciones
Tenés que explicarle el proceso cada vezEl agente sigue el workflow documentado
Las skills son opcionales, se usan al azarLas skills se activan en la fase correcta
El contexto es solo una lista del stackEl contexto es un manual de instrucciones para el agente
Cada sesión empieza desde ceroCada sesión retoma el contexto existente + historial de engram

En el Próximo Artículo…

El primer pilar está en su lugar. El agente ya tiene contexto y skills. En el próximo artículo vamos a:

  • Pilar 2: Restricciones — Reglas que le dicen al agente qué NO puede hacer
  • Cómo escribir reglas de dependencias que prevengan violaciones de arquitectura
  • Tests estructurales que enforcean convenciones automáticamente
  • Cómo evitar que el agente genere código fuera del alcance definido
  • Usar la skill qa para detectar violaciones antes de que lleguen a producción

El harness se construye capa por capa. El contexto es la base. Dale a tu agente las instrucciones correctas, y se construye solo.


¿Tenés un proyecto NestJS empezado? El proceso es el mismo — creá el proyecto, construí el AGENTS.md, instalá las skills. El stack importa menos que el workflow. Probá y contame cómo te va.

Compartir
D
Diego Duran
@fxckcode

Ingeniero backend que construye herramientas CLI agentivas. NestJS, Go, Django, AWS.