staffos 0.3.0 → 0.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.
package/AGENTS.md CHANGED
@@ -23,6 +23,7 @@ Reglas:
23
23
  - Registrar siempre el estado de migraciones por ambiente (Local, Test, Staging, Producción) en `docs/MIGRATIONS.md`.
24
24
  - Documentar cambios relevantes.
25
25
 
26
- Usar la skill:
26
+ Usar las skills obligatorias:
27
27
 
28
- skills/staffos/SKILL.md
28
+ - `skills/staffos/SKILL.md` (siempre)
29
+ - `skills/modern-web-guidance/SKILL.md` (obligatoria antes de escribir o modificar HTML, CSS, UI o JS del cliente)
package/README.md CHANGED
@@ -3,49 +3,73 @@
3
3
  [![NPM Version](https://img.shields.io/npm/v/staffos.svg)](https://www.npmjs.com/package/staffos)
4
4
  [![License](https://img.shields.io/npm/l/staffos.svg)](https://github.com/richtunic/StaffOS/blob/main/LICENSE)
5
5
 
6
- Skill para agentes de IA locales que obliga a programar con criterio profesional de Staff Engineer.
6
+ Skill y sistema operativo de trabajo para agentes de IA locales que obliga a programar con criterio profesional de **Staff Engineer**.
7
7
 
8
- Inspirado en la idea de escribir menos código, pero agregando seguridad estricta, validación sistemática, documentación continua y una optimización extrema del uso de tokens.
8
+ Inspirado en la idea de escribir menos código, pero agregando seguridad estricta, validación sistemática, **relevo continuo entre agentes**, **tracking de migraciones de base de datos por ambiente** y una optimización extrema del uso de tokens.
9
9
 
10
10
  ---
11
11
 
12
- ## Objetivo
12
+ ## Novedades recientes (v0.4.0)
13
13
 
14
- Evitar que los agentes de IA produzcan código inflado (*slop*), inseguro, o que consuman miles de tokens innecesariamente leyendo archivos irrelevantes del proyecto.
14
+ - **Modern Web Guidance incluida (`skills/modern-web-guidance/SKILL.md`)**: Integra la skill oficial de [GoogleChrome/modern-web-guidance](https://github.com/googlechrome/modern-web-guidance) como paso obligatorio para tareas web (HTML/CSS/JS cliente), reduciendo el AI slop y patrones obsoletos mediante consulta dinámica con `npx -y modern-web-guidance@latest`.
15
+ - **Modelos de IA y tarifas actualizadas**: Soporte y estimación de costos con **Claude 5.5**, **Gemini 4 (Hydrogen, Neon, Argon)** y **GPT-6.2 / 6.1**.
16
+ - **Cross-Agent Continuity (`docs/HANDOFF.md`)**: Guarda checkpoints continuos de progreso (agente anterior, rama/commit, estado, qué funciona y siguiente paso exacto) para que otro agente (**Antigravity**, **Claude Code**, **Codex**, **Cursor**, **OpenCode**) pueda continuar exactamente donde te quedaste si se agotan los tokens.
17
+ - **Database Migrations Tracking (`docs/MIGRATIONS.md`)**: Registro vivo por ambiente (`Local`, `Test`, `Staging`, `Producción`) con estados (`Pendiente`, `Aplicada`, `No aplica`, `Rollback`) para evitar confusiones sobre qué migraciones ya se aplicaron y cuáles faltan en producción.
18
+ - **Actualización segura (`npx staffos@latest`)**: Al actualizar StaffOS en un proyecto existente, el CLI actualiza reglas y comandos y crea los documentos nuevos (como `docs/MIGRATIONS.md`) **sin sobrescribir** tus archivos existentes en `docs/`.
15
19
 
16
20
  ---
17
21
 
18
- ## Instalación rápida (NPM)
22
+ ## Instalación y actualización rápida (NPM)
19
23
 
20
- Puedes instalar e inicializar todas las reglas, comandos y plantillas directamente en cualquier proyecto ejecutando:
24
+ Para instalar o actualizar StaffOS en cualquier proyecto:
21
25
 
22
26
  ```bash
23
- npx staffos
27
+ npx staffos@latest
24
28
  ```
25
29
 
26
- El instalador copiará la estructura automáticamente en tu directorio actual. Además, cuenta con un comprobador de actualizaciones asíncrono e integrado que te avisará si hay una versión superior disponible en NPM.
30
+ El instalador copiará la estructura automáticamente en tu directorio actual y verificará si existe una versión superior disponible en NPM.
27
31
 
28
- Para **analizar y estimar el ahorro exacto de tokens** y el costo proyectado de tu proyecto actual, ejecuta:
32
+ Para **analizar y estimar el ahorro exacto de tokens** y el costo proyectado de tu proyecto actual:
29
33
 
30
34
  ```bash
31
35
  npx staffos estimate
32
36
  ```
33
37
 
34
- Puedes especificar un modelo de IA en particular mediante el flag `--model` para obtener estimaciones de costos exactas basadas en las tarifas de 2026:
38
+ Puedes especificar un modelo de IA en particular mediante el flag `--model`:
35
39
 
36
40
  ```bash
37
- npx staffos estimate --model=gemini-pro
41
+ npx staffos estimate --model=gemini-neon
38
42
  ```
39
43
 
40
- Los modelos de IA soportados son:
41
- * `claude-sonnet` (Claude 4.8 Sonnet - predeterminado)
42
- * `claude-opus` (Claude 4.8 Opus)
43
- * `gemini-pro` (Gemini 3.1 Pro)
44
- * `gemini-flash` (Gemini 3.5 Flash)
45
- * `gpt-5.5` (GPT 5.5)
46
- * `local` (Modelos locales de Ollama/Llama sin costo de API)
44
+ ---
45
+
46
+ ## Agentes y Modelos de IA Compatibles
47
+
48
+ ### Agentes / IDEs soportados
49
+ StaffOS está diseñado para funcionar de forma nativa e intercambiable entre:
50
+
51
+ - **Antigravity (Antigravity 2.0)**
52
+ - **Claude Code**
53
+ - **OpenAI Codex**
54
+ - **Cursor**
55
+ - **OpenCode**
47
56
 
48
- Este comando escaneará la base de código de tu proyecto local y generará una tabla detallada con los cálculos en tiempo real.
57
+ ### Modelos de IA soportados para estimación (`--model=`)
58
+
59
+ Tarifas de referencia por 1M de tokens (Input / Output):
60
+
61
+ | Flag `--model=` | Modelo | Input / Output (1M) | Entorno principal |
62
+ | :--- | :--- | :---: | :--- |
63
+ | `claude-sonnet` | **Claude 5.5 Sonnet** *(predeterminado)* | $2.00 / $10.00 | Claude Code / Cursor |
64
+ | `claude-opus` | **Claude 5.5 Opus** | $4.00 / $20.00 | Claude Code / Cursor |
65
+ | `claude-haiku` | **Claude 5.5 Haiku** | $0.10 / $0.50 | Claude Code / API |
66
+ | `gemini-hydrogen` | **Gemini 4 Hydrogen** | $1.50 / $7.50 | Antigravity / OpenCode |
67
+ | `gemini-neon` | **Gemini 4 Neon** | $3.00 / $15.00 | Antigravity 2.0 |
68
+ | `gemini-argon` | **Gemini 4 Argon / Carbon** | $4.00 / $20.00 | Antigravity / Deep Reasoning |
69
+ | `gpt-6-sol` | **GPT-6.2 Sol** | $2.00 / $10.00 | OpenAI Codex |
70
+ | `gpt-6-astra` | **GPT-6.2 Astra** | $8.00 / $40.00 | OpenAI Codex / Flagship |
71
+ | `gpt-6-terra` | **GPT-6.1 Terra** | $1.00 / $5.00 | OpenAI API |
72
+ | `local` | **Modelos locales (Ollama / DeepSeek / Llama)** | $0.00 / $0.00 | Local (sin costo de API) |
49
73
 
50
74
  ---
51
75
 
@@ -62,13 +86,14 @@ Una de las mayores ventajas de usar **StaffOS** es el drástico ahorro de tokens
62
86
  | **Ciclos de Prueba y Error** | 3 - 5 iteraciones por tarea | 1 iteración (Planificado y validado) | **~75%** |
63
87
  | **Costo Estimado por Tarea** | $0.25 - $0.80 USD | $0.02 - $0.06 USD | **~85% - 90%** |
64
88
 
65
- ### Estrategias Clave de Ahorro y Continuidad:
66
- 1. **Project Memory Layer (Limitar Lecturas)**: En lugar de escanear el código fuente entero, el agente está obligado a leer primero `AI_CONTEXT.md`, `HANDOFF.md` y `MIGRATIONS.md`. Si es suficiente, no lee nada más.
67
- 2. **Cross-Agent Continuity (Relevo sin pérdida)**: El agente guarda checkpoints continuos en `docs/HANDOFF.md` tras cada avance para que otro agente (Antigravity, Claude Code, Codex, Cursor, OpenCode) pueda retomar el trabajo exactamente donde quedó si se agotan los tokens.
68
- 3. **Database Migrations Tracking (`docs/MIGRATIONS.md`)**: Registra qué migraciones están aplicadas en `Local`, `Test`, `Staging` y cuáles siguen pendientes en `Producción`, evitando confusiones entre bases de datos.
69
- 4. **Minimal Patch Engineering**: Prohíbe reescribir archivos enteros. Al forzar cambios enfocados de pocas líneas, los tokens de salida de la API se reducen al mínimo.
70
- 5. **Progressive Implementation Protocol**: Divide las tareas grandes en fases lógicas con validaciones intermedias obligatorias. Esto evita que el agente falle al final y tenga que repetir toda la tarea desde cero.
71
- 6. **Actualización segura (`npx staffos@latest`)**: Al actualizar StaffOS en un proyecto existente, el CLI actualiza las reglas y comandos sin sobrescribir tus archivos existentes en `docs/`.
89
+ ### Estrategias Clave de Ahorro y Continuidad
90
+
91
+ 1. **Project Memory Layer (Limitar Lecturas)**: En lugar de escanear el código fuente entero, el agente lee primero `docs/AI_CONTEXT.md`, `docs/PROJECT_OVERVIEW.md`, `docs/HANDOFF.md`, `docs/DECISIONS.md` y `docs/MIGRATIONS.md`.
92
+ 2. **Cross-Agent Continuity (Relevo sin pérdida)**: Guarda checkpoints continuos en `docs/HANDOFF.md` tras cada avance para cambiar de agente o continuar tras agotar tokens sin repetir trabajo.
93
+ 3. **Database Migrations Tracking (`docs/MIGRATIONS.md`)**: Registra qué migraciones están aplicadas en `Local`, `Test`, `Staging` y cuáles siguen pendientes en `Producción`.
94
+ 4. **Minimal Patch Engineering**: Prohíbe reescribir archivos enteros. Al forzar cambios enfocados de pocas líneas, los tokens de salida se reducen al mínimo.
95
+ 5. **Progressive Implementation Protocol**: Divide las tareas grandes en fases lógicas con validaciones intermedias obligatorias.
96
+ 6. **Error Loop Mitigation**: Detiene al agente tras 2 fallos consecutivos del mismo error y genera un handoff limpio para reiniciar la sesión sin ruido.
72
97
 
73
98
  ---
74
99
 
@@ -76,9 +101,9 @@ Una de las mayores ventajas de usar **StaffOS** es el drástico ahorro de tokens
76
101
 
77
102
  Una vez instalado en tu proyecto local, el agente operará bajo las siguientes directrices:
78
103
 
79
- * **Paso 1**: Leer [AGENTS.md](file:///Users/richtunic/Documents/Proyectos/Agent%20Skill/AGENTS.md) al inicio de la conversación.
80
- * **Paso 2**: Utilizar la skill en [skills/staffos/SKILL.md](file:///Users/richtunic/Documents/Proyectos/Agent%20Skill/skills/staffos/SKILL.md).
81
- * **Paso 3**: Utilizar las herramientas de comandos de revisión integradas.
104
+ - **Paso 1**: Leer [`AGENTS.md`](./AGENTS.md) al inicio de la conversación.
105
+ - **Paso 2**: Utilizar la skill en [`skills/staffos/SKILL.md`](./skills/staffos/SKILL.md).
106
+ - **Paso 3**: Mantener actualizados [`docs/HANDOFF.md`](./docs/HANDOFF.md) y [`docs/MIGRATIONS.md`](./docs/MIGRATIONS.md).
82
107
 
83
108
  ---
84
109
 
@@ -86,11 +111,11 @@ Una vez instalado en tu proyecto local, el agente operará bajo las siguientes d
86
111
 
87
112
  El agente puede invocar estos comandos de revisión en cualquier fase de su trabajo:
88
113
 
89
- * `staffos-review`: Revisa el diff actual buscando código redundante o abstracciones prematuras.
90
- * `staffos-audit`: Audita la arquitectura del proyecto para evitar sobreingeniería y dependencias innecesarias.
91
- * `staffos-security`: Revisa que no existan credenciales hardcodeadas ni endpoints expuestos.
92
- * `staffos-handoff`: Genera un informe detallado para que el siguiente agente pueda continuar el trabajo sin perder contexto.
93
- * `staffos-help`: Muestra un menú de ayuda y los modos de operación recomendados (Lite, Full, Ultra).
114
+ - `staffos-review`: Revisa el diff actual buscando código redundante o abstracciones prematuras.
115
+ - `staffos-audit`: Audita la arquitectura del proyecto para evitar sobreingeniería y dependencias innecesarias.
116
+ - `staffos-security`: Revisa que no existan credenciales hardcodeadas ni endpoints expuestos.
117
+ - `staffos-handoff`: Genera un checkpoint detallado (incluyendo migraciones de DB pendientes) para que el siguiente agente continúe sin perder contexto.
118
+ - `staffos-help`: Muestra un menú de ayuda y los modos de operación recomendados (Lite, Full, Ultra).
94
119
 
95
120
  ---
96
121
 
package/bin/cli.js CHANGED
@@ -27,6 +27,8 @@ const itemsToCopy = [
27
27
  { src: 'AGENTS.md', dest: 'AGENTS.md' },
28
28
  { src: 'skills/staffos/SKILL.md', dest: 'skills/staffos/SKILL.md' },
29
29
  { src: 'skills/staffos/SKILL.md', dest: '.opencode/skills/staffos/SKILL.md' },
30
+ { src: 'skills/modern-web-guidance/SKILL.md', dest: 'skills/modern-web-guidance/SKILL.md' },
31
+ { src: 'skills/modern-web-guidance/SKILL.md', dest: '.opencode/skills/modern-web-guidance/SKILL.md' },
30
32
  { src: 'commands', dest: 'commands' },
31
33
  { src: 'commands', dest: '.opencode/commands' },
32
34
  { src: 'docs', dest: 'docs', preserveExisting: true }
@@ -129,16 +131,32 @@ function getFilesRecursive(dir, fileList = []) {
129
131
  return fileList;
130
132
  }
131
133
 
132
- // Model Pricing Registry (2026 Standard Rates per 1M tokens)
134
+ // Model Pricing Registry (Late 2026 Verified Rates per 1M tokens)
133
135
  const modelsPricing = {
134
- 'claude-sonnet': { name: 'Claude 4.8 / 4.6 Sonnet', input: 3.00, output: 15.00 },
135
- 'claude-opus': { name: 'Claude 4.8 / 4.7 Opus', input: 15.00, output: 75.00 },
136
- 'gemini-pro': { name: 'Gemini 3.1 Pro (OpenCode)', input: 2.00, output: 12.00 },
137
- 'gemini-flash': { name: 'Gemini 3.5 Flash (Antigravity 2.0)', input: 0.075, output: 0.30 },
138
- 'gpt-5.5': { name: 'GPT 5.5 / 5.4 (Codex)', input: 5.00, output: 30.00 },
139
- 'local': { name: 'Modelos Locales (Ollama/DeepSeek)', input: 0.00, output: 0.00 }
136
+ 'claude-sonnet': { name: 'Claude 5.5 Sonnet', input: 2.00, output: 10.00 },
137
+ 'claude-opus': { name: 'Claude 5.5 Opus', input: 4.00, output: 20.00 },
138
+ 'claude-haiku': { name: 'Claude 5.5 Haiku', input: 0.10, output: 0.50 },
139
+ 'gemini-hydrogen': { name: 'Gemini 4 Hydrogen (Antigravity)', input: 1.50, output: 7.50 },
140
+ 'gemini-neon': { name: 'Gemini 4 Neon (Antigravity)', input: 3.00, output: 15.00 },
141
+ 'gemini-argon': { name: 'Gemini 4 Argon / Carbon', input: 4.00, output: 20.00 },
142
+ 'gpt-6-sol': { name: 'GPT-6.2 Sol (Codex)', input: 2.00, output: 10.00 },
143
+ 'gpt-6-astra': { name: 'GPT-6.2 Astra', input: 8.00, output: 40.00 },
144
+ 'gpt-6-terra': { name: 'GPT-6.1 Terra', input: 1.00, output: 5.00 },
145
+ 'local': { name: 'Modelos Locales (Ollama/DeepSeek/Llama)', input: 0.00, output: 0.00 }
140
146
  };
141
147
 
148
+ // Backwards-compatible aliases for legacy flags/configs
149
+ const modelAliases = {
150
+ 'gemini-flash': 'gemini-hydrogen',
151
+ 'gemini-pro': 'gemini-neon',
152
+ 'gpt-5.5': 'gpt-6-sol'
153
+ };
154
+
155
+ function resolveModelKey(key) {
156
+ const normalized = (key || '').toLowerCase();
157
+ return modelAliases[normalized] || normalized;
158
+ }
159
+
142
160
  // Parse active configuration files
143
161
  function detectModelFromConfigFile() {
144
162
  // 1. Check staffos.json config override
@@ -147,7 +165,7 @@ function detectModelFromConfigFile() {
147
165
  try {
148
166
  const config = JSON.parse(fs.readFileSync(staffosPath, 'utf8'));
149
167
  if (config.model) {
150
- const m = config.model.toLowerCase();
168
+ const m = resolveModelKey(config.model);
151
169
  if (modelsPricing[m]) {
152
170
  return { key: m, reason: 'configuración de staffos.json especificada' };
153
171
  }
@@ -185,44 +203,44 @@ function detectActiveAI() {
185
203
 
186
204
  // Heuristic 1: Active Runtime Environment Variables (High Priority)
187
205
  if (process.env.ANTIGRAVITY_AGENT === '1' || process.env.ANTIGRAVITY_PROJECT_ID) {
188
- return { key: 'gemini-flash', reason: 'ejecutando en entorno Antigravity 2.0' };
206
+ return { key: 'gemini-neon', reason: 'ejecutando en entorno Antigravity 2.0' };
189
207
  }
190
208
  if (process.env.CODEX === 'true' || process.env.CODEX_AGENT) {
191
- return { key: 'gpt-5.5', reason: 'ejecutando en entorno OpenAI Codex' };
209
+ return { key: 'gpt-6-sol', reason: 'ejecutando en entorno OpenAI Codex' };
192
210
  }
193
211
  if (process.env.OPENCODE === 'true') {
194
- return { key: 'gemini-pro', reason: 'ejecutando en entorno OpenCode' };
212
+ return { key: 'gemini-neon', reason: 'ejecutando en entorno OpenCode' };
195
213
  }
196
214
 
197
215
  // Heuristic 2: Directory structures (Fallback if no env var is present)
198
216
  if (fs.existsSync(path.join(targetDir, '.gemini')) || fs.existsSync(path.join(targetDir, 'adapters/antigravity'))) {
199
- return { key: 'gemini-flash', reason: 'directorio de integración de Antigravity 2.0 detectado' };
217
+ return { key: 'gemini-neon', reason: 'directorio de integración de Antigravity 2.0 detectado' };
200
218
  }
201
219
  if (fs.existsSync(path.join(targetDir, 'adapters/codex')) || fs.existsSync(path.join(targetDir, 'codex.json'))) {
202
- return { key: 'gpt-5.5', reason: 'directorio de integración de Codex detectado' };
220
+ return { key: 'gpt-6-sol', reason: 'directorio de integración de Codex detectado' };
203
221
  }
204
222
  if (fs.existsSync(path.join(targetDir, '.opencode')) || fs.existsSync(path.join(targetDir, 'opencode.json')) || fs.existsSync(path.join(targetDir, 'opencode.jsonc'))) {
205
- return { key: 'gemini-pro', reason: 'directorio de integración de OpenCode detectado' };
223
+ return { key: 'gemini-neon', reason: 'directorio de integración de OpenCode detectado' };
206
224
  }
207
225
  if (fs.existsSync(path.join(targetDir, '.claudecode'))) {
208
226
  return { key: 'claude-sonnet', reason: 'directorio .claudecode detectado' };
209
227
  }
210
228
  if (fs.existsSync(path.join(targetDir, '.cursorrules'))) {
211
229
  if (process.env.OPENAI_API_KEY && !process.env.ANTHROPIC_API_KEY) {
212
- return { key: 'gpt-5.5', reason: 'archivo .cursorrules y OPENAI_API_KEY detectados' };
230
+ return { key: 'gpt-6-sol', reason: 'archivo .cursorrules y OPENAI_API_KEY detectados' };
213
231
  }
214
232
  return { key: 'claude-sonnet', reason: 'archivo .cursorrules detectado (Cursor default)' };
215
233
  }
216
234
 
217
235
  // Heuristic 3: Env Var keys
218
236
  if (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY) {
219
- return { key: 'gemini-pro', reason: 'variable de entorno GEMINI_API_KEY / GOOGLE_API_KEY' };
237
+ return { key: 'gemini-neon', reason: 'variable de entorno GEMINI_API_KEY / GOOGLE_API_KEY' };
220
238
  }
221
239
  if (process.env.ANTHROPIC_API_KEY) {
222
240
  return { key: 'claude-sonnet', reason: 'variable de entorno ANTHROPIC_API_KEY' };
223
241
  }
224
242
  if (process.env.OPENAI_API_KEY) {
225
- return { key: 'gpt-5.5', reason: 'variable de entorno OPENAI_API_KEY' };
243
+ return { key: 'gpt-6-sol', reason: 'variable de entorno OPENAI_API_KEY' };
226
244
  }
227
245
 
228
246
  // Heuristic 4: Terminal program
@@ -252,7 +270,8 @@ function getModelSelection() {
252
270
  // Estimate token savings for the current workspace
253
271
  function runEstimator() {
254
272
  const selection = getModelSelection();
255
- const pricing = modelsPricing[selection.key] || modelsPricing['claude-sonnet'];
273
+ const resolvedKey = resolveModelKey(selection.key);
274
+ const pricing = modelsPricing[resolvedKey] || modelsPricing['claude-sonnet'];
256
275
 
257
276
  console.log(`${colors.cyan}${colors.bold}=== StaffOS Token & Cost Estimator ===${colors.reset}\n`);
258
277
  console.log(`Scanning workspace at: ${colors.gray}${targetDir}${colors.reset}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "staffos",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "StaffOS: Staff Engineer Operating System for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": "bin/cli.js",
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: modern-web-guidance
3
+ description: |
4
+ Search tool for modern web development best practices. MANDATORY: Execute FIRST for all HTML/CSS and clientside JS tasks. Do NOT skip — web APIs evolve rapidly and training weights contain obsolete patterns.
5
+ Trigger immediately for: modals/dialogs/popovers, tables, dark mode, anchor positioning, container queries, view transitions, scroll-driven animations, parallax/reveals, forms, validation, autofill, accessibility, custom selects, scrollbars, CWV (LCP, INP, CLS), content-visibility, fetch priority, image optimization, security, passkeys, HTML sanitization, web components, dates/timezones, built-in AI, WebAssembly, standard HTML/CSS/DOM in frameworks, etc.
6
+ DO NOT trigger for: backend (SQL, ORMs, API routes), infra/scripts (CI/CD, Docker, Actions, Python/Go, Git), or tooling/trivial (Vite, tsconfig, ESLint, tests, copy/renames, 3P docs), etc.
7
+ ---
8
+
9
+ # Modern Web Guidance
10
+
11
+ Search and retrieve standardized modern web best practices at the **start** of implementing or updating any web UI, CSS layout/animation, or client-side JS logic (dates/timezones, sanitization, performance, accessibility, UX fixes) before writing ad-hoc solutions or adding dependencies.
12
+
13
+ ## Primary Workflow
14
+
15
+ ### Step 1. Search Use Cases
16
+
17
+ Run `modern-web-guidance` directly with `npx` using a **2–5 word action-oriented English query** for a **single web platform capability or UI pattern**:
18
+ - **Keep queries focused and generic**: Describe the user-visible capability (`<verb> + <UI/platform object>`, optionally paired with the target HTML/CSS/JS feature name if known). Omit framework/library names (`React`, `Vue`, `Tailwind`, etc.) and app/domain nouns (product, route, or component/file names). Split multi-feature tasks into separate `search` calls.
19
+ - **Name implied UI primitives**: When the user's prompt expresses intent without naming the UI primitive (e.g. "confirm first", "delete with confirmation", "pick a date"), translate the domain intent into the implied UI component or platform mechanism (e.g. search `"confirmation modal dialog"` or `"confirm dialog"` rather than `"confirm destructive action"`, or `"date picker input"` rather than `"pick a date"`).
20
+ - **Example**: Search `"light dismiss dialog"` or `"responsive data table"`, **not** `"dialog"` (too terse), `"responsive table dark mode"` (compound — split into two searches), or `"close React settings modal on outside click"` (framework/app noise).
21
+
22
+ ```sh
23
+ npx -y modern-web-guidance@latest search "<query>" --skill-version 2026_11_16-268fb9ea
24
+ ```
25
+
26
+ > **Note**: Returns `[{ "id", "description" }, ...]`. Judge results by their `description` fields:
27
+ > - **Match found**: Call `retrieve` directly—do not also run `list`.
28
+ > - **Weak or empty results**: If `search` returns `[]` or unrelated descriptions, **rephrase `search` once** using the concrete HTML/CSS/UI component noun or synonym (e.g., `dialog`, `modal`, `popover`, `table`, `form`) before falling back to `list` (or use `list` once for broad UI audits).
29
+ > - **Topic not covered**: If no `description` matches after rephrasing, proceed without retrieving unrelated guides.
30
+
31
+ ### Step 2. Retrieve Best Practices
32
+
33
+ Once you have relevant `id`(s) from the search results, call `retrieve` to get the full guide(s)—including both specific use-case guides that match your task and any broader discipline guide (e.g., `html`, `css`, `js`, `forms`, `accessibility`, `color`, `performance`, `security`) that applies. You can pass multiple IDs separated by commas.
34
+
35
+ ```sh
36
+ npx -y modern-web-guidance@latest retrieve "<id>"
37
+ ```
38
+
39
+ If `retrieve` saves large output (> 9.5 KB) to a temporary file to prevent truncation, read that file path in full using your file-reading tool (reading remaining line ranges if needed)—do not use `cat` or `head`.
40
+
41
+ ### Step 3. Verify Guidance Compliance
42
+
43
+ When generating or modifying code, cross-check the implementation against the retrieved guide before concluding:
44
+ - **Applicable Guidance & Fallbacks**: Ensure the relevant modern patterns and necessary fallback strategies from the guide are correctly applied, without forcing unrequested features.
45
+ - **Task Fulfillment**: Confirm that the implementation fully satisfies the user's request.
46
+ - Do not run `legacy-scan`; it's for detecting legacy patterns to modernize, not this.
47
+
48
+ ### Step 4. Disclose Skill Usage
49
+
50
+ When you consult `modern-web-guidance` for a task, end the response where you deliver those changes with a `### Modern Web Guidance` section:
51
+ - **When retrieved guides shaped your code**: Write **one** bullet (1–2 sentences, ≤75 words) per newly applied `<id>` in first-person voice explaining the non-obvious implementation choices, CSS/API overrides, or fallbacks `<id>` required and the pitfall it prevented, anchored by a short verbatim quote of that specific rule or gotcha (never the guide's intro overview):
52
+ `- **\`<id>\`**: <Non-obvious APIs, overrides, or fallbacks applied and the pitfall prevented> ("<short verbatim quote of the specific rule or gotcha>").`
53
+ - **Never** guess `<id>`s or quotes from memory after context compaction (re-run `search`/`retrieve` if needed), and credit **only** guide-backed changes from the current turn.
54
+ - **When searched/listed in this turn but zero guides applied**: Write one first-person sentence naming which topics or guides you checked in `modern-web-guidance` and why none applied (omit if any guide applied).
55
+
56
+ ## Alternative flow: Modernize an existing codebase
57
+
58
+ **Only** when asked for a broad, open-ended codebase modernization or legacy-pattern scan where no specific target feature or component is named (do **not** run `legacy-scan` when asked to add, update, fix, or audit a specific feature or component), run the 4-step modernization flow:
59
+
60
+ > **Note**: `legacy-scan` scans for a curated subset (~20% of the guidance corpus).
61
+
62
+ ```sh
63
+ npx -y modern-web-guidance@latest legacy-scan <path> --json
64
+ ```
65
+
66
+ 1. Scan: Run `legacy-scan <path> --json` to detect legacy web platform patterns across the project or directory.
67
+ 2. Verify: Check each finding against its `keepWhen` / `dropWhen` rubric; drop false positives (fallbacks, cross-file helpers, vendor code, lookalikes).
68
+ 3. Report: Summarize verified findings (and the modernization plan, if editing) for the user, noting that `legacy-scan` only checks the subset of guides (~20% of the catalog) that have deterministic legacy rules.
69
+ 4. Modernize (when the user asked to modernize rather than only audit/report): Retrieve each finding's guide (`retrieve "<guide-id>"` via Step 2), apply the replacement (keeping existing libraries as fallbacks where the guide requires one), and re-run `legacy-scan <path>` on the modified files to confirm resolution.
70
+ - Dropped findings and kept fallbacks still match static scans; do not edit safe code or inspect `legacy-scan.mjs` to force 0 findings.
71
+
72
+ ## Using npx / pnpx
73
+
74
+ - **Runner & Permissions**: Prefer `pnpx` over `npx` if `pnpm` is available (`pnpx` does not use `-y`); on Windows, use `npx.cmd`. When requesting tool permissions, allowlist `npx -y modern-web-guidance@latest *` (or `pnpx modern-web-guidance@latest *`) specifically, never bare `npx *` or `pnpx *`.
75
+ - **Sandboxes & Network**: Fetching `modern-web-guidance` requires outbound network access. In sandboxed or approval-gated environments (e.g., Codex, Claude Code), **proactively request approval/allowlisting with network access BEFORE the first execution** to avoid timeouts, and set `NPM_CONFIG_CACHE=/tmp/npm-cache` if `~/.npm` is read-only.
76
+ - **Offline**: If the command hangs due to being offline, retry with `npx --offline …`.
77
+
78
+ ## Guidelines
79
+
80
+ - Always search **first** to find the most relevant guides. Do not hallucinate guides or ignore them; they represent the preferred local standard for the user's project.
81
+ - These guides use vanilla HTML/CSS/JS; adapt them to your framework without dropping the modern feature:
82
+ - **Types**: Spread/cast newly shipped HTML attributes (`{...({ popover: 'hint', interestfor: id, commandfor: id, switch: '' } as any)}`, `[attr.*]`) rather than removing them or merging `@types/react`.
83
+ - **SSR & Bundlers**: Guard `window`/`HTMLElement` in SSR and load polyfills via bare `import('<pkg>')` in client effects (or set Vite `build.target: 'esnext'` for top-level `await`)—never copy files from `node_modules`.
84
+ - **DOM, IDs & CSS**: Call `showModal()`/`moveBefore()` via refs on non-VDOM-managed nodes, generate per-instance IDs/`anchor-name`s (`useId()`), and keep `:root` and `@starting-style` top-level/unscoped.
85
+
86
+ ## Interpreting Browser Support & Fallbacks
87
+
88
+ * **Default Behavior**: All guides assume **Baseline Widely available** features are safe to use without fallbacks. For features that are not Baseline widely available, you **MUST** follow the fallback recommendations in the guide, unless the user has specified a custom browser support policy.
89
+ * **Custom Policies**: If the user defines explicit browser support requirements, use the guide's compatibility data to determine if a fallback can be ignored (for `Baseline YYYY` targets, a feature satisfies the target if its "Baseline since" date is `<= YYYY`). Examples: _"Do not implement feature fallbacks"_, _"Safari 17.4+"_, _"Never implement polyfills; use a lightweight custom fallback or redesign"_, or _"Allow Newly Available features if feature-detected with graceful degradation"_.
90
+ * **Reactive Policy Discovery**: Suggest documenting a policy in `AGENTS.md` or `CLAUDE.md` (e.g., `**Browser Support:** Allow Newly Available features, but only adopt custom fallback code that adds <= 20 lines and no external dependencies`) if the developer targets a restricted runtime (Electron/Tauri), excludes specific browsers, hesitates over polyfill size/complexity, or asks if a feature is safe without fallbacks.
@@ -89,6 +89,16 @@ Aplica especialmente a:
89
89
 
90
90
  ---
91
91
 
92
+ ## Modern Web Guidance (Obligatorio en Frontend / Web)
93
+
94
+ Antes de implementar o modificar cualquier interfaz web, HTML, CSS, layout, animaciones o JavaScript del cliente (modales, tablas, formularios, dark mode, accesibilidad, rendimiento, fechas/zonas horarias, sanitización, etc.):
95
+
96
+ 1. Leer y seguir `skills/modern-web-guidance/SKILL.md`.
97
+ 2. Consultar primero las guías oficiales actualizadas con `npx -y modern-web-guidance@latest search "<query>"` y `retrieve "<id>"` antes de escribir soluciones ad-hoc o instalar librerías innecesarias.
98
+ 3. No aplica a backend puro (SQL, ORMs, API routes), scripts de infra/CI o tooling.
99
+
100
+ ---
101
+
92
102
  ## Anti AI Code Slop
93
103
 
94
104
  Prohibido:
package/staffos.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "model": "gemini-flash"
2
+ "model": "gemini-neon"
3
3
  }
@@ -3,6 +3,7 @@ import fs from "node:fs";
3
3
  const requiredFiles = [
4
4
  "AGENTS.md",
5
5
  "skills/staffos/SKILL.md",
6
+ "skills/modern-web-guidance/SKILL.md",
6
7
  "commands/staffos-review.md",
7
8
  "commands/staffos-audit.md",
8
9
  "commands/staffos-security.md",
@@ -34,6 +35,7 @@ const requiredPhrases = [
34
35
  "Project Memory Layer",
35
36
  "Cross-Agent Continuity",
36
37
  "Database Migrations Tracking",
38
+ "Modern Web Guidance",
37
39
  "Context7",
38
40
  "Challenge Assumptions"
39
41
  ];