Tools Reference
Tools: Code Generation
Code generation tools scaffold backend apps, models, serializers, viewsets, routes, and more inside a backend project.
All code generation tools accept a project_id argument to target a specific project.
zeeb_create_app
Create a new app inside an existing project.
zeeb_create_app(name: str, project_id: str) → str
Arguments:
| Name | Type | Description |
|---|---|---|
name | string | App name in snake_case (e.g. blog, payments) |
project_id | string | UUID of the target project |
Example prompt: "Add a blog app to my project"
zeeb_create_model
Generate a data model and add it to the app's data models.
zeeb_create_model(app, name, fields, table_name?, ordering?, timestamps?, meta?, project_id) → str
Arguments:
| Name | Type | Description |
|---|---|---|
app | string | App name (e.g. blog) |
name | string | Model class name (e.g. Post) |
fields | list[dict] | List of field definitions (see below) |
table_name | string? | Override database table name |
ordering | list[str]? | Default ordering (e.g. ["-created_at"]) |
timestamps | bool | Auto-add created_at / updated_at (default: true) |
meta | dict? | Extra Meta options: unique_together, indexes, constraints, abstract, verbose_name, and more |
project_id | string | UUID of the target project |
Field definition keys:
| Key | Required | Description |
|---|---|---|
name | ✅ | Field name |
type | ✅ | string, text, int, bigint, float, decimal, bool, date, datetime, json, uuid, email, slug, url, foreignkey, manytomany |
max_length | — | For string/email/slug/url fields |
null | — | Allow null values |
blank | — | Allow blank in forms |
default | — | Default value |
unique | — | Add unique constraint |
index | — | Add database index |
related | — | Related model name (for foreignkey/manytomany) |
on_delete | — | CASCADE, SET_NULL, PROTECT |
choices | — | Enumerated choices for the field |
help_text | — | Human-readable help text |
raw | — | Escape hatch: emit this exact field declaration verbatim |
Example prompt: "Create a Post model in the blog app with title (string), body (text), and author (foreignkey to User)"
zeeb_create_user_model
Generate a custom user model based on the framework's base user model and register it as the project's user model. Must run before the first migration of the project.
zeeb_create_user_model(app, model_name?, extra_fields?, set_auth_user_model?, project_id) → str
Arguments:
| Name | Type | Description |
|---|---|---|
app | string | App that will own the user model |
model_name | string | Class name (default: User) |
extra_fields | list[dict]? | Additional field definitions (same keys as zeeb_create_model) |
set_auth_user_model | bool | Register the new model as the project's user model (default: true) |
project_id | string | UUID of the target project |
Example prompt: "Create a custom User model in the accounts app with a phone_number field"
zeeb_create_serializer
Generate a serializer and add it to the app's serializers.
zeeb_create_serializer(app, model, name?, fields, read_only_fields?, extra_fields?, validate_fields?, project_id) → str
| Argument | Description |
|---|---|
extra_fields | Declared fields such as SerializerMethodField or nested serializers, with get_* method stubs generated |
validate_fields | Field names to generate validate_<field> method stubs for |
zeeb_create_viewset
Generate a full-CRUD resource endpoint and register it in the app's routes.
zeeb_create_viewset(app, model, name?, serializer?, permissions?, prefix?, read_only?, lookup_field?, pagination?, throttles?, search_fields?, ordering_fields?, filterset?, authentication?, project_id) → str
| Argument | Description |
|---|---|
permissions | Permission classes — one or more entries, combined with AND (default: IsAuthenticatedOrReadOnly). Each entry is a built-in, a class created with zeeb_create_permission_class, or apps.<app>.permissions.<Class>; imports are wired automatically |
prefix | URL prefix for the router (default: pluralized lowercase model name, e.g. Company → companies) |
read_only | Generate a read-only resource endpoint (list/retrieve only) |
lookup_field | Detail-route lookup field (default: pk, e.g. slug) |
pagination | Pagination style: page, limit_offset, or cursor |
throttles | Throttle class names to apply to the viewset |
search_fields | Fields for ?search= full-text lookups |
ordering_fields | Fields allowed in ?ordering= |
filterset | FilterSet class to attach (see zeeb_create_filterset) |
authentication | Authentication classes — optional override of the project-wide default, tried in order (first scheme that recognizes the credentials wins). Omit to keep the global scheme wired by zeeb_setup_auth |
zeeb_create_filterset
Generate a FilterSet class in apps/<app>/filters.py for query-parameter filtering. Attach it to a viewset via the filterset argument of zeeb_create_viewset or zeeb_update_viewset.
zeeb_create_filterset(app, model, filter_fields, project_id) → str
Arguments:
| Name | Type | Description |
|---|---|---|
app | string | App name |
model | string | Model the FilterSet targets |
filter_fields | dict | Field → lookup list, e.g. {"status": ["exact", "in"], "price": ["gte", "lte"]} |
project_id | string | UUID of the target project |
Example prompt: "Add filtering to products so I can filter by status and price range"
zeeb_create_action
Add a custom @action to an existing viewset.
zeeb_create_action(app, viewset, name, detail?, methods?, url_path?, description?, body?, permissions?, project_id) → str
| Argument | Description |
|---|---|
detail | true for a per-object route (/{id}/<name>), false for a collection route (default: true) |
methods | HTTP methods (default: ["post"]) |
body | The action's implementation as Python source — pass the real logic here instead of editing views.py |
permissions | Permission classes for this action only (same forms as zeeb_create_viewset, ANDed). Omit to inherit the viewset's permissions |
zeeb_create_route
Add a standalone HTTP endpoint (non-CRUD) and wire it into routing.
zeeb_create_route(app, path, method?, name?, description?, request_schema?, response_model?, body?, imports?, project_id) → str
| Argument | Description |
|---|---|
path | URL path (e.g. /webhook/stripe, /search) |
method | HTTP method (default: get) |
body | The handler implementation as Python source — without it a TODO stub is generated |
imports | Extra import lines the handler body needs |
request_schema / response_model | Schema model names for request validation / response serialization |
zeeb_generate_crud
Generate a complete CRUD stack in one call: model + serializer + resource endpoint + route registration.
zeeb_generate_crud(app, model, fields, project_id, ...) → str
Forwards all options of the underlying tools: meta and the extended field spec keys (choices, help_text, raw) from zeeb_create_model, extra_fields / validate_fields from zeeb_create_serializer, and permissions, read_only, lookup_field, pagination, throttles, search_fields, ordering_fields, filterset, authentication from zeeb_create_viewset.
Example prompt: "Generate full CRUD for a Product model with name (string), price (decimal), and stock (int)"
zeeb_update_model
Replace an existing model's field list. fields is the complete new set of
fields — the model is regenerated from it. For incremental changes use
zeeb_add_field / zeeb_remove_field instead.
zeeb_update_model(app, name, fields, table_name?, ordering?, timestamps?, project_id) → str
zeeb_create_permission_class
Generate a custom permission class and write it to permissions.py. Attach it
to an endpoint via zeeb_create_viewset(permissions=[...]) or
zeeb_update_viewset(permissions=[...]).
zeeb_create_permission_class(app, class_name, logic?, project_id) → str
| Argument | Description |
|---|---|
logic | Preset behavior: deny_all (default), allow_all, owner_only, staff_only, or authenticated |
zeeb_update_serializer
Update an existing serializer's exposed or read-only field lists.
zeeb_update_serializer(app, model, fields?, read_only_fields?, project_id) → str
zeeb_update_viewset
Update options on an existing model's viewset in place — without regenerating it. Custom @action methods are preserved.
zeeb_update_viewset(app, model, permissions?, lookup_field?, pagination?, throttles?, search_fields?, ordering_fields?, authentication?, project_id) → str
Arguments:
| Name | Type | Description |
|---|---|---|
app | string | App name |
model | string | Model whose viewset to update |
permissions | list[str]? | Replace the permission classes (one or more entries, combined with AND) |
lookup_field | string? | Change the detail-route lookup field |
pagination | string? | page, limit_offset, or cursor |
throttles | list[str]? | Throttle classes to apply |
search_fields | list[str]? | Fields for ?search= lookups |
ordering_fields | list[str]? | Fields allowed in ?ordering= |
authentication | list[str]? | Set or replace the authentication classes (tried in order; omit to leave unchanged) |
project_id | string | UUID of the target project |
Example prompt: "Switch the Product viewset to cursor pagination and make it searchable by name"
zeeb_create_signal_receiver
Create a model lifecycle hook for model events (post_save, pre_delete, etc.).
zeeb_create_signal_receiver(app, signal_name, model_name, function_name, project_id) → str
| Argument | Description |
|---|---|
signal_name | Model event: pre_save, post_save, pre_delete, or post_delete |
model_name | Model the receiver listens on |
function_name | Name for the generated receiver function stub |
Notes
- All code generation writes directly to the project workspace; every project-scoped tool call commits and pushes automatically.
- Use
zeeb_get_project_structureto inspect the current layout before generating. - Use
zeeb_list_appsto see all apps in a project. - Auth and project-wide API configuration (JWT auth, OAuth providers, throttling, versioning) is covered in Auth & API Configuration.