본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)9.5k · #12239

convex-create-component

하는 일

이 스킬은 개발자가 백엔드 로직을 재사용 가능한 Convex 구성 요소로 묶도록 돕습니다. 자체 데이터를 소유하고 여러 앱에서 공유할 수 있는 독립된 부품을 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓백엔드 기능을 다른 Convex 앱이 재사용할 수 있는 부품으로 옮기고 싶을 때.
  • ✓자체 테이블이 필요한 서드파티 연동을 만들고 있을 때.
  • ✓메인 앱 로직과 분리된 재사용 가능한 백엔드 코드를 원하는 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-create-component/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 결제 처리 코드를 자체 데이터 테이블을 가진 재사용 가능한 Convex 구성 요소로 바꿔 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 먼저 구성 요소가 맞는 선택인지 확인하고, 필요한 테이블과 함수를 계획하며, 설정과 스키마 파일을 만들고, 앱에 노출되는 API를 작게 유지합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

구성 요소가 맞지 않는 경우는 언제인가요?

일회성 로직이거나 자체 테이블과 함수가 필요 없는 단순 유틸리티일 때입니다. 일반 라이브러리로 충분할 수 있습니다.

앱이 무엇을 넘겨줘야 하나요?

인증 정보, 환경 값, 상위 레코드 ID처럼 앱이 구성 요소에 제공하는 값들입니다.

새 구성 요소에만 작동하나요?

아닙니다. 새 구성 요소뿐 아니라 기존 백엔드 로직을 구성 요소로 분리하는 작업도 다룹니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
9.5k
순위
#12239
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬