Agent skill

Android XML Resource

by afkT in afkT/DevUtils

统一 Android XML 资源命名:layout、drawable、mipmap、color、values、id 的前缀与 snakecase 规则;把颜色/圆角/描边/状态编码进文件名(bg、border、textcolor…selector)。

Apache-2.0Auto-check passedMobile

Install Android XML Resource

skills CLI
$ npx skills add afkT/DevUtils --skill android-xml-resource -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install afkT/DevUtils android-xml-resource --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/afkT/DevUtils.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/android-xml-resource .claude/skills/android-xml-resource && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
android-xml-resource
GitHub stars
1.6k
Token cost
~1.3k tokens
SKILL.md length
222 words
Files
2 (incl. references)
Skills in repo
13
Repo updated
First seen
Licence
Apache-2.0

At a glance

统一 Android XML 资源命名:layout、drawable、mipmap、color、values、id 的前缀与 snakecase 规则;把颜色/圆角/描边/状态编码进文件名(bg、border、textcolor…selector)。

  • Works in 3 steps: 基于文件的资源名(layout/、drawable/、color/、mipmap/… → 资源只能放进… → 配置限定符以 短横线 -…
  • Mobile work in your project
  • SKILL.md covers 何时用本 Skill, 硬约束(违反会编译失败), 命名总则 and drawable 命名两族(摘要), plus 3 more sections
  • Reaches schemas.android.com

What it does

Android XML Resource is an agent skill from afkT/DevUtils. 统一 Android XML 资源命名:layout、drawable、mipmap、color、values、id 的前缀与 snakecase 规则;把颜色/圆角/描边/状态编码进文件名(bg、border、textcolor…selector)。 生成 selector 与 ColorStateList 时多状态写入单个文件、内联 shape、默认项放最后、按真实颜色 hex 命名(如 textcolor333333ffffffselector)。在用户要求命名或重命名资源文件、生成 selector / state color / shape / ripple / layer-list drawable、整理布局 id、 规范 colors/dimens/styles 命名时使用。

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/reference.md`).

It sits in Mobile. It works with Android. The repository describes itself as: :fire: ( 持续更新,目前含 300+ 工具类 ) DevUtils 是一个 Android 工具库,主要根据不同功能模块,封装快捷使用的工具类及 API 方法调用。该项目尽可能的便于开发人员,快捷、高效开发安全可靠的项目。 The licence is Apache-2.0.

When your agent uses it

  • Mobile work in your project

Example prompts

  • “/android-xml-resource”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. 基于文件的资源名(layout/、drawable/、color/、mipmap/、anim/…目录下文件)只能用小写 a-z、数字 0-9、下划线 _;大写、空格、连字符、中文都非法。
  2. 资源只能放进 预定义类型目录(drawable/、mipmap/、layout/、values/、color/、anim/、menu/、xml/、raw/、font/…),不能放 res/ 根,也不能自造目录基名。
  3. 配置限定符以 短横线 - 追加到目录基名(drawable-night-hdpi、values-zh-rCN、layout-land),并按官方优先级排序;目录不可嵌套。限定符顺序见 references/reference.md。

What it can do on your machine

Read from SKILL.md and the folder at commit 6022ede. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are xml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • schemas.android.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Android XML Resource loads about 1.3k tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 95 tokens; SKILL.md has 222 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~95
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from afkT/DevUtils at commit 6022ede, republished under its Apache-2.0 licence (© afkT). 222 words, ~1,255 tokens.

Download SKILL.mdSave it as .claude/skills/android-xml-resource/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
android-xml-resource
description
统一 Android XML 资源命名:layout、drawable、mipmap、color、values、id 的前缀与 snake_case 规则;把颜色/圆角/描边/状态编码进文件名(bg_、border_、text_color_…_selector)。 生成 selector 与 ColorStateList 时多状态写入单个文件、内联 shape、默认项放最后、按真实颜色 hex 命名(如 text_color_333333_ffffff_selector)。在用户要求命名或重命名资源文件、生成 selector / state color / shape / ripple / layer-list drawable、整理布局 id、 规范 colors/dimens/styles 命名时使用。

Android XML 资源命名规范(多项目通用)

让新建的 layout、drawable、mipmap、color、values 资源命名一致、可预测、可被工具校验。本 Skill 自包含,不依赖任何外部文档;全量表格、示例与反例见 references/reference.md。

何时用本 Skill

  • 新建或重命名 资源文件(layout / drawable / color / values 等),需要确定文件名与 name。
  • 生成 selector / ColorStateList / shape / ripple / layer-list / state color。
  • 整理布局内 @+id/、colors、dimens、styles 的命名。
  • 判断「该不该新建 drawable/color 文件」。

硬约束(违反会编译失败)

  1. 基于文件的资源名(layout/、drawable/、color/、mipmap/、anim/…目录下文件)只能用小写 a-z、数字 0-9、下划线 _;大写、空格、连字符、中文都非法。
  2. 资源只能放进 预定义类型目录(drawable/、mipmap/、layout/、values/、color/、anim/、menu/、xml/、raw/、font/…),不能放 res/ 根,也不能自造目录基名。
  3. 配置限定符以 短横线 - 追加到目录基名(drawable-night-hdpi、values-zh-rCN、layout-land),并按官方优先级排序;目录不可嵌套。限定符顺序见 references/reference.md。

命名总则

  1. 文件资源一律 snake_case(全小写下划线)。
  2. values/ 值名(name="...")统一 snake_case(btn_submit、dp_12、color_0088ff);仅 style / theme 用 PascalCase + 点分(Theme.App、Widget.App.Button.Primary)。
  3. 前缀表达「是什么」:文件名以用途/控件类型前缀开头(activity_、item_、ic_、bg_…)。
  4. 语义优先、缩写克制;宁可长而清晰。
  5. 模块化前缀:若工程按模块拆资源目录(如 res-<module>/),文件名以模块/功能域起头(main_tab_*、learning_word_*)规避跨模块同名。

各类型的前缀表与 name 规则(layout / drawable 两族 / colors / dimens / styles / ids)见 references/reference.md。

drawable 命名两族(摘要)

按用途二选一,全表见 references/reference.md § drawable 命名:

  • 图标 / 模块状态族:ic_*、btn_*、divider_*、<module>_..._selector(内部用 @mipmap/@drawable 切换状态)。
  • 值编码族(通用背景/描边/文本色,把颜色·圆角·描边·状态编进文件名):
bg_<color1>[_<color2>][_<alphaPercent>][_r<radius>][_border[_<borderColor>]][_w<width>]_<suffix>
border_<strokeColor>[_<alphaPercent>]_r<radius>[_w<width>]
text_color_<color1>_<color2>[_..]_selector
  • 颜色 token = 6 位小写 hex 不带 #(ffffff、0088ff);按真实颜色取值,即使引用的是短别名(@color/color_33 仍写 333333)。第 1 个 = 默认/normal 态,第 2 个 = 激活态。
  • alpha:_<百分比>(_40 = 40% 不透明)。圆角:r<dp>,小数用 _(r2_5 = 2.5dp,r50 = 胶囊)。描边:border/border_<色>、线宽 w<dp>。后缀:selector/shape/gradient。

状态资源单文件整合(强约束 + 重点)

随状态变化的 背景 / 文本色 / 图标 必须用 一个 selector 或 ColorStateList 文件表达全部 state。禁止拆成 xxx_normal.xml + xxx_pressed.xml + xxx_selector.xml。

规则:

  • 背景 selector:每个 <item> 内联 <shape>(corners/solid/stroke),不外链多个 shape 文件。
  • 把更具体/优先的 state 写在前(state_checked/state_pressed/state_selected/state_focused…),无 state 的默认项放最后兜底。
  • 按真实颜色 hex 命名:背景如 bg_ffffff_0088ff_r5_selector;文本色如 text_color_333333_ffffff_selector。

背景 selector 范式(单文件、内联 shape、默认项在最后):

xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_checked="true">
        <shape>
            <corners android:radius="@dimen/dp_5" />
            <solid android:color="@color/color_0088ff" />
        </shape>
    </item>

    <item android:state_selected="true">
        <shape>
            <corners android:radius="@dimen/dp_5" />
            <solid android:color="@color/color_0088ff" />
        </shape>
    </item>

    <item>
        <shape>
            <corners android:radius="@dimen/dp_5" />
            <solid android:color="@color/color_ffffff" />
        </shape>
    </item>
</selector>

文本色 ColorStateList 范式(res/color/ 下,默认项在最后):

xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:color="@color/white" android:state_checked="true" />
    <item android:color="@color/white" android:state_pressed="true" />
    <item android:color="@color/white" android:state_focused="true" />
    <item android:color="@color/white" android:state_selected="true" />
    <item android:color="@color/color_33" />

</selector>

何时「不建 drawable / color 文件」(生成前判断)

能不建文件就不建,优先复用工程现成能力:

  • 圆角 + 纯色 + 描边背景 → 优先项目内的圆角描边 View(如 DevWidget Round* 的 app:dev_*);复杂多态/渐变才写 drawable。
  • 阴影 / 渐变 / pressed / ripple / 子 View 裁剪 → 优先阴影容器(如 ShadowLayout 的 app:hl_*)。
  • 文本/控件状态色 → 优先 StateList BindingAdapter 或 ColorStateList。
  • 控件默认视觉 → 优先 ViewTheme 类封装。
  • dp/sp 字面量 → 用 @dimen/dp_*、@dimen/sp_*。

确需新建时,再按上文命名族与单文件整合规则落地。

自检清单(生成前)

  • 文件名仅小写字母/数字/下划线,且有正确前缀。
  • layout 用组件前缀;id 用「控件类型_语义」。
  • drawable 选对命名族:图标/模块 vs 值编码(颜色/圆角/描边)。
  • 颜色 color_<hex6>[_<alphaPercent>];尺寸 dp_*/sp_*。
  • 多 state 资源 单文件、背景内联 shape、默认项放最后。
  • 颜色 hex 取自真实色值(短别名也写满 6 位)。
  • 新建前已确认无法用现成 View 能力 / ColorStateList 复用。

© afkT, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in .cursor/skills/android-xml-resource of afkT/DevUtils.

  • SKILL.md
  • references/reference.md

Open the folder on GitHubat commit 6022ede

Compare with similar skills

Android XML Resource next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Android XML Resource compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Android XML Resource this skillafkT/DevUtils1.6k—~1.3kAutomated safety check: PassApache-2.0
Compose Multiplatform Patternsmonta-app/ocpp-emulator1805 repos~2kAutomated safety check: PassApache-2.0
Phone HarnessShawnPana/phone-harness3.2k—~4.3kAutomated safety check: PassMIT
Stylesarindamxd/camerax-android1324 repos~2.3kAutomated safety check: PassApache-2.0
Verified Emailarindamxd/camerax-android1324 repos~4.7kAutomated safety check: PassApache-2.0
Argent Metro Debuggerbbplayer-app/BBPlayer1.1k—~3.4kAutomated safety check: PassMIT

Similar skills

  • Compose Multiplatform Patterns

    monta-app/ocpp-emulator

    Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.

    180 GitHub starsUsed in 5 repos~2k tokens
    MobileAuto-check passed
  • Phone Harness

    ShawnPana/phone-harness

    Control the user's phone — an iPhone through the Mac's iPhone Mirroring window, an Android over adb, or a rented cloud Android: open apps, tap, type, swipe, read the screen.

    3.2k GitHub stars~4.3k tokensUpdated 10 days ago
    MobileAuto-check passed
  • Styles

    arindamxd/camerax-android

    A skill your agent uses to integrate the Jetpack Compose Styles API into an Android project.

    132 GitHub starsUsed in 4 repos~2.3k tokens
    MobileAuto-check passed
  • Verified Email

    arindamxd/camerax-android

    Provides a complete workflow for implementing verified email retrieval on Android Credential Manager API.

    132 GitHub starsUsed in 4 repos~4.7k tokens
    MobileAuto-check passed
  • Argent Metro Debugger

    bbplayer-app/BBPlayer

    Debug a JS runtime via CDP using argent debugger tools. An agent skill from bbplayer-app/BBPlayer.

    1.1k GitHub stars~3.4k tokensUpdated today
    MobileAuto-check passed
  • Mobile QA

    tloncorp/tlon-apps

    Run a mobile QA checklist on a physical Android device over adb for tlon-apps, then triage what fails into fixes.

    107 GitHub stars~2.4k tokensUpdated today
    MobileAuto-check passed

More from afkT/DevUtils

All 13 skills in this repo
  • 依据 Android 官方「版本」文档完成平台适配:按版本号 N 抓取行为变更(所有应用、 targetSdk=N)、changes/features 子页与探索新功能/API;归纳影响项并落地到 Manifest/Gradle/工具类封装。在用户要求 Android 版本适配、行为变更排查、 targetSdk 升级、新 API 封装或对照…

    1.6k GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • 根据用户给出的 Java/Kotlin 工具类或 View 相关源码,设计并实现 androidx.databinding.BindingAdapter。

    1.6k GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • 对 DevUtils 工程(DEPSROOT=file/gradle、DEPSMANIFEST=file/deps)中定义的第三方库 GAV 依赖做版本查证与升级;结合 Maven Central、Google Maven、Gradle Plugin Portal、 JitPack 与 GitHub Releases/README 交叉校验「最新可用版本」;必要时修正…

    1.6k GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • 为布局 XML 中的控件默认补全 DevSimple(lib/DevSimple)的 ViewTheme 样式引用: 按控件继承链匹配 ViewTheme.&lt;类名&gt;,ImageView/AppCompatImageView 使用 ViewTheme.ImageView.FITXY,无匹配则用 ViewTheme.View。工作区内优先 Read…

    1.6k GitHub stars~727 tokensUpdated 1 mo ago
    Auto-check passed
  • UI Devwidget Round

    afkT/DevUtils

    在需要圆角矩形纯色背景、描边边框时,优先用 DevWidget(io.github.afkt:DevWidgetX)的 dev.widget.ui.round 包替代 shape / layer-list drawable。流程与核心坑在 SKILL,Round 系列 View、R.styleable.DevWidget 中 app:dev 属性及源码对照见…

    1.6k GitHub stars~880 tokensUpdated 1 mo ago
    Auto-check passed
  • UI Dialogx Dialog

    afkT/DevUtils

    需要对话框、弹窗、菜单、加载等待、轻提示(Toast 替代)、应用内通知、底部弹窗、 上下文菜单、全屏/自定义弹层或操作引导时,默认使用 DialogX (com.github.kongzue.DialogX,本工程已依赖)而非系统 AlertDialog/Toast/PopupMenu。

    1.6k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Android XML Resource

What does Android XML Resource do?

统一 Android XML 资源命名:layout、drawable、mipmap、color、values、id 的前缀与 snakecase 规则;把颜色/圆角/描边/状态编码进文件名(bg、border、textcolor…selector)。. Android XML Resource is an agent skill from afkT/DevUtils.

When should I use Android XML Resource?

Android XML Resource fits situations like: mobile work in your project.

How do I install Android XML Resource in Claude Code?

Run `npx skills add afkT/DevUtils --skill android-xml-resource -a claude-code`. Or copy the skill folder (.cursor/skills/android-xml-resource in afkT/DevUtils) into .claude/skills/android-xml-resource in your project. Claude Code loads it when a task matches its description.

How do I install Android XML Resource in Codex?

Run `npx skills add afkT/DevUtils --skill android-xml-resource -a codex`. Or copy the skill folder (.cursor/skills/android-xml-resource in afkT/DevUtils) into .agents/skills/android-xml-resource in your project. Codex loads it when a task matches its description.

Can I use Android XML Resource in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add afkT/DevUtils --skill android-xml-resource -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/android-xml-resource, .gemini/skills/android-xml-resource, .github/skills/android-xml-resource and .opencode/skills/android-xml-resource in your project.

What does Android XML Resource need to run?

SKILL.md names no scripts, command-line tools or credentials: Android XML Resource is instructions for the agent only.

Does Android XML Resource access the network?

SKILL.md names 1 domain. In commands or code: schemas.android.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Android XML Resource safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Android XML Resource use?

Android XML Resource is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Android XML Resource use?

About 1.3k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.9k tokens, read only when the agent opens those files.

What are the alternatives to Android XML Resource?

Skills that share tags, products or a category with Android XML Resource: Compose Multiplatform Patterns (monta-app/ocpp-emulator, 180 stars), Phone Harness (ShawnPana/phone-harness, 3.2k stars), Styles (arindamxd/camerax-android, 132 stars) and Verified Email (arindamxd/camerax-android, 132 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Android XML Resource?

afkT (a GitHub user) maintains it in afkT/DevUtils, which has 1,612 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on September 2, 2026.

Source: afkT/DevUtils on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.