refacil-sdd-ai 4.2.4 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +239 -214
  2. package/agents/auditor.md +189 -184
  3. package/agents/debugger.md +201 -204
  4. package/agents/implementer.md +150 -149
  5. package/agents/investigator.md +80 -89
  6. package/agents/proposer.md +219 -124
  7. package/agents/tester.md +140 -144
  8. package/agents/validator.md +153 -145
  9. package/bin/cli.js +158 -116
  10. package/lib/bus/askFulfillment.js +17 -17
  11. package/lib/bus/broker.js +599 -599
  12. package/lib/bus/ui/app.js +318 -318
  13. package/lib/commands/sdd.js +447 -0
  14. package/lib/hooks.js +236 -236
  15. package/lib/installer.js +58 -2
  16. package/lib/methodology-migration-pending.js +101 -136
  17. package/package.json +4 -6
  18. package/skills/apply/SKILL.md +139 -120
  19. package/skills/archive/SKILL.md +105 -107
  20. package/skills/ask/SKILL.md +78 -78
  21. package/skills/attend/SKILL.md +70 -70
  22. package/skills/bug/SKILL.md +121 -128
  23. package/skills/explore/SKILL.md +73 -63
  24. package/skills/guide/SKILL.md +79 -79
  25. package/skills/inbox/SKILL.md +43 -43
  26. package/skills/join/SKILL.md +82 -82
  27. package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
  28. package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
  29. package/skills/prereqs/SKILL.md +30 -37
  30. package/skills/propose/SKILL.md +103 -102
  31. package/skills/reply/SKILL.md +44 -44
  32. package/skills/review/SKILL.md +163 -126
  33. package/skills/review/checklist-back.md +92 -92
  34. package/skills/review/checklist-front.md +72 -72
  35. package/skills/review/checklist.md +114 -114
  36. package/skills/say/SKILL.md +38 -38
  37. package/skills/setup/SKILL.md +85 -141
  38. package/skills/setup/troubleshooting.md +38 -35
  39. package/skills/test/SKILL.md +104 -94
  40. package/skills/test/testing-patterns.md +63 -63
  41. package/skills/up-code/SKILL.md +108 -108
  42. package/skills/update/SKILL.md +109 -132
  43. package/skills/verify/SKILL.md +159 -132
  44. package/templates/compact-guidance.md +45 -45
  45. package/templates/methodology-guide.md +46 -42
  46. package/config/openspec-config.yaml +0 -8
  47. package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
@@ -1,115 +1,122 @@
1
- # Contrato Metodologico SDD-AI (Refacil)
2
-
3
- Este archivo centraliza reglas transversales para evitar duplicacion e inconsistencias entre skills.
4
-
5
- ## 1) Estados del flujo (Definition of Ready / Done)
6
-
7
- - **READY_FOR_PROPOSE**: problema entendido (objetivo, alcance, restricciones) y contexto minimo del repo.
8
- - **READY_FOR_APPLY**: artefactos SDD completos (`proposal.md`, `design.md`, `tasks.md`, especificacion en `specs.md` y/o `specs/**/*.md`) y aprobacion explicita del usuario.
9
- - **READY_FOR_VERIFY**: implementacion terminada, sin cambios fuera de alcance.
10
- - **READY_FOR_REVIEW**: para cambios regulares (propose), verify ejecutado e issues criticos resueltos o aceptados por el usuario. Para bug fixes, la implementacion y tests de regresion estan completos (los bugs no pasan por verify).
11
- - **READY_FOR_ARCHIVE**: review aprobado (`.review-passed` existe), tasks completas o excepciones aprobadas, cambio funcionalmente cerrado.
12
- - **READY_FOR_MERGE**: review aprobado (`.review-passed` existe) e integracion lista: PR creado para la rama destino. `/refacil:up-code` verifica automaticamente el review antes del push — si falta, lo ejecuta.
13
- - Si existen multiples cambios activos sin review, se debe seleccionar explicitamente el cambio objetivo antes de ejecutar review/push.
14
-
15
- ## 2) Politica AGENTS.md
16
-
17
- - Si una skill requiere perfil `openspec`: `AGENTS.md` es obligatorio (si falta, detener y redirigir a `/refacil:setup`).
18
- - Si una skill requiere perfil `agents`: si falta `AGENTS.md`, continuar con baseline generico y reportar limitacion al usuario.
19
-
20
- ## 3) Resolucion de comando de tests (multi-stack)
21
-
22
- No hardcodear `npm test` salvo que sea realmente el comando del proyecto.
23
-
24
- Orden de deteccion:
25
- 1. Si `AGENTS.md` define comando oficial de tests, usar ese.
26
- 2. Si existe script de package manager (ej. `npm test`, `pnpm test`, `yarn test`, `bun test`), usar el correspondiente.
27
- 3. Si es Python: `pytest`.
28
- 4. Si es Go: `go test ./...`.
29
- 5. Si es Rust: `cargo test`.
30
- 6. Si es Java/Gradle: `./gradlew test` o `gradle test`.
31
- 7. Si es Java/Maven: `mvn test`.
32
-
33
- Coverage (si aplica): detectar comando del proyecto (`test:cov`, `coverage`, `pytest --cov`, etc.). Si no existe, reportar N/A con justificacion.
34
-
35
- ## 4) Politica de ramas protegidas y creacion de rama
36
-
37
- Ramas protegidas (nunca desarrollar directamente en ellas): `master`, `main`, `develop`, `dev`, `testing`, `qa`.
38
-
39
- Regla critica:
40
- - **NUNCA** hacer cambios directos en ramas protegidas.
41
- - Toda integracion a ramas protegidas se hace mediante PR, sin excepciones (incluye `testing`).
42
-
43
- ### Creacion de ramas de trabajo
44
-
45
- - Regla general: toda rama nueva de trabajo (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.) debe crearse desde `develop` o `dev` actualizado.
46
- - Excepcion para repos nuevos: si aun no existe `develop` ni `dev`, se permite crear temporalmente desde `main` o `master`.
47
- - Si se usa la excepcion, recomendar crear `develop`/`dev` y adoptar ese flujo como estandar del repo.
48
- - **NUNCA** crear ramas de trabajo desde `testing`, `qa` ni desde otras ramas de feature/bug.
49
-
50
- ### Integracion
51
-
52
- - Toda integracion a cualquier rama protegida requiere **PR**.
53
- - No hay excepciones: `testing`, `develop`, `main`, `master`, `qa`, `release/*` — todas requieren PR.
54
- - Recomendar al usuario crear PR a `testing` para que los cambios esten disponibles en el entorno de pruebas.
55
-
56
- ### Protocolo cuando la rama actual es protegida
57
-
58
- Si la rama actual es protegida y se necesita escribir codigo:
59
-
60
- 1. Informar y pedir identificador de tarea (Jira u otro).
61
- 2. Verificar working directory limpio (`git status --porcelain`).
62
- 3. Si hay cambios sin commitear, pedir aprobacion para `git stash push -m "stash-automatico-refacil"`.
63
- 4. Detectar rama base para crear rama de trabajo:
64
- - Preferir `develop`, luego `dev`.
65
- - Solo si no existen (repo nuevo), usar `main` o `master` como excepcion temporal.
66
- - Cambiar y actualizar (`git pull origin <base>`). Si ninguna existe, detener.
67
- 5. Crear rama de trabajo:
68
- - Feature: `feature/<ID>`
69
- - Bugfix: `fix/<ID>`
70
- - Sin ID: nombre descriptivo corto y recomendar crear ticket.
71
- 6. Restaurar `stash` si se uso.
72
- 7. Si el usuario no aprueba el proceso, detener.
73
-
74
- ## 5) Politica de salida (UX)
75
-
76
- Modo por defecto: **conciso**.
77
-
78
- - **Conciso**: veredicto + blockers + maximo 5 hallazgos priorizados + siguiente paso.
79
- - **Detallado**: reporte completo por seccion.
80
-
81
- Si el usuario no pide detalle, usa modo conciso.
82
-
83
- ### Continuidad natural del flujo (confirmacion)
84
-
85
- - Cuando exista **un unico siguiente paso posible** dentro del flujo, no limitarse a "ejecuta `/refacil:...`".
86
- - En ese caso, cerrar con una pregunta de continuidad en lenguaje natural usando la **formula unica**:
87
- - *"El siguiente paso es [descripcion breve]. Quieres que continue con `/refacil:<skill>`?"*
88
- - Cuando haya **multiples siguientes pasos validos** (ramificacion real), listar opciones numeradas y pedir seleccion explicita.
89
- - Si el paso actual es **terminal** (fin de flujo, p.ej. PR creado), cerrar sin preguntar por siguiente skill.
90
-
91
- **Regla operativa (obligatoria)**: si el usuario confirma afirmativamente ("si", "ok", "dale", "continua", "yes", etc.) a la pregunta de continuidad, **invocar directamente la siguiente skill via el Skill tool** en el mismo turno. No pedir al usuario que escriba `/refacil:X` ni que repita el contexto la sesion debe continuar sin friccion.
92
-
93
- ## 6) Scope de review y push
94
-
95
- - `up-code` y `check-review` solo deben auto-ejecutar review cuando hay un unico cambio pendiente.
96
- - Si hay multiples cambios pendientes de review, bloquear y pedir seleccion explicita de `nombre-cambio`.
97
- - `review` no debe correr en modo masivo por defecto cuando hay multiples cambios activos sin alcance explicito.
98
-
99
- ## 7) Persistencia de evidencia de review
100
-
101
- - `archive` requiere `.review-passed` como precondicion bloqueante (comprobar existencia segun **§8**).
102
- - Al archivar cambios regulares (via OpenSpec), la metadata de `.review-passed` debe persistirse en `openspec/specs/`.
103
- - El formato recomendado es `review.yaml` dentro de cada carpeta de spec afectada.
104
- - Si no se puede mapear de forma confiable a specs concretos, registrar la evidencia en `openspec/specs/review-metadata.yaml`.
105
-
106
- ## 8) Archivos ocultos bajo `openspec/changes/<cambio>/`
107
-
108
- - **`.review-passed`** y cualquier archivo cuyo nombre empiece por **`.`** son **ocultos** en muchos entornos: en shell, **`ls` sin `-a` / `-la` no los lista** — no concluyas que no existen por eso (evita falsos negativos en prereqs, review, verify, `up-code` y archive).
109
- - **Preferido**: herramienta **`Glob`** (patron bajo `openspec/changes/<nombre>/`), **`Read`** sobre la ruta exacta `openspec/changes/<nombre>/.review-passed`, o Bash **`test -f`** / **`[ -f ... ]`** sobre esa ruta.
110
- - Si el usuario dice que el archivo existe y tu comprobacion lo nego, **re-verifica** con uno de los metodos anteriores antes de insistir.
111
-
112
- ## 9) Identificador de carpeta bajo `openspec/changes/<cambio>/`
113
-
114
- - El **nombre de la carpeta** del cambio activo es el identificador que usa el CLI de OpenSpec (`openspec status --change`, flujos de archive, etc.).
115
- - **Debe empezar con una letra ASCII** `[a-zA-Z]`. Si el primer caracter es un digito u otro simbolo, el CLI rechaza el nombre (p. ej. `Invalid change name: Change name must start with a letter`).
1
+ # SDD-AI Methodology Contract
2
+
3
+ This file centralizes cross-cutting rules to avoid duplication and inconsistencies between skills.
4
+
5
+ ## §1 Flow states (Definition of Ready / Done)
6
+
7
+ - **READY_FOR_PROPOSE**: problem understood (objective, scope, constraints) and minimum repo context.
8
+ - **READY_FOR_APPLY**: complete SDD artifacts (`proposal.md`, `design.md`, `tasks.md`, specification in `specs.md` and/or `specs/**/*.md`) and explicit user approval.
9
+ - **READY_FOR_VERIFY**: implementation finished, no changes outside scope.
10
+ - **READY_FOR_REVIEW**: for regular changes (propose), verify executed and critical issues resolved or accepted by the user. For bug fixes, the implementation and regression tests are complete (bugs do not go through verify).
11
+ - **READY_FOR_ARCHIVE**: review approved (`.review-passed` exists), tasks complete or exceptions approved, change functionally closed.
12
+ - **READY_FOR_MERGE**: review approved (`.review-passed` exists) and integration ready: PR created for the target branch. `/refacil:up-code` automatically verifies the review before push — if missing, it runs it.
13
+ - If multiple active changes exist without review, the target change must be explicitly selected before running review/push.
14
+
15
+ ## §2 AGENTS.md policy
16
+
17
+ - If a skill requires the `sdd` profile: `AGENTS.md` is mandatory (if missing, stop and redirect to `/refacil:setup`).
18
+ - If a skill requires the `agents` profile: if `AGENTS.md` is missing, continue with a generic baseline and report the limitation to the user.
19
+
20
+ ## §3 Test command resolution (multi-stack)
21
+
22
+ Do not hardcode `npm test` unless it is genuinely the project's command.
23
+
24
+ Detection order:
25
+ 1. If `AGENTS.md` defines the official test command, use that.
26
+ 2. If a package manager script exists (e.g. `npm test`, `pnpm test`, `yarn test`, `bun test`), use the corresponding one.
27
+ 3. If Python: `pytest`.
28
+ 4. If Go: `go test ./...`.
29
+ 5. If Rust: `cargo test`.
30
+ 6. If Java/Gradle: `./gradlew test` or `gradle test`.
31
+ 7. If Java/Maven: `mvn test`.
32
+
33
+ Coverage (if applicable): detect the project command (`test:cov`, `coverage`, `pytest --cov`, etc.). If it does not exist, report N/A with justification.
34
+
35
+ ## §4 Protected branch policy and branch creation
36
+
37
+ Protected branches (never develop directly on them): `master`, `main`, `develop`, `dev`, `testing`, `qa`.
38
+
39
+ Critical rule:
40
+ - **NEVER** make direct changes on protected branches.
41
+ - All integration to protected branches is done via PR, without exceptions (including `testing`).
42
+
43
+ ### Working branch creation
44
+
45
+ - General rule: every new working branch (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.) must be created from an updated `develop` or `dev`.
46
+ - Exception for new repos: if neither `develop` nor `dev` exists yet, creating temporarily from `main` or `master` is allowed.
47
+ - If the exception is used, recommend creating `develop`/`dev` and adopting that flow as the repo standard.
48
+ - **NEVER** create working branches from `testing`, `qa`, or from other feature/bug branches.
49
+
50
+ ### Integration
51
+
52
+ - All integration to any protected branch requires a **PR**.
53
+ - No exceptions: `testing`, `develop`, `main`, `master`, `qa`, `release/*` — all require PR.
54
+ - Recommend the user create a PR to `testing` so the changes are available in the test environment.
55
+
56
+ ### Protocol when the current branch is protected
57
+
58
+ If the current branch is protected and code needs to be written:
59
+
60
+ 1. Inform and ask for a task identifier (Jira or other).
61
+ 2. Verify clean working directory (`git status --porcelain`).
62
+ 3. If there are uncommitted changes, ask for approval to `git stash push -m "auto-stash-refacil"`.
63
+ 4. Detect the base branch to create a working branch from:
64
+ - Prefer `develop`, then `dev`.
65
+ - Only if neither exists (new repo), use `main` or `master` as a temporary exception.
66
+ - Switch and update (`git pull origin <base>`). If none exist, stop.
67
+ 5. Create the working branch:
68
+ - Feature: `feature/<ID>`
69
+ - Bugfix: `fix/<ID>`
70
+ - Without ID: short descriptive name and recommend creating a ticket.
71
+ 6. Restore `stash` if used.
72
+ 7. If the user does not approve the process, stop.
73
+
74
+ ## §5 Output policy (UX)
75
+
76
+ Default mode: **concise**.
77
+
78
+ - **Concise**: verdict + blockers + maximum 5 prioritized findings + next step.
79
+ - **Detailed**: full section-by-section report.
80
+
81
+ If the user does not request detail, use concise mode.
82
+
83
+ ### Natural flow continuity (confirmation)
84
+
85
+ - When there is **one single possible next step** within the flow, do not limit yourself to "run `/refacil:...`".
86
+ - In that case, close with a continuity question in natural language using the **single formula**:
87
+ - *"The next step is [brief description]. Do you want me to continue with `/refacil:<skill>`?"*
88
+ - When there are **multiple valid next steps** (real branching), list numbered options and ask for explicit selection.
89
+ - If the current step is **terminal** (end of flow, e.g. PR created), close without asking for the next skill.
90
+
91
+ **Operative rule (mandatory)**: if the user confirms affirmatively ("yes", "ok", "go", "continue", "sure", etc.) to the continuity question, **directly invoke the next skill via the Skill tool** in the same turn. Do not ask the user to type `/refacil:X` or repeat the contextthe session must continue without friction.
92
+
93
+ ## §6 Review and push scope
94
+
95
+ - `up-code` and `check-review` should only auto-run review when there is a single pending change.
96
+ - If there are multiple changes pending review, block and ask for explicit selection of `change-name`.
97
+ - `review` must not run in bulk mode by default when there are multiple active changes without explicit scope.
98
+
99
+ ## §7 Review evidence persistence
100
+
101
+ - `archive` requires `.review-passed` as a blocking precondition (verify existence according to **§8**).
102
+ - When archiving regular changes (proposal-driven flow), the `.review-passed` metadata must be persisted in `refacil-sdd/specs/`.
103
+ - The recommended format is `review.yaml` inside each affected spec folder.
104
+ - If it cannot be reliably mapped to specific specs, record the evidence in `refacil-sdd/specs/review-metadata.yaml`.
105
+
106
+ ## §8 Hidden files under `refacil-sdd/changes/<change>/`
107
+
108
+ - **`.review-passed`** and any file whose name starts with **`.`** are **hidden** in many environments: in shell, **`ls` without `-a` / `-la` does not list them** — do not conclude they do not exist because of this (avoid false negatives in prereqs, review, verify, `up-code`, and archive).
109
+ - **Preferred**: **`Glob`** tool (pattern under `refacil-sdd/changes/<name>/`), **`Read`** on the exact path `refacil-sdd/changes/<name>/.review-passed`, or Bash **`test -f`** / **`[ -f ... ]`** on that path.
110
+ - If the user says the file exists and your check denied it, **re-verify** with one of the above methods before insisting.
111
+
112
+ ## §9 Folder identifier under `refacil-sdd/changes/<change>/`
113
+
114
+ - The **folder name** of the active change is the identifier used by the refacil-sdd CLI (`refacil-sdd status --change`, archive flows, etc.).
115
+ - **Must start with an ASCII letter** `[a-zA-Z]`. If the first character is a digit or other symbol, the CLI rejects the name (e.g. `Invalid change name: Change name must start with a letter`).
116
+
117
+ ## §10 — Language policy
118
+
119
+ - **Agent and skill internal instructions**: always in **English** (reduces token cost, improves LLM performance).
120
+ - **Responses to the user**: in the **user's language**. If the user writes in Spanish, respond in Spanish. If in English, respond in English. Default: Spanish.
121
+ - **SDD artifacts** (proposal.md, specs, design.md, tasks.md): in the **user's language** (or the language the team agreed on for the project).
122
+ - Technical terms, code identifiers, and proper nouns stay in their canonical language regardless.
@@ -1,37 +1,30 @@
1
- ---
2
- name: refacil:prereqs
3
- description: Referencia internaprerequisitos SDD-AI compartidos por el resto de skills refacil (no invocar manualmente)
4
- user-invocable: false
5
- ---
6
-
7
- # Prerequisitos SDD-AI
8
-
9
- Metodologia identica en Claude Code (`.claude/skills/refacil-*`) y Cursor (`.cursor/skills/refacil-*`). Usa la ruta del IDE abierto.
10
-
11
- Reglas transversales (estados, ramas, tests, salida): `METHODOLOGY-CONTRACT.md` en esta misma carpeta.
12
-
13
- ## Perfil `openspec`
14
-
15
- Una skill pide este perfil cuando usa OpenSpec y necesita `AGENTS.md`. Estas validaciones son obligatorias en cada ejecucion de skill que declare este perfil.
16
-
17
- 1. Verifica comando OpenSpec: `openspec --version 2>&1`. Si falla: *"OpenSpec no esta instalado o no esta en PATH. Ejecuta `/refacil:setup`"* y **detente**.
18
- 2. Verifica `openspec/` en la raiz del repo. Si falta: *"OpenSpec no esta inicializado en este repo. Ejecuta `/refacil:setup`"* y **detente**.
19
- 3. Lee `AGENTS.md` de la raiz. Si falta: *"No se encontro AGENTS.md. Ejecuta `/refacil:setup`"* y **detente**.
20
- 4. Si un comando de OpenSpec falla despues, consulta `.claude/skills/refacil-setup/troubleshooting.md`.
21
- 5. Si `AGENTS.md` incluye bloque `compact-guidance`, aplica esas reglas de eficiencia de tokens en toda la ejecucion.
22
-
23
- Caso especial: en `refacil:explore`, `AGENTS.md` es contexto activo durante toda la exploracion.
24
-
25
- ## Perfil `agents`
26
-
27
- Solo requiere `AGENTS.md`. Si existe, leelo y aplica `compact-guidance` si esta presente. Si falta: continua con baseline generico y avisa al usuario: *"No se encontro AGENTS.md; ejecuta `/refacil:setup` para reglas del proyecto."*
28
-
29
- ## OPENSPEC-DELTAS.md
30
-
31
- Convenciones Refacil al delegar a skills `openspec-*`: ver `OPENSPEC-DELTAS.md` (misma carpeta), leer junto a la skill OpenSpec que se invoque.
32
-
33
- ## BUS-CROSS-REPO.md
34
-
35
- Protocolo compartido para consultar a otros repositorios via `refacil-bus` y para **acuerdos en sala** (propose + cierre al solicitante). Aplica en `explore`, `propose`, `verify` y `bug` cuando la skill detecta dependencia cross-repo o coordinacion multi-repo. Ver `BUS-CROSS-REPO.md` (misma carpeta).
36
-
37
- Si faltan estos archivos, ejecuta `refacil-sdd-ai update` (o `init`).
1
+ ---
2
+ name: refacil:prereqs
3
+ description: Internal reference — SDD-AI prerequisites shared by all other refacil skills (do not invoke manually)
4
+ user-invocable: false
5
+ ---
6
+
7
+ # SDD-AI Prerequisites
8
+
9
+ Identical methodology in Claude Code (`.claude/skills/refacil-*`) and Cursor (`.cursor/skills/refacil-*`). Use the path of the open IDE.
10
+
11
+ Cross-cutting rules (states, branches, tests, output): `METHODOLOGY-CONTRACT.md` in this same folder.
12
+
13
+ ## `sdd` profile
14
+
15
+ A skill requests this profile when it needs `AGENTS.md` to operate with the SDD-AI flow. These validations are mandatory on each execution of a skill that declares this profile.
16
+
17
+ 1. Read `AGENTS.md` from the root. If missing: *"AGENTS.md not found. Run `/refacil:setup`"* and **stop**.
18
+ 2. If `AGENTS.md` includes a `compact-guidance` block, apply those token efficiency rules throughout the execution.
19
+
20
+ Special case: in `refacil:explore`, `AGENTS.md` is active context throughout the entire exploration.
21
+
22
+ ## `agents` profile
23
+
24
+ Only requires `AGENTS.md`. If it exists, read it and apply `compact-guidance` if present. If missing: continue with generic baseline and inform the user: *"AGENTS.md not found; run `/refacil:setup` for project rules."*
25
+
26
+ ## BUS-CROSS-REPO.md
27
+
28
+ Shared protocol for consulting other repositories via `refacil-bus` and for **room agreements** (propose + notification to the requester). Applies in `explore`, `propose`, `verify`, and `bug` when the skill detects a cross-repo dependency or multi-repo coordination. See `BUS-CROSS-REPO.md` (same folder).
29
+
30
+ If these files are missing, run `refacil-sdd-ai init` to reinstall skills and prereqs.
@@ -1,102 +1,103 @@
1
- ---
2
- name: refacil:propose
3
- description: Crear una propuesta de cambio completa delega la exploracion del codebase y la generacion de artefactos al sub-agente refacil-proposer, y maneja la revision humana obligatoria de los artefactos
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:propose — Entrypoint de Propuesta de Cambio
8
-
9
- Este skill es un **wrapper** que prepara el scope, delega la generacion de artefactos SDD al sub-agente `refacil-proposer`, y maneja la revision humana obligatoria (Human-in-the-Loop). El sub-agente corre en contexto aislado explorando el codebase y generando los artefactos; este wrapper los presenta al usuario para aprobacion.
10
-
11
- **Prerequisitos**: perfil `openspec` de `refacil-prereqs/SKILL.md` + reglas de `METHODOLOGY-CONTRACT.md`.
12
-
13
- ## Flujo
14
-
15
- ### Paso 1: Entender el cambio
16
-
17
- Si el usuario NO proporciono suficiente contexto en `$ARGUMENTS`, preguntale:
18
- - **Que tipo de cambio es?** (feature nuevo, mejora, refactor)
19
- - **Cual es el problema o necesidad?** (contexto de negocio)
20
- - **Cual es el objetivo?** (que debe lograr en una oracion)
21
-
22
- Si `$ARGUMENTS` ya es claro, no preguntes de nuevo.
23
-
24
- ### Paso 1.5: Identificador de carpeta del cambio (bloqueante)
25
-
26
- El directorio `openspec/changes/<nombre>/` **no puede** usar un `<nombre>` cuyo **primer caracter no sea una letra ASCII** `[a-zA-Z]` — ver **`refacil-prereqs/METHODOLOGY-CONTRACT.md` §9**. Nombres como `2026-04-17-exponer-algo` hacen fallar `openspec status --change` y otros comandos.
27
-
28
- **Antes de delegar al sub-agente:**
29
-
30
- 1. Acuerda o deriva el **slug final** del cambio (kebab-case: `feat-...`, `exponer-...`, `imp-...`, etc.). Fecha o ticket no van al **inicio** del nombre.
31
- 2. Si el usuario propone un nombre invalido, **corrigelo** (p. ej. prefijo `feat-` o `change-`) o pide el slug correcto; **no** delegar hasta tener un nombre valido.
32
- 3. Comunica al usuario el slug final acordado antes de generar.
33
-
34
- ### Paso 2: Delegar al sub-agente refacil-proposer
35
-
36
- Invoca al sub-agente `refacil-proposer` pasandole:
37
- - `changeName`: el slug valido acordado en el Paso 1.5.
38
- - `description`: descripcion completa del cambio (del Paso 1 o de `$ARGUMENTS`).
39
-
40
- El sub-agente:
41
- - Lee `openspec-propose/SKILL.md` + `OPENSPEC-DELTAS.md` para seguir las instrucciones de OpenSpec propose con los deltas Refacil.
42
- - Explora el codebase (lee `AGENTS.md`, detecta archivos y convenciones relevantes) antes de generar.
43
- - Genera los artefactos bajo `openspec/changes/<changeName>/`: `proposal.md`, especificacion (`specs.md` y/o `specs/**/*.md`), `design.md`, `tasks.md`.
44
- - Si el cambio involucra contratos cross-repo, lo nota en `design.md`.
45
- - Retorna UN solo mensaje con el resumen + bloque JSON fenced como ` ```refacil-propose-result `.
46
-
47
- Si el cambio surge de un **acuerdo en sala del bus** (`refacil-bus`), indicarselo al sub-agente en la descripcion para que lo tenga en cuenta al generar los artefactos. No acortar el flujo metodologico. Ver `refacil-prereqs/BUS-CROSS-REPO.md` (seccion acuerdos en sala).
48
-
49
- ### Paso 3: Revision del desarrollador (Human-in-the-Loop OBLIGATORIO)
50
-
51
- Parsea el bloque `refacil-propose-result` del sub-agente para obtener las rutas reales de los artefactos. Presenta al usuario un resumen claro para su revision:
52
-
53
- 1. **Proposal**: objetivo, alcance y justificacion del cambio.
54
- 2. **Specs**: criterios de aceptacion y rechazo listar **rutas reales** recibidas en el bloque JSON.
55
- 3. **Design**: archivos a crear/modificar y patrones a usar.
56
- 4. **Tasks**: lista de tareas verificar que el desglose sea correcto y completo.
57
-
58
- Pregunta explicitamente:
59
-
60
- ```
61
- === Revision requerida ===
62
- Los artefactos estan listos para tu revision:
63
- - openspec/changes/[nombre]/proposal.md
64
- - [rutas reales de specs]
65
- - openspec/changes/[nombre]/design.md
66
- - openspec/changes/[nombre]/tasks.md
67
-
68
- Por favor revisa los artefactos y confirma:
69
- 1. Los criterios de aceptacion son correctos?
70
- 2. El design se alinea con la arquitectura del proyecto?
71
- 3. Las tasks cubren todo el alcance?
72
-
73
- Responde "OK" para continuar, o indica que ajustes necesitas.
74
- ```
75
-
76
- **NO continuar al Paso 4 hasta que el usuario apruebe explicitamente.**
77
-
78
- Si el usuario pide ajustes acotados (cambiar un criterio, corregir una ruta, ajustar una task), aplicalos directamente en los archivos correspondientes y vuelve a presentar el resumen. Si los ajustes son amplios (cambiar el objetivo o el scope completo), re-invoca al sub-agente con la descripcion actualizada.
79
-
80
- ### Paso 4: Siguiente paso
81
-
82
- ```
83
- Propuesta aprobada en: openspec/changes/[nombre]/
84
- El siguiente paso es implementar las tasks.
85
- Quieres que continue con /refacil:apply?
86
- ```
87
-
88
- ## Reglas
89
-
90
- - **Nombre de carpeta del cambio**: cumplir siempre **§9** del contrato metodologico (primer caracter letra ASCII; nunca iniciar con digito). Validar ANTES de delegar.
91
- - **NUNCA escribir, modificar o generar codigo fuente** — solo artefactos SDD.
92
- - Aunque el usuario pase una descripcion completa en `$ARGUMENTS`, la salida es EXCLUSIVAMENTE artefactos de planificacion.
93
- - Si el usuario pide que tambien implemente, responder: "La implementacion se hace con `/refacil:apply` despues de aprobar los artefactos."
94
- - **Siempre delega la generacion al sub-agente**. No repliques aqui la logica de exploracion del codebase ni la generacion de artefactos.
95
- - **No muestres el bloque JSON al usuario**. Es solo metadata para obtener las rutas reales de los artefactos.
96
- - **Revision humana es obligatoria** NO saltar el Paso 3.
97
- - **Continuidad del flujo**: si el usuario confirma afirmativamente ("si", "ok", "dale", "continua", etc.) la pregunta de continuidad del Paso 4, invocar inmediatamente el **Skill tool** con `skill: "refacil:apply"`. No describirlo en texto ni esperar que el usuario escriba `/refacil:apply`. (Ver `METHODOLOGY-CONTRACT.md §5`.)
98
-
99
- ## Ver tambien
100
-
101
- - Sub-agente: `.claude/agents/refacil-proposer.md` (fuente: `refacil-sdd-ai/agents/proposer.md`)
102
- - Bus cross-repo: `refacil-prereqs/BUS-CROSS-REPO.md`
1
+ ---
2
+ name: refacil:propose
3
+ description: Create a complete change proposaldelegates codebase exploration and artifact generation to the refacil-proposer sub-agent, and handles mandatory human review of the artifacts
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:propose — Change Proposal Entrypoint
8
+
9
+ This skill is a **wrapper** that prepares the scope, delegates SDD artifact generation to the `refacil-proposer` sub-agent, and handles the mandatory human review (Human-in-the-Loop). The sub-agent runs in an isolated context exploring the codebase and generating the artifacts; this wrapper presents them to the user for approval.
10
+
11
+ **Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md`.
12
+
13
+ ## Flow
14
+
15
+ ### Step 0.5: Duplicate exploration guard (CA-11)
16
+
17
+ Before gathering context or delegating, check the current session conversation for a prior complete exploration report with overlapping scope (same modules, files, or described topic):
18
+
19
+ - **If a prior complete exploration exists for the same or highly overlapping topic**: summarize the already-known context in 2-3 sentences and ask:
20
+ ```
21
+ I already explored [topic] earlier in this session. The key findings were: [summary].
22
+ Do you want me to run a targeted follow-up, or proceed with the full exploration for this proposal?
23
+ ```
24
+ Wait for the user's answer. If they confirm "proceed", continue to Step 1 — do not re-invoke a full exploration automatically.
25
+ - **If there is no prior exploration** for this topic: continue to Step 1 without interruption.
26
+
27
+ ### Step 1: Understand the change
28
+
29
+ If the user did NOT provide sufficient context in `$ARGUMENTS`, ask:
30
+ - **What type of change is it?** (new feature, improvement, refactor)
31
+ - **What is the problem or need?** (business context)
32
+ - **What is the objective?** (what it must achieve in one sentence)
33
+
34
+ If `$ARGUMENTS` is already clear, do not ask again.
35
+
36
+ ### Step 1.5: Change folder identifier (blocking)
37
+
38
+ The `refacil-sdd/changes/<name>/` directory **cannot** use a `<name>` whose **first character is not an ASCII letter** `[a-zA-Z]` — see **`refacil-prereqs/METHODOLOGY-CONTRACT.md` §9**. Names like `2026-04-17-expose-something` cause `refacil-sdd-ai sdd status <name>` and other SDD commands to fail.
39
+
40
+ **Before delegating to the sub-agent:**
41
+
42
+ 1. Agree on or derive the **final slug** of the change (kebab-case: `feat-...`, `expose-...`, `imp-...`, etc.). Dates or tickets do not go at the **start** of the name.
43
+ 2. If the user proposes an invalid name, **correct it** (e.g. `feat-` or `change-` prefix) or ask for the correct slug; **do not** delegate until you have a valid name.
44
+ 3. Communicate the final agreed slug to the user before generating.
45
+
46
+ ### Step 2: Delegate to the refacil-proposer sub-agent
47
+
48
+ Invoke the `refacil-proposer` sub-agent passing it:
49
+ - `changeName`: the valid slug agreed in Step 1.5.
50
+ - `description`: complete description of the change (from Step 1 or from `$ARGUMENTS`).
51
+
52
+ The sub-agent:
53
+ - Explores the codebase (reads `AGENTS.md`, detects relevant files and conventions) before generating.
54
+ - Generates the artifacts under `refacil-sdd/changes/<changeName>/`: `proposal.md`, specification (`specs.md` and/or `specs/**/*.md`), `design.md`, `tasks.md`.
55
+ - If the change involves cross-repo contracts, notes it in `design.md`.
56
+ - Returns ONE single message with the summary + JSON block fenced as ` ```refacil-propose-result `.
57
+
58
+ If the change arises from a **bus room agreement** (`refacil-bus`), indicate it to the sub-agent in the description so it takes it into account when generating the artifacts. Do not shorten the methodology flow. See `refacil-prereqs/BUS-CROSS-REPO.md` (room agreements section).
59
+
60
+ ### Step 3: Developer review (Human-in-the-Loop — MANDATORY)
61
+
62
+ Parse the `refacil-propose-result` block from the sub-agent to get the real artifact paths. Present a clear summary to the user for their review:
63
+
64
+ 1. **Proposal**: objective, scope, and justification of the change.
65
+ 2. **Specs**: acceptance and rejection criteria — list **real paths** received in the JSON block.
66
+ 3. **Design**: files to create/modify and patterns to use.
67
+ 4. **Tasks**: task list — verify the breakdown is correct and complete.
68
+
69
+ Ask explicitly:
70
+
71
+ ```
72
+ === Review required ===
73
+ The artifacts are ready for your review:
74
+ - refacil-sdd/changes/[name]/proposal.md
75
+ - [real spec paths]
76
+ - refacil-sdd/changes/[name]/design.md
77
+ - refacil-sdd/changes/[name]/tasks.md
78
+
79
+ Please review the artifacts and confirm:
80
+ 1. Are the acceptance criteria correct?
81
+ 2. Does the design align with the project architecture?
82
+ 3. Do the tasks cover the full scope?
83
+
84
+ Reply "OK" to continue, or indicate what adjustments you need.
85
+ ```
86
+
87
+ **DO NOT continue to Step 4 until the user explicitly approves.**
88
+
89
+ If the user requests limited adjustments (change a criterion, fix a path, adjust a task), apply them directly to the corresponding files and present the summary again. If the adjustments are broad (changing the objective or the full scope), re-invoke the sub-agent with the updated description.
90
+
91
+ ### Step 4: Next step
92
+
93
+ ```
94
+ Proposal approved at: refacil-sdd/changes/[name]/
95
+ The next step is to implement the tasks.
96
+ Do you want me to continue with /refacil:apply?
97
+ ```
98
+
99
+ ## Rules
100
+
101
+ - **Change folder name**: always comply with **§9** of the methodology contract (first character ASCII letter; never start with a digit). Validate BEFORE delegating.
102
+ - **Always delegate generation to the sub-agent**. Do not replicate the codebase exploration or artifact generation logic here.
103
+ - **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 4, immediately invoke the **Skill tool** with `skill: "refacil:apply"`. Do not describe it in text or wait for the user to type `/refacil:apply`. (See `METHODOLOGY-CONTRACT.md §5`.)