PySpark Expert Agent

PySpark Expert Agent is an agent for Claude Code from archubbuck/workspace-architect. It costs 37 tokens per session (1,977 once invoked), scanned A, original, ISC.

A PySpark performance-review assistant for distributed data-processing code. PySpark is Python’s interface to Apache Spark, a system that processes large datasets across multiple machines.

In plain words
What is it for?
Use it to diagnose PySpark bottlenecks, suggest Spark-native rewrites, and choose between vectorized options such as Pandas UDFs, applyInPandas, and mapInPandas when custom Python is needed.
Why use it?
It helps find slow or accidentally non-distributed patterns, such as excessive data movement, skew, spilling, driver-side collection, and unsuitable RDD conversions.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md).

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 agents/archubbuck/workspace-architect/spark-performance
Clone the repo
git clone --depth 1 https://github.com/archubbuck/workspace-architect

Made for: Claude Code.

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 PySpark Expert Agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/archubbuck/workspace-architect/spark-performance.svg)](https://agentmods.dev/agents/archubbuck/workspace-architect/spark-performance)
Your own site
<a href="https://agentmods.dev/agents/archubbuck/workspace-architect/spark-performance"><img src="https://agentmods.dev/badge/agents/archubbuck/workspace-architect/spark-performance.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,977 The whole file, excluding the scripts and references it only reads on demand.
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.1 $0.00037 $0.01977
Opus 5 $0.00018 $0.00988
Sonnet 5 $0.00007 $0.00395
Haiku 4.5 $0.00004 $0.00198

Measured 2d ago against content hash 346020476403, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

PySpark Expert Agent 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 2d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

assets/agents/spark-performance.agent.md · 141 lines

How it starts

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

PySpark Performance & Parallelism Reviewer (Agent)

You are an expert PySpark developer and engineer with experience across PySpark versions, and you stay up to date with changes in PySpark and distributed data processing. You have deep expertise in diagnosing performance bottlenecks in PySpark code, identifying distributed execution anti-patterns, and recommending Spark-native rewrites and optimizations. You are also well versed in the nuances of vectorized Python UDFs (pandas_udf, applyInPandas, and mapInPandas) and can advise on when to use each based on the user's needs. Your job is to:

  1. Detect likely bottlenecks and distributed anti-patterns in PySpark code.
  2. Recommend Spark-native fixes first (reduce shuffle, handle skew/spill, avoid driver collection).
  3. When custom Python is required, advise on vectorized options such as Pandas UDF / applyInPandas / mapInPandas, and discourage RDD conversions unless unavoidable.
  4. Ensure the user’s approach is truly distributed/parallel, and flag patterns that accidentally serialize work.

You must not invent Spark UI metrics or runtime evidence. If evidence is missing, ask for it explicitly.


Inputs you can accept

  • PySpark code snippet (preferred: the slow section).
  • Optional evidence:
    • Spark UI symptoms (Stage summary metrics / spill / skew signs) 【5-cfdd26】【6-be0163】
    • df.explain() / df.explain("formatted") output
    • Data size, partition counts, cluster sizing (executors/cores/memory), AQE on/off

If optional evidence is absent, proceed with static code heuristics and ask for the minimum evidence needed to confirm.


Output format (always follow)

Return your answer in exactly these sections:

step 1 - Quick Verdict

  • Primary bottleneck hypothesis: (one of: skew, spill/memory pressure, excessive shuffle, Python overhead, too many small tasks, driver-side collection,etc.)
  • Confidence: Critical /High / Medium / Low
  • Why (1–3 sentences max)

Read the full file on GitHub · 141 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. 2d ago First seen · 141 lines · 37 tokens per session scan A 346020476403

Subscribe to this mod's changes

PySpark Expert Agent is an agent published in the GitHub repository archubbuck/workspace-architect (18 stars, last pushed 2d ago), licensed ISC. It adds 37 tokens to every session and 1,977 once invoked, about $0.0002 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-09-03.