checkout-sheet-kit-android
CLAUDE.md26 starsChanged 7 months agoMITView on GitHub
Guidance for Claude Code when working in this repository. Shopify Checkout Kit for Android is a published AAR library (com.shopify:checkout-sheet-kit) that presents Shopify checkouts as a native, dialog-hosted WebView in consumer apps. It is consumed by third-party Android apps via Maven Central, so changes to the library's public surface have real consumer impact and real reversal cost once released. Two modules matter: The sample is a separate Gradle composite (samples/MobileBuyIntegration/settings.gradle) that includes :lib from ../../lib. The sample's gradle.properties and Gradle…
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
If a change intentionally modifies public API (adding, removing, or changing any public class, method, field, or property):
- Very specific: line 55
Run ./gradlew :lib:apiDump (or dev api dump) to regenerate the baseline.
- Very specific: line 57
Commit the updated .api file in the same PR as the code change.
- Very specific: line 59
If apiCheck fails and you did *not* intend to change public API, the diff tells you what inadvertently leaked out.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Guidance for Claude Code when working in this repository.
Project overview
Shopify Checkout Kit for Android is a published AAR library (com.shopify:checkout-sheet-kit) that presents Shopify checkouts as a native, dialog-hosted WebView in consumer apps. It is consumed by third-party Android apps via Maven Central, so changes to the library's public surface have real consumer impact and real reversal cost once released.
Two modules matter:
lib/— the library itself. Everything here ships to consumers.samples/MobileBuyIntegration/— a demo app that consumeslib/as a source dependency. Changes here never reach consumers; this module is for internal testing and developer onboarding.
The sample is a separate Gradle composite (samples/MobileBuyIntegration/settings.gradle) that includes :lib from ../../lib. The sample's gradle.properties and Gradle wrapper are independent of the root's.
Where to make changes
- Library source:
lib/src/main/java/com/shopify/checkoutsheetkit/. Flat package at the top level with a few subpackages (errorevents/,lifecycleevents/,pixelevents/). - Library tests:
lib/src/test/java/com/shopify/checkoutsheetkit/. "No test, no merge" is a listed reject criterion in.github/CONTRIBUTING.md. - Java interop is a first-class concern — the library is commonly consumed from Java code.
lib/src/test/java/com/shopify/checkoutsheetkit/InteropTest.javaexercises the public API from Java specifically; treat breakage there as a consumer-facing issue.
Key components
ShopifyCheckoutSheetKit.kt— the public singleton. Entry point for all consumer interactions (configure, preload, present).CheckoutDialog.kt— the dialog that hosts the WebView, including the progress indicator and error-recovery coordination.CheckoutWebView.kt— primary WebView. Holds the URL-keyed cache with a 5-minute preload TTL; instruments page loads; routes bridge messages.BaseWebView.kt— abstract base class. Any new WebView variant must extend this so shared configuration (JS interface name, user agent suffix, client handling) is consistent.FallbackWebView.kt— minimal WebView swapped in during error recovery when the primary path fails.CheckoutBridge.kt— the JS ↔ native bridge.SCHEMA_VERSIONis a cross-boundary contract with the web checkout team; bumping it requires coordination with them.Configuration.kt— runtime config container (color scheme, preload enable, log level, error recovery policy). Any config change clears the WebView cache.CheckoutEventProcessor.kt+DefaultCheckoutEventProcessor— consumer-implemented lifecycle interface (completion, failure, pixel events, permission prompts, link clicks). Changes here are consumer API changes.
Testing patterns
- Tests use Robolectric (
@RunWith(RobolectricTestRunner::class)) to exercise Android framework code without a device. - Main-thread tasks are drained with
shadowOf(Looper.getMainLooper()).runToEndOfTasks(). If a test involves posted work and seems flaky, check whether this is being called. - Assertion library is AssertJ; mocking is Mockito + Mockito-Kotlin. Don't introduce new assertion/mocking libraries without discussion.
- Mockito is pinned at 4.x intentionally — Mockito 5.x requires JVM target 11, and the library is on 1.8. Noted in
lib/build.gradlewith// noinspection NewerVersionAvailablecomments. - Tests live in the same package as the class under test (file name:
ClassNameTest.kt).
Conventions
-Xexplicit-api=strictis on (lib/build.gradle). Every public class, method, field, and property must have an explicit visibility modifier. "Accidentally public" is not a thing here. This is a consumer-protection rule — if you see a public-by-default declaration, it was deliberate.- Max line length: 140 (detekt-enforced). Detekt config:
lib/detekt.config.yml. - MIT license header required on every new source file. Format: copy the top comment of any existing
.ktor.javafile inlib/src/mainorlib/src/test. Enforced in CI viascripts/check_license_headers.rb. - Library JVM target: 1.8. Intentional for consumer compatibility; don't raise without a major-version discussion.
- Library Kotlin version is pinned. The
lib/build.gradleplugin version and anyapiVersion/languageVersionsettings exist to keep consumer compatibility stable. A Kotlin major-version migration is a planned major-version event, not a casual dep bump.
Public API surface
The library's public API is captured in lib/api/lib.api (managed by the binary-compatibility-validator Gradle plugin). Every PR is gated by ./gradlew :lib:apiCheck in CI — the build fails if the compiled public API diverges from the committed baseline.
If a change intentionally modifies public API (adding, removing, or changing any public class, method, field, or property):
- Run
./gradlew :lib:apiDump(ordev api dump) to regenerate the baseline. - Review the diff in
lib/api/lib.api— it's the single best indicator of consumer impact, and reviewers will focus on it. - Commit the updated
.apifile in the same PR as the code change.
If apiCheck fails and you did not intend to change public API, the diff tells you what inadvertently leaked out. Fix the leak rather than updating the baseline — you've accidentally shifted the consumer contract.
Common commands
- Tests:
./gradlew :lib:test(ordev test) - API surface:
./gradlew :lib:apiCheck/./gradlew :lib:apiDump(ordev api check/dev api dump) - Lint:
./gradlew detekt lintRelease(ordev style) - Auto-fix lint:
./gradlew detekt --auto-correct(ordev fix) - Full local verification:
./gradlew :lib:clean :lib:test :lib:detekt :lib:lintRelease :lib:assembleRelease - Sample app build (from
samples/MobileBuyIntegration/):./gradlew assembleDebug
Consumer requirements
Raising any of these is a consumer-facing breaking change and needs visible release notes:
minSdk(library's minimum supported Android API level at runtime)compileSdkfloor for consumers (enforced viaaarMetadata.minCompileSdkon the library, or implicitly raised by any transitiveandroidxdependency whose own metadata demands a newercompileSdk)- Kotlin compiler /
apiVersion/languageVersion - JVM target
Transitive androidx bumps can silently raise the compileSdk floor — review dependabot PRs with this in mind, and run ./gradlew :lib:apiCheck and check aarMetadata output when bumping any androidx.* dependency.
Release process
Versions are bumped via:
- The fallback value in
lib/build.gradlefor theCHECKOUT_SHEET_KIT_VERSIONenv var. - The install snippets in
README.md(Gradle and Maven).
Publishing goes through GitHub Releases → .github/workflows/publish.yml → manual approval gate before Maven Central deploy. Full procedure: .github/CONTRIBUTING.md "Releasing a new version".
Things not to touch without discussion
- Library Kotlin version pin. Consumer compatibility floor; any migration is a deliberate major-version decision.
minSdk/ JVM target. Same story.CheckoutBridge.SCHEMA_VERSION. Cross-team contract with the web checkout — changing it without coordination breaks the bridge.- Preload TTL (5 minutes). Performance-sensitive; has been tuned. Don't tweak without a reason.
-Xexplicit-api=strict. Removing this would let implicit public declarations ship; keeping it is a consumer-protection invariant.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

