Elffuss BraidHub

utopia-ia/elffuss public

Framing directivo de skills: que el modelo pequeño no niegue una skill instalada

Medido en vivo (Claw con E4B): con una skill instalada, el modelo decía «I don't
have that skill» y creaba una app genérica en vez de usarla. El bloque de skills
era pasivo («síguelas cuando la tarea encaje»), y un 4B no lo conecta.

Ahora el bloque es directivo: dice que las skills SON capacidades suyas ahora,
que empareje por TEMA aunque el usuario use otro nombre, que NUNCA niegue tener
una skill listada, y que si trae plantilla HTML la cree con app.create
copiándola en vez de inventar una app distinta.

Ayuda con el síntoma de negar la skill; el uso fiable de skills complejas sigue
pidiendo un modelo más capaz que E4B.
Changeset4006725820882d04005c5ddae48a569681594e8041add76bcec25230b4159878
AuthorKikoCis <kikocisneros@gmail.com> · 2026-08-18 20:08 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-08-18 20:08 +02:00
Parents26b03efb6034

Browse the files at this changeset

1 file changed

modified core/skills.js +36 −31
@@ -1,14 +1,14 @@
1-// Elffuss Code skills: markdown instructions (Claude Code's SKILL.md format)
2-// that the model follows when they apply. They install from the big OFFICIAL
3-// catalogue (github.com/anthropics/skills), from the official plugins, or from
4-// ANY public repo (community marketplaces such as OpenClaude/openclaw).
5-// Everything is transparent: you see the repo, the list, and the SKILL.md that
6-// gets injected. They are stored in IndexedDB (nothing leaves the browser).
1+// Skills de Elffuss Code: instrucciones en markdown (formato SKILL.md de
2+// Claude Code) que el modelo sigue cuando aplican. Se instalan desde el
3+// catálogo grande OFICIAL (github.com/anthropics/skills), desde los plugins
4+// oficiales, o desde CUALQUIER repo público (marketplaces de la comunidad
5+// tipo OpenClaude/openclaw). Todo transparente: se ve el repo, la lista y el
6+// SKILL.md que se inyecta. Se guardan en IndexedDB (nada sale del navegador).
77 import * as db from './db.js';
88
9-const KEY = 'skills'; // installed skills
10-const SRC_KEY = 'skills.sources'; // custom repos added by the user
11-const MAX_SKILL = 12_000; // characters of the body injected into the model
9+const KEY = 'skills'; // skills instaladas
10+const SRC_KEY = 'skills.sources'; // repos personalizados añadidos por el usuario
11+const MAX_SKILL = 12_000; // caracteres del cuerpo que se inyectan al modelo
1212
1313 export const CATALOG_REPO = 'anthropics/skills';
1414 export const DEFAULT_SOURCES = [
@@ -17,11 +17,12 @@
1717 { repo: 'anthropics/claude-plugins-official', label: 'Anthropic · Claude Code Plugins (oficial)', official: true },
1818 ];
1919
20-let cache = []; // installed, in memory (so that systemPrompt can be synchronous)
20+let cache = []; // instaladas, en memoria (para que el systemPrompt sea síncrono)
2121
22-// `loaded` tells "there are no skills" apart from "we could not read them". A
23-// transient IndexedDB failure used to leave the cache empty, and the next
24-// install() then persisted that emptiness — wiping every installed skill.
22+// `loaded` distingue «no hay skills» de «no se pudo leer»: si la lectura
23+// falla, cache queda vacío pero loaded=false, y install() se niega a persistir
24+// (antes, un fallo transitorio de IndexedDB borraba TODAS las skills al
25+// guardar la siguiente).
2526 let loaded = false;
2627 export async function initSkills() {
2728 try {
@@ -31,7 +32,7 @@
3132 } catch (e) {
3233 cache = [];
3334 loaded = false;
34- console.warn('[elffuss] could not read skills; refusing to overwrite them', e);
35+ console.warn('[elffuss] no se pudieron leer las skills; no las sobrescribiré', e);
3536 }
3637 return cache;
3738 }
@@ -42,21 +43,20 @@
4243 export function isInstalled(repo, path) { return cache.some(s => s.repo === repo && s.path === path); }
4344
4445 export async function install(skill) {
45- // If the initial read failed, `cache` does not represent what is installed:
46- // retry before writing, and refuse rather than destroy.
46+ // Si la carga inicial falló, cache no representa lo instalado: reintentar
47+ // leer antes de escribir. Sin esto, guardar aquí borraría las skills reales.
4748 if (!loaded) {
4849 await initSkills();
49- if (!loaded) throw new Error('Could not read your saved skills; not installing, so none are lost. Reload and try again.');
50+ if (!loaded) throw new Error('No pude leer tus skills guardadas; no instalo para no perderlas. Recarga la página e inténtalo otra vez.');
5051 }
5152 cache = cache.filter(s => !(s.repo === skill.repo && s.path === skill.path) && s.name !== skill.name);
5253 const entry = { ...skill, content: (skill.content || '').slice(0, MAX_SKILL) };
5354 cache.push(entry);
5455 await db.set('kv', KEY, cache);
55- return entry; // returns the full skill (name, description…)
56+ return entry; // devuelve la skill completa (name, description…)
5657 }
5758
58-// "How to use it" message after installing: what it does + an example of what
59-// to ask for. The returned copy is user-facing and stays in Spanish.
59+// Mensaje «cómo usarla» tras instalar: qué hace + un ejemplo de qué pedir.
6060 export function usageMessage(skill) {
6161 const desc = (skill.description || '').trim();
6262 const ejemplo = firstExample(skill) || `algo relacionado con «${skill.name}»`;
@@ -65,7 +65,7 @@
6565 `Ya la sigo en cada conversación. Para usarla, pídeme por ejemplo:\n\n> ${ejemplo}`;
6666 }
6767
68-// Tries to pull a usage example out of the SKILL.md body (example/usage lines).
68+// Intenta sacar un ejemplo de uso del cuerpo del SKILL.md (líneas de ejemplo/uso).
6969 function firstExample(skill) {
7070 const body = skill.content || '';
7171 const m = body.match(/(?:ejemplo|example|uso|usage|prueba|try)[^\n:]*[::]\s*["“]?([^\n"”]{6,90})/i)
@@ -82,7 +82,7 @@
8282 return cache.find(s => s.name.toLowerCase() === String(name).toLowerCase()) || null;
8383 }
8484
85-// ---- sources (repos) ----
85+// ---- fuentes (repos) ----
8686 export async function sources() {
8787 const custom = (await db.get('kv', SRC_KEY).catch(() => null)) || [];
8888 return [...DEFAULT_SOURCES, ...custom];
@@ -101,8 +101,8 @@
101101 await db.set('kv', SRC_KEY, custom.filter(s => s.repo !== repo));
102102 }
103103
104-// ---- catalogue from GitHub ----
105-// A single call to the repo's git tree → every SKILL.md.
104+// ---- catálogo desde GitHub ----
105+// Una sola llamada al árbol git del repo → todos los SKILL.md.
106106 export async function listFromRepo(repo) {
107107 let tree, branch;
108108 for (const b of ['main', 'master']) {
@@ -117,7 +117,7 @@
117117 .sort((a, b) => a.dir.localeCompare(b.dir));
118118 }
119119
120-// Downloads the SKILL.md and installs it (simple YAML frontmatter).
120+// Descarga el SKILL.md y lo instala (frontmatter YAML simple).
121121 export async function installFromRepo(entry) {
122122 let md = null;
123123 for (const b of [entry.branch, 'main', 'master'].filter(Boolean)) {
@@ -139,9 +139,9 @@
139139 return { name, description, content };
140140 }
141141
142-// Skill maker: Elffuss builds a skill of its own (SKILL.md) out of whatever the
143-// user wants, and installs it instantly. It shows up in the Skills tab and is
144-// injected into the prompt of the following turns.
142+// Creador de skills: Elffuss fabrica una skill propia (SKILL.md) a partir de
143+// lo que el usuario quiere, y la instala al instante. Aparece en la pestaña
144+// Skills y se inyecta en el prompt de los siguientes turnos.
145145 export async function createSkill({ name, description, instructions } = {}) {
146146 if (!name || !instructions) throw new Error('Faltan name o instructions');
147147 const skill = {
@@ -155,11 +155,16 @@
155155 return `Skill «${skill.name}» creada e instalada. Ya la sigo en cada conversación (mírala en la pestaña Skills).`;
156156 }
157157
158-// Block for the systemPrompt (synchronous, straight from the cache). The
159-// injected wording is prompt content, not documentation: it stays in Spanish.
158+// Bloque para el systemPrompt (síncrono, desde la caché).
160159 export function skillsPromptBlock() {
161160 if (!cache.length) return '';
161+ const nombres = cache.map(s => `«${s.name}»`).join(', ');
162162 const parts = cache.map(s =>
163163 `### Skill «${s.name}»${s.repo ? ` (de ${s.repo})` : ''}\n${s.description || ''}\n${(s.content || '').slice(0, MAX_SKILL)}`);
164- return `\n\nSKILLS ACTIVAS (instrucciones especializadas; síguelas cuando la tarea encaje):\n${parts.join('\n\n')}`;
164+ return `\n\nSKILLS INSTALADAS — son capacidades que TIENES AHORA MISMO: ${nombres}.\n` +
165+ `REGLAS con las skills:\n` +
166+ `- Si la petición encaja con una skill (aunque el usuario la nombre con otras palabras o un nombre parecido, empareja por el TEMA de su descripción), ÚSALA siguiendo sus instrucciones al pie de la letra.\n` +
167+ `- NUNCA digas que no tienes esa skill o esa capacidad: la tienes, está aquí abajo.\n` +
168+ `- Si la skill incluye una plantilla de app (HTML), créala con la herramienta app.create COPIANDO esa plantilla y adaptando solo lo que la skill indique — no inventes una app genérica distinta.\n\n` +
169+ parts.join('\n\n');
165170 }