Zum Inhalt springen
Skillpedia
APIs & Server (Backend)9.5k · #12239

convex-create-component

Was er macht

Dieser Skill hilft Entwickelnden, Backend-Logik in einer wiederverwendbaren Convex-Komponente zu bündeln. Er ist für in sich geschlossene Bausteine gedacht, die ihre eigenen Daten besitzen und über mehrere Apps geteilt werden können.

Wann du ihn nutzt

  • ✓Wenn du eine Backend-Funktion in einen Baustein verschieben willst, den andere Convex-Apps wiederverwenden können.
  • ✓Wenn du eine Integration eines Drittanbieters baust, die eigene Tabellen braucht.
  • ✓Wenn du wiederverwendbaren Backend-Code getrennt von der Logik der Haupt-App halten willst.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-create-component/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Mach aus meinem Code zur Zahlungsabwicklung eine wiederverwendbare Convex-Komponente mit eigenen Datentabellen.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent prüft zuerst, ob eine Komponente die richtige Wahl ist, plant dann, welche Tabellen und Funktionen sie braucht, erstellt die Konfigurations- und Schema-Dateien und hält die Schnittstelle zur App klein.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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
Häufige Fragen

Wann ist eine Komponente nicht die richtige Wahl?

Wenn die Logik einmalig ist oder ein einfaches Hilfswerkzeug, das keine eigenen Tabellen oder Funktionen braucht. Eine normale Bibliothek kann dann reichen.

Was muss die App übergeben?

Dinge wie Authentifizierungsdaten, Umgebungswerte und IDs übergeordneter Datensätze, die die App der Komponente gibt.

Funktioniert es nur für neue Komponenten?

Nein. Es deckt neue Komponenten ab und auch das Herauslösen vorhandener Backend-Logik in eine Komponente.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
9.5k
Platz im Ranking
#12239
Lizenz
MIT
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills