Skip to content

Commit cbc0ed4

Browse files
fix formatting errors
1 parent 56481a7 commit cbc0ed4

46 files changed

Lines changed: 517 additions & 492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/convex-create-component/SKILL.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,35 @@ A minimal local component with a table and two functions, plus the app wiring.
6666

6767
```ts
6868
// convex/components/notifications/convex.config.ts
69-
import { defineComponent } from "convex/server";
69+
import { defineComponent } from 'convex/server';
7070

71-
export default defineComponent("notifications");
71+
export default defineComponent('notifications');
7272
```
7373

7474
```ts
7575
// convex/components/notifications/schema.ts
76-
import { defineSchema, defineTable } from "convex/server";
77-
import { v } from "convex/values";
76+
import { defineSchema, defineTable } from 'convex/server';
77+
import { v } from 'convex/values';
7878

7979
export default defineSchema({
8080
notifications: defineTable({
8181
userId: v.string(),
8282
message: v.string(),
8383
read: v.boolean(),
84-
}).index("by_user", ["userId"]),
84+
}).index('by_user', ['userId']),
8585
});
8686
```
8787

8888
```ts
8989
// convex/components/notifications/lib.ts
90-
import { v } from "convex/values";
91-
import { mutation, query } from "./_generated/server.js";
90+
import { v } from 'convex/values';
91+
import { mutation, query } from './_generated/server.js';
9292

9393
export const send = mutation({
9494
args: { userId: v.string(), message: v.string() },
95-
returns: v.id("notifications"),
95+
returns: v.id('notifications'),
9696
handler: async (ctx, args) => {
97-
return await ctx.db.insert("notifications", {
97+
return await ctx.db.insert('notifications', {
9898
userId: args.userId,
9999
message: args.message,
100100
read: false,
@@ -106,7 +106,7 @@ export const listUnread = query({
106106
args: { userId: v.string() },
107107
returns: v.array(
108108
v.object({
109-
_id: v.id("notifications"),
109+
_id: v.id('notifications'),
110110
_creationTime: v.number(),
111111
userId: v.string(),
112112
message: v.string(),
@@ -115,18 +115,18 @@ export const listUnread = query({
115115
),
116116
handler: async (ctx, args) => {
117117
return await ctx.db
118-
.query("notifications")
119-
.withIndex("by_user", (q) => q.eq("userId", args.userId))
120-
.filter((q) => q.eq(q.field("read"), false))
118+
.query('notifications')
119+
.withIndex('by_user', (q) => q.eq('userId', args.userId))
120+
.filter((q) => q.eq(q.field('read'), false))
121121
.collect();
122122
},
123123
});
124124
```
125125

126126
```ts
127127
// convex/convex.config.ts
128-
import { defineApp } from "convex/server";
129-
import notifications from "./components/notifications/convex.config.js";
128+
import { defineApp } from 'convex/server';
129+
import notifications from './components/notifications/convex.config.js';
130130

131131
const app = defineApp();
132132
app.use(notifications);
@@ -136,17 +136,17 @@ export default app;
136136

137137
```ts
138138
// convex/notifications.ts (app-side wrapper)
139-
import { v } from "convex/values";
140-
import { mutation, query } from "./_generated/server";
141-
import { components } from "./_generated/api";
142-
import { getAuthUserId } from "@convex-dev/auth/server";
139+
import { v } from 'convex/values';
140+
import { mutation, query } from './_generated/server';
141+
import { components } from './_generated/api';
142+
import { getAuthUserId } from '@convex-dev/auth/server';
143143

144144
export const sendNotification = mutation({
145145
args: { message: v.string() },
146146
returns: v.null(),
147147
handler: async (ctx, args) => {
148148
const userId = await getAuthUserId(ctx);
149-
if (!userId) throw new Error("Not authenticated");
149+
if (!userId) throw new Error('Not authenticated');
150150

151151
await ctx.runMutation(components.notifications.lib.send, {
152152
userId,
@@ -160,7 +160,7 @@ export const myUnread = query({
160160
args: {},
161161
handler: async (ctx) => {
162162
const userId = await getAuthUserId(ctx);
163-
if (!userId) throw new Error("Not authenticated");
163+
if (!userId) throw new Error('Not authenticated');
164164

165165
return await ctx.runQuery(components.notifications.lib.listUnread, {
166166
userId,
@@ -196,7 +196,7 @@ const apiKey = process.env.OPENAI_API_KEY;
196196
```ts
197197
// Good: the app resolves auth and env, then passes explicit values
198198
const userId = await getAuthUserId(ctx);
199-
if (!userId) throw new Error("Not authenticated");
199+
if (!userId) throw new Error('Not authenticated');
200200

201201
await ctx.runAction(components.translator.translate, {
202202
userId,
@@ -219,7 +219,7 @@ export const sendNotification = mutation({
219219
returns: v.null(),
220220
handler: async (ctx, args) => {
221221
const userId = await getAuthUserId(ctx);
222-
if (!userId) throw new Error("Not authenticated");
222+
if (!userId) throw new Error('Not authenticated');
223223

224224
await ctx.runMutation(components.notifications.lib.send, {
225225
userId,
@@ -235,7 +235,7 @@ export const sendNotification = mutation({
235235
```ts
236236
// Bad: parent app table IDs are not valid component validators
237237
args: {
238-
userId: v.id("users");
238+
userId: v.id('users');
239239
}
240240
```
241241

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
interface:
2-
display_name: "Convex Create Component"
3-
short_description: "Design and build reusable Convex components with clear boundaries."
4-
icon_small: "./assets/icon.svg"
5-
icon_large: "./assets/icon.svg"
6-
brand_color: "#14B8A6"
7-
default_prompt: "Help me create a Convex component for this feature. First check that a component is actually justified, then design the tables, API surface, and app-facing wrappers before implementing it."
2+
display_name: 'Convex Create Component'
3+
short_description: 'Design and build reusable Convex components with clear boundaries.'
4+
icon_small: './assets/icon.svg'
5+
icon_large: './assets/icon.svg'
6+
brand_color: '#14B8A6'
7+
default_prompt: 'Help me create a Convex component for this feature. First check that a component is actually justified, then design the tables, API surface, and app-facing wrappers before implementing it.'
88

99
policy:
1010
allow_implicit_invocation: true

.agents/skills/convex-create-component/references/advanced-patterns.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ When the app needs to pass a callback function to the component, use function ha
88

99
```ts
1010
// App side: create a handle and pass it to the component
11-
import { createFunctionHandle } from "convex/server";
11+
import { createFunctionHandle } from 'convex/server';
1212

1313
export const startJob = mutation({
1414
handler: async (ctx) => {
@@ -22,14 +22,14 @@ export const startJob = mutation({
2222

2323
```ts
2424
// Component side: accept and invoke the handle
25-
import { v } from "convex/values";
26-
import type { FunctionHandle } from "convex/server";
27-
import { mutation } from "./_generated/server.js";
25+
import { v } from 'convex/values';
26+
import type { FunctionHandle } from 'convex/server';
27+
import { mutation } from './_generated/server.js';
2828

2929
export const enqueue = mutation({
3030
args: { callback: v.string() },
3131
handler: async (ctx, args) => {
32-
const handle = args.callback as FunctionHandle<"mutation">;
32+
const handle = args.callback as FunctionHandle<'mutation'>;
3333
await ctx.scheduler.runAfter(0, handle, {});
3434
},
3535
});
@@ -40,19 +40,19 @@ export const enqueue = mutation({
4040
Instead of manually repeating field types in return validators, extend the schema validator:
4141

4242
```ts
43-
import { v } from "convex/values";
44-
import schema from "./schema.js";
43+
import { v } from 'convex/values';
44+
import schema from './schema.js';
4545

4646
const notificationDoc = schema.tables.notifications.validator.extend({
47-
_id: v.id("notifications"),
47+
_id: v.id('notifications'),
4848
_creationTime: v.number(),
4949
});
5050

5151
export const getLatest = query({
5252
args: {},
5353
returns: v.nullable(notificationDoc),
5454
handler: async (ctx) => {
55-
return await ctx.db.query("notifications").order("desc").first();
55+
return await ctx.db.query('notifications').order('desc').first();
5656
},
5757
});
5858
```
@@ -78,11 +78,11 @@ export const configure = mutation({
7878
args: { maxRetries: v.number(), webhookUrl: v.optional(v.string()) },
7979
returns: v.null(),
8080
handler: async (ctx, args) => {
81-
const existing = await ctx.db.query("globals").first();
81+
const existing = await ctx.db.query('globals').first();
8282
if (existing) {
8383
await ctx.db.patch(existing._id, args);
8484
} else {
85-
await ctx.db.insert("globals", args);
85+
await ctx.db.insert('globals', args);
8686
}
8787
return null;
8888
},
@@ -95,10 +95,10 @@ For components with many functions or configuration options, a class-based clien
9595

9696
```ts
9797
// src/client/index.ts
98-
import type { GenericMutationCtx, GenericDataModel } from "convex/server";
99-
import type { ComponentApi } from "../component/_generated/component.js";
98+
import type { GenericMutationCtx, GenericDataModel } from 'convex/server';
99+
import type { ComponentApi } from '../component/_generated/component.js';
100100

101-
type MutationCtx = Pick<GenericMutationCtx<GenericDataModel>, "runMutation">;
101+
type MutationCtx = Pick<GenericMutationCtx<GenericDataModel>, 'runMutation'>;
102102

103103
export class Notifications {
104104
constructor(
@@ -109,19 +109,19 @@ export class Notifications {
109109
async send(ctx: MutationCtx, args: { userId: string; message: string }) {
110110
return await ctx.runMutation(this.component.lib.send, {
111111
...args,
112-
channel: this.options?.defaultChannel ?? "default",
112+
channel: this.options?.defaultChannel ?? 'default',
113113
});
114114
}
115115
}
116116
```
117117

118118
```ts
119119
// App usage
120-
import { Notifications } from "@convex-dev/notifications";
121-
import { components } from "./_generated/api";
120+
import { Notifications } from '@convex-dev/notifications';
121+
import { components } from './_generated/api';
122122

123123
const notifications = new Notifications(components.notifications, {
124-
defaultChannel: "alerts",
124+
defaultChannel: 'alerts',
125125
});
126126

127127
export const send = mutation({

.agents/skills/convex-migration-helper/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ users: defineTable({
6868

6969
```typescript
7070
posts: defineTable({
71-
userId: v.id("users"),
71+
userId: v.id('users'),
7272
title: v.string(),
73-
}).index("by_user", ["userId"]);
73+
}).index('by_user', ['userId']);
7474
```
7575

7676
### Adding Index
@@ -79,7 +79,7 @@ posts: defineTable({
7979
users: defineTable({
8080
name: v.string(),
8181
email: v.string(),
82-
}).index("by_email", ["email"]);
82+
}).index('by_email', ['email']);
8383
```
8484

8585
## Breaking Changes: The Deployment Workflow
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
interface:
2-
display_name: "Convex Migration Helper"
3-
short_description: "Plan and run safe Convex schema and data migrations."
4-
icon_small: "./assets/icon.svg"
5-
icon_large: "./assets/icon.svg"
6-
brand_color: "#8B5CF6"
7-
default_prompt: "Help me plan and execute this Convex migration safely. Start by identifying the schema change, the existing data shape, and the widen-migrate-narrow path before making edits."
2+
display_name: 'Convex Migration Helper'
3+
short_description: 'Plan and run safe Convex schema and data migrations.'
4+
icon_small: './assets/icon.svg'
5+
icon_large: './assets/icon.svg'
6+
brand_color: '#8B5CF6'
7+
default_prompt: 'Help me plan and execute this Convex migration safely. Start by identifying the schema change, the existing data shape, and the widen-migrate-narrow path before making edits.'
88

99
policy:
1010
allow_implicit_invocation: true

0 commit comments

Comments
 (0)