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/install.py CHANGED
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env python3
2
- """Pemasang skill Android untuk berbagai agent AI.
2
+ """Installer for the Android skill, for a range of AI agents.
3
3
 
4
- Didukung: opencode (default), claude, codex, gemini, copilot, cursor, windsurf.
4
+ Supported: opencode (default), claude, codex, gemini, copilot, cursor, windsurf.
5
5
 
6
- Pemakaian:
6
+ Usage:
7
7
  python3 install.py # OpenCode global
8
- python3 install.py --project . # OpenCode proyek
9
- python3 install.py --target claude --project . # Claude Code proyek
8
+ python3 install.py --project . # OpenCode project
9
+ python3 install.py --target claude --project . # Claude Code project
10
10
  python3 install.py --target cursor # Cursor global
11
- python3 install.py --target codex --project . # Codex: .android-skills/ + blok di AGENTS.md
11
+ python3 install.py --target codex --project . # Codex: .android-skills/ + block in AGENTS.md
12
12
  python3 install.py --target gemini --project . # Gemini CLI: GEMINI.md
13
- python3 install.py --target copilot --project . # GitHub Copilot: .github/copilot-instructions.md
14
- python3 install.py --link # symlink, bukan salinan
15
- python3 install.py --agents-md # tulis blok instruksi ke file aturan (skills mode)
13
+ python3 install.py --target copilot --project . # GitHub Copilot: .github/copilot-instructions.md
14
+ python3 install.py --link # symlink instead of a copy
15
+ python3 install.py --agents-md # write the instructions block into the rules file (skills mode)
16
16
  python3 install.py --uninstall
17
17
  python3 install.py --validate
18
18
 
19
- OpenCode & Claude Code memakai layout skill <root>/skills/<nama>/SKILL.md .
20
- Cursor & Windsurf memakai file rules di <root>/rules/ .
21
- Codex, Gemini CLI, dan Copilot memakai file instruksi (AGENTS.md, GEMINI.md,
22
- copilot-instructions.md) plus folder skill di <root>/.android-skills/ (proyek)
23
- atau <root>/android-skills/ (global).
19
+ OpenCode & Claude Code use the skill layout <root>/skills/<name>/SKILL.md .
20
+ Cursor & Windsurf use rules files in <root>/rules/ .
21
+ Codex, Gemini CLI, and Copilot use instruction files (AGENTS.md, GEMINI.md,
22
+ copilot-instructions.md) plus the skill folder in <root>/.android-skills/ (project)
23
+ or <root>/android-skills/ (global).
24
24
  """
25
25
  import argparse
26
26
  import os
@@ -29,14 +29,16 @@ import shutil
29
29
  import sys
30
30
 
31
31
  HERE = os.path.dirname(os.path.abspath(__file__))
32
- SKILLS = ["android-ui-minimal", "android-ui-security-review"]
32
+ SKILLS = ["android-ui"]
33
33
  SKILL_SUMMARY = {
34
- "android-ui-minimal": "membuat, merekonstruksi, dan merapikan UI Android",
35
- "android-ui-security-review": "meninjau keamanan pada lapisan UI/frontend Android",
34
+ "android-ui": "builds/polishes Android UIs and audits the UI/frontend security layer",
36
35
  }
37
36
  NAME_RE = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$")
38
37
  BEGIN, END = "<!-- android-skills:begin -->", "<!-- android-skills:end -->"
39
- COMMANDS = ("ui-minimal.md", "ui-security.md")
38
+ COMMANDS = ("ui.md",)
39
+ # Old names from earlier versions, cleaned up on uninstall.
40
+ LEGACY_SKILLS = ["android-ui-minimal", "android-ui-security-review"]
41
+ LEGACY_COMMANDS = ("ui-minimal.md", "ui-security.md")
40
42
 
41
43
  TARGETS = {
42
44
  "opencode": dict(
@@ -97,27 +99,27 @@ def validate():
97
99
  for s in SKILLS:
98
100
  md = os.path.join(HERE, s, "SKILL.md")
99
101
  if not os.path.isfile(md):
100
- print(f"GAGAL {s}: SKILL.md tidak ada")
102
+ print(f"FAIL {s}: SKILL.md not found")
101
103
  ok = False
102
104
  continue
103
105
  fm = frontmatter(md)
104
106
  if not fm:
105
- print(f"GAGAL {s}: frontmatter tidak ditemukan")
107
+ print(f"FAIL {s}: frontmatter not found")
106
108
  ok = False
107
109
  continue
108
110
  name, desc = fm.get("name", ""), fm.get("description", "")
109
111
  problems = []
110
112
  if name != s:
111
- problems.append(f"name '{name}' harus sama dengan nama folder '{s}'")
113
+ problems.append(f"name '{name}' must equal the folder name '{s}'")
112
114
  if not (1 <= len(name) <= 64 and NAME_RE.match(name)):
113
- problems.append("name harus huruf kecil, angka, dan tanda hubung tunggal (1-64)")
115
+ problems.append("name must be lowercase letters, digits, and single hyphens (1-64)")
114
116
  if not (1 <= len(desc) <= 1024):
115
- problems.append(f"description harus 1-1024 karakter (sekarang {len(desc)})")
117
+ problems.append(f"description must be 1-1024 characters (currently {len(desc)})")
116
118
  for p in problems:
117
- print(f"GAGAL {s}: {p}")
119
+ print(f"FAIL {s}: {p}")
118
120
  ok &= not problems
119
121
  if not problems:
120
- print(f"OK {s} (description {len(desc)} karakter)")
122
+ print(f"OK {s} (description {len(desc)} chars)")
121
123
  return ok
122
124
 
123
125
 
@@ -137,23 +139,21 @@ def put(src, dst, link):
137
139
 
138
140
 
139
141
  def managed_block(skills_dir, start_at):
140
- """Blok instruksi terkelola untuk file aturan (AGENTS.md, CLAUDE.md, dsb.)."""
142
+ """Managed instructions block for rules files (AGENTS.md, CLAUDE.md, etc.)."""
141
143
  rel = lambda p: os.path.relpath(p, start_at)
142
144
  lines = [
143
145
  BEGIN,
144
146
  "",
145
- "## Skill Android UI",
147
+ "## Android UI skill",
146
148
  "",
147
- "Dua skill lokal tersedia:",
148
- ]
149
- for s in SKILLS:
150
- lines.append(f"- `{s}` — {SKILL_SUMMARY[s]}. SKILL.md: `{rel(os.path.join(skills_dir, s, 'SKILL.md'))}`")
151
- lines += [
149
+ "The `android-ui` skill is available for Android work:",
150
+ f"- UI mode: build/polish the UI. SKILL.md: `{rel(os.path.join(skills_dir, 'android-ui', 'SKILL.md'))}`",
151
+ "- Security mode: audit the UI/frontend layer (read-only unless asked to fix).",
152
152
  "",
153
- "Aturan:",
154
- f"- Sebelum menulis atau merapikan UI Android, baca skill `{SKILLS[0]}` dan referensi terkait.",
155
- f"- Sebelum audit keamanan frontend Android, baca skill `{SKILLS[1]}`; baca-saja kecuali diminta memperbaiki.",
156
- "- Tanpa emoji di UI, string, komentar, atau commit. Tanyakan dulu bila permintaan ambigu.",
153
+ "Rules:",
154
+ "- Before UI work or a security audit on Android, read the `android-ui` SKILL.md and the relevant references.",
155
+ "- Verify compilation/tests before pushing; one commit one thing; do not roll back a design to make CI green.",
156
+ "- No emoji in UI, strings, comments, or commits. Ask first when the request is ambiguous.",
157
157
  "",
158
158
  END,
159
159
  ]
@@ -185,17 +185,17 @@ def with_always_apply(md_text):
185
185
 
186
186
 
187
187
  def make_rule_file(skill, dst, skills_dir, ext):
188
- """Buat file rules (.mdc untuk Cursor, .md untuk Windsurf) dari SKILL.md."""
188
+ """Create a rules file (.mdc for Cursor, .md for Windsurf) from SKILL.md."""
189
189
  text = open(os.path.join(HERE, skill, "SKILL.md"), encoding="utf-8").read().replace("\r\n", "\n")
190
190
  text = with_always_apply(text)
191
- note = f"\n> Folder lengkap skill (referensi & skrip) ada di: {os.path.relpath(os.path.join(skills_dir, skill), start=os.path.dirname(dst))}\n"
191
+ note = f"\n> Full skill folder (references & scripts) is at: {os.path.relpath(os.path.join(skills_dir, skill), start=os.path.dirname(dst))}\n"
192
192
  os.makedirs(os.path.dirname(dst), exist_ok=True)
193
193
  with open(dst, "w", encoding="utf-8") as fh:
194
194
  fh.write(text + note)
195
195
 
196
196
 
197
197
  def layout(t, project):
198
- """Hitung lokasi target berdasarkan mode."""
198
+ """Compute target locations based on the mode."""
199
199
  if t["mode"] == "skills":
200
200
  base = os.path.join(project, t["project_base"]) if project else t["global_base"]()
201
201
  skills_dir = os.path.join(base, "skills")
@@ -215,7 +215,7 @@ def layout(t, project):
215
215
  skills_dir = os.path.join(base, ".android-skills")
216
216
  else:
217
217
  if t["global_base"] is None:
218
- raise SystemExit(f"target '{t['desc']}' hanya mendukung --project DIR (mis. --project .)")
218
+ raise SystemExit(f"target '{t['desc']}' only supports --project DIR (e.g. --project .)")
219
219
  base = t["global_base"]()
220
220
  skills_dir = os.path.join(base, "android-skills")
221
221
  return dict(base=base, skills_dir=skills_dir, cmd_dir=None,
@@ -228,20 +228,20 @@ def remove_skill_dir(p):
228
228
  shutil.rmtree(p)
229
229
  else:
230
230
  os.remove(p)
231
- print(f"dihapus: {p}")
231
+ print(f"removed: {p}")
232
232
 
233
233
 
234
234
  def main():
235
235
  ap = argparse.ArgumentParser(
236
236
  description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
237
- ap.add_argument("--project", metavar="DIR", help="pasang per-proyek ke DIR (path global bila tidak diisi)")
237
+ ap.add_argument("--project", metavar="DIR", help="install per-project into DIR (global path if omitted)")
238
238
  ap.add_argument("--target", choices=sorted(TARGETS), default="opencode",
239
- help="agent tujuan (default: opencode)")
240
- ap.add_argument("--link", action="store_true", help="symlink, bukan salinan")
239
+ help="target agent (default: opencode)")
240
+ ap.add_argument("--link", action="store_true", help="symlink instead of a copy")
241
241
  ap.add_argument("--agents-md", action="store_true",
242
- help="tulis/hapus blok instruksi ke file aturan target (AGENTS.md, CLAUDE.md, "
243
- "GEMINI.md, copilot-instructions.md). Di target rules (cursor/windsurf) "
244
- "file rules selalu dibuat.")
242
+ help="write/remove the instructions block in the target rules file "
243
+ "(AGENTS.md, CLAUDE.md, GEMINI.md, copilot-instructions.md). "
244
+ "For rules targets (cursor/windsurf) the rules file is always created.")
245
245
  ap.add_argument("--uninstall", action="store_true")
246
246
  ap.add_argument("--validate", action="store_true")
247
247
  a = ap.parse_args()
@@ -263,40 +263,54 @@ def main():
263
263
  for s in SKILLS:
264
264
  remove_skill_dir(os.path.join(skills_dir, s))
265
265
  if L.get("cmd_dir"):
266
- for c in COMMANDS:
266
+ for c in COMMANDS + LEGACY_COMMANDS:
267
267
  p = os.path.join(L["cmd_dir"], c)
268
268
  if os.path.lexists(p):
269
269
  os.remove(p)
270
- print(f"dihapus: {p}")
270
+ print(f"removed: {p}")
271
271
  legacy_dir = os.path.join(L["base"], "command")
272
- for c in COMMANDS:
272
+ for c in COMMANDS + LEGACY_COMMANDS:
273
273
  p = os.path.join(legacy_dir, c)
274
274
  if os.path.lexists(p):
275
275
  os.remove(p)
276
- print(f"dihapus (legacy): {p}")
276
+ print(f"removed (legacy): {p}")
277
277
  if rules_dir:
278
278
  for s in SKILLS:
279
279
  p = os.path.join(rules_dir, s + rules_ext)
280
280
  if os.path.lexists(p):
281
281
  os.remove(p)
282
- print(f"dihapus: {p}")
282
+ print(f"removed: {p}")
283
+ for s in LEGACY_SKILLS:
284
+ p = os.path.join(rules_dir, s + rules_ext)
285
+ if os.path.lexists(p):
286
+ os.remove(p)
287
+ print(f"removed (old name): {p}")
288
+ # clean up leftovers from older installs (separate skills)
289
+ for s in LEGACY_SKILLS:
290
+ p = os.path.join(skills_dir, s)
291
+ if os.path.lexists(p):
292
+ if os.path.isdir(p) and not os.path.islink(p):
293
+ shutil.rmtree(p)
294
+ else:
295
+ os.remove(p)
296
+ print(f"removed (old version): {p}")
283
297
  if mode == "instructions":
284
298
  existed = os.path.exists(rules_path)
285
299
  update_managed_file(rules_path, skills_dir, remove=True)
286
- print(f"blok dihapus dari: {rules_path}" if existed else "tidak ada blok lama")
300
+ print(f"block removed from: {rules_path}" if existed else "no old block found")
287
301
  if os.path.isdir(skills_dir) and not os.listdir(skills_dir):
288
302
  os.rmdir(skills_dir)
289
- print(f"dihapus: {skills_dir}")
303
+ print(f"removed: {skills_dir}")
290
304
  elif a.agents_md and rules_path and os.path.exists(rules_path):
291
305
  update_managed_file(rules_path, skills_dir, remove=True)
292
- print(f"blok dihapus dari: {rules_path}")
293
- print("Uninstall selesai.")
306
+ print(f"block removed from: {rules_path}")
307
+ print("Uninstall complete.")
294
308
  return
295
309
 
296
310
  for s in SKILLS:
297
311
  dst = os.path.join(skills_dir, s)
298
312
  put(os.path.join(HERE, s), dst, a.link)
299
- print(f"terpasang: {dst}")
313
+ print(f"installed: {dst}")
300
314
  scripts = os.path.join(dst, "scripts")
301
315
  if os.path.isdir(scripts) and not os.path.islink(dst):
302
316
  for f in os.listdir(scripts):
@@ -308,29 +322,29 @@ def main():
308
322
  if L.get("cmd_dir"):
309
323
  for c in COMMANDS:
310
324
  put(os.path.join(HERE, "opencode", "commands", c), os.path.join(L["cmd_dir"], c), a.link)
311
- print(f"terpasang: {os.path.join(L['cmd_dir'], c)}")
325
+ print(f"installed: {os.path.join(L['cmd_dir'], c)}")
312
326
 
313
327
  if rules_dir:
314
328
  for s in SKILLS:
315
329
  p = os.path.join(rules_dir, s + rules_ext)
316
330
  make_rule_file(s, p, skills_dir, rules_ext)
317
- print(f"terpasang: {p}")
331
+ print(f"installed: {p}")
318
332
  elif mode == "instructions":
319
333
  update_managed_file(rules_path, skills_dir)
320
- print(f"instruksi diperbarui: {rules_path}")
334
+ print(f"instructions updated: {rules_path}")
321
335
  elif a.agents_md:
322
336
  update_managed_file(rules_path, skills_dir)
323
- print(f"aturan diperbarui: {rules_path}")
337
+ print(f"rules updated: {rules_path}")
324
338
 
325
339
  rel_hint = {"opencode": "OpenCode", "claude": "Claude Code", "codex": "Codex",
326
340
  "gemini": "Gemini CLI", "copilot": "Copilot", "cursor": "Cursor",
327
341
  "windsurf": "Windsurf"}[a.target]
328
- print(f"\nSelesai ({rel_hint}). Mulai ulang sesi agent bila perlu.")
342
+ print(f"\nDone ({rel_hint}). Restart the agent session if needed.")
329
343
  if L.get("cmd_dir"):
330
- print("Command opsional OpenCode: /ui-minimal <layar> atau /ui-security <folder>")
344
+ print("Optional OpenCode command: /ui <screen|folder> (the mode is picked from the arguments)")
331
345
  if rules_dir:
332
- print("File rules terpasang di " + rules_dir +
333
- " — pastikan rules aktif; user rules global mungkin perlu ditambahkan lewat UI agent.")
346
+ print("Rules file installed in " + rules_dir +
347
+ " — make sure rules are enabled; global user rules may need to be added via the agent UI.")
334
348
 
335
349
 
336
350
  if __name__ == "__main__":
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: Android UI work (build/reconstruct/polish) or frontend security audit, using the android-ui skill
3
+ ---
4
+
5
+ Load the `android-ui` skill (OpenCode ID: `@android-ui`), pick the mode from the arguments below, and follow the skill's workflow.
6
+
7
+ Arguments: $ARGUMENTS
8
+
9
+ - If the arguments mention a screen/UI/redesign/tidying → **UI mode**.
10
+ - If the arguments mention audit/security/hardening → **Security mode** (read-only unless asked to fix).
11
+ - If empty, infer from the conversation context; if still ambiguous, ask one thing first.
12
+
13
+ If the target is clear, proceed without re-asking what is already known. Read the relevant references from the skill directory. Run the relevant automated checks (linter, contrast, or security scanner). Follow the safety rules: verify compilation/tests BEFORE pushing, one commit one thing, fix forward instead of rolling back. Change only the requested scope. Report the files changed, the checks that ran (and the ones that could not run), and their limits.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "android-skills",
3
- "version": "1.0.0",
4
- "description": "Pemasang skill Android UI (build & security review) untuk OpenCode, Claude Code, Codex, Cursor, Windsurf, Gemini CLI, dan GitHub Copilot. Dipakai via npx atau npm.",
3
+ "version": "2.0.0",
4
+ "description": "Installer for the Android UI skill pack (build & security review) for OpenCode, Claude Code, Codex CLI, Cursor, Windsurf, Gemini CLI, and GitHub Copilot. Works via npx, npm, or git.",
5
5
  "license": "MIT",
6
6
  "author": "tamvanpr",
7
7
  "repository": {
@@ -29,8 +29,7 @@
29
29
  "files": [
30
30
  "bin/",
31
31
  "install.py",
32
- "android-ui-minimal/",
33
- "android-ui-security-review/",
32
+ "android-ui/",
34
33
  "opencode/",
35
34
  "README.md",
36
35
  "LICENSE"
@@ -1,98 +0,0 @@
1
- ---
2
- name: android-ui-minimal
3
- description: Membangun, merombak, merekonstruksi, atau memperbaiki UI aplikasi Android native (Kotlin, Jetpack Compose, atau XML Views) dengan desain minimalis, matang, aksesibel, dan konsisten. Gunakan untuk redesign UI/UX, implementasi layar dari screenshot/referensi, audit visual, theming, design token, komponen, layout, typography, dark/light mode, dan responsive UI.
4
- license: MIT
5
- compatibility: opencode, Claude Code, dan agent lain yang membaca SKILL.md
6
- metadata:
7
- platform: android
8
- language: kotlin
9
- version: "1.1.0"
10
- ---
11
-
12
- # Android UI Minimal
13
-
14
- Skill ini mengatur cara Claude/opencode merekonstruksi UI Android agar minimalis dan terasa dirancang, bukan di-generate. SKILL.md ini hanya ringkasan aturan dan alur. Detail ada di `references/` dan alat bantu ada di `scripts/`. Baca file referensi yang relevan sebelum menulis kode, jangan mengandalkan ringkasan ini saja.
15
-
16
- ## Alur kerja (ikuti berurutan)
17
-
18
- 1. **Klarifikasi dulu.** Baca `references/clarifying-questions.md`. Jika salah satu syarat "ambigu" terpenuhi, berhenti dan tanyakan. Maksimal 4 pertanyaan, pilihan ganda bila bisa, sertakan default yang kamu rekomendasikan.
19
- 2. **Audit kondisi saat ini.** Cari tema, token, dan komponen yang sudah ada (`Theme.kt`, `Color.kt`, `Type.kt`, `themes.xml`, `colors.xml`). Pakai yang ada. Jangan membuat sistem desain kedua.
20
- 3. **Tentukan token sebelum layar.** Warna, tipografi, spacing, radius ditetapkan di satu tempat. Lihat `references/color-and-contrast.md` dan `references/typography-spacing.md`.
21
- 4. **Bangun layar** dengan pola di `references/compose-patterns.md` (atau padanan XML bila proyek memakai Views).
22
- 5. **Jalankan pemeriksaan otomatis:**
23
- - `python3 scripts/lint_ui.py <path-proyek>` untuk melacak pelanggaran gaya.
24
- - `python3 scripts/contrast.py <fg> <bg>` untuk memverifikasi kontras warna.
25
- 6. **Review mandiri** memakai `references/anti-slop-checklist.md`. Perbaiki sebelum melapor selesai.
26
- 7. **Laporkan singkat:** apa yang berubah, token apa yang dipakai, apa yang sengaja tidak dilakukan.
27
-
28
- ## Aturan keras
29
-
30
- **Emoji dan simbol dekoratif**
31
- - Jangan memakai emoji di UI, string resource, nama file, komentar, atau pesan commit kecuali user memintanya secara eksplisit.
32
- - Jangan memakai karakter pengganti ikon (misalnya tanda bintang, panah unicode, centang unicode). Pakai `Icons` Material atau vector drawable.
33
- - Jangan menambah ikon hanya untuk mengisi ruang. Ikon harus membawa makna atau aksi.
34
-
35
- **Bertanya, bukan menebak**
36
- - Jika platform (Compose atau Views), tujuan layar, data nyata, atau arah visual tidak jelas, tanyakan.
37
- - Jika user menyertakan screenshot, anggap itu acuan struktur. Tanyakan apakah warna dan font ikut dipertahankan atau boleh diganti.
38
- - Jangan mengarang fitur, teks marketing, atau data dummy yang terlihat nyata. Pakai placeholder netral dan tandai jelas.
39
-
40
- **Warna**
41
- - Satu warna aksen. Sisanya netral. Maksimal dua keluarga warna di satu layar, di luar warna status (error, sukses).
42
- - Semua warna lewat token tema (`MaterialTheme.colorScheme.*` atau atribut tema). Dilarang `Color(0xFF...)` di dalam composable layar.
43
- - Teks body harus kontras minimal 4.5:1, teks besar dan ikon fungsional minimal 3:1. Verifikasi dengan `scripts/contrast.py`.
44
- - Wajib menyediakan skema terang dan gelap. Gelap bukan hitam murni `#000000` kecuali layar OLED-first yang diminta user. Terang bukan putih menyilaukan yang dipaksa di semua permukaan.
45
- - Dilarang gradien dekoratif, glow, dan shadow berlapis kecuali diminta.
46
-
47
- **Tata letak**
48
- - Grid spacing 4dp. Nilai yang dipakai: 4, 8, 12, 16, 24, 32, 48. Tidak ada angka acak seperti 13dp atau 27dp.
49
- - Satu hierarki jelas per layar: satu judul, satu aksi utama.
50
- - Pisahkan dengan spasi dan tonal surface dulu, baru divider tipis, dan card hanya jika elemen benar-benar berdiri sendiri. Jangan membungkus semuanya dalam card.
51
- - Target sentuh minimal 48dp. Konten tidak boleh terpotong pada font scale 1.3 dan layar 360dp.
52
- - Dukung edge-to-edge dan window insets dengan benar.
53
-
54
- **Tipografi**
55
- - Maksimal dua weight di satu layar. Pakai skala `MaterialTheme.typography`. Jangan `fontSize = 17.sp` ad hoc.
56
- - Teks memakai `sp`, jarak memakai `dp`.
57
-
58
- **Motion**
59
- - Hanya motion yang menjelaskan perubahan state. Durasi 150-250 ms. Hormati pengaturan "remove animations".
60
-
61
- **Aksesibilitas**
62
- - `contentDescription` bermakna untuk ikon aksi, `null` untuk dekoratif.
63
- - Jangan mengandalkan warna saja untuk menyampaikan status.
64
-
65
- **Cakupan perubahan**
66
- - Ubah yang diminta saja. Jangan refactor arsitektur, ganti library, atau memindahkan package kecuali diminta.
67
- - Jangan menambah dependency baru tanpa bertanya.
68
- - Jangan menyentuh logika bisnis saat merekonstruksi UI. Pisahkan state dan event dari tampilan (state hoisting).
69
-
70
- ## Tanda "AI slop" yang harus dihindari
71
-
72
- Gradien ungu-biru, card dengan sudut sangat besar dan bayangan di mana-mana, ikon dalam lingkaran berwarna di setiap baris, judul bergaya marketing ("Selamat datang di pengalaman baru"), empty state dengan ilustrasi emoji, badge dan chip tanpa fungsi, semua tombol berwarna primer, spacing seragam tanpa ritme. Daftar lengkap ada di `references/anti-slop-checklist.md`.
73
-
74
- ## Peta file
75
-
76
- | File | Isi |
77
- |---|---|
78
- | `references/clarifying-questions.md` | Kapan harus bertanya, template pertanyaan |
79
- | `references/color-and-contrast.md` | Cara memilih palet, contoh palet netral siap pakai, aturan kontras |
80
- | `references/typography-spacing.md` | Skala tipografi, spacing, radius, elevasi |
81
- | `references/compose-patterns.md` | Pola kode Compose dan padanan XML |
82
- | `references/reconstruction-workflow.md` | Cara membaca screenshot atau layar lama lalu merekonstruksinya |
83
- | `references/anti-slop-checklist.md` | Daftar periksa akhir |
84
- | `scripts/lint_ui.py` | Linter gaya untuk `.kt` dan `.xml` |
85
- | `scripts/contrast.py` | Kalkulator kontras WCAG |
86
- | `scripts/gen_tokens.py` | Pembuat `Color.kt` dan `Theme.kt` dari satu warna aksen |
87
-
88
- ## Menemukan skrip
89
-
90
- Path `scripts/...` di atas relatif terhadap folder skill ini, bukan folder proyek. Gunakan base directory yang diberikan saat skill dimuat. Jika tidak ada, cari:
91
-
92
- ```
93
- find ~/.config/opencode .opencode ~/.claude .claude -path '*android-ui-minimal/scripts/lint_ui.py' 2>/dev/null
94
- ```
95
-
96
- ## Batasan skill ini
97
-
98
- Skill ini hanya soal tampilan dan struktur UI. Untuk celah keamanan pada layar, gunakan skill pendamping `android-ui-security-review`. Skill ini tidak menjamin keputusan desain tunggal yang benar. Jika ada konflik antara aturan di sini dan permintaan eksplisit user, ikuti user dan sebutkan konsekuensinya satu kalimat.
@@ -1,61 +0,0 @@
1
- # Checklist anti-slop
2
-
3
- Jalankan sebelum melapor selesai. Jawab ya atau tidak. Semua "tidak" pada bagian Wajib harus diperbaiki.
4
-
5
- ## Wajib
6
-
7
- - [ ] Tidak ada emoji di kode, string, komentar, atau nama file
8
- - [ ] Tidak ada karakter unicode dekoratif sebagai ikon
9
- - [ ] Satu aksen warna, sisanya netral
10
- - [ ] Tidak ada gradien dekoratif
11
- - [ ] Tidak ada `Color(0x...)` di luar berkas tema
12
- - [ ] Spacing hanya dari skala 4dp
13
- - [ ] Tipografi hanya dari `MaterialTheme.typography`
14
- - [ ] Kontras teks minimal 4.5:1, komponen 3:1
15
- - [ ] Terang dan gelap sama-sama diperiksa
16
- - [ ] Target sentuh minimal 48dp
17
- - [ ] Ada state empty, loading, error untuk layar berdata
18
- - [ ] `contentDescription` benar (bermakna atau null)
19
- - [ ] Teks UI ada di `strings.xml`, bukan hardcode
20
- - [ ] Tidak ada dependency baru tanpa persetujuan
21
- - [ ] Logika bisnis tidak tersentuh
22
-
23
- ## Tanda template AI (hapus atau ganti)
24
-
25
- | Gejala | Perbaikan |
26
- |---|---|
27
- | Header gradien ungu-biru | Warna solid netral |
28
- | Setiap item dibungkus card dengan bayangan | Baris polos + divider |
29
- | Ikon dalam lingkaran berwarna di tiap baris | Hapus, atau satu ikon fungsional |
30
- | Judul bergaya promosi ("Temukan pengalaman baru") | Judul fungsional ("Catatan") |
31
- | Teks sapaan panjang di halaman utama | Hapus |
32
- | Empty state dengan ilustrasi besar dan emoji | Satu kalimat + satu aksi |
33
- | Semua tombol warna primer | Satu utama, sisanya outlined atau teks |
34
- | Chip dan badge tanpa fungsi | Hapus |
35
- | Radius 24dp+ di semua elemen | Skala 8/12/16 |
36
- | Bayangan lembut di semua permukaan | Tonal atau garis tipis |
37
- | Rata tengah untuk teks panjang | Rata kiri |
38
- | Data dummy terlihat nyata ("Budi Santoso, 3 jam lalu") | Placeholder netral dan jelas |
39
- | Animasi masuk di setiap elemen | Hanya transisi state penting |
40
- | Teks bold di mana-mana | Satu level penekanan |
41
- | Warna acak per kategori | Satu aksen, bedakan lewat label |
42
-
43
- ## Uji cepat
44
-
45
- 1. **Uji kabur:** kecilkan tangkapan layar atau burem. Apakah satu hal utama tetap menonjol?
46
- 2. **Uji grayscale:** hierarki masih terbaca?
47
- 3. **Uji hapus:** hapus satu elemen. Apakah ada yang hilang fungsinya? Jika tidak, biarkan terhapus.
48
- 4. **Uji font besar:** 1.5x, tidak terpotong atau tumpang tindih?
49
- 5. **Uji layar sempit:** 360dp, tidak ada scroll horizontal?
50
- 6. **Uji konten panjang:** teks dua kali lebih panjang, tata letak bertahan?
51
-
52
- ## Penulisan teks UI
53
-
54
- - Pendek, jelas, kata kerja untuk aksi ("Simpan", "Hapus").
55
- - Konsisten satu bahasa per aplikasi, kecuali memang multibahasa lewat resource.
56
- - Tidak ada tanda seru berlebihan, tidak ada nada promosi.
57
- - Pesan error menyebut penyebab dan langkah berikutnya.
58
-
59
- ## Pelaporan jujur
60
-
61
- Jika ada item checklist yang tidak bisa dipenuhi (misalnya tidak bisa menjalankan preview di lingkungan ini), katakan apa adanya. Jangan menulis "sudah diverifikasi" untuk hal yang tidak dijalankan.
@@ -1,55 +0,0 @@
1
- # Kapan harus bertanya
2
-
3
- Bertanya itu wajib, bukan opsional, jika salah satu kondisi di bawah ini benar. Tujuannya mencegah membangun hal yang salah lalu membuang waktu user.
4
-
5
- ## Kondisi pemicu
6
-
7
- 1. **Platform tidak jelas.** Tidak terlihat apakah proyek memakai Jetpack Compose, XML Views, atau campuran. Cek dulu `build.gradle(.kts)` (`buildFeatures { compose = true }`). Jika masih tidak jelas, tanya.
8
- 2. **Tujuan layar tidak jelas.** "Bikin halaman bagus" tanpa tahu fungsinya.
9
- 3. **Acuan visual bertentangan.** Contoh: user minta minimalis tetapi melampirkan screenshot yang padat dan berwarna-warni.
10
- 4. **Data nyata tidak diketahui.** Daftar berisi apa, ada berapa item, panjang teks maksimum, ada gambar atau tidak.
11
- 5. **Ruang lingkup besar.** Permintaan menyentuh lebih dari 3 layar atau mengubah tema global.
12
- 6. **Warna brand ada tapi tidak diberikan.** User menyebut "warna aplikasi saya" tanpa nilai.
13
- 7. **Ada pilihan yang mengubah banyak kode.** Contoh: ganti font, ganti navigasi, ganti pola state.
14
- 8. **Bahasa dan konten.** Teks UI Indonesia atau Inggris, atau keduanya (perlu `strings.xml` terpisah).
15
-
16
- ## Kapan tidak perlu bertanya
17
-
18
- - Perubahan kecil dan jelas (ubah padding, rapikan satu tombol).
19
- - Jawabannya bisa dibaca dari kode yang ada. Baca kode dulu sebelum bertanya.
20
- - Pertanyaan yang jawabannya memiliki default aman. Ambil default, nyatakan di awal laporan, lanjutkan.
21
-
22
- ## Format pertanyaan
23
-
24
- - Maksimal 4 pertanyaan sekaligus.
25
- - Satu pertanyaan, satu hal.
26
- - Beri 2-4 opsi dan tandai rekomendasi.
27
- - Tulis dalam bahasa yang dipakai user.
28
- - Jangan bertanya hal yang sudah dijawab user di pesan sebelumnya.
29
-
30
- ## Template
31
-
32
- ```
33
- Sebelum mulai, ada beberapa hal yang perlu dipastikan:
34
-
35
- 1. Proyek ini pakai Compose atau XML Views?
36
- a. Compose (Rekomendasi, saya lihat compose = true di build.gradle)
37
- b. XML Views
38
- c. Campuran
39
-
40
- 2. Warna aksen yang dipakai?
41
- a. Pertahankan warna yang sekarang (#xxxxxx)
42
- b. Saya usulkan satu aksen netral-dingin
43
- c. Saya kasih kode warna sendiri
44
-
45
- 3. Layar ini menampilkan berapa item biasanya, dan ada gambar?
46
- (Memengaruhi pilihan list, card, atau baris polos)
47
- ```
48
-
49
- ## Setelah user menjawab
50
-
51
- Ringkas keputusan dalam satu blok pendek ("Keputusan: Compose, aksen biru-abu #3B5BA9, daftar baris polos tanpa card"), lalu kerjakan. Jangan bertanya ulang hal yang sama.
52
-
53
- ## Jika user tidak membalas atau sedang tidak bisa dihubungi
54
-
55
- Ambil asumsi paling konservatif, tulis daftar asumsi di awal laporan, dan buat perubahan mudah diganti (token, bukan nilai tersebar).
@@ -1,104 +0,0 @@
1
- # Warna dan kontras
2
-
3
- Tujuan: UI terlihat tenang dan jelas tanpa terlihat "kurang" (pucat, datar, tak berbatas). Rahasianya bukan lebih banyak warna, tetapi tingkat netral yang cukup dan satu aksen yang konsisten.
4
-
5
- ## Struktur palet
6
-
7
- Satu layar hanya membutuhkan peran-peran ini:
8
-
9
- | Peran | Fungsi | Material 3 |
10
- |---|---|---|
11
- | Background | Dasar layar | `background` |
12
- | Surface | Area konten, bar | `surface` |
13
- | Surface variant (tonal) | Pemisah halus, field, chip | `surfaceVariant`, `surfaceContainer*` |
14
- | Outline | Garis tipis | `outlineVariant` |
15
- | Text primary | Judul, body | `onSurface` |
16
- | Text secondary | Keterangan | `onSurfaceVariant` |
17
- | Accent | Aksi utama, state aktif | `primary` / `onPrimary` |
18
- | Error | Kesalahan | `error` |
19
-
20
- Kalau semua peran di atas terisi, UI jarang terlihat kurang. Masalah biasanya muncul karena hanya ada dua tingkat (putih dan abu muda), sehingga tidak ada hierarki.
21
-
22
- ## Aturan agar tidak terlihat kurang
23
-
24
- 1. **Minimal 3 tingkat netral** per tema: background, surface, dan surface yang lebih tinggi atau variant. Selisih luminans antar tingkat kira-kira 3 sampai 6 persen.
25
- 2. **Aksen dipakai hemat tapi konsisten**: tombol utama, state terpilih, indikator fokus, link. Jangan dipakai sebagai latar area besar.
26
- 3. **Teks sekunder tetap terbaca.** Jangan menurunkan opasitas teks sampai di bawah 4.5:1. Hindari `alpha = 0.38` untuk teks yang harus dibaca.
27
- 4. **Pemisah ada**, tapi halus: spasi dulu, lalu perubahan tonal, lalu garis 1dp `outlineVariant`.
28
- 5. **Warna status** (error, sukses, peringatan) boleh di luar satu aksen, tapi selalu disertai teks atau ikon, bukan warna saja.
29
- 6. **Mode gelap** didesain sendiri, bukan inversi. Gelap: background sekitar `#0F1114` sampai `#141619`, surface naik bertahap. Aksen dilunakkan (kroma lebih rendah, lebih terang) agar tidak bergetar.
30
- 7. **Tes grayscale.** Ubah tangkapan layar ke hitam-putih. Hierarki harus tetap terbaca.
31
-
32
- ## Cara memilih aksen
33
-
34
- - Jika user punya warna brand, pakai itu. Turunkan tonal-nya, jangan ubah huenya.
35
- - Jika tidak ada, pilih satu hue dengan kroma sedang. Hindari ungu-biru neon dan gradien. Pilihan aman: biru baja, hijau teal gelap, terakota, hijau zaitun, indigo gelap.
36
- - Jangan memakai lebih dari satu hue aksen. Jika butuh pembeda kategori, bedakan dengan bentuk, label, atau ikon.
37
- - Generate token otomatis: `python3 scripts/gen_tokens.py "#3B5BA9"`.
38
-
39
- ## Palet contoh (netral, siap pakai)
40
-
41
- Terang:
42
-
43
- | Token | Hex |
44
- |---|---|
45
- | background | `#F7F7F5` |
46
- | surface | `#FFFFFF` |
47
- | surfaceVariant | `#EFEFEC` |
48
- | outlineVariant | `#DADAD5` |
49
- | onSurface | `#1B1C1A` |
50
- | onSurfaceVariant | `#5B5D58` |
51
- | primary | `#3B5BA9` |
52
- | onPrimary | `#FFFFFF` |
53
- | error | `#B3261E` |
54
-
55
- Gelap:
56
-
57
- | Token | Hex |
58
- |---|---|
59
- | background | `#121312` |
60
- | surface | `#1A1B1A` |
61
- | surfaceVariant | `#252624` |
62
- | outlineVariant | `#3A3B38` |
63
- | onSurface | `#E6E6E2` |
64
- | onSurfaceVariant | `#A9AAA4` |
65
- | primary | `#9DB4F0` |
66
- | onPrimary | `#14224A` |
67
- | error | `#F2B8B5` |
68
-
69
- Verifikasi sebelum memakai: `python3 scripts/contrast.py "#5B5D58" "#F7F7F5"`.
70
-
71
- ## Kontras (WCAG 2.2)
72
-
73
- - Teks normal: minimal 4.5:1.
74
- - Teks besar (18sp atau 14sp bold) dan komponen UI (border field, ikon aksi): minimal 3:1.
75
- - State disabled boleh lebih rendah, tapi jangan dipakai untuk info penting.
76
- - Teks di atas gambar: pakai scrim solid, bukan mengandalkan gambar.
77
-
78
- ## Implementasi Compose
79
-
80
- ```kotlin
81
- private val LightColors = lightColorScheme(
82
- primary = Color(0xFF3B5BA9),
83
- onPrimary = Color(0xFFFFFFFF),
84
- background = Color(0xFFF7F7F5),
85
- surface = Color(0xFFFFFFFF),
86
- surfaceVariant = Color(0xFFEFEFEC),
87
- outlineVariant = Color(0xFFDADAD5),
88
- onSurface = Color(0xFF1B1C1A),
89
- onSurfaceVariant = Color(0xFF5B5D58),
90
- error = Color(0xFFB3261E),
91
- )
92
- ```
93
-
94
- Nilai hex hanya boleh muncul di berkas tema ini. Di layar, pakai `MaterialTheme.colorScheme.primary` dan seterusnya.
95
-
96
- Dynamic color (Material You): jangan diaktifkan secara default jika user punya warna brand. Jadikan opsi dan tanyakan.
97
-
98
- ## Anti-pola
99
-
100
- - Putih murni `#FFFFFF` sebagai background utama di mana-mana, ditambah teks hitam murni.
101
- - Hitam murni `#000000` + teks putih murni (halasi dan melelahkan), kecuali OLED-first.
102
- - Abu-abu dengan opasitas di atas warna lain (hasil tak terduga). Pakai warna solid dari token.
103
- - Warna acak per komponen untuk "variasi".
104
- - Gradien aksen di tombol, header, dan latar.