bknd-crud-create_skill

This skill helps you create records in Bknd using SDK or REST, including relations, responses, errors, and bulk operations.

2

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill cameronapak/bknd-skills --skill bknd-crud-create

  • SKILL.md12.6 KB

Overview

This skill explains how to insert new records into a Bknd entity using the SDK or REST API. It covers createOne, createMany, creating relations with $set, response and error handling, and common client-side patterns for reliable record creation. Use it to add single or bulk records, link relations, and integrate creation into apps.

How this skill works

The SDK exposes api.data.createOne and api.data.createMany to insert records; each call returns an object with ok, data, and error fields. Relations are linked at create time using objects with a $set key (e.g., author: { $set: id } or tags: { $set: [ids] }). The REST API mirrors the SDK with POST requests to /api/data/:entity. Always check ok before using data and handle validation, unique, and foreign key errors.

When to use it

  • Create a single record from a form submission in a web app
  • Insert many records at once for imports or seed data
  • Link newly created records to existing related records (many-to-one or many-to-many)
  • Automate record creation in background jobs or integrations
  • Manual entry and quick tests via the admin UI

Best practices

  • Always check the response ok field and handle error.message when ok is false
  • Authenticate or set a token before creating protected records
  • Verify related record IDs exist before using $set to avoid foreign key errors
  • Use createMany for bulk inserts and batch large imports to control memory and progress
  • Apply optimistic UI or SWR mutate to keep client lists responsive and revalidated

Example use cases

  • Create a post and link it to an existing author using author: { $set: userId }
  • Bulk-create tag records with createMany during onboarding or migrations
  • Form submission that creates a record, clears inputs, and shows API validation errors
  • Optimistic UI flow: insert temporary item client-side, replace or remove it after createOne response
  • Batch import products with progress reporting and retry on failures

FAQ

It returns ok (boolean), data (created record with defaults applied) when ok is true, and error with message/code when ok is false.

How do I link relations when creating?

Use a $set object on the relation field, e.g. author: { $set: authorId } or tags: { $set: [tagId1, tagId2] }.

How should I handle unique constraint failures?

Either check existence before creating or catch the error and map UNIQUE messages to a user-friendly response.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational