Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Android Versioning

ASecurity

Use this skill when setting up or explaining Android versionCode/versionName for KMP or standard Android projects. Implements packed semver: major*1_000_000 + minor*1_000 + patch as a single integer that preserves semver ordering.

8 stars
0 votes
0 copies
0 views
Added 9/20/2026
devopsgokotlinbashgit

Security Analysis

A100/100

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add tstapler/dotfiles --skill android-versioning --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Versioning?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Android Versioning
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tstapler-android-versioning/badge)](https://www.skillsdirectory.com/skills/tstapler-android-versioning)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: android-versioning
description: "Use this skill when setting up or explaining Android versionCode/versionName for KMP or standard Android projects. Implements packed semver: major*1_000_000 + minor*1_000 + patch as a single integer that preserves semver ordering."
---

# Android Versioning — Packed SemVer

Android requires `versionCode` as a single integer, but we encode `major.minor.patch` into it using place-value arithmetic so semver ordering is preserved.

## Formula

```
versionCode = major * 1_000_000 + minor * 1_000 + patch
```

Examples: `v1.3.0` → `1_003_000`, `v1.2.999` → `1_002_999`. Since `1_003_000 > 1_002_999`, ordering is always correct.

**Limits:** major 0–2100, minor 0–999, patch 0–999 (Android cap: 2,100,000,000).

**Gotcha:** If minor or patch exceeds 999, they bleed into the next component's space and break ordering. In practice this never happens.

## Gradle Implementation

In `androidApp/build.gradle.kts` inside `defaultConfig {}`:

```kotlin
val appVersionStr = (findProperty("appVersion") as? String ?: "0.1.0").removePrefix("v")
val vParts = appVersionStr.split(".")
val vMajor = vParts.getOrNull(0)?.toIntOrNull() ?: 0
val vMinor = vParts.getOrNull(1)?.toIntOrNull() ?: 0
val vPatch = vParts.getOrNull(2)?.toIntOrNull() ?: 0
versionCode = (vMajor * 1_000_000 + vMinor * 1_000 + vPatch).coerceAtLeast(2)
versionName = appVersionStr
```

- CI passes `-PappVersion=X.Y.Z` to Gradle; local builds fall back to `"0.1.0"`.
- `coerceAtLeast(2)`: ensures every new APK outranks historical builds that used the hardcoded `versionCode = 1` default.

## CI Strategy

### Dev builds (every push to main)

Derive version automatically: latest git tag sets major.minor; commits since that tag become patch.

```bash
BASE_TAG=$(git describe --tags --match "v*" --abbrev=0 2>/dev/null || echo "v0.1.0")
BASE_VER=${BASE_TAG#v}
MAJOR=$(echo "$BASE_VER" | cut -d. -f1)
MINOR=$(echo "$BASE_VER" | cut -d. -f2)
PATCH=$(git rev-list "${BASE_TAG}..HEAD" --count 2>/dev/null || echo "0")
APP_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
```

Then pass `-PappVersion="$APP_VERSION"` to both `assembleRelease` and `appDistributionUploadRelease`.

### Prod builds (manual workflow dispatch)

Require an exact tag on HEAD — fail loudly if missing:

```bash
APP_VERSION=$(git describe --tags --exact-match HEAD 2>/dev/null | sed 's/^v//')
if [ -z "$APP_VERSION" ]; then
  echo "ERROR: HEAD is not tagged. Tag a release with 'git tag vX.Y.Z && git push --tags' before deploying to prod."
  exit 1
fi
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
```

## Release Notes

Run this step before `appDistributionUploadRelease`:

```bash
{
  echo "v${APP_VERSION} · $(date -u '+%Y-%m-%d %H:%M UTC')"
  echo "Commit: $GITHUB_SHA"
  echo ""
  git log --oneline -15 --format="• %s"
} > androidApp/release-notes.txt
```

## Bumping Major / Minor

```bash
git tag v0.2.0
git push --tags
# Then trigger the prod deploy workflow
```

Patch auto-increments on every dev build; you only tag when intentionally cutting a minor or major release.

Attribution

tstaplertstapler
View sourceMore from tstapler →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Terraform Module Library

Build reusable Terraform modules for AWS, Azure, and GCP infrastructure following infrastructure-as-code best practices. Use when creating infrastructure modules, standardizing cloud provisioning, or implementing reusable IaC components.

393431 votes

sematext-otel

Wire a service's OpenTelemetry output to Sematext Cloud. Walks through region, App-type, instrumentation flow (managed OTLP endpoint vs Sematext Agent), and signal selection (traces/metrics/logs), then produces the exact env-var block and points at a runnable reference example in this repo. Invoke when instrumenting a new app for Sematext.

01 votes

Deployment Patterns

Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications. Use when setting up deployment infrastructure or planning releases.

2459130 votes

Babysit

Watch a pull request or review cycle until it is ready to merge. Use when asked to babysit, monitor, or keep checking PR comments, reviews, and CI until all actionable issues are resolved.

929660 votes

V7 Roster

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

805540 votes
View all in devops →