convex-quickstart
Convexを新規プロジェクトに導入したり、既存のReactなどのアプリに追加したりする際に、必要な初期設定や環境変数の設定、開発サーバーの起動などをスムーズに行えるように支援するSkill。
📜 元の英語説明(参考)
Initializes a new Convex project from scratch or adds Convex to an existing app. Use this skill when starting a new project with Convex, scaffolding with npm create convex@latest, adding Convex to an existing React, Next.js, Vue, Svelte, or other frontend, wiring up ConvexProvider, configuring environment variables for the deployment URL, or running npx convex dev for the first time, even if the user just says "set up Convex" or "add a backend."
🇯🇵 日本人クリエイター向け解説
Convexを新規プロジェクトに導入したり、既存のReactなどのアプリに追加したりする際に、必要な初期設定や環境変数の設定、開発サーバーの起動などをスムーズに行えるように支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o convex-quickstart.zip https://jpskill.com/download/19144.zip && unzip -o convex-quickstart.zip && rm convex-quickstart.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19144.zip -OutFile "$d\convex-quickstart.zip"; Expand-Archive "$d\convex-quickstart.zip" -DestinationPath $d -Force; ri "$d\convex-quickstart.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
convex-quickstart.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
convex-quickstartフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 2
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] convex-quickstart
Convex クイックスタート
Convex プロジェクトを可能な限り迅速にセットアップします。
使用するタイミング
- Convex を使用して新しいプロジェクトを開始する場合
- 既存の React、Next.js、Vue、Svelte、またはその他のアプリに Convex を追加する場合
- プロトタイプ作成のために Convex アプリをスキャフォールディングする場合
使用しないタイミング
- プロジェクトにすでに Convex がインストールされており、
convex/が存在する場合 - そのまま開発を開始してください - 既存の Convex アプリに認証を追加するだけの場合 -
convex-setup-authスキルを使用してください
ワークフロー
- 開始点(新規プロジェクトか既存アプリか)を決定します。
- 新規プロジェクトの場合、テンプレートを選択し、
npm create convex@latestでスキャフォールディングします。 - 既存アプリの場合、
convexをインストールし、プロバイダーを接続します。 npx convex devを実行してデプロイメントに接続し、開発ループを開始します。- セットアップが機能することを確認します。
パス 1: 新規プロジェクト (推奨)
公式のスキャフォールディングツールを使用します。これにより、フロントエンドフレームワーク、Convex バックエンド、およびすべての設定が連携した完全なプロジェクトが作成されます。
テンプレートを選択する
| テンプレート | スタック |
|---|---|
react-vite-shadcn |
React + Vite + Tailwind + shadcn/ui |
nextjs-shadcn |
Next.js App Router + Tailwind + shadcn/ui |
react-vite-clerk-shadcn |
React + Vite + Clerk auth + shadcn/ui |
nextjs-clerk |
Next.js + Clerk auth |
nextjs-convexauth-shadcn |
Next.js + Convex Auth + shadcn/ui |
nextjs-lucia-shadcn |
Next.js + Lucia auth + shadcn/ui |
bare |
Convex バックエンドのみ、フロントエンドなし |
ユーザーが好みを指定していない場合、シンプルなアプリには react-vite-shadcn を、SSR または API ルートが必要なアプリには nextjs-shadcn をデフォルトとします。
GitHub リポジトリをテンプレートとして使用することもできます。
npm create convex@latest my-app -- -t owner/repo
npm create convex@latest my-app -- -t owner/repo#branch
プロジェクトをスキャフォールディングする
インタラクティブなプロンプトを避けるため、常にプロジェクト名とテンプレートフラグを渡してください。
npm create convex@latest my-app -- -t react-vite-shadcn
cd my-app
npm install
スキャフォールディングツールはファイルを作成しますが、npm install は実行しないため、自分で実行する必要があります。
現在のディレクトリ(空の場合)にスキャフォールディングするには:
npm create convex@latest . -- -t react-vite-shadcn
npm install
開発ループを開始する
npx convex dev は、バックエンドコードを保存するたびに Convex デプロイメントに同期する、長時間実行されるウォッチャープロセスです。また、初回実行時には認証(ブラウザベースの OAuth)が必要です。これらの理由から、エージェントが直接実行するのには適していません。
ユーザーにこれを自分で実行するように依頼してください:
ユーザーにターミナルで npx convex dev を実行するように伝えてください。初回実行時には、ログインまたは匿名開発のプロンプトが表示されます。実行されると、次の処理が行われます。
- Convex プロジェクトと開発デプロイメントを作成します。
- デプロイメント URL を
.env.localに書き込みます。 - 生成された型を含む
convex/ディレクトリを作成します。 - 変更を監視し、継続的に同期します。
ユーザーは、コードの作業中に npx convex dev をバックグラウンドで実行し続ける必要があります。ウォッチャーは、convex/ 内で作成または編集したファイルを自動的に検出します。
例外 - クラウドまたはヘッドレスエージェント: インタラクティブなログインのためにブラウザを開くことができない環境では、ユーザーの操作なしで匿名で実行するためにエージェントモード(下記参照)を使用する必要があります。
フロントエンドを開始する
ユーザーは、別のターミナルでフロントエンド開発サーバーも実行する必要があります。
npm run dev
Vite アプリは http://localhost:5173 で、Next.js は http://localhost:3000 で提供されます。
得られるもの
スキャフォールディング後、プロジェクト構造は次のようになります。
my-app/
convex/ # バックエンド関数とスキーマ
_generated/ # 自動生成された型 (git にチェックインしてください)
schema.ts # データベーススキーマ (テンプレートに含まれる場合)
src/ # フロントエンドコード (Next.js の場合は app/)
package.json
.env.local # CONVEX_URL / VITE_CONVEX_URL / NEXT_PUBLIC_CONVEX_URL
テンプレートにはすでに次のものが含まれています。
ConvexProviderがアプリのルートに接続されています。- フレームワークに適した環境変数名。
- Tailwind と shadcn/ui が準備されています (shadcn テンプレートの場合)。
- 認証プロバイダーが設定されています (認証テンプレートの場合)。
スキーマ、関数、UI の追加に進んでください。
パス 2: 既存のアプリに Convex を追加する
ユーザーがすでにフロントエンドプロジェクトを持っており、Convex をバックエンドとして追加したい場合に使用します。
インストール
npm install convex
初期化と開発ループの開始
ユーザーにターミナルで npx convex dev を実行するように依頼してください。これにより、ログイン処理、convex/ ディレクトリの作成、デプロイメント URL の .env.local への書き込み、およびファイルウォッチャーの開始が行われます。エージェントがこれを直接実行すべきではない理由については、パス 1 の注記を参照してください。
プロバイダーを接続する
Convex クライアントは、アプリのルートでアプリをラップする必要があります。セットアップはフレームワークによって異なります。
ConvexReactClient は、コンポーネント内ではなく、モジュールスコープで作成してください。
// 悪い例: レンダリングごとにクライアントを再作成します
function App() {
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
return <ConvexProvider client={convex}>...</ConvexProvider>;
}
// 良い例: モジュールスコープで一度だけ作成されます
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
function App() {
return <ConvexProvider client={convex}>...</ConvexProvider>;
}
React (Vite)
// src/main.tsx
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { ConvexProvider, ConvexReactClient } from "convex/react";
import App from "./App";
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
createRoot(document.getElementById("root")!).render(
<StrictMode>
<ConvexProvider client={convex}>
<App />
</ConvexProvider>
</StrictMode>,
);
Next.js (App Router)
// app/ConvexClientProvider.tsx
"use client";
import { ConvexProvider, ConvexReactClient } from "convex/react";
import { ReactNode } from "react";
const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
export function ConvexClientProvider({ children }: { children: ReactNode }) {
return <ConvexProvider client={convex}>{children}</ConvexProvider>;
} 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Convex Quickstart
Set up a working Convex project as fast as possible.
When to Use
- Starting a brand new project with Convex
- Adding Convex to an existing React, Next.js, Vue, Svelte, or other app
- Scaffolding a Convex app for prototyping
When Not to Use
- The project already has Convex installed and
convex/exists - just start building - You only need to add auth to an existing Convex app - use the
convex-setup-authskill
Workflow
- Determine the starting point: new project or existing app
- If new project, pick a template and scaffold with
npm create convex@latest - If existing app, install
convexand wire up the provider - Run
npx convex devto connect a deployment and start the dev loop - Verify the setup works
Path 1: New Project (Recommended)
Use the official scaffolding tool. It creates a complete project with the frontend framework, Convex backend, and all config wired together.
Pick a template
| Template | Stack |
|---|---|
react-vite-shadcn |
React + Vite + Tailwind + shadcn/ui |
nextjs-shadcn |
Next.js App Router + Tailwind + shadcn/ui |
react-vite-clerk-shadcn |
React + Vite + Clerk auth + shadcn/ui |
nextjs-clerk |
Next.js + Clerk auth |
nextjs-convexauth-shadcn |
Next.js + Convex Auth + shadcn/ui |
nextjs-lucia-shadcn |
Next.js + Lucia auth + shadcn/ui |
bare |
Convex backend only, no frontend |
If the user has not specified a preference, default to react-vite-shadcn for simple apps or nextjs-shadcn for apps that need SSR or API routes.
You can also use any GitHub repo as a template:
npm create convex@latest my-app -- -t owner/repo
npm create convex@latest my-app -- -t owner/repo#branch
Scaffold the project
Always pass the project name and template flag to avoid interactive prompts:
npm create convex@latest my-app -- -t react-vite-shadcn
cd my-app
npm install
The scaffolding tool creates files but does not run npm install, so you must run it yourself.
To scaffold in the current directory (if it is empty):
npm create convex@latest . -- -t react-vite-shadcn
npm install
Start the dev loop
npx convex dev is a long-running watcher process that syncs backend code to a Convex deployment on every save. It also requires authentication on first run (browser-based OAuth). Both of these make it unsuitable for an agent to run directly.
Ask the user to run this themselves:
Tell the user to run npx convex dev in their terminal. On first run it will prompt them to log in or develop anonymously. Once running, it will:
- Create a Convex project and dev deployment
- Write the deployment URL to
.env.local - Create the
convex/directory with generated types - Watch for changes and sync continuously
The user should keep npx convex dev running in the background while you work on code. The watcher will automatically pick up any files you create or edit in convex/.
Exception - cloud or headless agents: Environments that cannot open a browser for interactive login should use Agent Mode (see below) to run anonymously without user interaction.
Start the frontend
The user should also run the frontend dev server in a separate terminal:
npm run dev
Vite apps serve on http://localhost:5173, Next.js on http://localhost:3000.
What you get
After scaffolding, the project structure looks like:
my-app/
convex/ # Backend functions and schema
_generated/ # Auto-generated types (check this into git)
schema.ts # Database schema (if template includes one)
src/ # Frontend code (or app/ for Next.js)
package.json
.env.local # CONVEX_URL / VITE_CONVEX_URL / NEXT_PUBLIC_CONVEX_URL
The template already has:
ConvexProviderwired into the app root- Correct env var names for the framework
- Tailwind and shadcn/ui ready (for shadcn templates)
- Auth provider configured (for auth templates)
Proceed to adding schema, functions, and UI.
Path 2: Add Convex to an Existing App
Use this when the user already has a frontend project and wants to add Convex as the backend.
Install
npm install convex
Initialize and start dev loop
Ask the user to run npx convex dev in their terminal. This handles login, creates the convex/ directory, writes the deployment URL to .env.local, and starts the file watcher. See the notes in Path 1 about why the agent should not run this directly.
Wire up the provider
The Convex client must wrap the app at the root. The setup varies by framework.
Create the ConvexReactClient at module scope, not inside a component:
// Bad: re-creates the client on every render
function App() {
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
return <ConvexProvider client={convex}>...</ConvexProvider>;
}
// Good: created once at module scope
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
function App() {
return <ConvexProvider client={convex}>...</ConvexProvider>;
}
React (Vite)
// src/main.tsx
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { ConvexProvider, ConvexReactClient } from "convex/react";
import App from "./App";
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL as string);
createRoot(document.getElementById("root")!).render(
<StrictMode>
<ConvexProvider client={convex}>
<App />
</ConvexProvider>
</StrictMode>,
);
Next.js (App Router)
// app/ConvexClientProvider.tsx
"use client";
import { ConvexProvider, ConvexReactClient } from "convex/react";
import { ReactNode } from "react";
const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
export function ConvexClientProvider({ children }: { children: ReactNode }) {
return <ConvexProvider client={convex}>{children}</ConvexProvider>;
}
// app/layout.tsx
import { ConvexClientProvider } from "./ConvexClientProvider";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<ConvexClientProvider>{children}</ConvexClientProvider>
</body>
</html>
);
}
Other frameworks
For Vue, Svelte, React Native, TanStack Start, Remix, and others, follow the matching quickstart guide:
Environment variables
The env var name depends on the framework:
| Framework | Variable |
|---|---|
| Vite | VITE_CONVEX_URL |
| Next.js | NEXT_PUBLIC_CONVEX_URL |
| Remix | CONVEX_URL |
| React Native | EXPO_PUBLIC_CONVEX_URL |
npx convex dev writes the correct variable to .env.local automatically.
Agent Mode (Cloud and Headless Agents)
When running in a cloud or headless agent environment where interactive browser login is not possible, set CONVEX_AGENT_MODE=anonymous to use a local anonymous deployment.
Add CONVEX_AGENT_MODE=anonymous to .env.local, or set it inline:
CONVEX_AGENT_MODE=anonymous npx convex dev
This runs a local Convex backend on the VM without requiring authentication, and avoids conflicting with the user's personal dev deployment.
Verify the Setup
After setup, confirm everything is working:
- The user confirms
npx convex devis running without errors - The
convex/_generated/directory exists and hasapi.tsandserver.ts .env.localcontains the deployment URL
Writing Your First Function
Once the project is set up, create a schema and a query to verify the full loop works.
convex/schema.ts:
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
export default defineSchema({
tasks: defineTable({
text: v.string(),
completed: v.boolean(),
}),
});
convex/tasks.ts:
import { query, mutation } from "./_generated/server";
import { v } from "convex/values";
export const list = query({
args: {},
handler: async (ctx) => {
return await ctx.db.query("tasks").collect();
},
});
export const create = mutation({
args: { text: v.string() },
handler: async (ctx, args) => {
await ctx.db.insert("tasks", { text: args.text, completed: false });
},
});
Use in a React component (adjust the import path based on your file location relative to convex/):
import { useQuery, useMutation } from "convex/react";
import { api } from "../convex/_generated/api";
function Tasks() {
const tasks = useQuery(api.tasks.list);
const create = useMutation(api.tasks.create);
return (
<div>
<button onClick={() => create({ text: "New task" })}>Add</button>
{tasks?.map((t) => <div key={t._id}>{t.text}</div>)}
</div>
);
}
Development vs Production
Always use npx convex dev during development. It runs against your personal dev deployment and syncs code on save.
When ready to ship, deploy to production:
npx convex deploy
This pushes to the production deployment, which is separate from dev. Do not use deploy during development.
Next Steps
- Add authentication: use the
convex-setup-authskill - Design your schema: see Schema docs
- Build components: use the
convex-create-componentskill - Plan a migration: use the
convex-migration-helperskill - Add file storage: see File Storage docs
- Set up cron jobs: see Scheduling docs
Checklist
- [ ] Determined starting point: new project or existing app
- [ ] If new project: scaffolded with
npm create convex@latestusing appropriate template - [ ] If existing app: installed
convexand wired up the provider - [ ] User has
npx convex devrunning and connected to a deployment - [ ]
convex/_generated/directory exists with types - [ ]
.env.localhas the deployment URL - [ ] Verified a basic query/mutation round-trip works
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (10,883 bytes)
- 📎 assets/icon.svg (435 bytes)