amy-expert

Guides adding and extending amy CLI subcommands in the Amethyst Kotlin codebase.

1.6k|222|Updated Jan 11, 2023
One-click install
npx skills add https://github.com/vitorpamplona/amethyst --skill amy-expert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: amy-expert
Source: https://github.com/vitorpamplona/amethyst/tree/main/.claude/skills/amy-expert
Command: npx skills add https://github.com/vitorpamplona/amethyst --skill amy-expert

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Extending the amy CLI in the Amethyst repository requires following strict architectural rules: the cli/ module must stay a thin assembly layer, output must follow a dual text/JSON contract, and business logic must live in commons/ or quartz/. This Skill encodes those rules so new commands are added without breaking the CLI's public API or interop test harnesses.

Core Features & Use Cases

  • Command scaffolding: Provides a standard command-file template, the shared route() dispatcher pattern, and a wire-up checklist covering Main.kt dispatch, printUsage(), README, and ROADMAP updates.
  • Output contract enforcement: Documents the dual-output rules (human text by default, single-line JSON under --json, exit codes 0/1/2/124) and the Output.emit/Output.error APIs.
  • Extract-from-Android recipe: Gives a step-by-step process for moving logic out of amethyst/ into commons/ (handling Context, SharedPreferences, WorkManager dependencies) so CLI commands can call it.
  • Use Case: When asked to add an amy note publish command, use this Skill to place the event-building logic in commons/, write the command file from the template, wire it into Main.kt, and emit results via Output.emit with the correct JSON shape.

Quick Start

Use the amy-expert skill to add a new amy subcommand that publishes a text note, following the command template and wiring it into Main.kt.

Frequently Asked Questions about amy-expert

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

FAQPage Schema
How do I add a new amy CLI subcommand?

Create a command file under cli/commands/ using the standard object pattern, add a branch in Main.kt's dispatch, extend printUsage(), and add a row to cli/README.md's command table. Multi-verb groups use the shared route() helper in Router.kt.

Where should business logic for a CLI command live in Amethyst?

Business logic belongs in commons/ and protocol logic in quartz/, never in cli/. If the logic only exists in amethyst/ with Android dependencies, extract it to commons/ first using the extraction recipe, then add the CLI command in a separate commit.

What output format does the amy CLI use for scripts?

amy emits human-readable text on stdout by default and a single-line JSON object under the --json flag, with stable snake_case keys. Errors go to stderr, and exit codes are 0 for success, 1 for runtime errors, 2 for bad arguments, and 124 for await timeouts.

How do I move Android-dependent code so the CLI can call it?

List the Android-only dependencies such as Context, SharedPreferences, or WorkManager, then inline, abstract via expect/actual, or invert them as constructor arguments. Move the file to commons/commonMain, update the Android caller, and add a JVM test before writing the command.

Why should commands avoid println and runBlocking in amy?

Commands must emit results through Output.emit and Output.error so the text/JSON mode branching works correctly, and they are suspend functions because main() already handles runBlocking. Direct println breaks the dual-output contract that interop harnesses depend on.