android-skills 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +55 -58
  2. package/android-ui/SKILL.md +187 -0
  3. package/android-ui/references/anti-slop-checklist.md +61 -0
  4. package/android-ui/references/checklist.md +95 -0
  5. package/android-ui/references/clarifying-questions.md +55 -0
  6. package/android-ui/references/color-and-contrast.md +104 -0
  7. package/android-ui/references/components-intents.md +74 -0
  8. package/android-ui/references/compose-patterns.md +120 -0
  9. package/android-ui/references/compose-risks.md +86 -0
  10. package/android-ui/references/input-and-state.md +77 -0
  11. package/android-ui/references/network-storage.md +87 -0
  12. package/android-ui/references/reconstruction-workflow.md +74 -0
  13. package/android-ui/references/report-template.md +71 -0
  14. package/android-ui/references/sensitive-data-ui.md +73 -0
  15. package/android-ui/references/typography-spacing.md +93 -0
  16. package/android-ui/references/webview.md +105 -0
  17. package/{android-ui-minimal → android-ui}/scripts/contrast.py +8 -8
  18. package/{android-ui-minimal → android-ui}/scripts/gen_tokens.py +11 -11
  19. package/{android-ui-minimal → android-ui}/scripts/lint_ui.py +29 -29
  20. package/{android-ui-security-review → android-ui}/scripts/scan.py +146 -146
  21. package/bin/android-skills.js +10 -10
  22. package/install.py +79 -65
  23. package/opencode/commands/ui.md +13 -0
  24. package/package.json +3 -4
  25. package/android-ui-minimal/SKILL.md +0 -98
  26. package/android-ui-minimal/references/anti-slop-checklist.md +0 -61
  27. package/android-ui-minimal/references/clarifying-questions.md +0 -55
  28. package/android-ui-minimal/references/color-and-contrast.md +0 -104
  29. package/android-ui-minimal/references/compose-patterns.md +0 -120
  30. package/android-ui-minimal/references/reconstruction-workflow.md +0 -74
  31. package/android-ui-minimal/references/typography-spacing.md +0 -93
  32. package/android-ui-security-review/SKILL.md +0 -93
  33. package/android-ui-security-review/references/checklist.md +0 -95
  34. package/android-ui-security-review/references/components-intents.md +0 -74
  35. package/android-ui-security-review/references/compose-risks.md +0 -86
  36. package/android-ui-security-review/references/input-and-state.md +0 -77
  37. package/android-ui-security-review/references/network-storage.md +0 -87
  38. package/android-ui-security-review/references/report-template.md +0 -71
  39. package/android-ui-security-review/references/sensitive-data-ui.md +0 -73
  40. package/android-ui-security-review/references/webview.md +0 -105
  41. package/opencode/commands/ui-minimal.md +0 -9
  42. package/opencode/commands/ui-security.md +0 -9
package/README.md CHANGED
@@ -1,24 +1,21 @@
1
1
  # Android Skills
2
2
 
3
- Paket ini berisi dua skill untuk pekerjaan Android:
3
+ One skill for Android work: `android-ui`, with two modes — **UI** (building, reconstructing, and polishing Android UIs) and **security** (auditing the Android UI/frontend layer). Works with OpenCode, Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, Cursor, and Windsurf.
4
4
 
5
- - `android-ui-minimal` — membangun, merekonstruksi, dan merapikan UI Android.
6
- - `android-ui-security-review` — meninjau keamanan pada lapisan UI/frontend Android.
7
5
 
8
- Didukung untuk berbagai agent AI: **OpenCode** (default), **Claude Code**, **Codex CLI**, **Gemini CLI**, **GitHub Copilot**, **Cursor**, dan **Windsurf**.
9
6
 
10
- ## Instalasi
7
+ ## Installation
11
8
 
12
9
  ### Via npm / npx
13
10
 
14
11
  ```bash
15
- # langsung dari repo (tanpa clone), butuh python3 di mesin
12
+ # straight from the repo (no clone); requires python3 on the machine
16
13
  npx tamvanpr/android-skills --help
17
14
  npx tamvanpr/android-skills --target claude --project .
18
15
  npx tamvanpr/android-skills --target cursor
19
16
  ```
20
17
 
21
- Atau pasang global:
18
+ Or install globally:
22
19
 
23
20
  ```bash
24
21
  npm i -g android-skills
@@ -26,7 +23,7 @@ android-skills --target codex --project .
26
23
  android-skills --uninstall --target opencode
27
24
  ```
28
25
 
29
- `android-skills` adalah wrapper yang menjalankan `install.py` dengan argumen yang sama; installer tetap butuh `python3` di PATH.
26
+ `android-skills` is a wrapper that runs `install.py` with the same arguments; the installer still needs `python3` on PATH.
30
27
 
31
28
  ### Via git / ZIP
32
29
 
@@ -36,96 +33,96 @@ cd android-skills
36
33
  python3 install.py
37
34
  ```
38
35
 
39
- Atau dari ZIP: ekstrak, masuk ke folder `android-skills`, lalu `python3 install.py`.
36
+ Or from a ZIP: extract, enter the `android-skills` folder, then run `python3 install.py`.
40
37
 
41
- Flag tersedia: `--project DIR`, `--target`, `--link`, `--agents-md`, `--uninstall`, `--validate` (lihat `--help`).
38
+ Available flags: `--project DIR`, `--target`, `--link`, `--agents-md`, `--uninstall`, `--validate` (see `--help`).
42
39
 
43
- ## Agent yang didukung
40
+ ## Supported agents
44
41
 
45
- | Target | Mekanisme | Lokasi global | Lokasi proyek |
42
+ | Target | Mechanism | Global location | Project location |
46
43
  |---|---|---|---|
47
- | `opencode` | folder skill + command | `~/.config/opencode/` | `<proyek>/.opencode/` |
48
- | `claude` | folder skill | `~/.claude/skills/` | `<proyek>/.claude/skills/` |
49
- | `codex` | instruksi `AGENTS.md` + `<root>/.android-skills/` | `~/.codex/` | `<proyek>/` |
50
- | `gemini` | instruksi `GEMINI.md` + folder skill | `~/.gemini/` | `<proyek>/` |
51
- | `copilot` | `.github/copilot-instructions.md` + folder skill | — (proyek saja) | `<proyek>/.github/` |
52
- | `cursor` | rules `.mdc` di `<root>/rules/` + folder skill | `~/.cursor/` | `<proyek>/.cursor/` |
53
- | `windsurf` | rules `.md` di `<root>/rules/` + folder skill | `~/.windsurf/` | `<proyek>/.windsurf/` |
44
+ | `opencode` | skill folder + commands | `~/.config/opencode/` | `<project>/.opencode/` |
45
+ | `claude` | skill folder | `~/.claude/skills/` | `<project>/.claude/skills/` |
46
+ | `codex` | `AGENTS.md` instructions + `<root>/.android-skills/` | `~/.codex/` | `<project>/` |
47
+ | `gemini` | `GEMINI.md` instructions + skill folder | `~/.gemini/` | `<project>/` |
48
+ | `copilot` | `.github/copilot-instructions.md` + skill folder | — (project only) | `<project>/.github/` |
49
+ | `cursor` | `.mdc` rules in `<root>/rules/` + skill folder | `~/.cursor/` | `<project>/.cursor/` |
50
+ | `windsurf` | `.md` rules in `<root>/rules/` + skill folder | `~/.windsurf/` | `<project>/.windsurf/` |
54
51
 
55
- Untuk target `codex`, `gemini`, dan `copilot`, installer menyalin skill ke folder skill dan menambahkan blok instruksi terkelola (`<!-- android-skills:begin -->`) di file aturan. Blok itu dihapus otomatis oleh `--uninstall`.
52
+ For `codex`, `gemini`, and `copilot`, the installer copies the skills into the skill folder and adds a managed instruction block (`<!-- android-skills:begin -->`) to the rules file. The block is removed automatically by `--uninstall`.
56
53
 
57
- Untuk `cursor` dan `windsurf`, installer menulis satu file rules per skill (dengan `alwaysApply: false`) plus menyalin folder skill agar referensi dan skrip tetap bisa diakses. Bila rules global tidak terbaca oleh UI agent, tambah lewat panel rules.
54
+ For `cursor` and `windsurf`, the installer writes one rules file per skill (with `alwaysApply: false`) plus copies the skill folder so references and scripts remain accessible. If the agent's UI does not pick up the global rules, add them through the rules panel.
58
55
 
59
- Pemasangan ulang menimpa versi lama. Untuk memperbarui: `git pull` lalu jalankan `install.py` lagi (tidak perlu jika memakai `--link`). Untuk jalur npm, ulang `npx tamvanpr/android-skills ...` atau `npm i -g` lagi.
56
+ Reinstalling overwrites the old version. To update: `git pull` then run `install.py` again (not needed when using `--link`). For the npm route, rerun `npx tamvanpr/android-skills ...` or `npm i -g` again.
60
57
 
61
- Di Termux (Android), `python3` dan `git` cukup dipasang lewat `pkg install python git`. Path global tetap `~/.config/opencode`.
58
+ On Termux (Android), just install `python3` and `git` via `pkg install python git`. The global path stays `~/.config/opencode`.
62
59
 
63
- Setelah dipasang, mulai ulang sesi OpenCode. Jika skill tidak muncul, periksa nama folder, huruf kapital `SKILL.md`, dan permission `skill` pada agent yang dipakai.
60
+ After installing, restart the OpenCode session. If a skill does not show up, check the folder name, the capitalization of `SKILL.md`, and the `skill` permission on the agent being used.
64
61
 
65
- ## Cara memakai di OpenCode
62
+ ## Using it in OpenCode
66
63
 
67
- Ada tiga cara:
64
+ There are three ways:
68
65
 
69
- 1. **Otomatis.** OpenCode menampilkan nama dan deskripsi skill ke agent, lalu agent memuatnya lewat tool `skill` bila permintaan cocok.
70
- 2. **Mention `@`.** Di OpenCode v2, ketik `@android-ui-minimal` atau `@android-ui-security-review` di prompt untuk memuat skill secara manual. Di v1, fitur ini tidak ada; minta saja "muat skill android-ui-minimal".
71
- 3. **Command.** `/ui-minimal <layar>` dan `/ui-security <folder>` adalah shortcut opsional dari folder `opencode/commands`.
66
+ 1. **Automatic.** OpenCode shows the skill name and description to the agent, and the agent loads it via the `skill` tool when the request matches.
67
+ 2. **`@` mention.** In OpenCode v2, type `@android-ui` in the prompt to load a skill manually. v1 does not have this feature; just ask "load the android-ui skill".
68
+ 3. **Commands.** `/ui <screen|folder>` is an optional shortcut from the `opencode/commands` folder; the right mode is picked from the argument and context.
72
69
 
73
- Contoh:
70
+ Examples:
74
71
 
75
72
  ```text
76
- @android-ui-minimal
77
- Rombak halaman pengaturan. Pertahankan seluruh fungsi dan state yang ada.
73
+ @android-ui
74
+ Rework the settings screen. Keep all existing functionality and state.
78
75
  ```
79
76
 
80
77
  ```text
81
- @android-ui-security-review
82
- Audit keamanan frontend pada app/src/main, variant debug dan release.
83
- Jangan ubah file; berikan laporan temuan dan false positive.
78
+ @android-ui
79
+ Audit frontend security on app/src/main, debug and release variants.
80
+ Do not modify files; report findings and false positives.
84
81
  ```
85
82
 
86
- ID skill mengikuti nama folder. Jangan ganti nama folder `android-ui-minimal` dan `android-ui-security-review`.
83
+ The skill ID follows the folder name (`android-ui`). Do not rename the `android-ui` folder.
87
84
 
88
- Referensi dan skrip tidak dimuat otomatis. Skill menginstruksikan agent membaca referensi yang relevan dan menjalankan skrip dari folder skill.
85
+ References and scripts are not loaded automatically. The skills instruct the agent to read relevant references and run scripts from the skill folder.
89
86
 
90
- ## Struktur
87
+ ## Structure
91
88
 
92
89
  ```text
93
90
  android-skills/
94
- ├── android-ui-minimal/
95
- │ ├── SKILL.md
96
- │ ├── references/
97
- │ └── scripts/
98
- ├── android-ui-security-review/
91
+ ├── android-ui/
99
92
  │ ├── SKILL.md
100
93
  │ ├── references/
101
94
  │ └── scripts/
102
95
  ├── opencode/
103
96
  │ └── commands/
104
97
  ├── bin/
105
- │ └── android-skills.js (wrapper npm/npx)
98
+ │ └── android-skills.js (npm/npx wrapper)
106
99
  ├── package.json
107
100
  ├── install.py
108
- └── README.md
101
+ ├── README.md (English)
102
+ └── README.id.md (Bahasa Indonesia)
109
103
  ```
110
104
 
111
- Referensi dan skrip tidak dimuat otomatis ketika skill di-mention. Skill menginstruksikan agent untuk membaca referensi yang relevan dan menjalankan skrip yang diperlukan.
105
+ References and scripts are not loaded automatically when a skill is mentioned. The skills instruct the agent to read the relevant references and run the necessary scripts.
112
106
 
113
- ## Skrip
107
+ ## Scripts
114
108
 
115
109
  ```bash
116
- python3 android-ui-minimal/scripts/lint_ui.py app/src/main
117
- python3 android-ui-minimal/scripts/contrast.py "#5B5D58" "#F7F7F5"
118
- python3 android-ui-minimal/scripts/gen_tokens.py "#3B5BA9" --package com.example.app
110
+ python3 android-ui/scripts/lint_ui.py app/src/main
111
+ python3 android-ui/scripts/contrast.py "#5B5D58" "#F7F7F5"
112
+ python3 android-ui/scripts/gen_tokens.py "#3B5BA9" --package com.example.app
119
113
 
120
- python3 android-ui-security-review/scripts/scan.py app --format md --out security-report.md
121
- python3 android-ui-security-review/scripts/scan.py app --fail-on high
114
+ python3 android-ui/scripts/scan.py app --format md --out security-report.md
115
+ python3 android-ui/scripts/scan.py app --fail-on high
122
116
  ```
123
117
 
124
- Path skrip di atas relatif terhadap folder hasil ekstraksi. Setelah terpasang, jalankan skrip melalui path instalasi skill atau path yang diberikan OpenCode.
118
+ The script paths above are relative to the extracted folder. After installing, run scripts via the skill installation path or the path OpenCode provides.
119
+
120
+ ## Limitations
121
+
122
+ - `scan.py` is pattern-based. It does not track data flow and may produce false positives or miss vulnerabilities.
123
+ - `lint_ui.py` catches measurable violations; visual quality still requires human review.
124
+ - Audit results do not guarantee the app is safe and are not a substitute for a pentest or backend review.
125
+ - API recommendations can change. Verify the official documentation for the Android/AndroidX versions you use.
126
+
125
127
 
126
- ## Batasan
127
128
 
128
- - `scan.py` berbasis pola. Ia tidak melacak aliran data dan dapat menghasilkan false positive atau melewatkan celah.
129
- - `lint_ui.py` menangkap pelanggaran yang dapat diukur; kualitas visual tetap memerlukan review manusia.
130
- - Hasil audit bukan jaminan aplikasi aman dan bukan pengganti pentest atau review backend.
131
- - Rekomendasi API dapat berubah. Verifikasi dokumentasi resmi sesuai versi Android/AndroidX yang dipakai.
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: android-ui
3
+ description: Build, rework, reconstruct, or fix the UI of native Android apps (Kotlin, Jetpack Compose, or XML Views) with minimalist, mature, accessible design, and audit the frontend/UI security layer (WebView, exported components, deep links, intents, data leaks, input validation, storage, secrets). Use for UI/UX redesign, theming, design tokens, screens from screenshots, visual audits, security reviews, vulnerability assessment, pre-release checks, or frontend hardening. Security mode is read-only unless asked to fix.
4
+ license: MIT
5
+ compatibility: opencode, Claude Code, and other agents that read SKILL.md
6
+ metadata:
7
+ platform: android
8
+ language: kotlin
9
+ version: "2.0.0"
10
+ ---
11
+
12
+ # Android UI (Build & Audit)
13
+
14
+ One skill for two jobs in the UI layer of native Android apps (Kotlin, Jetpack Compose, or XML Views):
15
+
16
+ - **UI mode** — building, reconstructing, or tidying up UI: minimalist, mature, accessible, consistent.
17
+ - **Security mode** — auditing the UI/frontend security layer: WebView, exported components, deep links, intents, on-screen data leaks, input validation, storage, secrets.
18
+
19
+ Pick the mode from the user's request: visual work → UI mode; security review / assessment / pre-release check / hardening → Security mode. A mixed request (e.g. "tidy up and harden this screen") runs UI mode first, then Security mode over the same scope.
20
+
21
+ This SKILL.md is a summary of the rules and workflows. Details live in `references/`, tooling lives in `scripts/`. Read the relevant reference files before writing code or drawing conclusions; do not rely on this summary alone.
22
+
23
+ ---
24
+
25
+ ## UI mode — Workflow (follow in order)
26
+
27
+ 1. **Clarify first.** Read `references/clarifying-questions.md`. If any of the "ambiguous" conditions are met, stop and ask. At most 4 questions, multiple choice where possible, and include the default you recommend.
28
+ 2. **Audit the current state.** Find the existing theme, tokens, and components (`Theme.kt`, `Color.kt`, `Type.kt`, `themes.xml`, `colors.xml`). Use what is there. Do not create a second design system.
29
+ 3. **Define tokens before screens.** Color, typography, spacing, and radius are decided in one place. See `references/color-and-contrast.md` and `references/typography-spacing.md`.
30
+ 4. **Build the screens** using the patterns in `references/compose-patterns.md` (or the XML equivalents if the project uses Views).
31
+ 5. **Run the automated checks:**
32
+ - `python3 scripts/lint_ui.py <project-path>` to catch style violations.
33
+ - `python3 scripts/contrast.py <fg> <bg>` to verify color contrast.
34
+ 6. **Self-review** with `references/anti-slop-checklist.md`. Fix issues before reporting done.
35
+ 7. **Verify compilation, then report** (see the Safety rules below).
36
+
37
+ ## UI mode — Hard rules
38
+
39
+ **Emoji and decorative symbols**
40
+ - No emoji in UI, string resources, file names, comments, or commit messages unless the user explicitly asks.
41
+ - No stand-in icon characters (e.g. asterisks, unicode arrows, unicode checkmarks). Use Material `Icons` or vector drawables.
42
+ - Do not add icons just to fill space. An icon must carry meaning or an action.
43
+
44
+ **Ask, don't guess**
45
+ - If the platform (Compose or Views), the screen's purpose, the real data, or the visual direction is unclear, ask.
46
+ - If the user attaches a screenshot, treat it as the structural reference. Ask whether the colors and fonts must be kept or may be changed.
47
+ - Do not invent features, marketing copy, or dummy data that looks real. Use neutral placeholders and mark them clearly.
48
+
49
+ **Color**
50
+ - One accent color. Everything else neutral. At most two color families per screen, excluding status colors (error, success).
51
+ - All colors go through theme tokens (`MaterialTheme.colorScheme.*` or theme attributes). `Color(0xFF...)` inside screen composables is forbidden.
52
+ - Body text needs at least 4.5:1 contrast; large text and functional icons at least 3:1. Verify with `scripts/contrast.py`.
53
+ - Provide both a light and a dark scheme. Dark is not pure black `#000000` unless the user asks for an OLED-first screen. Light is not blinding white forced onto every surface.
54
+ - No decorative gradients, glows, or stacked shadows unless asked.
55
+
56
+ **Layout**
57
+ - 4dp spacing grid. The values in use: 4, 8, 12, 16, 24, 32, 48. No ad-hoc numbers like 13dp or 27dp.
58
+ - One clear hierarchy per screen: one heading, one primary action.
59
+ - Separate with space and tonal surfaces first, then a thin divider, and cards only when an element truly stands alone. Do not wrap everything in cards.
60
+ - Touch targets at least 48dp. Content must not be clipped at font scale 1.3 and a 360dp screen.
61
+ - Support edge-to-edge and window insets properly.
62
+
63
+ **Typography**
64
+ - At most two weights per screen. Use the `MaterialTheme.typography` scale. No ad-hoc `fontSize = 17.sp`.
65
+ - Text in `sp`, distances in `dp`.
66
+
67
+ **Motion**
68
+ - Only motion that explains a state change. Durations 150–250 ms. Respect the "remove animations" setting.
69
+
70
+ **Accessibility**
71
+ - `contentDescription` meaningful for action icons, `null` for decorative ones.
72
+ - Do not rely on color alone to communicate state.
73
+
74
+ **Scope of changes**
75
+ - Change only what was asked. No refactoring the architecture, swapping libraries, or moving packages unless asked.
76
+ - Do not add new dependencies without asking.
77
+ - Do not touch business logic when reconstructing the UI. Separate state and events from the view (state hoisting).
78
+
79
+ ## UI mode — "AI slop" signs to avoid
80
+
81
+ Purple-to-blue gradients, very large corner-radius cards with shadows everywhere, colored circle icons on every row, marketing-style headlines ("Welcome to the new experience"), empty states with emoji illustrations, badges and chips with no purpose, every button in the primary color, uniform spacing with no rhythm. The full list is in `references/anti-slop-checklist.md`.
82
+
83
+ ## Safety rules (MANDATORY, all modes)
84
+
85
+ Goal: no commit that breaks the build, no red CI, and no feature "reversed" back to an old version just to get green.
86
+
87
+ - **Verify before pushing.** If the project has Gradle, run the relevant compile and unit tests (e.g. `./gradlew compileDebugKotlin` then `:app:testDebugUnitTest`) and fix until they pass BEFORE pushing. If they cannot run in the agent's environment (no JDK/SDK), say so explicitly and limit changes to small pieces that are certainly safe.
88
+ - **One commit = one complete, compilable thing.** Never send a dangling piece (a parameter without a definition, a missing import, a half-finished function). Split big changes into several sequential commits, each of which still builds.
89
+ - **Fix forward, don't back up.** The build is broken because of your change? Fix the change, not by undoing the design. Rollback is only allowed as the user's decision.
90
+ - **Keep project conventions.** Strings go through resources (`stringResource`), names and structure follow the project's existing patterns. Do not change working conventions unasked.
91
+ - **Report what was verified.** In the final report, name the checks that actually ran (compile, tests, linter, contrast) and the ones that could not run.
92
+
93
+ ---
94
+
95
+ ## Security mode — Workflow
96
+
97
+ 1. **Define the scope.** Which folder, which module, which build variant (debug or release), which targetSdk. If unclear, ask. Do not inspect outside the folder given.
98
+ 2. **Automated scan:**
99
+ ```
100
+ python3 scripts/scan.py <project-path> --format md --out security-report.md
101
+ ```
102
+ Options: `--min-severity medium`, `--format json`, `--fail-on high` (for CI), `--include-tests`.
103
+ 3. **Manually verify every finding.** The scanner is regex, not data-flow analysis. Open the file, read the context, decide whether it is actually exploitable. Mark each finding as confirmed, possible, or false positive.
104
+ 4. **Trace what the scanner does not catch** using `references/checklist.md`: deep link logic, login flows, payment screens, token storage, share intents, FileProvider.
105
+ 5. **Report** with `references/report-template.md`. Order by severity; include location, impact, and a concrete fix.
106
+ 6. **Fix only when asked** — and follow the Safety rules above (minimal change per finding, one finding one change, compilation passes, explain the side effects).
107
+
108
+ ## Security mode — Hard rules
109
+
110
+ - **Read-only by default.** Do not modify files, add dependencies, or change build configuration unless the user asks for fixes.
111
+ - **Do not write exploits.** No malware, active payloads, or ready-to-use PoCs against other people's apps. Explain reproduction steps conceptually and minimally (e.g. "send an intent with extra X to activity Y") for the user's own app.
112
+ - **Only the user's own app, or one explicitly authorized.** If it looks like the user is asking to attack a third-party app, stop and state the limit.
113
+ - **Do not print full secrets.** If you find an API key, token, or private key, show only the first 4 characters and recommend rotation.
114
+ - **Do not claim "safe".** Say "no issues found in this pass" and name what was not checked.
115
+ - **Ask when ambiguous.** Unclear whether this is a public or internal app, whether it processes sensitive data, or what the release target is. That context changes the severity.
116
+ - **Distinguish debug from release.** Findings in `src/debug/` or behind `BuildConfig.DEBUG` are downgraded, but still recorded if they can leak into release.
117
+ - **Be honest about limits.** This scanner does not replace a pentest, an architecture review, or backend analysis.
118
+ - **No emoji** in reports or code.
119
+
120
+ ## Security mode — Severity levels
121
+
122
+ | Level | Meaning | Examples |
123
+ |---|---|---|
124
+ | critical | Directly exploitable, high impact | Trust-all SSL, private key in the repo |
125
+ | high | Exploitable under mild conditions | `addJavascriptInterface` with untrusted content, exported provider without a permission |
126
+ | medium | Needs specific conditions or weakens a defense | No FLAG_SECURE on a sensitive screen, `allowBackup` enabled |
127
+ | low | Hardening | Logging stack traces, `printStackTrace()` |
128
+ | info | Point to check manually | Deep link parameter |
129
+
130
+ Assessment details are in `references/report-template.md`.
131
+
132
+ ## Security mode — Coverage
133
+
134
+ 1. WebView and web content (`references/webview.md`)
135
+ 2. Components, intents, deep links, PendingIntent, FileProvider (`references/components-intents.md`)
136
+ 3. Sensitive data on screen: screenshots, recents, clipboard, autofill, keyboard, logs, persisted state (`references/sensitive-data-ui.md`)
137
+ 4. Inputs and state: injection, path traversal, untrusted navigation arguments (`references/input-and-state.md`)
138
+ 5. Network and storage from the UI perspective (`references/network-storage.md`)
139
+ 6. Compose-specific: `rememberSaveable`, semantics, `AndroidView`, text fields (`references/compose-risks.md`)
140
+
141
+ ## Security mode — Suppressing false positives
142
+
143
+ Add a comment on the same line or the line above, with the reason:
144
+
145
+ ```kotlin
146
+ // sec-ignore: W-JS local content from assets, no external URLs loaded
147
+ settings.javaScriptEnabled = true
148
+ ```
149
+
150
+ Do not suppress a finding without a written reason.
151
+
152
+ ---
153
+
154
+ ## File map
155
+
156
+ | File | Contents |
157
+ |---|---|
158
+ | `references/clarifying-questions.md` | When to ask, question templates |
159
+ | `references/color-and-contrast.md` | How to pick a palette, ready-made neutral palettes, contrast rules |
160
+ | `references/typography-spacing.md` | Type scale, spacing, radius, elevation |
161
+ | `references/compose-patterns.md` | Compose code patterns and XML equivalents |
162
+ | `references/reconstruction-workflow.md` | How to read a screenshot or an old screen and reconstruct it |
163
+ | `references/anti-slop-checklist.md` | Final checklist |
164
+ | `references/checklist.md` | Numbered security checklist (IDs are used by the scanner and the report) |
165
+ | `references/webview.md` | Safe WebView configuration and anti-patterns |
166
+ | `references/components-intents.md` | Exported, intent filters, deep links, PendingIntent |
167
+ | `references/sensitive-data-ui.md` | Leaks through the screen and device |
168
+ | `references/input-and-state.md` | Input validation and external data |
169
+ | `references/network-storage.md` | Cleartext, trust managers, storage |
170
+ | `references/compose-risks.md` | Compose-specific risks |
171
+ | `references/report-template.md` | Report format and severity assessment |
172
+ | `scripts/lint_ui.py` | Style linter for `.kt` and `.xml` |
173
+ | `scripts/contrast.py` | WCAG contrast calculator |
174
+ | `scripts/gen_tokens.py` | Generates `Color.kt` and `Theme.kt` from one accent color |
175
+ | `scripts/scan.py` | Static security scanner |
176
+
177
+ ## Finding the scripts
178
+
179
+ The `scripts/...` paths above are relative to this skill folder, not the project folder. Use the base directory provided when the skill is loaded. If there is none, search:
180
+
181
+ ```
182
+ find ~/.config/opencode .opencode ~/.claude .claude -path '*android-ui/scripts/scan.py' 2>/dev/null
183
+ ```
184
+
185
+ ## Limits of this skill
186
+
187
+ UI mode is about the look and structure of the UI only; security mode only finds gaps in the frontend/UI layer, not backend analysis or a pentest. This skill does not guarantee a single correct design decision. If a rule here conflicts with an explicit user request, follow the user and state the consequence in one sentence.
@@ -0,0 +1,61 @@
1
+ # Anti-slop checklist
2
+
3
+ Run this before reporting done. Answer yes or no. Every "no" in the Required section must be fixed.
4
+
5
+ ## Required
6
+
7
+ - [ ] No emoji in code, strings, comments, or file names
8
+ - [ ] No decorative unicode characters used as icons
9
+ - [ ] One accent color, the rest neutral
10
+ - [ ] No decorative gradients
11
+ - [ ] No `Color(0x...)` outside the theme files
12
+ - [ ] Spacing only from the 4dp scale
13
+ - [ ] Typography only from `MaterialTheme.typography`
14
+ - [ ] Text contrast at least 4.5:1, components 3:1
15
+ - [ ] Both light and dark checked
16
+ - [ ] Touch targets at least 48dp
17
+ - [ ] Data screens have empty, loading, and error states
18
+ - [ ] `contentDescription` correct (meaningful or null)
19
+ - [ ] UI text lives in `strings.xml`, not hardcoded
20
+ - [ ] No new dependencies without approval
21
+ - [ ] Business logic untouched
22
+
23
+ ## AI template tells (remove or replace)
24
+
25
+ | Symptom | Fix |
26
+ |---|---|
27
+ | Purple-blue gradient header | Solid neutral color |
28
+ | Every item wrapped in a shadowed card | Plain row + divider |
29
+ | Colored circle icons on every row | Remove, or keep one functional icon |
30
+ | Promotional headline ("Discover the new experience") | Functional headline ("Notes") |
31
+ | Long greeting text on the main page | Remove |
32
+ | Empty state with big illustration and emoji | One sentence + one action |
33
+ | Every button in the primary color | One primary, the rest outlined or text |
34
+ | Chips and badges with no purpose | Remove |
35
+ | 24dp+ radius on everything | 8/12/16 scale |
36
+ | Soft shadows on every surface | Tonal or thin line |
37
+ | Center alignment for long text | Left alignment |
38
+ | Dummy data that looks real ("John Smith, 3 hours ago") | Neutral, clearly marked placeholder |
39
+ | Entry animation on every element | Only important state transitions |
40
+ | Bold text everywhere | One emphasis level |
41
+ | Random color per category | One accent, differentiate via labels |
42
+
43
+ ## Quick tests
44
+
45
+ 1. **Blur test:** shrink or blur the screenshot. Does one main thing still stand out?
46
+ 2. **Grayscale test:** is the hierarchy still readable?
47
+ 3. **Removal test:** remove one element. Does anything lose its function? If not, leave it removed.
48
+ 4. **Large font test:** at 1.5x, nothing clipped or overlapping?
49
+ 5. **Narrow screen test:** at 360dp, no horizontal scrolling?
50
+ 6. **Long content test:** text twice as long, does the layout hold?
51
+
52
+ ## UI copy
53
+
54
+ - Short, clear, verbs for actions ("Save", "Delete").
55
+ - One language per app, unless it is truly multilingual via resources.
56
+ - No excessive exclamation marks, no promotional tone.
57
+ - Error messages name the cause and the next step.
58
+
59
+ ## Honest reporting
60
+
61
+ If a checklist item cannot be met (e.g. a preview cannot run in this environment), say so plainly. Do not write "verified" for something that was not run.
@@ -0,0 +1,95 @@
1
+ # Android UI security checklist
2
+
3
+ IDs are used by `scripts/scan.py` and by reports. For each item: risk, how to check, fix.
4
+
5
+ ## A. WebView
6
+
7
+ | ID | Risk | Check | Fix |
8
+ |---|---|---|---|
9
+ | W-JS | XSS becomes code execution in the app with untrusted content | `javaScriptEnabled` | Enable only for trusted content |
10
+ | W-INTERFACE | Web page calls Kotlin code | `addJavascriptInterface` | Minimal methods, local content only, or WebMessageListener with origin restrictions |
11
+ | W-FILE / W-FILE2 | Read local files from a malicious page | `allowFileAccess*`, `allowUniversalAccessFromFileURLs` | Disable, use `WebViewAssetLoader` |
12
+ | W-MIXED | http content injected into an https page | `MIXED_CONTENT_ALWAYS_ALLOW` | `NEVER_ALLOW` |
13
+ | W-SSL | MITM | `onReceivedSslError` + `proceed()` | `cancel()` |
14
+ | W-DEBUG | WebView inspection in release | `setWebContentsDebuggingEnabled(true)` | Debug only |
15
+ | W-LOADURL-HTTP / W-LOADURL-DYN | Loading http or untrusted URLs | `loadUrl("http://...")`, `loadUrl(variable)` | HTTPS, allowlist schemes and hosts |
16
+ | W-LOADDATA | Untrusted data interpolated into HTML | `loadData*` with interpolation | Escape, or do not build HTML |
17
+ | W-CONTENT | Content provider access from WebView | `allowContentAccess` | Disable if not needed |
18
+ | W-EVALJS | Script injection | `evaluateJavascript` with a built string | JSON escaping, `postWebMessage` |
19
+
20
+ ## B. Components and intents
21
+
22
+ | ID | Risk | Check | Fix |
23
+ |---|---|---|---|
24
+ | M-EXPORT-IMPLICIT | Component opened by accident | intent-filter without `exported` | Set it explicitly |
25
+ | M-EXPORT | Other apps can trigger the component | `exported="true"` | Signature permission, or false |
26
+ | M-PROVIDER / M-GRANT | Data leak | exported provider, grantUriPermissions | Restrict paths and permissions |
27
+ | M-APPLINK | Link hijacking | https without `autoVerify` | Verified App Links |
28
+ | M-DEEPLINK | Untrusted input | BROWSABLE intent-filter | Validate parameters |
29
+ | C-REDIRECT | Intent redirection | Launching an Intent taken from an extra | Validate the target, strip URI flags |
30
+ | C-PENDING | Intent modified by another app | PendingIntent without flags | `FLAG_IMMUTABLE`, explicit Intent |
31
+ | C-RECEIVER | Receiver exposed | `registerReceiver` | `RECEIVER_NOT_EXPORTED` |
32
+ | C-BROADCAST | Data leaks via broadcast | `sendBroadcast` | `setPackage`, permission |
33
+ | C-IMPLICIT | Opening arbitrary URIs | `ACTION_VIEW` + dynamic Uri | Validate scheme and host |
34
+ | C-FILEPROVIDER | Sharing more files than intended | root path in provider XML | Specific subfolder |
35
+ | M-PERM | Attack surface | Risky permissions | Remove, or use a safer API |
36
+
37
+ ## C. Sensitive data in the UI
38
+
39
+ | ID | Risk | Check | Fix |
40
+ |---|---|---|---|
41
+ | U-SECURE | Screenshot and recents preview leak | No `FLAG_SECURE` on a sensitive screen | Set the flag per screen |
42
+ | U-TAPJACK | Overlay deceives the user | Sensitive button without touch filtering | `filterTouchesWhenObscured` |
43
+ | U-LOG | Data leaks via logcat | Logs containing tokens, passwords | Remove the logs, strip in release |
44
+ | U-STACKTRACE | Internal info leaks | `printStackTrace`, exception toasts | Generic message |
45
+ | U-CLIPBOARD | Other apps read the clipboard | `setPrimaryClip` with secret data | Avoid, mark as sensitive |
46
+ | U-SAVEABLE | Secrets in the Bundle | `rememberSaveable` + password | `remember` |
47
+ | U-AUTOFILL | Autofill sends data to a third-party service | `importantForAutofill="yes"` | Check sensitive fields manually |
48
+ | U-PWFIELD / U-INPUTTYPE | Password visible or cached by the keyboard | TextField without transformation | Transformation + keyboard type |
49
+
50
+ ## D. Inputs and state
51
+
52
+ | ID | Risk | Check | Fix |
53
+ |---|---|---|---|
54
+ | I-SQL | SQL injection | `rawQuery` with a built string | Parameter binding |
55
+ | I-PATH | Path traversal | `File(...)` from input | canonicalPath + allowlist |
56
+ | I-DEEPLINK | Untrusted parameter | `getQueryParameter` | Validate |
57
+ | I-HTML | Rendering untrusted HTML | `Html.fromHtml` | Trusted source |
58
+ | I-RANDOM | Guessable tokens | `Random` | `SecureRandom` |
59
+ | I-HASH / I-CIPHER | Weak crypto | MD5, SHA-1, ECB | SHA-256, AES-GCM |
60
+
61
+ ## E. Network and storage
62
+
63
+ | ID | Risk | Check | Fix |
64
+ |---|---|---|---|
65
+ | N-HTTP | Cleartext | `http://` URLs | HTTPS |
66
+ | M-CLEARTEXT / N-NSC-CLEAR | Global cleartext | Manifest, NSC | Disable |
67
+ | N-NSC-USER | User CAs trusted | `src="user"` | Debug only |
68
+ | N-TRUSTALL / N-HOSTNAME | Full MITM | Custom TrustManager and HostnameVerifier | Remove |
69
+ | N-PINNING | Certificate spoofing | OkHttp without pinning | Consider pinning |
70
+ | S-PREFS | Secrets readable | Plain SharedPreferences | Keystore encryption |
71
+ | S-WORLD | Files readable by other apps | `MODE_WORLD_*` | `MODE_PRIVATE` |
72
+ | S-EXTERNAL | Data on shared storage | External storage | Private storage |
73
+ | M-BACKUP | Data goes with backups | `allowBackup` | Disable, or exclude |
74
+ | M-DEBUGGABLE | Debugging in production | `debuggable` | Remove |
75
+
76
+ ## F. Secrets
77
+
78
+ | ID | Check |
79
+ |---|---|
80
+ | S-SECRET | Literal values on variables named key, token, secret |
81
+ | S-PRIVKEY | Private key headers |
82
+ | S-AWS, S-TOKENFMT, S-GOOGLEKEY | Known token formats |
83
+
84
+ Rule: anything shipped to a client is public. Real secrets live on the server.
85
+
86
+ ## Manual checks that cannot be automated
87
+
88
+ 1. Are sensitive screens reachable only after authentication? What happens when the process is killed and reopened via a deep link?
89
+ 2. Does logout clear state, image caches, WebView cookies, and the clipboard?
90
+ 3. Do sensitive actions (transfer, delete account) require re-authentication or BiometricPrompt with CryptoObject?
91
+ 4. Do error messages leak the difference between "user not found" and "wrong password"?
92
+ 5. Is there security logic done only on the client (price check, role check)? It must be repeated on the server.
93
+ 6. Are server-provided images or URLs loaded without size or scheme limits?
94
+ 7. Do third-party libraries (WebView wrappers, ad SDKs) add permissions or exported components via manifest merge? Check the merged manifest (`app/build/intermediates/merged_manifests`).
95
+ 8. Is ProGuard or R8 enabled for release, and does it not leak sensitive names?
@@ -0,0 +1,55 @@
1
+ # When to ask
2
+
3
+ Asking is mandatory, not optional, when any of the conditions below holds. The goal is to prevent building the wrong thing and wasting the user's time.
4
+
5
+ ## Trigger conditions
6
+
7
+ 1. **Platform unclear.** It is not visible whether the project uses Jetpack Compose, XML Views, or a mix. Check `build.gradle(.kts)` first (`buildFeatures { compose = true }`). If still unclear, ask.
8
+ 2. **Screen purpose unclear.** "Make a nice page" without knowing what it does.
9
+ 3. **Conflicting visual references.** E.g. the user asks for minimalism but attaches a dense, colorful screenshot.
10
+ 4. **Real data unknown.** What is in the list, how many items, maximum text length, with images or not.
11
+ 5. **Large scope.** The request touches more than 3 screens, or changes the global theme.
12
+ 6. **Brand color mentioned but not given.** The user says "my app's color" without values.
13
+ 7. **A choice that changes a lot of code.** E.g. changing the font, changing navigation, changing the state pattern.
14
+ 8. **Language and content.** UI text in English or another language, or both (needs separate `strings.xml`).
15
+
16
+ ## When not to ask
17
+
18
+ - Small, clear changes (adjust padding, tidy one button).
19
+ - The answer can be read from the existing code. Read the code before asking.
20
+ - Questions whose answer has a safe default. Take the default, state it at the top of the report, and proceed.
21
+
22
+ ## Question format
23
+
24
+ - At most 4 questions at once.
25
+ - One question, one thing.
26
+ - Give 2–4 options and mark the recommendation.
27
+ - Write in the language the user is using.
28
+ - Do not ask what the user already answered in a previous message.
29
+
30
+ ## Template
31
+
32
+ ```
33
+ Before starting, a few things to confirm:
34
+
35
+ 1. Does this project use Compose or XML Views?
36
+ a. Compose (recommended — I see compose = true in build.gradle)
37
+ b. XML Views
38
+ c. Mixed
39
+
40
+ 2. Which accent color?
41
+ a. Keep the current color (#xxxxxx)
42
+ b. Suggest one cool-neutral accent
43
+ c. I'll provide my own hex value
44
+
45
+ 3. How many items does this screen usually show, and are there images?
46
+ (Affects the choice of list, card, or plain rows)
47
+ ```
48
+
49
+ ## After the user answers
50
+
51
+ Summarize the decisions in one short block ("Decision: Compose, accent steel-blue #3B5BA9, plain rows without cards"), then proceed. Do not re-ask the same things.
52
+
53
+ ## If the user does not reply or is unreachable
54
+
55
+ Take the most conservative assumptions, write the assumption list at the top of the report, and make the changes easy to swap (tokens, not scattered values).