agentleFS
angelgabrieljacintohuayllascoangelgabrieljacintohuayllasco/clipboard-skills/skills/test-strategy/SKILL.md

test-strategy

Skill0 starsChanged 2 months agoMITView on GitHub

Decide what and how to test: \"no hay tests\", \"qué pruebo\", \"write tests\", flaky or slow suites, useless coverage, legacy characterization tests, mutation testing.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use test-data-management, incident-response and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • petrkindlmannSkill

    test-data-management

    Create and manage test data with factory patterns, fixture strategies, data anonymization, and synthetic data generation. Covers Fishery (TypeScript), FactoryBot (Ruby), Factory Boy (Python), database seeding, cleanup strategies, and GDPR-compliant data handling. Use when: "test data," "fixtures," "factories," "seed data," "synthetic data," "test database," "data anonymization." Not for: migration/integrity testing of the DB itself — use database-testing; environment provisioning and database branching strategy — use test-environments. Related: test-environments, database-testing, api-testing, unit-testing.

    Also in 3 projects that use this

  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 5 projects that use this

  • LLl0k0laDSkill

    security-and-hardening

    Use when handling user input, authentication, data storage, or external integrations. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services.

    Also in 3 projects that use this

  • mrgoonieSkill

    context-engineering

    Master context engineering for AI agent systems. Use when designing agent architectures, debugging context failures, optimizing token usage, implementing memory systems, building multi-agent coordination, evaluating agent performance, or developing LLM-powered pipelines. Covers context fundamentals, degradation patterns, optimization techniques (compaction, masking, caching), compression strategies, memory architectures, multi-agent patterns, LLM-as-Judge evaluation, tool design, and project development.

    Also in 4 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 1

    Distinctive

    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:

    Test que se rompe cada vez que se mueve código sin cambiar comportamiento = test mal escrito.

    line 70

“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “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

Test-Strategy — la red que permite no leer cada línea

Overview

Si el humano deja de auditar el código que escribe la IA, la suite de pruebas es lo único que queda entre el cambio y el usuario. Eso cambia el criterio de diseño: no se prueba para subir un número, se prueba para poder aceptar código que nadie leyó.

Cobertura alta con tests que no afirman nada es peor que no tener tests: da permiso para confiar. El puntaje de mutación existe justo para medir eso — cuántos fallos inyectados detecta tu suite de verdad.

Cuándo usar

  • Proyecto sin tests, o con tests que no atrapan nada.
  • Convertir criterios de aceptación del spec en pruebas ejecutables.
  • Antes de refactorizar (tests de caracterización).
  • Suite lenta, frágil o intermitente.
  • Cobertura alta y aun así se escapan bugs.

Cuándo NO usar

SituaciónRuta
Correr y evaluar métricasquality-gate
Fijar umbrales por perfilconstitution
Bug concreto con stack tracefixer (prueba de regresión incluida)
Prototipo P1 desechable1 smoke test del camino feliz y seguir

Regla de hierro: el test se escribe viendo fallar

UN TEST QUE NUNCA SE VIO EN ROJO NO PRUEBA NADA.

Procedimiento: escribe el test → córrelo y observa el fallo → implementa → míralo pasar. Si pasó a la primera, rompe a propósito el código (cambia un > por >=, devuelve null) y confirma que el test se cae. Un test que pasa con el código roto es peor que ningún test.

Cómo repartir el esfuerzo

NivelQué pruebaProporción sugeridaRegla
UnitarioLógica de dominio pura: cálculos, reglas, validaciones, máquinas de estado~70%Sin red, sin disco, sin reloj. Milisegundos. Es donde vive la mutación.
IntegraciónLos bordes: base de datos real, cola, sistema de archivos, cliente HTTP contra doble local~20%Un mock del borde no prueba el borde. Al menos uno real por integración.
E2E / aceptaciónLos 3-5 caminos por los que la gente paga~10%Lento y frágil por naturaleza: pocos, estables, sobre los flujos del spec.
ContratoLo que prometes a otros sistemassegún integracionesSi terceros dependen de tu formato, un cambio silencioso rompe a otros.

Regla práctica: cada criterio de aceptación (AC-n) del spec se mapea a un test con su identificador en el nombre. Así la trazabilidad spec ↔ suite es mecánica:

test('AC-3: cliente sin saldo no puede confirmar pedido', ...)

Qué probar primero (orden de valor)

  1. Lo que cuesta dinero o datos si falla: cobros, permisos, borrados, envíos a terceros.
  2. Lo que ya falló antes: todo bug arreglado nace con su prueba de regresión. Sin esa prueba, el bug vuelve.
  3. Reglas de negocio con ramas: descuentos, estados, límites, fechas, impuestos.
  4. Bordes y valores límite: 0, negativo, vacío, nulo, duplicado, gigante, unicode, zona horaria.
  5. Concurrencia e idempotencia: doble clic, reintento del webhook, dos procesos a la vez.

Qué NO probar (YAGNI aplicado a tests)

  • Frameworks y librerías de terceros: ya tienen sus tests.
  • Getters, setters y DTOs sin lógica.
  • Detalles de implementación privados: se rompen con cada refactor y no prueban comportamiento.
  • Maquetación pixel a pixel (para eso, pruebas visuales aparte y con criterio).
  • El camino feliz repetido diez veces con distintos nombres.

Test que se rompe cada vez que se mueve código sin cambiar comportamiento = test mal escrito. Prueba comportamiento observable, no estructura interna.

Legado sin tests: caracterización

  1. Elige la frontera más estrecha que rodee lo que vas a tocar.
  2. Escribe tests que capturen lo que el sistema hace hoy, no lo que debería hacer (aunque sea feo — el objetivo es detectar cambios, no juzgar).
  3. Con la red puesta, recién ahí refactor.
  4. Cuando descubras que un comportamiento actual está mal, no lo corrijas en el mismo paso: anótalo y decídelo con quien manda.

Mutación: la prueba de las pruebas

  • Mide qué porcentaje de fallos inyectados detecta la suite. Referencia práctica: 75-85% es sólido; por debajo de 60% hay huecos serios; 100% es inalcanzable por mutantes equivalentes.
  • Córrela sobre el núcleo de dominio, no sobre todo el repo (es cara).
  • Incremental sobre archivos cambiados en el día a día; completa de noche o semanal.
  • Un mutante sobreviviente es una pregunta honesta: "si cambio esto y nadie se queja, ¿para qué está esta línea?" — a veces la respuesta es borrar código, no agregar un test.

Suites frágiles: causas y arreglo

SíntomaCausa típicaArreglo
Falla 1 de cada 10 corridasEsperas por tiempo (sleep), orden de tests, estado compartidoEsperar por condición, aislar estado, resetear BD por test
Falla solo en CIZona horaria, locale, rutas, recursosFijar TZ y locale en el entorno de test; rutas relativas al proyecto
Falla al cambiar el ordenTests que dependen unos de otrosCada test crea su propio dato; nada de fixtures globales mutables
Lenta (>5 min)E2E de más, BD sin transaccionesBajar de nivel: mover reglas a tests unitarios; transacción por test
Fechas rompen en eneronew Date() real dentro del dominioReloj inyectable; nunca tiempo real en lógica

Un test intermitente que se ignora entrena al equipo a ignorar el rojo. O se arregla, o se borra: mantenerlo es peor que las dos.

Anti-racionalización

ExcusaRealidad
"Escribo los tests después"Después el código ya tiene la forma de lo intestable (dependencias duras, efectos en el constructor). El test escrito antes es también un diseño.
"Es muy difícil de testear"Eso no es un problema del test: es el diseño avisando. Extrae la lógica pura del efecto.
"Tengo 90% de cobertura"¿Y de mutación? La cobertura dice qué se ejecutó; la mutación dice qué se verificó.
"Mockeo todo, es más rápido"Y no prueba nada real. Los mocks de tus propios bordes se desincronizan con la realidad en silencio.
"El E2E cubre todo, no necesito unitarios"Un E2E rojo dice "algo se rompió". Un unitario rojo dice qué, dónde y por qué.
"Ese bug no vuelve a pasar"Vuelve. Siempre vuelve. Por eso el fix trae su test.

Formato de salida

  • Plan de pruebas: qué se prueba en cada nivel y por qué, con el mapeo AC-n → test.
  • Lista de lo que explícitamente NO se prueba, con motivo.
  • Tests escritos (vistos en rojo antes de verlos en verde).
  • Puntaje de mutación del núcleo si aplica, con los mutantes sobrevivientes relevantes.
  • Deuda de pruebas pendiente, priorizada por riesgo.

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.