
Mobile Security
- 22 installs
- 60 repo stars
- Updated June 14, 2026
- ahmed3elshaer/everything-claude-code-mobile
mobile-security is a Claude Code skill that provides Android security patterns for secure storage, network security, input validation, and authentication.
About
mobile-security is a Claude Code skill that documents Android security patterns. It covers secure storage with EncryptedSharedPreferences and the Android Keystore, network security config and certificate pinning, input validation, safe logging, and biometric authentication. Developers use it when hardening an Android app's storage, network, and auth surfaces. Every pattern is shown as concrete Kotlin.
- Android secure storage via EncryptedSharedPreferences and Android Keystore
- Network security config, Ktor certificate pinning, and biometric auth patterns
- Input validation and release-safe logging to avoid leaking secrets
Mobile Security by the numbers
- 22 all-time installs (skills.sh)
- Ranked #1,568 of 2,203 Security skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
mobile-security capabilities & compatibility
- Capabilities
- security audit · secure storage · cert pinning · biometric auth
- Works with
- github
- Use cases
- security audit
- Platforms
- macOS · Linux · Windows
What mobile-security says it does
Security best practices for Android.
SQL injection prevention - use parameterized queries
npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill mobile-securityAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 22 |
|---|---|
| repo stars | ★ 60 |
| Last updated | June 14, 2026 |
| Repository | ahmed3elshaer/everything-claude-code-mobile ↗ |
What it does
Apply Android security patterns for encrypted storage, certificate pinning, input validation, safe logging, and biometric authentication.
Who is it for?
Hardening an Android app's storage, network, logging, and auth against common mobile threats
Skip if: iOS-specific security or server-side/backend security concerns
When should I use this skill?
Adding token storage, certificate pinning, input validation, or biometric auth to an Android app
What you get
The app stores tokens encrypted, pins certificates, validates input, and gates sensitive actions behind biometrics
By the numbers
- Covers 5 security areas (secure storage, network security, safe logging, input validation, biometric auth)
Files
Mobile Security Patterns
Security best practices for Android.
Secure Storage
EncryptedSharedPreferences
// Create encrypted preferences
private fun createSecurePrefs(context: Context): SharedPreferences {
val masterKey = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
return EncryptedSharedPreferences.create(
context,
"secure_prefs",
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
}
// Usage
class TokenStorage(context: Context) {
private val prefs = createSecurePrefs(context)
var accessToken: String?
get() = prefs.getString("access_token", null)
set(value) = prefs.edit().putString("access_token", value).apply()
fun clear() = prefs.edit().clear().apply()
}Android Keystore
// Generate key in Keystore
fun generateSecretKey(alias: String) {
val keyGenerator = KeyGenerator.getInstance(
KeyProperties.KEY_ALGORITHM_AES,
"AndroidKeyStore"
)
keyGenerator.init(
KeyGenParameterSpec.Builder(alias,
KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
.setUserAuthenticationRequired(true)
.setUserAuthenticationParameters(300, KeyProperties.AUTH_BIOMETRIC_STRONG)
.build()
)
keyGenerator.generateKey()
}Network Security
Network Security Config
<!-- res/xml/network_security_config.xml -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
<!-- Debug only -->
<debug-overrides>
<trust-anchors>
<certificates src="user"/>
</trust-anchors>
</debug-overrides>
<!-- Certificate pinning -->
<domain-config>
<domain includeSubdomains="true">api.example.com</domain>
<pin-set expiration="2025-12-31">
<pin digest="SHA-256">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</pin>
<pin digest="SHA-256">BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=</pin>
</pin-set>
</domain-config>
</network-security-config>Certificate Pinning (Ktor)
val client = HttpClient(OkHttp) {
engine {
config {
certificatePinner(
CertificatePinner.Builder()
.add("api.example.com", "sha256/AAAA...")
.add("api.example.com", "sha256/BBBB...") // Backup
.build()
)
}
}
}Safe Logging
// ❌ NEVER log sensitive data
Log.d("Auth", "Token: $token")
// ✅ Release-safe logging with Timber
class ReleaseTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (priority >= Log.WARN) {
// Send to crash reporting
Crashlytics.log(priority, tag, message)
}
}
}
// In Application
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
} else {
Timber.plant(ReleaseTree())
}Input Validation
// Validate before use
fun validateEmail(email: String): Result<String> {
return when {
email.isBlank() -> Result.failure(ValidationError.Empty)
!Patterns.EMAIL_ADDRESS.matcher(email).matches() ->
Result.failure(ValidationError.InvalidFormat)
email.length > 254 -> Result.failure(ValidationError.TooLong)
else -> Result.success(email)
}
}
// SQL injection prevention - use parameterized queries
@Query("SELECT * FROM users WHERE id = :userId")
suspend fun getUser(userId: String): User?Biometric Authentication
val biometricPrompt = BiometricPrompt(
activity,
executor,
object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
val cipher = result.cryptoObject?.cipher
// Use cipher to decrypt sensitive data
}
}
)
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle("Authenticate")
.setNegativeButtonText("Cancel")
.setAllowedAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG)
.build()
biometricPrompt.authenticate(promptInfo, BiometricPrompt.CryptoObject(cipher))ProGuard/R8 Security
# R8 rules for security
-keepattributes SourceFile,LineNumberTable # For crash reports only
# Obfuscate sensitive classes
-repackageclasses 'a'
-allowaccessmodification
# Remove logging
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
}---
Remember: Security is not optional. Build it in from the start.
Related skills
FAQ
How does it store tokens securely?
It uses EncryptedSharedPreferences with an AES256_GCM master key, or keys generated in the Android Keystore.
Does it cover certificate pinning?
Yes, via both network security config XML and a Ktor/OkHttp CertificatePinner with backup pins.