Skip to content

Commit 49658d8

Browse files
committed
new llm rules
1 parent c56b295 commit 49658d8

File tree

2 files changed

+500
-147
lines changed

2 files changed

+500
-147
lines changed

instructions/convex_rules.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
## description:
2-
Guidelines and best practices for building Convex projects, including database schema design, queries, mutations, and real-world examples
3-
4-
51
# Convex guidelines
62
## Function guidelines
73
### New function syntax
@@ -94,7 +90,7 @@ Convex Type | TS/JS type | Example Usage | Validator for argument val
9490
| Boolean | boolean | `true` | `v.boolean()` |
9591
| String | string | `"abc"` | `v.string()` | Strings are stored as UTF-8 and must be valid Unicode sequences. Strings must be smaller than the 1MB total size limit when encoded as UTF-8. |
9692
| Bytes | ArrayBuffer | `new ArrayBuffer(8)` | `v.bytes()` | Convex supports first class bytestrings, passed in as `ArrayBuffer`s. Bytestrings must be smaller than the 1MB total size limit for Convex types. |
97-
| Array | Array] | `[1, 3.2, "abc"]` | `v.array(values)` | Arrays can have at most 8192 values. |
93+
| Array | Array | `[1, 3.2, "abc"]` | `v.array(values)` | Arrays can have at most 8192 values. |
9894
| Object | Object | `{a: "abc"}` | `v.object({property: value})` | Convex only supports "plain old JavaScript objects" (objects that do not have a custom prototype). Objects can have at most 1024 entries. Field names must be nonempty and not start with "$" or "_". |
9995
| Record | Record | `{"a": "1", "b": "2"}` | `v.record(keys, values)` | Records are objects at runtime, but can have dynamic keys. Keys must be only ASCII characters, nonempty, and not start with "$" or "_". |
10096

@@ -289,8 +285,9 @@ export default crons;
289285
- The `ctx.storage.getUrl()` method returns a signed URL for a given file. It returns `null` if the file doesn't exist.
290286
- Do NOT use the deprecated `ctx.storage.getMetadata` call for loading a file's metadata.
291287

292-
Instead, query the `_storage` system table. For example, you can use `ctx.db.system.get` to get an `Id<"_storage">`.
293-
```
288+
Instead, query the `_storage` system table. For example, you can use `ctx.db.system.get` to get an `Id<"_storage">`.
289+
290+
```ts
294291
import { query } from "./_generated/server";
295292
import { Id } from "./_generated/dataModel";
296293

@@ -409,10 +406,10 @@ Internal Functions:
409406
4. Schema Design:
410407
- users
411408
- validator: { name: v.string() }
412-
- indexes: <none>
409+
- indexes: \<none>
413410
- channels
414411
- validator: { name: v.string() }
415-
- indexes: <none>
412+
- indexes: \<none>
416413
- messages
417414
- validator: { channelId: v.id("channels"), authorId: v.optional(v.id("users")), content: v.string() }
418415
- indexes
@@ -422,8 +419,6 @@ Internal Functions:
422419
- AI response generation runs asynchronously after each user message
423420
- Uses OpenAI's GPT-4 to generate contextual responses
424421
- Maintains conversation context using recent message history
425-
426-
427422
### Implementation
428423

429424
#### package.json

0 commit comments

Comments
 (0)