python-scala-sealed-enum

python-scala-sealed-enum is a skill for Claude Code, Codex from cxcscmu/SkillLearnBench. It costs 34 tokens per session (476 once invoked), scanned A, original, MIT.

A translation pattern for converting Python enum classes into Scala sealed classes or traits with named values and exhaustive pattern matching.

In plain words
What is it for?
Use it when porting Python enum definitions to Scala while keeping value fields and exhaustive handling of every case.
Why use it?
Python enums and Scala's type patterns work differently, and a direct conversion can lose stored values or compiler-checked cases. This explains an idiomatic Scala structure.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when porting Python enum definitions to Scala while keeping value…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cxcscmu/skilllearnbench/python-scala-sealed-enum
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.

Any agent
npx skills add cxcscmu/SkillLearnBench --skill python-scala-sealed-enum
Clone the repo
git clone --depth 1 https://github.com/cxcscmu/SkillLearnBench

Made for: Claude Code, Codex.

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 python-scala-sealed-enum

README.md
[![agentmods](https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/python-scala-sealed-enum.svg)](https://agentmods.dev/skills/cxcscmu/skilllearnbench/python-scala-sealed-enum)
Your own site
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/python-scala-sealed-enum"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/python-scala-sealed-enum.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 476 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00034 $0.00476
Opus 5 $0.00017 $0.00238
Sonnet 5 $0.00007 $0.00095
Haiku 4.5 $0.00003 $0.00048

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

Security

Grade A, and why

python-scala-sealed-enum 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 3d 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.

skills/b1-one-shot-claude-sonnet-4-6/python-scala-translation/python-scala-sealed-enum/SKILL.md · 65 lines

What it actually says

Python Enum → Scala Sealed Traits

Python Pattern

class TokenType(Enum):
    STRING = "string"
    NUMERIC = "numeric"
    NULL = "null"

Scala Idiomatic Translation

Use sealed abstract class (not Enum) with a companion object holding case object members:

sealed abstract class TokenType(val value: String)

object TokenType {
  case object STRING  extends TokenType("string")
  case object NUMERIC extends TokenType("numeric")
  case object NULL    extends TokenType("null")
}

Why sealed abstract class over sealed trait?

  • Use sealed abstract class when members need constructor parameters (like value: String).
  • Use sealed trait for purely marker/tag types with no data.

Key Differences from Python

Python Scala
TokenType.STRING.value TokenType.STRING.value (same API)
isinstance(x, TokenType) Pattern match on sealed type
Can iterate list(TokenType) Use Set(STRING, NUMERIC, ...) manually
TokenType["STRING"] Not needed; use TokenType.STRING directly

Exhaustive Pattern Matching (Bonus)

def describe(t: TokenType): String = t match {
  case TokenType.STRING  => "A string token"
  case TokenType.NUMERIC => "A numeric token"
  case TokenType.NULL    => "A null token"
  // Compiler warns if a case is missing (because sealed)
}

Companion Object values List (if needed)

object TokenType {
  case object STRING  extends TokenType("string")
  case object NUMERIC extends TokenType("numeric")
  case object NULL    extends TokenType("null")

  val values: List[TokenType] = List(STRING, NUMERIC, NULL)

  def fromString(s: String): Option[TokenType] =
    values.find(_.value == s)
}
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. 3d ago First seen · 65 lines · 34 tokens per session scan A 6d9c0e5697d4

Subscribe to this mod's changes

python-scala-sealed-enum is a skill published in the GitHub repository cxcscmu/SkillLearnBench (83 stars, last pushed 1mo ago), licensed MIT. It adds 34 tokens to every session and 476 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.

Related

Other skills, from other repositories

rdkit

Cheminformatics toolkit for fine-grained molecular control. SMILES/SDF parsing, descriptors (MW, LogP, TPSA), fingerprints, substructure search, 2D/3D generation, similarity, reactions. For standard workflows with simpler interface, use datamol (wrapper around RDKit). Use rdkit for advanced control, custom…

benchflow-ai/skillsbench · 80 tokens

pcap-analysis

Guidance for analyzing network packet captures (PCAP files) and computing network statistics using Python, with tested utility functions.

benchflow-ai/skillsbench · 28 tokens

memory-optimization

Optimize Python code for reduced memory usage and improved memory efficiency. Use when asked to reduce memory footprint, fix memory leaks, optimize data structures for memory, handle large datasets efficiently, or diagnose memory issues. Covers object sizing, generator patterns, efficient data structures, and memory…

benchflow-ai/skillsbench · 60 tokens

python-parallelization

Transform sequential Python code into parallel/concurrent implementations. Use when asked to parallelize Python code, improve code performance through concurrency, convert loops to parallel execution, or identify parallelization opportunities. Handles CPU-bound (multiprocessing), I/O-bound (asyncio, threading), and…

benchflow-ai/skillsbench · 68 tokens

trl

Reference for the TRL (Transformer Reinforcement Learning) library codebase. Use proactively before reading or editing any file under trl/ so you have the intended contracts and invariants in mind, not just what the current code says. Covers trainer hierarchy (SFT, DPO, GRPO, KTO), shared utility functions…

benchflow-ai/skillsbench · 100 tokens

parallel-processing

Parallel processing with joblib for grid search and batch computations. Use when speeding up computationally intensive tasks across multiple CPU cores.

benchflow-ai/skillsbench · 28 tokens