/databricks-skills:cookbook-computefrom databricks-skills
Connects Databricks Apps to shared clusters or serverless compute using Databricks Connect. Provides recipes for Dash, Streamlit, and Reflex apps to run Spark SQL or Python.
Ships in databricks-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use Databricks Connect to execute Python or SQL code on a shared cluster or serverless compute from your Databricks App.
import os
from databricks.connect import DatabricksSession
cluster_id = "0709-132523-cnhxf2p6"
spark = DatabricksSession.builder.remote(
host=os.getenv("DATABRICKS_HOST"),
cluster_id=cluster_id
).getOrCreate()
query = "SELECT 'hello' AS message"
result = spark.sql(query).toPandas()
print(result)
import os
import streamlit as st
from databricks.connect import DatabricksSession
cluster_id = st.text_input("Cluster ID:", placeholder="0709-132523-cnhxf2p6")
if cluster_id:
spark = DatabricksSession.builder.remote(
host=os.getenv("DATABRICKS_HOST"),
cluster_id=cluster_id
).getOrCreate()
result = spark.sql("SELECT 'hello' AS message").toPandas()
st.dataframe(result)
import os
import asyncio
import reflex as rx
from databricks.connect import DatabricksSession
def run_spark_workload(host: str, cluster_id: str):
spark = DatabricksSession.builder.remote(
host=host, cluster_id=cluster_id
).getOrCreate()
return spark.sql("SELECT 'hello' AS message").toPandas().values.tolist()
class ConnectClusterState(rx.State):
cluster_id: str = ""
result: list = []
@rx.event(background=True)
async def connect_and_run(self):
host = os.getenv("DATABRICKS_HOST")
loop = asyncio.get_running_loop()
data = await loop.run_in_executor(
None, run_spark_workload, host, self.cluster_id
)
async with self:
self.result = data
You can also connect to serverless compute instead of a shared cluster. Replace the cluster connection with:
from databricks.connect import DatabricksSession
spark = DatabricksSession.builder.serverless(True).getOrCreate()
The app service principal needs:
CAN ATTACH TO on the clusterSee Compute permissions.
databricks-connect
pandas
Plus your framework package (dash, streamlit, or reflex).
@rx.event(background=True) and asyncio.get_running_loop().run_in_executor() for blocking Spark callsDATABRICKS_HOST is auto-injected when deployed; set it manually for local developmentWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
12 skills in this plugin
/cookbook-aimlInvoke ML models, run vector search, and connect to MCP servers from Databricks Apps. Use when the user wants to call a model serving endpoint, query a vector search index, use LLMs/embeddings, or connect to an MCP server in Dash, Streamlit, Reflex, or FastAPI./cookbook-authenticationImplement authentication in Databricks Apps: get current user info, on-behalf-of-user (OBO) auth, service principal auth, and OAuth patterns. Use when the user asks about auth, user tokens, service principals, OAuth, or OBO in Dash, Streamlit, Reflex, or FastAPI./cookbook-biEmbed AI/BI dashboards and integrate Genie Spaces into Databricks Apps. Use when the user wants to embed a Databricks dashboard or build a chat interface with the Genie Conversations API in Dash, Streamlit, or Reflex.npx claudepluginhub databricks-solutions/databricks-apps-cookbook --plugin databricks-skillsOther plugins' skills for the same job