Skip to content
Development
Command

/extract

Extract a composable from amethyst to shared code

From plugin
amethyst
1.6k3 skills3 commands
Install
$ npx -y skills add vitorpamplona/amethyst --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/extract

Context preview

What this command does when you run it.

Extract a composable from amethyst to shared code

Command definition

extract.md
description: Extract a composable from amethyst to shared code

Extract the component `$ARGUMENTS` from the Android app to shared KMP code:

Process

1. **Locate the component** in the amethyst module:

   find amethyst/src -name "*$ARGUMENTS*"
   grep -r "fun $ARGUMENTS\|class $ARGUMENTS" amethyst/src/

2. **Analyze dependencies**:

  • Android-specific imports (Context, Intent, etc.)
  • Platform APIs (Camera, MediaStore, etc.)
  • Android Compose specifics vs standard Compose

3. **Identify what can be shared**:

  • Pure Composable functions → `commons/commonMain/`
  • Business logic → `quartz/commonMain/`
  • Platform-specific → create expect/actual

4. **Create shared version**:

  • Move to appropriate shared module
  • Replace Android imports with multiplatform alternatives
  • Add expect declarations for platform-specific parts

5. **Update references**:

  • Change imports in amethyst module
  • Add implementations in desktopApp if needed

Common Replacements

| Android | Multiplatform | |---------|---------------| | `LocalContext.current` | expect/actual or parameter | | `stringResource()` | `Res.string.*` | | `painterResource()` | `painterResource(Res.drawable.*)` | | `Toast.makeText()` | Custom snackbar/notification | | `Intent` | expect/actual for navigation |

Example

/extract NoteCard

This will find NoteCard, analyze its dependencies, and guide you through extracting it to shared code.

Read more
Ships withamethyst

Nostr client for Android

Get the whole plugin
Stats
1,600
Stars
221
Forks
Active
Maintenance
Kotlin
Language
MIT
License
11m ago
Last commit
3y ago
Created

Repo: vitorpamplona/amethyst

Other commands on amethyst.