android-skills 1.1.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 +22 -171
  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 +2 -3
  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,27 +1,12 @@
1
1
  # Android Skills
2
2
 
3
- Two skills for Android work:
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` — building, reconstructing, and polishing Android UIs.
6
- - `android-ui-security-review` — security review of the Android UI/frontend layer.
7
5
 
8
- > [!NOTE]
9
- > **Bahasa:** [English](#english) · [Bahasa Indonesia](#bahasa-indonesia)
10
6
 
11
- ---
7
+ ## Installation
12
8
 
13
- ## English
14
-
15
- This package contains two skills for Android work:
16
-
17
- - `android-ui-minimal` — building, reconstructing, and polishing Android UIs.
18
- - `android-ui-security-review` — security review of the Android UI/frontend layer.
19
-
20
- It works with multiple AI agents: **OpenCode** (default), **Claude Code**, **Codex CLI**, **Gemini CLI**, **GitHub Copilot**, **Cursor**, and **Windsurf**.
21
-
22
- ### Installation
23
-
24
- #### Via npm / npx
9
+ ### Via npm / npx
25
10
 
26
11
  ```bash
27
12
  # straight from the repo (no clone); requires python3 on the machine
@@ -40,7 +25,7 @@ android-skills --uninstall --target opencode
40
25
 
41
26
  `android-skills` is a wrapper that runs `install.py` with the same arguments; the installer still needs `python3` on PATH.
42
27
 
43
- #### Via git / ZIP
28
+ ### Via git / ZIP
44
29
 
45
30
  ```bash
46
31
  git clone https://github.com/tamvanpr/android-skills.git
@@ -52,7 +37,7 @@ Or from a ZIP: extract, enter the `android-skills` folder, then run `python3 ins
52
37
 
53
38
  Available flags: `--project DIR`, `--target`, `--link`, `--agents-md`, `--uninstall`, `--validate` (see `--help`).
54
39
 
55
- ### Supported agents
40
+ ## Supported agents
56
41
 
57
42
  | Target | Mechanism | Global location | Project location |
58
43
  |---|---|---|---|
@@ -74,40 +59,36 @@ On Termux (Android), just install `python3` and `git` via `pkg install python gi
74
59
 
75
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.
76
61
 
77
- ### Using it in OpenCode
62
+ ## Using it in OpenCode
78
63
 
79
64
  There are three ways:
80
65
 
81
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.
82
- 2. **`@` mention.** In OpenCode v2, type `@android-ui-minimal` or `@android-ui-security-review` in the prompt to load a skill manually. v1 does not have this feature; just ask "load the android-ui-minimal skill".
83
- 3. **Commands.** `/ui-minimal <screen>` and `/ui-security <folder>` are optional shortcuts from the `opencode/commands` folder.
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.
84
69
 
85
70
  Examples:
86
71
 
87
72
  ```text
88
- @android-ui-minimal
73
+ @android-ui
89
74
  Rework the settings screen. Keep all existing functionality and state.
90
75
  ```
91
76
 
92
77
  ```text
93
- @android-ui-security-review
78
+ @android-ui
94
79
  Audit frontend security on app/src/main, debug and release variants.
95
80
  Do not modify files; report findings and false positives.
96
81
  ```
97
82
 
98
- Skill IDs follow the folder names. Do not rename the `android-ui-minimal` and `android-ui-security-review` folders.
83
+ The skill ID follows the folder name (`android-ui`). Do not rename the `android-ui` folder.
99
84
 
100
85
  References and scripts are not loaded automatically. The skills instruct the agent to read relevant references and run scripts from the skill folder.
101
86
 
102
- ### Structure
87
+ ## Structure
103
88
 
104
89
  ```text
105
90
  android-skills/
106
- ├── android-ui-minimal/
107
- │ ├── SKILL.md
108
- │ ├── references/
109
- │ └── scripts/
110
- ├── android-ui-security-review/
91
+ ├── android-ui/
111
92
  │ ├── SKILL.md
112
93
  │ ├── references/
113
94
  │ └── scripts/
@@ -117,161 +98,31 @@ android-skills/
117
98
  │ └── android-skills.js (npm/npx wrapper)
118
99
  ├── package.json
119
100
  ├── install.py
120
- └── README.md
101
+ ├── README.md (English)
102
+ └── README.id.md (Bahasa Indonesia)
121
103
  ```
122
104
 
123
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.
124
106
 
125
- ### Scripts
107
+ ## Scripts
126
108
 
127
109
  ```bash
128
- python3 android-ui-minimal/scripts/lint_ui.py app/src/main
129
- python3 android-ui-minimal/scripts/contrast.py "#5B5D58" "#F7F7F5"
130
- 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
131
113
 
132
- python3 android-ui-security-review/scripts/scan.py app --format md --out security-report.md
133
- 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
134
116
  ```
135
117
 
136
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.
137
119
 
138
- ### Limitations
120
+ ## Limitations
139
121
 
140
122
  - `scan.py` is pattern-based. It does not track data flow and may produce false positives or miss vulnerabilities.
141
123
  - `lint_ui.py` catches measurable violations; visual quality still requires human review.
142
124
  - Audit results do not guarantee the app is safe and are not a substitute for a pentest or backend review.
143
125
  - API recommendations can change. Verify the official documentation for the Android/AndroidX versions you use.
144
126
 
145
- ---
146
-
147
- ## Bahasa Indonesia
148
-
149
- Paket ini berisi dua skill untuk pekerjaan Android:
150
-
151
- - `android-ui-minimal` — membangun, merekonstruksi, dan merapikan UI Android.
152
- - `android-ui-security-review` — meninjau keamanan pada lapisan UI/frontend Android.
153
-
154
- Didukung untuk berbagai agent AI: **OpenCode** (default), **Claude Code**, **Codex CLI**, **Gemini CLI**, **GitHub Copilot**, **Cursor**, dan **Windsurf**.
155
-
156
- ### Instalasi
157
-
158
- #### Via npm / npx
159
-
160
- ```bash
161
- # langsung dari repo (tanpa clone), butuh python3 di mesin
162
- npx tamvanpr/android-skills --help
163
- npx tamvanpr/android-skills --target claude --project .
164
- npx tamvanpr/android-skills --target cursor
165
- ```
166
-
167
- Atau pasang global:
168
-
169
- ```bash
170
- npm i -g android-skills
171
- android-skills --target codex --project .
172
- android-skills --uninstall --target opencode
173
- ```
174
-
175
- `android-skills` adalah wrapper yang menjalankan `install.py` dengan argumen yang sama; installer tetap butuh `python3` di PATH.
176
-
177
- #### Via git / ZIP
178
-
179
- ```bash
180
- git clone https://github.com/tamvanpr/android-skills.git
181
- cd android-skills
182
- python3 install.py
183
- ```
184
-
185
- Atau dari ZIP: ekstrak, masuk ke folder `android-skills`, lalu `python3 install.py`.
186
-
187
- Flag tersedia: `--project DIR`, `--target`, `--link`, `--agents-md`, `--uninstall`, `--validate` (lihat `--help`).
188
-
189
- ### Agent yang didukung
190
-
191
- | Target | Mekanisme | Lokasi global | Lokasi proyek |
192
- |---|---|---|---|
193
- | `opencode` | folder skill + command | `~/.config/opencode/` | `<proyek>/.opencode/` |
194
- | `claude` | folder skill | `~/.claude/skills/` | `<proyek>/.claude/skills/` |
195
- | `codex` | instruksi `AGENTS.md` + `<root>/.android-skills/` | `~/.codex/` | `<proyek>/` |
196
- | `gemini` | instruksi `GEMINI.md` + folder skill | `~/.gemini/` | `<proyek>/` |
197
- | `copilot` | `.github/copilot-instructions.md` + folder skill | — (proyek saja) | `<proyek>/.github/` |
198
- | `cursor` | rules `.mdc` di `<root>/rules/` + folder skill | `~/.cursor/` | `<proyek>/.cursor/` |
199
- | `windsurf` | rules `.md` di `<root>/rules/` + folder skill | `~/.windsurf/` | `<proyek>/.windsurf/` |
200
-
201
- 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`.
202
-
203
- 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.
204
-
205
- 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.
206
-
207
- Di Termux (Android), `python3` dan `git` cukup dipasang lewat `pkg install python git`. Path global tetap `~/.config/opencode`.
208
-
209
- Setelah dipasang, mulai ulang sesi OpenCode. Jika skill tidak muncul, periksa nama folder, huruf kapital `SKILL.md`, dan permission `skill` pada agent yang dipakai.
210
-
211
- ### Cara memakai di OpenCode
212
-
213
- Ada tiga cara:
214
-
215
- 1. **Otomatis.** OpenCode menampilkan nama dan deskripsi skill ke agent, lalu agent memuatnya lewat tool `skill` bila permintaan cocok.
216
- 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".
217
- 3. **Command.** `/ui-minimal <layar>` dan `/ui-security <folder>` adalah shortcut opsional dari folder `opencode/commands`.
218
-
219
- Contoh:
220
-
221
- ```text
222
- @android-ui-minimal
223
- Rombak halaman pengaturan. Pertahankan seluruh fungsi dan state yang ada.
224
- ```
225
-
226
- ```text
227
- @android-ui-security-review
228
- Audit keamanan frontend pada app/src/main, variant debug dan release.
229
- Jangan ubah file; berikan laporan temuan dan false positive.
230
- ```
231
-
232
- ID skill mengikuti nama folder. Jangan ganti nama folder `android-ui-minimal` dan `android-ui-security-review`.
233
-
234
- Referensi dan skrip tidak dimuat otomatis. Skill menginstruksikan agent membaca referensi yang relevan dan menjalankan skrip dari folder skill.
235
-
236
- ### Struktur
237
-
238
- ```text
239
- android-skills/
240
- ├── android-ui-minimal/
241
- │ ├── SKILL.md
242
- │ ├── references/
243
- │ └── scripts/
244
- ├── android-ui-security-review/
245
- │ ├── SKILL.md
246
- │ ├── references/
247
- │ └── scripts/
248
- ├── opencode/
249
- │ └── commands/
250
- ├── bin/
251
- │ └── android-skills.js (wrapper npm/npx)
252
- ├── package.json
253
- ├── install.py
254
- └── README.md
255
- ```
256
-
257
- Referensi dan skrip tidak dimuat otomatis ketika skill di-mention. Skill menginstruksikan agent untuk membaca referensi yang relevan dan menjalankan skrip yang diperlukan.
258
-
259
- ### Skrip
260
-
261
- ```bash
262
- python3 android-ui-minimal/scripts/lint_ui.py app/src/main
263
- python3 android-ui-minimal/scripts/contrast.py "#5B5D58" "#F7F7F5"
264
- python3 android-ui-minimal/scripts/gen_tokens.py "#3B5BA9" --package com.example.app
265
-
266
- python3 android-ui-security-review/scripts/scan.py app --format md --out security-report.md
267
- python3 android-ui-security-review/scripts/scan.py app --fail-on high
268
- ```
269
-
270
- Path skrip di atas relatif terhadap folder hasil ekstraksi. Setelah terpasang, jalankan skrip melalui path instalasi skill atau path yang diberikan OpenCode.
271
127
 
272
- ### Batasan
273
128
 
274
- - `scan.py` berbasis pola. Ia tidak melacak aliran data dan dapat menghasilkan false positive atau melewatkan celah.
275
- - `lint_ui.py` menangkap pelanggaran yang dapat diukur; kualitas visual tetap memerlukan review manusia.
276
- - Hasil audit bukan jaminan aplikasi aman dan bukan pengganti pentest atau review backend.
277
- - 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?