1k-patching-native-modules_skill

This skill analyzes crash logs from iOS and Android native modules to generate patches that fix crashes and stabilize builds.
  • TypeScript

2.3k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill onekeyhq/app-monorepo --skill 1k-patching-native-modules

  • SKILL.md5.2 KB

Overview

This skill patches native mobile modules (iOS/Android) such as expo-image and react-native to fix native crashes and runtime bugs. It guides through analyzing crash logs, locating the faulty native code, applying safe nil/null checks, cleaning build artifacts, and generating small reproducible patch files. The workflow is secure, repeatable, and focused on avoiding polluted patches.

How this skill works

It inspects crash logs (EXC_BAD_ACCESS, SIGABRT, NullPointerException, OOM) to identify the crashing function and the implicated native package. You locate the module source in node_modules, apply minimal native fixes (Swift/Kotlin nil checks, weak references, size limits), clean Android/iOS build artifacts, and generate a patch with patch-package. It includes checks to verify the patch does not include build outputs and steps to commit and create a PR.

When to use it

  • A native crash references code inside node_modules for a known package (expo-image, reanimated, etc.).
  • Crashes show EXC_BAD_ACCESS, KERN_INVALID_ADDRESS, SIGABRT on iOS or NullPointerException/OutOfMemoryError on Android.
  • You need a small focused change you can ship as a patch without forking the library.
  • You must avoid binary/build artifacts in generated patches to keep diffs small and reviewable.

Best practices

  • Always extract exception type, stack trace, thread info and exact crashing function from the crash log before changing code.
  • Add minimal, defensive checks (guard let in Swift, ?: return in Kotlin) rather than broad refactors.
  • Remove node_modules/<package>/android/build and other build dirs before running npx patch-package to avoid binary pollution.
  • Verify patch content with grep/head to ensure no android/build or .class/.jar entries are included.
  • Commit patch with a descriptive message referencing the crash and Sentry or issue number when available.

Example use cases

  • Fix EXC_BAD_ACCESS in expo-image by guarding against nil image URIs in ImageView.swift.
  • Resolve NullPointerException in a React Native module by adding Kotlin null checks in android/src files.
  • Limit image decoding size to avoid OutOfMemoryError on Android in a native image loader.
  • Create a small patch for @react-native-async-storage to prevent a crash on null input and push a PR with the patch file.

FAQ

Remove android/ios build folders in node_modules/<package> and regenerate the patch; verify with grep that no build paths are present.

How do I handle version mismatches so the patch applies?

Check node_modules/<package>/package.json for the installed version. Rename the patch file to match the package+version or update the dependency so versions align.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
1k-patching-native-modules skill by onekeyhq/app-monorepo | VeilStrat