Community코딩 & 개발github.com

waynesutton/convex-schema-validator

Convex 데이터베이스 스키마를 정의하고 검증하며, 적절한 타입 지정, 인덱스 구성, 선택적 필드, 유니온, 스키마 변경 마이그레이션 전략을 제공합니다.

convex-schema-validator란 무엇인가요?

이 스킬은 Convex 플랫폼에서 데이터베이스 스키마를 정의하고 검증하는 방법을 다룹니다. 정적 타입 검증, 인덱스 구성, 선택적(optional) 필드 처리, 유니온(union) 타입 사용, 그리고 스키마 변경 시 필요한 마이그레이션 전략을 중점적으로 설명합니다. Convex의 스키마 정의는 TypeScript 인터페이스와 유사한 방식으로 이루어지며, `defineTable`, `defineSchema`, `v.object`, `v.union` 등의 함수를 사용하여 명확하고 안전한 데이터 모델을 구축할 수 있습니다. 이 스킬은 개발자가 Convex 애플리케이션에서 데이터 무결성을 유지하고, 유지보수 가능한 스키마를 설계하며, 안전하게 변경을 적용할 수 있도록 돕습니다. 주로 Convex 백엔드 서버리스 환경에서 사용됩니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/waynesutton/convexskills/tree/main/skills/convex-schema-validator

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

convex-schema-validator은(는) 무엇을 하나요?

Convex 데이터베이스 스키마를 정의하고 검증하며, 적절한 타입 지정, 인덱스 구성, 선택적 필드, 유니온, 스키마 변경 마이그레이션 전략을 제공합니다.

개요

이 스킬은 Convex 백엔드에서 스키마를 정의할 때 모범 사례를 따르도록 가이드합니다. convex/schema.ts 파일에서 defineSchema와 defineTable을 사용하여 구조화된 테이블을 만들고, v 헬퍼를 통해 각 필드의 타입을 검증합니다.

주요 기능

  • 타입 정의: v.string(), v.number(), v.boolean(), v.id("tableName"), v.array(), v.object() 등 다양한 타입 지원
  • 선택적 필드: v.optional(v.string()) 형태로 필드를 선택적으로 정의
  • 유니온 타입: v.union(v.string(), v.number())로 여러 타입 허용
  • 인덱스 구성: index 메서드를 사용하여 조회 성능 최적화
  • 마이그레이션 전략: 스키마 변경 시 데이터 무결성을 유지하는 방법

사용 예시

// convex/schema.ts
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  users: defineTable({
    name: v.string(),
    email: v.string(),
    age: v.optional(v.number()),
    role: v.union(v.literal("admin"), v.literal("user")),
  }).index("by_email", ["email"]),

  posts: defineTable({
    title: v.string(),
    content: v.string(),
    authorId: v.id("users"),
    tags: v.optional(v.array(v.string())),
  })
    .index("by_author", ["authorId"])
    .index("by_title", ["title"]),
});

스키마 검증

Convex는 런타임에 스키마를 검증하여 데이터 무결성을 보장합니다. 필드 타입이 일치하지 않으면 오류가 발생합니다.

인덱스 구성

인덱스는 조회 성능을 높이는 데 필수적입니다. 여러 필드에 대한 복합 인덱스도 지원됩니다.

.index("by_author_and_date", ["authorId", "creationTime"])

마이그레이션 전략

스키마 변경 시:

  1. 항상 선택적 필드로 새 필드를 추가하세요.
  2. 기존 데이터를 마이그레이션하는 쿼리를 작성하세요.
  3. 필드를 필수로 변경하기 전에 모든 기존 데이터가 업데이트되었는지 확인하세요.

참고: Convex 공식 문서

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

waynesutton/avoid-feature-creep

Prevent feature creep when building software, apps, and AI-powered products. Use this skill when planning features, reviewing scope, building MVPs, managing backlogs, or when a user says "just one more feature." Helps developers and AI agents stay focused, ship faster, and avoid bloated products.

waynesutton/convex

Umbrella skill for all Convex development patterns. Routes to specific skills like convex-functions, convex-realtime, convex-agents, etc.

waynesutton/convex-agents

Building AI agents with the Convex Agent component including thread management, tool integration, streaming responses, RAG patterns, and workflow orchestration

waynesutton/convex-best-practices

Guidelines for building production-ready Convex apps covering function organization, query patterns, validation, TypeScript usage, error handling, and the Zen of Convex design philosophy

waynesutton/convex-component-authoring

How to create, structure, and publish self-contained Convex components with proper isolation, exports, and dependency management

waynesutton/convex-cron-jobs

Scheduled function patterns for background tasks including interval scheduling, cron expressions, job monitoring, retry strategies, and best practices for long-running tasks

waynesutton/convex-file-storage

Complete file handling including upload flows, serving files via URL, storing generated files from actions, deletion, and accessing file metadata from system tables

waynesutton/convex-functions

Writing queries, mutations, actions, and HTTP actions with proper argument validation, error handling, internal functions, and runtime considerations

waynesutton/convex-http-actions

External API integration and webhook handling including HTTP endpoint routing, request/response handling, authentication, CORS configuration, and webhook signature validation

waynesutton/convex-migrations

Schema migration strategies for evolving applications including adding new fields, backfilling data, removing deprecated fields, index migrations, and zero-downtime migration patterns

waynesutton/convex-realtime

Patterns for building reactive apps including subscription management, optimistic updates, cache behavior, and paginated queries with cursor-based loading

waynesutton/convex-security-audit

Deep security review patterns for authorization logic, data access boundaries, action isolation, rate limiting, and protecting sensitive operations

waynesutton/convex-security-check

Quick security audit checklist covering authentication, function exposure, argument validation, row-level access control, and environment variable handling

관련 스킬