Kotlin Sum Types

🌐Community
by anderssv · vlatest · Repository

Generate Kotlin sealed classes/data objects representing sum types from natural language descriptions for robust data modeling.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add kotlin-sum-types npx -- -y @trustedskills/kotlin-sum-types
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "kotlin-sum-types": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/kotlin-sum-types"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill allows AI agents to generate and understand Kotlin sum types, also known as sealed classes. It can create data structures that represent a fixed set of possibilities, ensuring type safety and simplifying logic around handling different states or outcomes. The agent will produce valid Kotlin code implementing these sum types based on provided descriptions.

When to use it

  • Representing application state: Define the possible states of a UI element (e.g., Loading, Success, Error).
  • Handling API responses: Model different response scenarios from an external API call (e.g., ValidData, NotFound, ServerError).
  • Creating command patterns: Represent various commands that can be executed in a system, each with its own specific data or behavior.
  • Defining result types: Represent the outcome of a function which might succeed with a value or fail with an error.

Key capabilities

  • Generates Kotlin sum type definitions (sealed classes).
  • Understands natural language descriptions of sum types.
  • Produces valid and compilable Kotlin code.

Example prompts

  • "Create a Kotlin sum type representing the possible outcomes of a database query: Success(data), NotFound, and Error(message)."
  • "Generate a sealed class for UI states: Loading, ContentLoaded(data), Empty."
  • “Define a sum type to represent different payment methods: CreditCard(cardNumber), PayPal(email).”

Tips & gotchas

  • The agent requires familiarity with Kotlin syntax and concepts. Providing context about the desired data structure's purpose will improve results.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
anderssv
Installs
8

🌐 Community

Passed automated security scans.