Agent skill

Android Dimen Dp Sp

by afkT in afkT/DevUtils

将布局与代码中的硬编码 dp、sp 改为引用 @dimen/dp、@dimen/sp 与 R.dimen.; 资源名规则为整数部分与一位小数部分用下划线连接(如 12.5 → dp125)。

Apache-2.0Auto-check passedMobile

Install Android Dimen Dp Sp

skills CLI
$ npx skills add afkT/DevUtils --skill android-dimen-dp-sp -a claude-code

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

GitHub CLI
$ gh skill install afkT/DevUtils android-dimen-dp-sp --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-dimen-dp-sp .claude/skills/android-dimen-dp-sp && 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-dimen-dp-sp
GitHub stars
1.6k
Token cost
~512 tokens
SKILL.md length
163 words
Files
1
Skills in repo
13
Repo updated
First seen
Licence
Apache-2.0

At a glance

将布局与代码中的硬编码 dp、sp 改为引用 @dimen/dp、@dimen/sp 与 R.dimen.; 资源名规则为整数部分与一位小数部分用下划线连接(如 12.5 → dp125)。

  • Works in 4 steps: 前缀:物理长度用 dp_,文字尺寸用 sp_。 → 有小数时:整数部分 + _ + 小数点后那一位数字(仅 一位 小数参与命名)。 → 一位小数的得出方式(与「12.5555 →… → …
  • Tasks that involve Android development
  • SKILL.md covers 何时用本 Skill, 命名规则(核心), 从字面量到资源名的算法(给 Agent 执行用) and XML 写法, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Android Dimen Dp Sp is an agent skill from afkT/DevUtils. 将布局与代码中的硬编码 dp、sp 改为引用 @dimen/dp、@dimen/sp 与 R.dimen.; 资源名规则为整数部分与一位小数部分用下划线连接(如 12.5 → dp125)。 在用户要求去掉魔法数、统一 dimen、替换 dp/sp 字面量或规范化尺寸引用时使用。

Its SKILL.md is about 510 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

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

When your agent uses it

  • Tasks that involve Android development

Example prompts

  • “/android-dimen-dp-sp”

Workflow steps

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

  1. 前缀:物理长度用 dp_,文字尺寸用 sp_。
  2. 有小数时:整数部分 + _ + 小数点后那一位数字(仅 一位 小数参与命名)。
  3. 一位小数的得出方式(与「12.5555 → dp_12_5」一致):截断到小数点后一位(丢弃第二位及以后),不按四舍五入成 12.6。
  4. 无小数(整数)时:dp_12、sp_8,不要写成 dp_12_0(除非用户项目已有该风格再跟随项目)。

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.

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

  • Network

    No URLs in SKILL.md.

    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 Dimen Dp Sp loads about 512 tokens when it runs. Until then it costs about 42 tokens; SKILL.md has 163 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~512

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). 163 words, ~512 tokens.

Download SKILL.mdSave it as .claude/skills/android-dimen-dp-sp/SKILL.md (or your agent's skills folder).
name
android-dimen-dp-sp
description
将布局与代码中的硬编码 dp、sp 改为引用 @dimen/dp_*、@dimen/sp_* 与 R.dimen.*; 资源名规则为整数部分与一位小数部分用下划线连接(如 12.5 → dp_12_5)。 在用户要求去掉魔法数、统一 dimen、替换 dp/sp 字面量或规范化尺寸引用时使用。

Android:硬编码 dp / sp → @dimen/dp_*、@dimen/sp_*

何时用本 Skill

  • 用户要把 XML / Kotlin / Java 里写死的 Ndp / Nsp 或等价的 dp、sp 数值,改成 dimen 引用。
  • 不要去仓库里搜索、推断或校验 values/dimens.xml 是否已有对应项:默认视为已存在,直接按规则写出 @dimen/... 与 R.dimen....。

命名规则(核心)

  1. 前缀:物理长度用 dp_,文字尺寸用 sp_。
  2. 有小数时:整数部分 + _ + 小数点后那一位数字(仅 一位 小数参与命名)。
    • 小数部分命名里的 _ 表示小数点,不是第二个「任意分隔符」。
  3. 一位小数的得出方式(与「12.5555 → dp_12_5」一致):截断到小数点后一位(丢弃第二位及以后),不按四舍五入成 12.6。
  4. 无小数(整数)时:dp_12、sp_8,不要写成 dp_12_0(除非用户项目已有该风格再跟随项目)。
原始数值(dp 或 sp,单位一致即可)资源名(dp 示例)XML 引用代码引用
0.5dp_0_5@dimen/dp_0_5R.dimen.dp_0_5
12.5dp_12_5@dimen/dp_12_5R.dimen.dp_12_5
12.5555dp_12_5(先截断为 12.5)@dimen/dp_12_5R.dimen.dp_12_5
12dp_12@dimen/dp_12R.dimen.dp_12

sp 同理:12.5sp → @dimen/sp_12_5、R.dimen.sp_12_5。

从字面量到资源名的算法(给 Agent 执行用)

对某个 dp 或 sp 的数值 v(只看数字部分):

  1. 若 v 为整数(或可视为整数):资源名为 dp_<整数> 或 sp_<整数>。
  2. 若 v 有小数部分:将 v 截断到小数点后一位得到 v',拆成整数部分 a 与一位小数数字 b(b 为 0–9),资源名为 dp_<a>_<b> 或 sp_<a>_<b>。
    • 例:v = 12.5555 → v' = 12.5 → a = 12, b = 5 → dp_12_5。
    • 例:v = 0.5 → v' = 0.5 → dp_0_5。

XML 写法

  • 将 android:padding="12.5dp"、tools:layout_margin="8sp" 等中的 字面量 改为 @dimen/dp_12_5、@dimen/sp_8 等形式;不要在属性值里再保留 dp/sp 后缀(dimen 条目自身已带单位语义)。
  • 若原先是 tools: 或 app: 等命名空间,只替换尺寸字面量部分,其余属性名与命名空间不变。

Kotlin / Java 写法

  • 需要 资源 id 时:R.dimen.dp_12_5、R.dimen.sp_8 等,与上述命名一致。
  • 取像素时仍按项目惯例使用 resources.getDimension(R.dimen.dp_12_5) 等;本 Skill 只规定 资源名与引用形式,不规定用 px 还是 dp 的封装工具类。

注意

  • 只改 dp/sp 到 dimen 的映射与引用;不要顺带「优化」无关布局、不要擅自新建 dimens.xml 条目(除非用户明确要求创建资源文件)。
  • 负值、表达式(如 10dp+2dp)若出现,本 Skill 未定义统一资源名:先向用户确认或按项目已有约定处理。

© 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

Just SKILL.md in .cursor/skills/android-dimen-dp-sp of afkT/DevUtils.

Open the folder on GitHubat commit 6022ede

Compare with similar skills

Android Dimen Dp Sp 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 Dimen Dp Sp compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Android Dimen Dp Sp this skillafkT/DevUtils1.6k—~512Automated safety check: PassApache-2.0
Android Hidden API and R8 Checkgkd-kit/gkd43k—~1.5kAutomated safety check: PassGPL-3.0
Compose Multiplatform Patternsmonta-app/ocpp-emulator1805 repos~2kAutomated safety check: PassApache-2.0
Android Developmentdpconde/claude-android-skill337—~1.7kAutomated safety check: PassMIT
Architecture Overclocknekomangaorg/Neko2.8k—~1.4kAutomated safety check: PassApache-2.0
Claude Android NinjaDrjacky/claude-android-ninja124—~5.2kAutomated safety check: PassApache-2.0

Similar skills

  • Checks whether Android hidden-API implementations and system callbacks survive R8 minification, and diagnoses Release-only failures such as AbstractMethodError.

    43k GitHub stars~1.5k tokensUpdated yesterday
    MobileAuto-check passed
  • 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
  • Android Development

    dpconde/claude-android-skill

    Create production-quality Android applications following Google's official architecture guidance and NowInAndroid best practices.

    337 GitHub stars~1.7k tokensUpdated 10 mo ago
    MobileAuto-check passed
  • Architecture Overclock

    nekomangaorg/Neko

    Resolves deep, structural performance bottlenecks in the Kotlin Android codebase.

    2.8k GitHub stars~1.4k tokensUpdated today
    MobileAuto-check passed
  • Claude Android Ninja

    Drjacky/claude-android-ninja

    Build and migrate Android apps with Kotlin, Jetpack Compose, MVVM, Hilt, Room 3 (KSP, SQLiteDriver, Flow/suspend DAOs), Navigation3, and multi-module Gradle.

    124 GitHub stars~5.2k tokensUpdated 10 days ago
    MobileAuto-check passed
  • Expo Brownfield Integration

    mweinbach/agent-coworker

    Helps add Expo and React Native to an existing native iOS or Android app, and choose between a prebuilt AAR or XCFramework and a fully integrated build.

    156 GitHub starsUsed in 2 repos~900 tokens
    MobileAuto-check: notes

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

    1.6k GitHub stars~1.3k 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

Works with

Categories

Questions about Android Dimen Dp Sp

What does Android Dimen Dp Sp do?

将布局与代码中的硬编码 dp、sp 改为引用 @dimen/dp、@dimen/sp 与 R.dimen.; 资源名规则为整数部分与一位小数部分用下划线连接(如 12.5 → dp125)。. Android Dimen Dp Sp is an agent skill from afkT/DevUtils.

When should I use Android Dimen Dp Sp?

Android Dimen Dp Sp fits situations like: tasks that involve Android development.

How do I install Android Dimen Dp Sp in Claude Code?

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

How do I install Android Dimen Dp Sp in Codex?

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

Can I use Android Dimen Dp Sp 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-dimen-dp-sp -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-dimen-dp-sp, .gemini/skills/android-dimen-dp-sp, .github/skills/android-dimen-dp-sp and .opencode/skills/android-dimen-dp-sp in your project.

What does Android Dimen Dp Sp need to run?

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

Does Android Dimen Dp Sp access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Android Dimen Dp Sp 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 Dimen Dp Sp use?

Android Dimen Dp Sp 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 Dimen Dp Sp use?

About 512 tokens (SKILL.md is roughly 2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Android Dimen Dp Sp?

Skills that share tags, products or a category with Android Dimen Dp Sp: Android Hidden API and R8 Check (gkd-kit/gkd, 43k stars), Compose Multiplatform Patterns (monta-app/ocpp-emulator, 180 stars), Android Development (dpconde/claude-android-skill, 337 stars) and Architecture Overclock (nekomangaorg/Neko, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Android Dimen Dp Sp?

afkT (a GitHub user) maintains it in afkT/DevUtils, which has 1,613 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.