OpenParable
Skip to content
← Back to skills

Scala CLI Adding Directives

Development
scala-cli-adding-directives

Scala CLI Adding Directives is an Agent Skill for development published in the VirtusLab/scala-cli repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Add or change using directives in Scala CLI. Use when adding a new //> using directive, registering a directive handler, or editing directive preprocessing.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/VirtusLab/scala-cli/blob/HEAD/agentskills/adding-directives/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/scala-cli-adding-directives, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Adding a new directive (Scala CLI)

  1. Create a case class in modules/directives/src/main/scala/scala/build/preprocessing/directives/ extending one of:

    • HasBuildOptions — produces BuildOptions directly
    • HasBuildOptionsWithRequirements — produces BuildOptions with scoped requirements (e.g. test.dep)
    • HasBuildRequirements — produces BuildRequirements (for //> require)
  2. Annotate: @DirectiveLevel(SpecificationLevel.EXPERIMENTAL), @DirectiveDescription("…"), @DirectiveUsage("…"), @DirectiveExamples("…"), @DirectiveName("key") on fields.

  3. Companion: val handler: DirectiveHandler[YourDirective] = DirectiveHandler.derive

  4. Register in modules/build/.../DirectivesPreprocessingUtils.scala in the right list: usingDirectiveHandlers, usingDirectiveWithReqsHandlers, or requireDirectiveHandlers.

  5. Regenerate reference docs: ./mill -i 'generate-reference-doc[]'.run

CLI options always override directive values when both set the same thing.