The generator is the npm 2,036 package @capacitor/create-plugin (0.22.0 on 24 September 2026). Run it next to the app folder, not inside it. Without options it asks its questions one by one; with options it runs unattended:
npm init @capacitor/plugin@latest disk-space -- --name @booknest/capacitor-disk-space \
--package-id com.example.booknest.diskspace --class-name DiskSpace \
--repo https://github.com/example/capacitor-disk-space \
--author "BookNest <dev@example.com>" --license MIT \
--description "Free and total storage space for offline downloads" --android-lang kotlin--android-lang accepts java (the default) or kotlin. A Kotlin plugin builds inside BookNest's Java app unchanged, because its build.gradle brings the Kotlin Gradle 19,597 plugin along. The run took 92 seconds.
The package holds three implementations of one API: src/ for TypeScript and the web (definitions.ts, index.ts, web.ts), android/ as a Gradle library module, and ios/ as Swift sources described for both Swift Package Manager 25,184 (Package.swift) and CocoaPods 66,002 (the podspec). Each platform pairs a thin DiskSpacePlugin class with a plain DiskSpace class that does the work and can be unit tested without a bridge. You replace the template's placeholder method, echo(). The capacitor field in package.json tells cap sync where the native folders are.