dask

dask is a cursor rule for coding agents from sanjeed5/awesome-cursor-rules-mdc. It costs 2,735 tokens per session, scanned A, original, CC0-1.0.

A set of coding guidelines for Dask, a Python library that splits data work across larger datasets or multiple computers. It explains its delayed execution model and the overhead of distributed processing.

In plain words
What is it for?
Use it when profiling slow data work, deciding whether to use Dask, writing Dask pipelines, and managing Dask clients explicitly.
Why use it?
It helps developers avoid adding Dask where ordinary Python, Pandas, or NumPy is sufficient and reduces performance problems caused by unnecessary distribution.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/sanjeed5/awesome-cursor-rules-mdc/dask
Clone the repo
git clone --depth 1 https://github.com/sanjeed5/awesome-cursor-rules-mdc

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dask

README.md
[![agentmods](https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/dask.svg)](https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/dask)
Your own site
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/dask"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/dask.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,735 This file is loaded in full into every session.
When invoked 2,735 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02735 $0.02735
Opus 5 $0.01367 $0.01367
Sonnet 5 $0.00547 $0.00547
Haiku 4.5 $0.00274 $0.00274

Measured 4d ago against content hash c6877ee40c44, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dask scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules-mdc/dask.mdc · 299 lines

How it starts

The opening of the file, as written. The whole thing — 299 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Dask Best Practices

Dask is a powerful library for scaling Python, but it introduces new paradigms. Writing effective Dask code requires understanding its lazy execution model and distributed computing overhead. This guide outlines critical best practices to ensure your Dask pipelines are reliable, performant, and easy to maintain.

Critical Guidelines

1. Start Small and Profile First

Before reaching for Dask, ensure your problem genuinely requires distributed computing. Optimize your serial code first. Dask adds overhead; it's not a magic bullet for inefficient algorithms.

✅ GOOD: Profile your Pandas/NumPy code to identify bottlenecks. Only then consider Dask for the specific slow parts.

import pandas as pd
import numpy as np
import time

# Simulate a large dataset operation
data = np.random.rand(10_000_000, 10)
df_small = pd.DataFrame(data)

start_time = time.time()
result_small = df_small[df_small[0] > 0.5].groupby(1).mean()
print(f"Pandas execution time: {time.time() - start_time:.2f}s")

# If this is too slow, then consider Dask for the bottleneck.
# Don't start with Dask if Pandas is fast enough.

2. Explicit Client Management

Always create an explicit dask.distributed.Client at the top of your script or notebook. Use it as a context manager to ensure proper shutdown and pass it explicitly to any Dask-aware libraries. Avoid relying on implicit global state.

❌ BAD: Implicit client usage or manual client.close().

# Relying on implicit client or forgetting to close
from dask.distributed import Client
client = Client() # Client might not be closed on error
# ... Dask operations ...
# client.close() # Easily forgotten

✅ GOOD: Use Client as a context manager and pass it explicitly.

from dask.distributed import Client, LocalCluster

# For local development, use LocalCluster
with LocalCluster(n_workers=4, threads_per_worker=1, memory_limit='2GB') as cluster:
    with Client(cluster) as client:
        print(f"Dask Dashboard: {client.dashboard_link}")
        # Your Dask operations here, passing 'client' if needed
        import dask.dataframe as dd
        df = dd.read_csv("s3://bucket/data/*.csv", blocksize="64MB")
        # ...

Read the full file on GitHub · 299 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 299 lines · 0 tokens per session scan A c6877ee40c44

Subscribe to this mod's changes

dask is a cursor rule published in the GitHub repository sanjeed5/awesome-cursor-rules-mdc (3,571 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 2,735 tokens to every session, about $0.0137 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.