golem-scala-code-generation

Generates shared Scala source code for Golem sbt and Mill build plugins.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-scala-code-generation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-scala-code-generation
Source: https://github.com/golemcloud/golem/tree/main/.agents/skills/golem-scala-code-generation
Command: npx skills add https://github.com/golemcloud/golem --skill golem-scala-code-generation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Maintaining consistent code generation across two build tools (sbt and Mill) for Golem agent projects is error-prone when each plugin reimplements discovery, validation, and rendering logic. This Skill guides changes to the shared codegen pipeline so both plugins stay behaviorally aligned.

Core Features & Use Cases

  • Shared codegen pipeline: Source discovery, validated semantic IR (AgentSurfaceIR, ToolProjectionIR), and source rendering live in sdks/scala/codegen/, keeping sbt and Mill integrations thin.
  • RPC and tool client generation: Mode-aware durable and ephemeral client generation with correct signatures for get, newPhantom, apply, cancelable, and trigger/schedule receipts.
  • Cross-version constraints: Shared sources must compile on Scala 2.12.21 (sbt) and Scala 3.8.2 (Mill/repository build), avoiding Scala-3-only syntax.
  • Use Case: When adding a new generated RPC method, update RpcCodegen.scala and the IR once, then verify both plugins with sbt "++3.8.2; codegen/test" and the Mill fixtures instead of patching each plugin separately.

Quick Start

Ask the assistant to add a new generated tool client method to the Golem Scala codegen pipeline and verify it with the codegen tests on both Scala versions.

Frequently Asked Questions about golem-scala-code-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new generated RPC method to the Golem Scala codegen?

Add the method in the shared codegen module under sdks/scala/codegen, treating RpcCodegen.scala, AgentClientRuntime.scala, and InvocationMetadata.scala as authoritative for signatures. Then run the codegen tests on both Scala versions and compile a consumer project.

How do I keep the sbt and Mill Golem plugins behaviorally aligned?

Keep all semantic generation in the shared codegen module and make the sbt and Mill plugins thin wrappers that only handle source collection, logging, output directories, formatting, and task wiring. Check existing task names and output handling before adding hooks.

Which Scala versions must the shared Golem codegen sources support?

The shared codegen sources are consumed by sbt 1.x on Scala 2.12.21 and by the repository build and Mill plugin on Scala 3.8.2, so avoid Scala-3-only syntax. Mill consumer fixtures compile generated application code with Scala 3.3.7, which is a fixture setting, not the codegen host version.

What is the difference between durable and ephemeral generated clients in Golem?

Durable clients expose get and phantom constructors, while ephemeral clients expose newPhantom. Durable apply returns Future[A] and ephemeral apply returns Future[InvocationResult[A]]; cancelable and trigger/schedule operations also return different receipt types per mode.

How do I verify changes to the Golem Scala code generation pipeline?

Run the affected generator tests with sbt ++3.8.2; codegen/test, cross-test with ++2.12.21! for the sbt plugin, and compile a consumer with testAgents/fastLinkJS. For Mill changes, use the tasks in sdks/scala/mill/README.md and the fixtures in mill/build.mill.