Saltar al contenido
Skillpedia
APIs y servidores (backend)9,5 mil · #12239

convex-create-component

Qué hace

Esta habilidad ayuda a los desarrolladores a empaquetar la lógica del backend en un componente reutilizable de Convex. Está pensada para crear piezas autocontenidas que gestionan sus propios datos y pueden compartirse entre apps.

Cuándo usarla

  • ✓Cuando quieres pasar una función de backend a una pieza que otras apps de Convex puedan reutilizar.
  • ✓Cuando estás creando una integración de terceros que necesita sus propias tablas.
  • ✓Cuando quieres mantener el código reutilizable del backend separado de la lógica de la app principal.

Link de la skill

https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-create-component/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-create-component/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Convierte mi código de gestión de pagos en un componente reutilizable de Convex con sus propias tablas de datos.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El agente primero comprueba que un componente sea la elección correcta, después planifica qué tablas y funciones necesita, crea sus archivos de configuración y esquema, y mantiene pequeña la API que ve la app.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Convex Create Component

Create reusable Convex components with clear boundaries and a small app-facing API.

When to Use

  • Creating a new Convex component in an existing app
  • Extracting reusable backend logic into a component
  • Building a third-party integration that should own its own tables and workflows
  • Packaging Convex functionality for reuse across multiple apps

When Not to Use

  • One-off business logic that belongs in the main app
  • Thin utilities that do not need Convex tables or functions
  • App-level orchestration that should stay in convex/
  • Cases where a normal TypeScript library is enough

Workflow

  1. Ask the user what they are building and what the end goal is. If the repo already makes the answer obvious, say so and confirm before proceeding.
  2. Choose the shape using the decision tree below and read the matching reference file.
  3. Decide whether a component is justified. Prefer normal app code or a regular library if the feature does not need isolated tables, backend functions, or reusable persistent state.
  4. Make a short plan for:
    • what tables the component owns
    • what public functions it exposes
    • what data must be passed in from the app (auth, env vars, parent IDs)
    • what stays in the app as wrappers or HTTP mounts
  5. Create the component structure with convex.config.ts, schema.ts, and function files.
  6. Implement functions using the component's own ./_generated/server imports, not the app's generated files.
  7. Wire the component into the app with app.use(...). If the app does not already have convex/convex.config.ts, create it.
  8. Call the component from the app through components.<name> using ctx.runQuery, ctx.runMutation, or ctx.runAction.
  9. If React clients, HTTP callers, or public APIs need access, create wrapper functions in the app instead of exposing component functions directly.
  10. Run npx convex dev and fix codegen, type, or boundary issues before finishing.

Choose the Shape

Ask the user, then pick one path:

Goal Shape Reference
Component for this app only Local references/local-components.md
Publish or share across apps Packaged references/packaged-components.md
User explicitly needs local + shared library code Hybrid references/hybrid-components.md
Not sure Default to local references/local-components.md

Read exactly one reference file before proceeding.

Default Approach

Unless the user explicitly wants an npm package, default to a local component:

  • Put it under convex/components/<componentName>/
  • Define it with defineComponent(...) in its own convex.config.ts
  • Install it from the app's convex/convex.config.ts with app.use(...)
  • Let npx convex dev generate the component's own _generated/ files

Component Skeleton

A minimal local component with a table and two functions, plus the app wiring.

// convex/components/notifications/convex.config.ts
import { defineComponent } from "convex/server";

export default defineComponent("notifications");
// convex/components/notifications/schema.ts
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  notifications: defineTable({
    userId: v.string(),
    message: v.string(),
    read: v.boolean(),
  }).index("by_user_read", ["userId", "read"]),
});
// convex/components/notifications/lib.ts
import { v } from "convex/values";
import { mutation, query } from "./_generated/server.js";

export const send = mutation({
  args: { userId: v.string(), message: v.string() },
  returns: v.id("notifications"),
  handler: async (ctx, args) => {
    return await ctx.db.insert("notifications", {
      userId: args.userId,
      message: args.message,
      read: false,
    });
  },
});

export const listUnread = query({
  args: { userId: v.string() },
  returns: v.array(
    v.object({
      _id: v.id("notifications"),
      _creationTime: v.number(),
      userId: v.string(),
      message: v.string(),
      read: v.boolean(),
    }),
  ),
  handler: async (ctx, args) => {
    return awai
Preguntas frecuentes

¿Cuándo no es buena elección un componente?

Cuando la lógica es puntual o es una utilidad sencilla que no necesita tablas ni funciones propias. Puede bastar una biblioteca normal.

¿Qué tiene que pasarle la app?

Cosas como datos de autenticación, valores de entorno e ids de registros padre, que la app entrega al componente.

¿Solo sirve para componentes nuevos?

No. Cubre componentes nuevos y también extraer a uno la lógica de backend existente.

Detalles

Descripción original del autor

Builds reusable Convex components with isolated tables and app-facing APIs. Use for new components, reusable backend modules, integrations, or component boundary work.

repo: openclaw/clawhub

Popularidad

Estrellas en GitHub
9,5 mil
Posición en el ranking
#12239
Licencia
MIT
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas