CtrlK
BlogDocsLog inGet started
Tessl Logo

architect

Architect orchestrator Luana v4 (post pm-redesign 2026-05 Punto 4). Lee 01-spec.md (de /po-ux o /po) + 02-design-agentic.md (si agentic) en stories state=refined. Decide qué surfaces toca (BE/FE/agentic). Spawna `architect-orchestrator` (single agent type, full-stack) que internamente carga las skills `architect-be` + `architect-fe` + `architect-agentic` según surface — produce 03-arch.md consolidado + 03-arch-{be,fe,agentic}.md por surface en una sola pasada. Reúne y produce el READY PACKAGE: 03-arch.md (consolidado) + 04-validators.yaml (★CRITICAL — pytest/playwright/shell commands must_pass:true ejecutables, 4 categories: non_functional/functional/visual/agentic_eval) + 05-guidelines.md (patterns required/forbidden + files in scope) + 06-tickets.yaml (work units atómicos). Cierra story state refined → ready. Activa cuando user dice: '/architect', 'diseñemos la arq', 'tickets', 'qué tickets salen', 'arquitectura técnica', 'cómo lo construimos técnicamente', 'cerrá el ready package'.

70

Quality

88%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

/architect — Architect Orchestrator (Conv 1 cierre — produce ready package)

Owner: docs/product/stories/{story-id}/03-arch.md + 04-validators.yaml + 05-guidelines.md + 06-tickets.yaml. Cuando los 4 cerrados → state=refined → ready. Conv 2 (autonomous build) puede arrancar.

(single-brand — no brand input required)

<brand> ∈ (single-brand project — no brand selector). Si Chris no lo provee, PREGUNTAR antes de proceder. platform = stories cross-module que tocan engine (raro — requiere /pm autorización + outcome platform-level).

Si invocado vía /pm o vía /po-ux//po//ux-agentico handoff, el brand viene en el handoff. Si invocado directo por Chris → preguntar primero.

Cross-package surface scope (CRÍTICO):

SurfacePath canónicoEditable per-story
Brand backend modulesbackend/src/modules/{m}/✅ libre per-project
Brand frontend featuresfrontend/src/features/{m}/✅ libre per-project
Brand testsbackend/tests/ + frontend/src/**/*.test.ts + frontend/e2e/✅ libre per-project
Engine core packages(N/A single-brand — was Luana engine)⛔ requiere lift via /pm (promotion gate) — NO se edita en story brand-específica
Brand-extension agenticbackend/src/modules/{copilot,sales_agent}/{tools,extractors,workflows,personas,goldens,kb}/✅ libre per-project

Inputs obligatorios

  1. <brand> (REQUIRED, ver sección arriba)
  2. docs/product/stories/{story-id}/01-spec.md — ratificada por Chris (de /po-ux para UI std, /po para service/agentic)
  3. docs/product/stories/{story-id}/02-design-agentic.md — si agentic-story o mixed
  4. docs/product/stories/{story-id}/checkpoint.md — state=refined requerido (spec + diseño UX/agentic ratificados por Chris)
  5. docs/product/modules/{m}.md — estado funcional per-project
  6. docs/domains/INDEX.md o (N/A single-brand — core-modules registry was single-project)README.md — routing técnico per-project vs engine
  7. .claude/rules/anti-duplication.md — inventario shared abstractions cross-module

Workflow

Step 1 — Decidir surfaces

Lee 01-spec.md + 02-design-agentic.md (si aplica) + checkpoint. Decide cuáles surfaces toca:

  • BE: nuevo endpoint? schema change? service nuevo?
  • FE: UI nueva? hook nuevo? component nuevo?
  • AGENTIC: tool nuevo? prompt slot? eval suite?

Tabla decisión:

Story typeSurfaces típicas
ui-story simpleFE only
ui-story con CRUDFE + BE
agentic-storyAGENTIC + (BE si tool nuevo) + (FE si trigger UI)
service-storyBE only o AGENTIC + BE

Step 2 — Spawn architect-orchestrator (single-shot full-stack)

Canonical pattern (formalized 2026-05-08 después del 2do uso exitoso): spawn UN solo agent architect-orchestrator que cubre BE+FE+AGENTIC en una sola pasada. Las skills architect-be, architect-fe, architect-agentic son instruction docs (no agent types registrados) que el orchestrator carga contextualmente según las surfaces que el ticket toca. Esto produce coherent design + cross-cutting decisions consistent — valor demostrado en Story B (eval-foundation-simulator) + Story C (personas-instrumented-runtime) + Story D (goldens-3-tenants-dataset).

Histórico: intentos previos de spawnar architect-be / architect-fe / architect-agentic como agent types separados fallaron — esos types nunca se registraron en .claude/agents/. Solo existe architect-orchestrator.md.

Spawn (REQUIRED: pasá <brand>: {brand} como input al sub-agent):

Agent({
  description: "Architect Story {id} {scope}",
  subagent_type: "architect-orchestrator",
  prompt: "<brand>: {brand}                          # ★ REQUIRED — single-project scope
           <pr_folder>: docs/product/stories/{id}/
           story_type: {ui-story|service-story|agentic-story}
           surfaces: {BE | FE | AGENTIC | combinaciones}
           mode: SINGLE-SHOT FULL-STACK

           PRIORITY READ:
           1. docs/product/stories/{id}/checkpoint.md (state=refined required)
           2. docs/product/stories/{id}/01-spec.md ratificada por Chris
           3. docs/product/stories/{id}/02-design-agentic.md si agentic-story
           4. docs/product/stories/{id}/00-story.md / delta-spec.md si existen
           5. docs/product/outcomes/{outcome-id}.md
           6. docs/product/modules/{m}.md
           7. Stories archivadas relacionadas (predecesores) en docs/archive/

           LOAD SKILLS contextualmente según surface:
           - BE: backend-expert + tessl__fastapi + tessl__pytest-api-testing
           - FE: frontend-expert + tessl__react-patterns + tessl__zod + tessl__shadcn-ui + tessl__tailwind + tessl__vitest + tessl__nextjs-app-router-modularization
           - AGENTIC: sales-agent-expert / copilot-expert + tessl__langgraph + claude-api
           - Cross-cutting: tessl__graceful-degradation + domain skills (brand/offer/preset/metrics)

           DELIVERABLES (4-5 files, todos bajo docs/product/stories/{id}/):
           1. 03-arch.md (consolidado, secciones por surface — incluye § Test Construction Plan ★ v4.1)
           2. 03-arch-{be,fe,agentic}.md per surface tocado (opcional, si arch es complejo per-surface)
           3. 04-validators.yaml (5 categories — non_functional / functional / visual / agentic_eval / architectural_validation ★ v4.1 — scenario_coverage 100%, must_pass:true, test_construction_plan completo)
           4. 05-guidelines.md (must_load_skills enforceable ★ v4.1 + patterns required/forbidden + files in scope)
           5. 06-tickets.yaml (atomic, R23 marked AGENTIC, owner_eligibility, DAG, gherkin_coverage per ticket)

           CRITICAL CONSTRAINTS:
           - Cross-module audit anti-duplication.md (no mirror shared abstractions cross-module)
           - R23: AGENTIC tickets production_code:true → claude_opus_required:true
           - AGENTIC tickets SEPARADOS de BE/FE (R23 enforcement)
           - Tickets > 10 → split story
           - Each ticket: acceptance.validator_ids + DAG + gherkin_coverage (post 2026-05-18)
           - Hot-fix: repro_verified field si aplica (R26)
           - Engine boundaries: NUNCA proponer tickets que editen `core/luana-core-*/src/` directamente. Si scope requiere editar engine → escalá `/pm` (promotion gate) ANTES de cerrar package.
           - Brand-extension agentic: `backend/src/modules/{copilot,sales_agent}/{tools,extractors,workflows,personas,goldens,kb}/` SÍ es editable.
           - ★ v4.1 Playwright mandatory para surface funcional: test_construction_plan.playwright_required=true SIEMPRE que story sea ui-story o ui-mixed
           - ★ v4.1 must_load_skills enforceable: dev-team builder spawn cita lista verbatim
           - ★ v4.1 architectural_validation category con sub-tests (DDD/FSD boundaries, tenant_isolation grep, anti-dup scan, cross-module audit)
           - ★ v4.1 sub-categorías scenarios obligatorias: race conditions, concurrent users, network failures, empty states, large datasets, accessibility, i18n (heredadas de /po-ux refused refined sin ellas)

           After writing all files, transition checkpoint.md state: refined → ready.

           LAST LINE: done -> docs/product/stories/{id}/06-tickets.yaml"
})

El orchestrator escribe TODOS los archivos y devuelve done -> 06-tickets.yaml (anti-telephone-game).

Step 3 — Cross-module audit (NO-NEW-LAYER)

Antes de cerrar el package, validar que el orchestrator respetó .claude/rules/anti-duplication.md inventario shared. Especial atención si introduce:

  • Provider nuevo (LLM, FX, pricing) → debe extender shared, no mirror
  • Observability layer → use shared
  • Outbox / idempotency / billing guards → shared
  • Channel format / intent detector → shared
  • Extraction orchestrator → subclass BaseExtractionOrchestrator

Si orchestrator propone NEW cuando shared existe ≥80% → escala /pm (engine surface) o /pm (brand-extension surface): "orchestrator propone NEW para subsystem Y, pero shared tiene Z. Decidir EXTEND vs NEW."

cross-module mirror check: si la abstracción propuesta ya vive en {other_brand}/..., escalá /pm como promotion candidate (brand→core lift) en lugar de mirror por-brand.

Step 4 — Validar 03-arch.md producido por orchestrator

Lee el 03-arch.md que el orchestrator escribió. Verificar:

  • Secciones por surface presente (BE / FE / AGENTIC según tickets toca)
  • Cross-cutting decisions section (tenant isolation, currency, PII)
  • Per-surface detail puede vivir inline en 03-arch.md O en archivos separados 03-arch-{be,fe,agentic}.md (orchestrator decide según complejidad)

Template estructura mínima:

# 03-arch.md — Story {id}

## Surfaces involved
- BE: yes (3 endpoints, 2 SQLA models, 1 migration)
- FE: yes (1 page route, 2 components, 1 RHF form)
- AGENTIC: no

## BE arch (full detail in 03-arch-be.md)
... summary + key decisions ...

## FE arch (full detail in 03-arch-fe.md)
... summary + key decisions ...

## Cross-cutting decisions
- Tenant isolation strategy: ...
- Currency handling: ...
- PII fields: ...

Step 5 — Producir 04-validators.yaml + Test Construction Plan ★ CRITICAL ★

Este es el corazón del autonomous build. Sonnet en Conv 2 itera contra estos hasta GREEN.

v4.1 cement 2026-05-19: además de los validators ejecutables, architect MUST producir un test_construction_plan explícito que indique al dev-team CÓMO construir las pruebas Playwright (no solo qué comandos correr). Esto es responsabilidad arquitectónica — dev-team no debe inventar el orden ni estructura.

Reglas:

  • Cada validator es un comando shell ejecutable (pytest / playwright / lint / etc.)
  • must_pass: true por default — sin ambigüedad
  • Cobertura completa de scenarios del 01-spec.md (mapping explícito)
  • Iteration policy define cap + on_fail behavior
  • Nueva categoría architectural_validation separada de non_functional (DDD boundary scan, anti-dup grep, tenant_isolation grep, cross-module audit)
  • TODA story con surface FE/funcional MUST incluir Playwright behavior tests — el architect dicta los scenarios E2E exactos a cubrir (no es opcional)
  • test_construction_plan section dentro de 04-validators.yaml con: orden de creación, POMs requeridos, fixtures compartidos, mapping scenario Gherkin → spec.ts file → assertions

Template (paths brand-scoped; workspace root parametrizado via ${WS} o cd ...):

# docs/product/stories/{story-id}/04-validators.yaml
# v4 schema: 4 categories — non_functional / functional / visual / agentic_eval
# NOTE: validator cmds usan paths relativos al workspace root. `${WS}` o `git rev-parse --show-toplevel`
# debe ser resuelto por gate-runner antes de ejecutar.

validators:
  # ─── NON-FUNCTIONAL (lint, arch fitness, type-check, format) ───
  - id: be_arch_fitness
    category: non_functional
    type: pytest
    cmd: "cd backend && ../../.venv/bin/pytest tests/architecture/ -x -q --override-ini='addopts='"
    must_pass: true
    timeout_sec: 120

  - id: be_lint
    category: non_functional
    type: shell
    cmd: "cd backend && ../../.venv/bin/ruff check src/modules/{m}/ tests/modules/{m}/ --no-cache && ../../.venv/bin/ruff format --check src/modules/{m}/ tests/modules/{m}/"
    must_pass: true
    timeout_sec: 30

  - id: fe_typecheck
    category: non_functional
    type: shell
    cmd: "cd frontend && npx tsc --noEmit"
    must_pass: true
    timeout_sec: 90

  # ─── FUNCTIONAL (Gherkin scenarios — happy/negative/edge/adversarial) ───
  - id: be_unit_create_endpoint
    category: functional
    type: pytest
    cmd: "cd backend && ../../.venv/bin/pytest tests/modules/{m}/test_create.py -v --tb=short"
    must_pass: true
    timeout_sec: 60

  - id: fe_unit
    category: functional
    type: shell
    cmd: "cd frontend && npx vitest run src/features/{m}/"
    must_pass: true
    timeout_sec: 60

  - id: e2e_happy
    category: functional
    type: playwright
    cmd: "cd frontend && E2E_BASE_URL=http://localhost:300X npx playwright test --project=smoke e2e/regression/{m}-{story}.spec.ts"
    must_pass: true
    timeout_sec: 180

  # ─── VISUAL (responsive + visual fidelity Playwright + screenshots) ───
  - id: visual_fidelity
    category: visual
    type: playwright
    cmd: "cd frontend && npx playwright test e2e/visual/{story}.spec.ts --update-snapshots=false"
    capture: screenshots
    must_pass: true
    timeout_sec: 240

  - id: responsive_breakpoints
    category: visual
    type: playwright
    cmd: "cd frontend && npx playwright test e2e/visual/{story}-responsive.spec.ts --project=mobile,tablet,desktop"
    must_pass: true
    timeout_sec: 240

  # ─── AGENTIC EVAL (pass^k, rubrics, trajectory, cost/latency budgets) ───
  # Solo si story toca backend/src/modules/{copilot,sales_agent}/ brand-extension surface
  # (engine `core/luana-core-{copilot,sales-agent}/` requiere /pm — NO se edita en story brand)
  - id: agentic_pass_k
    category: agentic_eval
    type: shell
    cmd: "cd backend && ../../.venv/bin/python scripts/run_agent_evals.py --story={story-id} --personas=A,B,C"
    rubrics: [voice-fidelity, goal-completion, tool-call-accuracy]
    pass_k:
      trials: 3
      per_trial_threshold: 0.66
      pass_k_threshold: 0.5
    must_pass: true
    timeout_sec: 600

  - id: agentic_trajectory
    category: agentic_eval
    type: shell
    cmd: "cd backend && ../../.venv/bin/python scripts/run_trajectory_eval.py --expected=docs/specs/trajectories/{story-id}.yaml"
    must_pass: true
    timeout_sec: 300

  - id: agentic_cost_budget
    category: agentic_eval
    type: shell
    cmd: "cd backend && ../../.venv/bin/python scripts/check_cost_budget.py --story={story-id}"
    threshold: { cost_usd_max: 0.50, tokens_max: 6000, latency_p95_max: 8.0 }
    must_pass: true
    timeout_sec: 60

  # ─── ARCHITECTURAL VALIDATION (★ v4.1 — separada de non_functional) ───
  # Verificación arquitectónica explícita: DDD/FSD boundaries, anti-dup scan, tenant isolation grep, cross-module audit
  - id: arch_ddd_boundaries
    category: architectural_validation
    type: pytest
    cmd: "cd backend && ../../.venv/bin/pytest tests/architecture/test_ddd_boundaries.py -v"
    must_pass: true
    timeout_sec: 30
    description: "DDD layers domain→infra→app→api boundary enforcement"

  - id: arch_tenant_isolation_grep
    category: architectural_validation
    type: shell
    cmd: "! grep -rn 'select.*Model)' backend/src/modules/{m}/ | grep -v 'tenant_id' | grep -v test_"
    must_pass: true
    timeout_sec: 10
    description: "Cada query debe filtrar tenant_id (regex scan + auditor doble check)"

  - id: arch_anti_duplication_scan
    category: architectural_validation
    type: shell
    cmd: "scripts/scan_cross_brand_mirror.sh {brand} {m}"
    must_pass: true
    timeout_sec: 30
    description: "Detecta mirrors cross-module del módulo. Match → spawn promotion proposal."

  - id: arch_fsd_boundaries
    category: architectural_validation
    type: shell
    cmd: "cd frontend && npx vitest run src/__tests__/architecture/test_fsd_boundaries.test.ts"
    must_pass: true
    timeout_sec: 60
    description: "FSD-Lite boundaries — feature → feature own/shared/lib only"

scenario_coverage:
  - scenario_id: happy
    validators: [be_unit_create_endpoint, fe_unit, e2e_happy]
  - scenario_id: negative
    validators: [be_unit_create_endpoint, fe_unit]
  - scenario_id: edge
    validators: [be_unit_create_endpoint, e2e_edge_race]
  - scenario_id: adversarial
    validators: [be_unit_create_endpoint, e2e_adversarial]
  - scenario_id: empty_state
    validators: [fe_unit, e2e_empty_state]
  - scenario_id: network_failure
    validators: [fe_unit, e2e_network_failure]
  - scenario_id: concurrent_users
    validators: [be_unit_create_endpoint, e2e_concurrent]
  - scenario_id: large_dataset
    validators: [fe_unit, e2e_large_dataset]
  - scenario_id: accessibility
    validators: [a11y_axe]
  - scenario_id: i18n
    validators: [fe_unit_voseo_check, e2e_locale_AR_MX_CL]

# ★ v4.1 cement 2026-05-19 — Test Construction Plan (mandatory para stories con surface funcional)
test_construction_plan:
  # Architect dicta el orden + estructura. Dev-team CONSTRUYE siguiendo este plan, no inventa.

  playwright_required: true     # toda story funcional MUST tener Playwright behavior tests
  base_path: "frontend/e2e/regression/{story-id}/"

  # Orden de creación (dependencias entre tests)
  creation_order:
    - step: 1
      file: "frontend/e2e/fixtures/{story-id}.fixture.ts"
      content: "Fixtures compartidos — tenant setup, Clerk auth state, DB seed minimal"
      depends_on: []
    - step: 2
      file: "frontend/e2e/regression/{story-id}/poms/{m}-list-page.pom.ts"
      content: "Page Object Model para lista {m}"
      depends_on: [1]
    - step: 3
      file: "frontend/e2e/regression/{story-id}/poms/{m}-detail-page.pom.ts"
      content: "Page Object Model para detail {m}"
      depends_on: [1]
    - step: 4
      file: "frontend/e2e/regression/{story-id}/{m}-happy.spec.ts"
      content: "Scenario happy — usa POMs"
      depends_on: [2, 3]
    - step: 5
      file: "frontend/e2e/regression/{story-id}/{m}-negative.spec.ts"
      content: "Scenario negative — input inválido"
      depends_on: [2, 3]
    - step: 6
      file: "frontend/e2e/regression/{story-id}/{m}-edge.spec.ts"
      content: "Scenarios edge (race, concurrent, empty, large, network failure)"
      depends_on: [2, 3]
    - step: 7
      file: "frontend/e2e/regression/{story-id}/{m}-adversarial.spec.ts"
      content: "Scenarios adversarial (cross-tenant, XSS, prompt injection si aplica)"
      depends_on: [2, 3]
    - step: 8
      file: "frontend/e2e/a11y/{story-id}.spec.ts"
      content: "Accessibility axe-core scan"
      depends_on: [4]

  # Mapping explícito scenario Gherkin (01-spec.md) → spec.ts file → assertions
  scenario_to_test:
    - gherkin_scenario: "Scenario 1 — happy-path"
      test_file: "frontend/e2e/regression/{story-id}/{m}-happy.spec.ts"
      test_function: "test('user creates {entity} successfully'"
      assertions:
        - "expect(toast).toContainText('{entity} guardada')"
        - "expect(page.url()).toContain('/detail/')"
        - "DB check: SELECT * FROM {table} WHERE tenant_id={tid} AND ... returns 1 row"
    - gherkin_scenario: "Scenario 2 — negative invalid input"
      test_file: "frontend/e2e/regression/{story-id}/{m}-negative.spec.ts"
      test_function: "test('rejects empty required field'"
      assertions:
        - "expect(form errors).toContainText('Campo requerido')"
        - "DB check: NO row inserted"
    - gherkin_scenario: "Scenario 3 — edge concurrent"
      test_file: "frontend/e2e/regression/{story-id}/{m}-edge.spec.ts"
      test_function: "test('handles concurrent create same slug'"
      assertions:
        - "expect(second request).toHaveStatus(409 or 422)"
        - "DB check: only 1 row exists with that slug"
    - gherkin_scenario: "Scenario 4 — adversarial cross-tenant"
      test_file: "frontend/e2e/regression/{story-id}/{m}-adversarial.spec.ts"
      test_function: "test('rejects cross-tenant access'"
      assertions:
        - "expect(request as tenant B for tenant A resource).toHaveStatus(404 or 403)"
        - "NO leak en error body"

  # POMs requeridos (Page Object Models) — qué métodos exponen
  poms_required:
    - file: "{m}-list-page.pom.ts"
      methods:
        - "goto()"
        - "filterBy(criteria)"
        - "clickCreateButton()"
        - "getRowCount() → number"
        - "getRowByName(name)"
    - file: "{m}-detail-page.pom.ts"
      methods:
        - "goto(id)"
        - "fillForm(data)"
        - "submit()"
        - "getErrorMessage() → string|null"

  # Fixtures compartidos requeridos
  fixtures_required:
    - name: "authedAs(role: 'admin' | 'user')"
      content: "Clerk storage state + tenant setup"
    - name: "dbSeed({m}: count)"
      content: "Insert N rows in {table} para el tenant del test"
    - name: "networkFailure(endpoint)"
      content: "Mock route con 500/503 para simular network failure"

iteration:
  max_iterations: 10
  on_fail: "fix targeted file based on test output, re-run failing validator only"
  on_all_pass: "set state=developing→developed, append iteration_log to T-{n}-impl-log.md"
  on_cap_reached: "set state=developing→blocked, escalate to Chris with last error trace"

Validation gate v4.1: Every scenario in 01-spec.md MUST appear en scenario_coverage AND test_construction_plan.scenario_to_test. If any uncovered → architect itera hasta cubrirlos. Sub-categorías scenarios obligatorias (v4.1 /po-ux refused refined sin ellas): race conditions, concurrent users, network failures, empty states, large datasets, accessibility, i18n. Si /po-ux ratificó refined SIN estas sub-categorías → flag para Chris (spec quality gap).

Step 6 — Producir 05-guidelines.md ★ v4.1 must_load_skills enforceable ★

Patterns concretos que Sonnet debe seguir/evitar. SIN AMBIGÜEDAD.

v4.1 cement 2026-05-19: la sección "Reference docs (load before coding)" pasa a llamarse must_load_skills y deja de ser sugerencia — el dev-team Step 2 cita esta lista verbatim al builder spawn, y el builder MUST entregar en T-{n}-result.md una sección "Skills consulted" listando cuáles cargó. Si no las cargó → CHANGES_REQUESTED auditor automático.

Template:

# 05-guidelines.md — Story {id}

## Patterns required
- SQLAlchemy 2.0 `select(Model).where(...)` — NO `session.query()`
- All DB queries filter `tenant_id` (incluye `get_by_id`)
- Soft deletes only (`deleted_at`)
- Pydantic v2 `model_config = ConfigDict(...)` — NO inner `class Config`
- `structlog` logging — NO `print` / `logging`
- Migrations idempotentes (`IF NOT EXISTS` / `IF EXISTS`)
- FastAPI endpoints `response_model=` mandatory (PII allowlist)
- Use `datetime` fields with `timezone=True`
- Use `utc_now()` from `shared/domain/datetime_utils.py` (no `datetime.utcnow()`)
- React Server Components default; `"use client"` solo cuando necesario
- React Query (TanStack) para data fetching
- RHF + Zod para forms
- Tailwind utility classes con tokens semánticos (no hex literals)
- Spanish neutro LatAm en TODA UI string (no voseo, no léxico regional)

## Patterns forbidden
- `datetime.utcnow()` — use `utc_now()`
- Hardcoded `'USD'` en monetary fields — use `tenant.currency`
- Cross-module imports (excepto `copilot`)
- `session.query()` (SA 1.x)
- `sa.Enum()` en `op.create_table()` (broken SA 2.0.27)
- `op.create_table()` / `add_column()` / `create_index()` no idempotente
- `// eslint-disable` sin justification comment
- `any` en TypeScript (use `unknown` + type guards)
- Default exports (excepto Next.js pages)
- Hex colors hardcoded en components/styles

## Files in scope (Sonnet edits ONLY these — todos brand-scoped bajo )
- backend/src/modules/{m}/api/routes.py
- backend/src/modules/{m}/application/services/...
- backend/src/modules/{m}/domain/...
- backend/src/modules/{m}/infrastructure/...
- backend/alembic/versions/{timestamp}_{slug}.py (NEW migration brand-scoped)
- backend/tests/modules/{m}/test_{name}.py
- frontend/src/features/{m}/...
- frontend/src/app/{m}/page.tsx
- frontend/e2e/regression/{m}-{story}.spec.ts

## Files Sonnet NEVER touches (escalate to Chris / /pm)
- (N/A single-brand — was Luana engine)** (engine — requires lift via /pm promotion gate; NUNCA en story brand-específica)
- backend/src/modules/{copilot,sales_agent}/** runtime (agentic — solo via builder-agentic Opus; brand-extension surface OK con R23 check)
- {other_brand}/** (cross-module edit — escalate /pm outcome platform)
- backend/src/core/config.py (default flag flips require R31 anti-default-flip-audit)
- frontend/src/components/ui/** (Shadcn primitives per-project — extend via wrappers, no edit; cross-module reuse = promotion candidate /pm)
- frontend/src/lib/api/fetchClient.ts (cross-cutting per-project — escalate)
- .claude/** y .claude/** (skill/rule edits — manual only)

## must_load_skills (★ v4.1 enforceable — builder MUST cargar todas + reportar "Skills consulted" en T-{n}-result.md)
required:
  # Skills core obligatorios por surface
  - id: backend-expert
    when: "surface=BE o BE-test"
    purpose: "DDD patterns, arch fitness, currency, master-data, currency-handling"
  - id: frontend-expert
    when: "surface=FE"
    purpose: "FSD-Lite, Shadcn reuse, form-runtime, tailwind tokens"
  - id: "{domain}-expert"
    when: "module touched (brand-expert / offer-expert / metrics-expert / copilot-expert / sales-agent-expert)"
    purpose: "Domain invariants + reference docs por módulo"
  - id: playwright-expert
    when: "test_construction_plan.playwright_required=true"
    purpose: "POM patterns, Clerk auth fixture, network mocking, smoke debugging"

  # Rules obligatorias siempre
  - id: ".claude/rules/tenant-isolation.md"
    purpose: "Every query filter tenant_id"
  - id: ".claude/rules/backend-ddd.md o frontend-fsd.md"
    purpose: "Layer boundaries"
  - id: ".claude/rules/spanish-text.md"
    purpose: "Voseo glosario + magic comment escape"
  - id: ".claude/rules/anti-duplication.md"
    purpose: "cross-module mirror ban + shared abstractions inventory"
  - id: ".claude/rules/tdd-mandatory.md"
    purpose: "TDD RED→GREEN→REFACTOR discipline"
  - id: ".claude/rules/auditor-self-fix-policy.md"
    purpose: "Conocer qué findings auditor self-fix vs spawn dev-team (forward motion)"

  # Tessl skills (versioned canonical docs) si aplica
  - id: "tessl__fastapi"
    when: "BE endpoint nuevo"
  - id: "tessl__pytest-api-testing"
    when: "BE tests nuevos"
  - id: "tessl__react-patterns + tessl__shadcn-ui + tessl__tailwind"
    when: "FE component nuevo"
  - id: "tessl__zod"
    when: "FE form con validation"
  - id: "tessl__vitest"
    when: "FE tests nuevos"
  - id: "tessl__langgraph + claude-api"
    when: "AGENTIC surface"

reference_artifacts:
  # Documentos del ready package que builder re-lee mid-build cuando surge ambigüedad
  - "docs/product/stories/{story-id}/01-spec.md" (re-read Gherkin scenarios)
  - "docs/product/stories/{story-id}/03-arch.md" (re-read decisiones técnicas)
  - "docs/product/stories/{story-id}/04-validators.yaml § test_construction_plan" (re-read orden + POMs + fixtures)

Step 7 — Producir 06-tickets.yaml

Seguir template docs/specs/templates/06-tickets-template.yaml (post-redesign — antes era 04-tickets.yaml paradigma viejo). Reglas:

Reglas de ticket split (CRÍTICAS):

  1. Agentic tickets SIEMPRE separados de BE/FE en tickets distintos
    • Razón: opencode/Sonnet ban en agentic production code. Mezclar = no asignable.
  2. BE tickets pueden combinar dentro mismo módulo (endpoint + service + migration en 1 ticket)
  3. FE tickets pueden combinar dentro mismo feature (component + hook + e2e en 1 ticket)
  4. Migration aislada si afecta tabla compartida o downtime risk
  5. Cada ticket = entrega funcional total (no "T-1 BE half" + "T-2 BE other half" sin razón)
  6. Si tickets > 10 → story es demasiado grande, split en N stories

Owner eligibility (CRÍTICO):

Surfaceproduction_codeqwen-opencodeclaude-sonnetclaude-opus
BE/FE no-agentictrue✅ default
BE/FE no-agenticfalse (tests/docs)✅ default
AGENTICtrue⛔ PROHIBIDO⛔ PROHIBIDO✅ OBLIGATORIO
AGENTICfalse (tests/docs only)✅ R23
Migration aisladatrue
Cross-module sharedtrue

production_code flag (R23 mandatory per ticket):

  • true si modifica backend/src/, frontend/src/, migrations/versions/, prompts/, tools/, agent runtime
  • false si modifica tests/, docs/, scripts/ tooling, configs no-runtime

Dependencies / blocks:

- id: T-1 (BE endpoint)
  depends_on: []
  blocks: [T-2, T-3]
- id: T-2 (agentic tool wire)
  depends_on: [T-1]
  blocks: [T-3]
- id: T-3 (FE button)
  depends_on: [T-2]
  blocks: []

Acceptance criteria por ticket — los validators de 04-validators.yaml que cubren el ticket:

acceptance:
  - validator_ids: [be_unit_create_endpoint, be_arch_fitness, be_lint]

Cross-stack handoff notes (anti retrabajo):

Cuando ticket agentic depende de BE/FE → /architect agrega NOTAS DETALLADAS al ticket BE/FE:

T-1 (BE endpoint, owner: opencode/sonnet):
  ...
  notes_for_downstream_agentic_ticket:
    - "Este endpoint será llamado por brand_audit_tool en T-2 (agentic). NO cambiar response shape sin coordinar."
    - "Response model: BrandAuditResponse(gaps: list[Gap], priorities: dict)"
    - "Latencia p95 < 500ms (agentic budget total $0.50)"

Hot-fix repro evidence (R26): Si story es hot-fix, cada ticket DEBE incluir:

repro_verified: true
repro_evidence:
  command: "cd backend && ../../.venv/bin/pytest <paths brand-scoped> -v"
  output: |
    <verbatim error/traceback first 5-10 lines>
  diagnosis_validates_handoff: <true|false>

Step 8 — Validate ready package (★ v4.1 expanded checklist)

Antes de cerrar story como ready:

Estructura básica:

  • 03-arch.md consolidado escrito (con secciones inline por surface, O archivos separados 03-arch-{be,fe,agentic}.md si orchestrator decidió split por complejidad)
  • 04-validators.yaml cubre TODOS scenarios del 01-spec.md (gate hard)
  • 04-validators.yaml cada validator tiene cmd ejecutable native Linux (host) (no Docker para tests)
  • 05-guidelines.md lista patterns required + forbidden + files in scope
  • 06-tickets.yaml cada ticket: production_code flag set, owner_eligibility coherente, acceptance.validator_ids mapea a 04-validators.yaml ids
  • Dependencies son DAG (no ciclos)
  • AGENTIC tickets con production_code: true → claude_opus_required: true (HARD)
  • Estimate hours razonables (alerta si > 8h por ticket → split)
  • Tickets > 10 total → STOP, split story

★ v4.1 cement 2026-05-19 expanded gates:

  • 04-validators.yaml § architectural_validation category presente con ≥3 sub-tests (DDD/FSD + tenant_isolation grep + anti-dup scan)
  • 04-validators.yaml § test_construction_plan completo con: playwright_required flag, creation_order (steps numerados), scenario_to_test mapping (cada Gherkin scenario → spec.ts + function + assertions), poms_required, fixtures_required
  • Para stories ui-story o ui-mixed: test_construction_plan.playwright_required: true (HARD — no opt-out)
  • scenario_coverage cubre sub-categorías mandatory: race / concurrent / network_failure / empty_state / large_dataset / a11y / i18n (heredadas de /po-ux refined gate)
  • 05-guidelines.md § must_load_skills enforceable (sección renombrada de "Reference docs", builder spawn cita verbatim)
  • 06-tickets.yaml cada ticket tiene gherkin_coverage field (post 2026-05-18 mandatory)

Step 9 — Transition state + Hand off

Update docs/product/stories/{story-id}/checkpoint.md:

brand: {brand}        # ★ REQUIRED — single-project scope
state: ready          # ★ TRANSITION ★ refined → ready
phase: READY_PACKAGE_CLOSED
last_artifact: 06-tickets.yaml
last_modified: 2026-05-06T...
next_action: "/dev-team <brand>: {brand} starts Conv 2 autonomous build (toma T-1 first, iterate vs 04-validators.yaml)"

Output:

Ready package cerrado para story {id}.

Artifacts (en docs/product/stories/{id}/):
- 03-arch.md (consolidado, secciones por surface inline)
- 03-arch-{be,fe,agentic}.md OPCIONAL (orchestrator decide si arch es complejo per-surface)
- 04-validators.yaml ({N} validators, scenario coverage 4/4)
- 05-guidelines.md
- 06-tickets.yaml ({N} tickets)

Owner mix:
- T-1 (BE, qwen/sonnet, 2h)
- T-2 (AGENTIC, opus-only, 3h)
- T-3 (FE, qwen/sonnet, 2h)

Dependencies: T-2 depends T-1; T-3 depends T-2.

Story state: refined → ready.
WIP cap check: ready (was N) now N+1 / cap 5.

Próximo: Conv 2 (autonomous build). /dev-team <brand>: {brand} toma T-1 (state: ready → developing).

Anti-patterns

  • ❌ Mezclar agentic + BE en MISMO ticket (opencode/qwen ban en agentic production code)
  • ❌ Producir tickets sin acceptance.validator_ids mapeado a 04-validators.yaml
  • 04-validators.yaml con scenarios uncovered (gate hard — todos scenarios deben tener validator)
  • ❌ Skip cross-module audit (anti-duplication) → mirror code
  • ❌ Tickets sin DAG (cycle dependencies)
  • ❌ Tickets >8h sin split
  • ❌ Tickets cross-stack sin notes_for_downstream
  • Intentar spawnar architect-be / architect-fe / architect-agentic como agent types — NO existen en .claude/agents/. Solo architect-orchestrator existe. Las skills architect-{be,fe,agentic}/SKILL.md son instruction docs (cargadas contextualmente por orchestrator), no agent types spawnable.
  • ❌ Aprobar tu propio ready package sin verificar 03-arch.md coherencia cross-surface
  • ❌ Asignar Opus a tickets BE/FE non-agentic (cost waste)
  • ❌ Editar paths legacy docs/archive/2026/legacy-pis/PI-N/... o docs/archive/2026/snapshot-pre-single-project-pm-redesign/ (snapshot inmutable)
  • ❌ Cerrar state=ready con WIP cap=5 ya alcanzado (escalate Chris primero)
  • 05-guidelines.md con "be careful" / "follow best practices" (vago — usa patterns concretos)
  • ❌ Inferir el brand del contexto si Chris no lo dijo — PREGUNTAR primero

Anti cross-module pollution

  • ❌ NUNCA generar tickets que editen {other_brand}/... cuando trabajás en {brand}. Si la story necesita tocar otra brand → STOP, escalate /pm (outcome cross-module).
  • ❌ NUNCA generar tickets que editen core/luana-core-*/src/ directamente. Requiere lift via /pm (promotion gate) — propuesta en (N/A single-brand — promotion-gate was single-project)proposals/ ANTES de cerrar package.
  • ❌ NUNCA escribir specs/archs/tickets en root docs/product/stories/ — solo <brand>: platform (cross-module) outcomes van ahí, y eso requiere autorización explícita /pm.
  • ❌ NUNCA referenciar backend/src/ o frontend/src/ sin el prefix `` — post reorg 2026-05-15 no existe root backend/ ni frontend/. Solo (N/A single-brand — was Luana engine) (engine) y backend/src/ (brand).
  • ❌ NUNCA hardcodear paths absolutos /home/chris/AISALESHT/... o /home/chalreme/Proyectos/... — usar ${WS} resuelto via git rev-parse --show-toplevel.

Output format

Resumen de tickets en lista. Dependencias en flecha. NUNCA reproducir 06-tickets.yaml entero en chat (cita path).

Referencias

  • docs/process/paradigm-v4.md — paradigma 3 conversaciones + ready package + § v4.1 autonomy amplification 2026-05-19
  • docs/architecture/ADR/ADR-004-paradigm-v4.1.md — decisión cementada (test_construction_plan + must_load + Playwright mandatory funcional)
  • docs/specs/templates/03-arch-template.md — template arch (incluye Test Construction Plan ★ v4.1)
  • docs/specs/templates/04-validators-template.yaml — template validators (5 categorías incluyendo architectural_validation ★ v4.1)
  • docs/specs/templates/05-guidelines-template.md — template guidelines (must_load_skills enforceable ★ v4.1)
  • docs/specs/templates/06-tickets-template.yaml — template tickets (gherkin_coverage mandatory)
  • .claude/rules/auditor-self-fix-policy.md — auditor decision tree v4.1 (whitelist 17 + spawn dev-team autónomo)
  • .claude/rules/anti-duplication.md — inventario shared abstractions
  • .claude/rules/anti-default-flip-audit.md — R31 default flag flips
  • .claude/rules/auditor-downstream-regression.md — surface→downstream test mapping
Repository
alpacapurpura/luana-method
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.