Databricks apps

From databricks/databricks-agent-skills · View interactive version

Databricks apps is an AI agent skill from the GitHub repository databricks/databricks-agent-skills. Build apps on Databricks Apps platform. Use when asked to create data apps, analytics tools, or custom interactive visualizations. A plain \"create a dashboard\" request means a managed AI/BI (Lakeview) dashboard → use databricks-aibi-dashboards, not this skill. Evaluates data access patterns (analy

How to use this skill

Skill file

Databricks Apps Development

FIRST: Use the parent databricks-core skill for CLI basics, authentication, and profile selection.

Package manager — resolve this before any install or command below:

Databricks Apps officially supports npm and pnpm only.

  1. Detect the project's manager, in priority order: project instructions → package.json's packageManager field → lockfile (pnpm-lock.yaml → pnpm, package-lock.json → npm).
  2. If signals conflict, or if an unsupported manager (yarn, bun, etc.) is detected, stop and ask the user which manager to use before proceeding.
  3. Only if none is established, default to pnpm.

Throughout this skill and its guides, substitute what you resolved:

<pm> is a documentation placeholder, not a shell variable — expand it, don't type it.

Is this even a Databricks App? Don't assume an app is the only way to show data. For a simple "dashboard with a few charts" and no app-specific need, the managed AI/BI (Lakeview) dashboard is the simpler path → use the databricks-aibi-dashboards skill, not this one. Reach for a custom Databricks App only when the user needs something AI/BI can't give them — bespoke interactivity/components, write-back, embedded or auth-gated workflows, a Genie/chat surface inside the app — or explicitly asks for an app. If it's genuinely ambiguous, surface both options (managed AI/BI dashboard vs custom app) and let the user choose instead of defaulting to an app. Once an app is the right call, it's fine for this skill to favor an app-based dashboard, and databricks-app-design covers building it well.

For data UI design (required for any data-displaying app): once you've confirmed the user wants a custom-code app (not a managed AI/BI dashboard — see above), if the app shows ANY data — a KPI/overview page, report, chart, table, query results, OR a conversational / chat / Genie natural-language assistant — you MUST use the databricks-app-design skill (alongside this one) to decide layout, charts, KPIs, semantic color, required states, and AI-result trust, and map them to AppKit components. This includes chat/Genie apps, not just static data views — if in doubt, use it.

Build apps that deploy to Databricks Apps platform.

Required Reading by Phase

| Phase | READ BEFORE proceeding |

|-------|------------------------|

| Scaffolding | ⚠️ STOP — review the State Storage Guidance and complete the Data Access Decision Gate below before scaffolding. Parent databricks-core skill (auth, warehouse discovery); then run databricks apps manifest + databricks apps init with --features and --set (see AppKit section below) |

| Writing SQL queries | SQL Queries Guide |

| Writing UI components | Frontend Guide |

| Using useAnalyticsQuery | AppKit SDK |

| Querying a governed UC Metric View | Metric Views Guide |

| Adding API endpoints | Custom Endpoints Guide |

| Using Lakebase (OLTP database) | Lakebase Guide |

| Adding Genie chat / Genie-powered apps | Genie Guide — follow the Genie agent workflow below |

| Using Model Serving (ML inference) | Model Serving Guide |

| Generating or editing images (text-to-image, image-to-image) | Image Generation Guide |

| Hosting an AI agent (tool-using chatbot, beta) | Agents Guide — import from @databricks/appkit/beta |

| Typed data contracts (proto-first design) | Proto-First Guide and Plugin Contracts |

| Managing files in UC Volumes | Files Guide |

| Triggering / monitoring Lakeflow Jobs from the app | Jobs Guide |

| Platform rules (permissions, deployment, limits) | Platform Guide — READ for ALL apps including AppKit |

| Non-AppKit app (Streamlit, FastAPI, Flask, Gradio, Next.js, etc.) | Other Frameworks |

Generic Guidelines

Project Structure (after `databricks apps init --features analytics`)

Project Structure (after `databricks apps init --features lakebase`)

Data Discovery

Before writing any SQL, use the parent databricks-core skill for data exploration — search information_schema by keyword, then batch discover-schema for the tables you need. Do NOT skip this step.

State Storage Guidance (evaluate BEFORE the Decision Gate):

If the user's app description involves storing or persisting data — forms, CRUD operations, user submissions, orders, todos, or other user-generated content — the app likely needs a Lakebase database.

  1. Ask the user whether the app needs persistent storage (Lakebase) before scaffolding. Do not silently add Lakebase.
  2. If confirmed, ask whether to reuse an existing Lakebase project or create a new one (same as the Genie flow below) — never create one silently. Use the databricks-lakebase skill to obtain the branch and database resource names:
  1. Scaffold with --features lakebase and pass --set lakebase.postgres.branch=<BRANCH_NAME> --set lakebase.postgres.database=<DATABASE_NAME>.
  2. If the app also reads from Unity Catalog tables, proceed to the Data Access Decision Gate below to determine whether to add --features analytics or use Lakebase synced tables.

Do NOT add Lakebase to analytics, dashboard, or visualization apps unless the user explicitly requests persistent write-back storage. Read-only data display, filters, and preferences do not require a database.

Development Workflow (FOLLOW THIS ORDER)

Data Access Decision Gate (REQUIRED before scaffolding):

If the app reads from Unity Catalog / lakehouse tables, you MUST show the comparison below to the user and ask them to choose. Do not skip this. Do not choose for them.

| | (A) Lakebase synced tables | (B) Analytics |

|--|---|---|

| Speed | Sub-second responses | Takes a few seconds |

| Best for | Full-text search, typeahead, autocomplete, real-time lookups, operational apps | Dashboards, charts, aggregations, KPIs, filtered queries, browsing |

| How it works | Data synced from Delta into Lakebase Postgres | Queries run on SQL warehouse at read time |

After showing the table, add a brief recommendation. Default to recommending Analytics (B) for most read-only apps — dashboards, charts, filtered queries, browsing, and aggregations. Recommend Lakebase synced tables (A) only when the app needs sub-second latency for full-text search, typeahead/autocomplete, real-time lookups by ID, or operational data serving. Note: "search" or "filter" in a prompt usually means SQL WHERE clauses (Analytics), not full-text search (Lakebase). Always let the user make the final call.

After the user chooses:

Analytics apps (--features analytics):

  1. Create SQL files in config/queries/
  2. Run <pm> run typegen — verify all queries show ✓
  3. Read client/src/appKitTypes.d.ts to see generated types
  4. THEN write App.tsx using the generated types
  5. Update tests/smoke.spec.ts selectors
  6. Run databricks apps validate --profile <PROFILE>

DO NOT write UI code before running typegen — types won't exist and you'll waste time on compilation errors.

Lakebase apps (--features lakebase): No SQL files or typegen. See Lakebase Guide for the onPluginsReady pattern: initialize schema at startup, register Express routes in server/server.ts, then build the React frontend.

When to Use What

After completing the decision gate above, use this routing table:

Frameworks

AppKit (Recommended)

TypeScript/React framework with type-safe SQL queries and built-in components.

Official Documentation — the source of truth for all API details. Use the project-local appkit CLI from the installed @databricks/appkit package:

npx @databricks/appkit docs                            # ← ALWAYS start here to see available pages
npx @databricks/appkit docs <query>                    # view a section by name or doc path
npx @databricks/appkit docs --full                     # full index with all API entries
npx @databricks/appkit docs "appkit-ui API reference"   # example: section by name
npx @databricks/appkit docs ./docs/plugins/analytics.md  # example: specific doc file

DO NOT guess doc paths. Run without args first, pick from the index. The <query> argument accepts both section names (from the index) and file paths. Docs are the authority on component props, hook signatures, and server APIs — skill files only cover anti-patterns and gotchas.

App Manifest and Scaffolding

Agent workflow for scaffolding: get the manifest first, then build the init command.

  1. Get the manifest (JSON schema describing plugins and their resources):

```bash

databricks apps manifest --profile <PROFILE>

# See plugins available in a specific AppKit version:

databricks apps manifest --version <VERSION> --profile <PROFILE>

# Custom template:

databricks apps manifest --template <GIT_URL> --profile <PROFILE>

```

The output defines:

  1. Scaffold (use the Databricks CLI only):

```bash

databricks apps init --name <NAME> --features <plugin1>,<plugin2> \

--set <plugin1>.<resourceKey>.<field>=<value> \

--set <plugin2>.<resourceKey>.<field>=<value> \

--description "<DESC>" --run none --profile <PROFILE>

# --run none: skip auto-run after scaffolding (review code first)

# With custom template:

databricks apps init --template <GIT_URL> --name <NAME> --features ... --set ... --profile <PROFILE>

```

Optionally use --version <VERSION> to target a specific AppKit version.

DO NOT guess plugin names, resource keys, or property names — always derive them from databricks apps manifest output. Example: if the manifest shows plugin analytics with a required resource resourceKey: "sql-warehouse" and fields: { "id": ... }, include --set analytics.sql-warehouse.id=<ID>.

Execution identity (auth mode): --auth-mode obo|sp (app default) and per-resource --set <plugin>.<resourceKey>.authMode=obo|sp|both need databricks CLI >= v1.20.0; omit them on older CLIs (everything binds to the service principal). Default to SP; choose OBO only when the app must enforce the viewing user's own permissions (row-level or per-user data access). Flag rules, errors, and what each mode emits: Platform Guide.

Scaffolding Rules Protocol: if databricks apps manifest emits scaffolding.rules (template-level and per plugin, as must / should / never), they override this skill. Run Before init rules before databricks apps init and After init rules after it; if a plugin must contradicts a template never on the same target, STOP and ask the user. Gather, precedence, and reporting steps: AppKit Overview § Scaffolding Rules Protocol.

READ AppKit Overview for project structure, workflow, and pre-implementation checklist.

Genie Agent Workflow: for a Genie-powered app, ask which UC tables to query and whether to reuse or create a space; don't start by asking for a Genie Space ID. Steps: Genie Guide § Agent workflow.

Read the Genie Guide for configuration, SSE endpoints, and frontend integration.

Common Scaffolding Mistakes

# ❌ WRONG: name is NOT a positional argument
databricks apps init --features analytics my-app-name
# → "unknown command" error

# ✅ CORRECT: use --name flag
databricks apps init --name my-app-name --features analytics --set "..." --profile <PROFILE>

Directory Naming

databricks apps init creates directories in kebab-case matching the app name.

App names must be lowercase with hyphens only (≤26 chars).

Other Frameworks (Streamlit, FastAPI, Flask, Gradio, Dash, Next.js, etc.)

Databricks Apps supports any framework that runs as an HTTP server. LLMs already know these frameworks — the challenge is Databricks platform integration.

READ Other Frameworks Guide BEFORE building any non-AppKit app. It covers port/host configuration, app.yaml and databricks.yml setup, dependency management, networking, and framework-specific gotchas.

Post-Deploy Verification

After deploying, verify the app is running:

databricks apps get <app-name> --profile <PROFILE> -o json   # Check app_status.state: RUNNING; the `url` field is the app's URL
databricks apps logs <app-name> --follow --profile <PROFILE>  # Stream live logs (Ctrl+C to stop)

Note: databricks apps logs requires OAuth authentication and does not work with PAT. Use databricks apps get for status checks if using PAT auth.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.