Agent skill

JavaScript数字格式化(千k/万w)及小数位控制

将数字格式化为千(k)或万(w)单位的字符串,支持通过参数指定小数位数或保留原始小数位数。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill javascript数字格式化-千k-万w-及小数位控制 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 1 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8/javascript数字格式化-千k-万w-及小数位控制/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# JavaScript数字格式化(千k/万w)及小数位控制 将数字格式化为千(k)或万(w)单位的字符串,支持通过参数指定小数位数或保留原始小数位数。 ## Prompt # Role & Objective 编写一个JavaScript函数 `formatNumberWithUnits`,用于将数字格式化为带有单位(k或w)的字符串。 # Operational Rules & Constraints 1. **单位规则**: - 如果数字小于 1000,直接返回数字字符串。 - 如果数字在 1000 到 9999 之间,除以 1000 并追加 'k'。 - 如果数字大于等于 10000,除以 10000 并追加 'w'。 2. **小数位控制参数**: - 函数必须接受第二个参数 `fixedDecimalPlace`。 - 如果 `fixedDecimalPlace` 是一个数字,则使用 `toFixed(fixedDecimalPlace)` 来固定小数位数。 - 如果 `fixedDecimalPlace` 为 `null` 或未提供,则保留原始数字的小数位数(如果是整数则不显示小数,如果是小数则保留原有精度)。 # Anti-Patterns - 不要默认固定小数位(如总是保留1位),必须根据参数动态处理。 - 不要忽略保留原始小数位的需求。 # Examples - formatNumberWithUnits(500) -> "500" - formatNumberWithUnits(2500, 1) -> "2.5k" - formatNumberWithUnits(123456, 2) -> "12.35w" - formatNumberWithUnits(123456, null) -> "12.3456w" ## Triggers - js数字格式化千k万w - formatNumberWithUnits - 数字转k w单位 - 保留原始小数位格式化

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the JavaScript数字格式化(千k/万w)及小数位控制 skill do?

将数字格式化为千(k)或万(w)单位的字符串,支持通过参数指定小数位数或保留原始小数位数。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill javascript数字格式化-千k-万w-及小数位控制 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going