Snippet library

Save, organize, version, and share SQL queries and code snippets across your workspace.

Last updated

The snippet library is Cocobox’s persistent home for the SQL (and code) you write. Every query you’d otherwise paste into a Slack thread or a personal text file belongs here instead.

Save a snippet

In the editor, hit Cmd/Ctrl + S or click Save. Cocobox prompts for:

  • Name — short, descriptive. Searchable.
  • Folder — pick or create. Folders nest.
  • Tags — comma-separated. dashboards, onboarding, prod-only, etc.
  • Visibility — private, workspace, or link (anyone with the URL).

Subsequent saves update the existing snippet. Cmd/Ctrl + Shift + S forks (saves a copy).

Organization

  • Folders for high-level grouping.
  • Tags for cross-cutting concerns. A snippet can live in Reports/Q2 and also be tagged revenue and internal.
  • Pinned — pin frequently-used snippets to the top of the sidebar.
  • Recent — last 20 you opened, regardless of folder.

Cmd/Ctrl + K opens the global search. Searches:

  • Snippet names
  • Tags
  • Statement bodies (full-text)
  • Folder paths

Filter with prefixes:

  • tag:revenue — only snippets tagged revenue.
  • connection:prod-readonly — bound to a specific connection.
  • author:ada@example.com — written by a specific person.
  • updated:7d — updated in the last 7 days.

Versions

Every save creates a new version. Open the snippet → History → see the diff between any two versions. Revert with one click. Versions are kept for the lifetime of the snippet (or until you explicitly purge them).

Sharing

Visibility levels:

  • Private — only the author. Default for new snippets.
  • Workspace — every member of the workspace can read; only the author and admin can edit.
  • Link — anyone with the URL can read. Snippets shared this way are read-only and never executable; they’re a presentation surface, not a connection-leakage surface.

To execute a snippet, the viewer still needs an active role on its connection. Sharing a snippet does not share access to the underlying database.

Bound to a connection

A snippet can be bound to a specific connection. When opened, it auto-selects that connection — no risk of running prod queries against staging by accident. Workspace admins can require this binding for run-role users.

Export

  • Single snippet — download as .sql, .json, or copy to clipboard.
  • Folder — download as a .zip of .sql files.
  • Workspace — full export available from Settings → Workspace → Export.