agentleFS
boy-offi9-incboy-offi9-inc/hexforge-gateway/skills/hexforge-apk-patch-rebuild/SKILL.md

hexforge-apk-patch-rebuild

Skill14 starsChanged 2 months agoMITView on GitHub

Decode, patch, rebuild, align, sign and verify an Android APK with HexForge's apktool/apksigner agents. Use when asked to modify an APK, change its manifest or resources, or rebuild and re-sign a decoded project.

  • Sends data out

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is 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.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Don't write outside WORKSPACES_ROOT/<workspaceId>/ - agents reject it.

    line 66
  2. Distinctive:

    Don't skip alignment before signing.

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HexForge APK patch → rebuild → sign

Requires a running HexForge Gateway (http://localhost:8080) with the pinned runtime (Dockerfile.runtime) or apktool/apksigner/zipalign on its host. Every step writes its artifact under WORKSPACES_ROOT/<workspaceId>/, so the chain is resumable and every artifact is linked to the exact task that produced it.

1. Workspace + decode

curl -s -X PUT http://localhost:8080/workspaces/by-name/acme-patch \
  -H "Content-Type: application/json" -d '{}'
# (PUT by-name reuses the workspace across sessions; POST /workspaces also works)

curl -s -X POST http://localhost:8080/workspaces/$WS/tasks \
  -H "Content-Type: application/json" \
  -d '{"agent": "apktool", "operation": "decode", "payload": {"apkPath": "/abs/path/app.apk"}}'

Poll GET /workspaces/$WS/tasks until completed; the result carries the decoded project directory.

2. Patch

Smali or resources, one patch per task, each recorded with what changed:

curl -s -X POST http://localhost:8080/workspaces/$WS/tasks \
  -d '{"agent": "apktool", "operation": "patch", "payload": {"projectDir": "<decode output dir>", "file": "AndroidManifest.xml", "find": "debuggable=\"false\"", "replace": "debuggable=\"true\""}}'

file is relative to the project; string resources, smali constants and manifest attributes all work the same way.

3. Rebuild

curl -s -X POST http://localhost:8080/workspaces/$WS/tasks \
  -d '{"agent": "apktool", "operation": "build", "payload": {"projectDir": "<decode output dir>"}}'

4. Align + sign

curl -s -X POST http://localhost:8080/workspaces/$WS/tasks \
  -d '{"agent": "apksigner", "operation": "sign", "payload": {"apkPath": "<rebuilt apk>"}}'

The signed copy lands at WORKSPACES_ROOT/<workspaceId>/apksigner/signed/<name>-signed.apk.

5. Verify

  • triage on the signed APK should report the patched manifest values.
  • adb install ({"agent": "adb", "operation": "install", "payload": {"apkPath": "<signed apk>"}}) against a connected device for a live check.

What NOT to do

  • Don't write outside WORKSPACES_ROOT/<workspaceId>/ - agents reject it.
  • Don't skip alignment before signing; apksigner refuses misaligned APKs.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.