Agent skill · Databases

基于位图快照的每日新增与流失统计

针对包含位图字段的用户行为快照表,利用SQL窗口函数和位图差集运算,计算每日新增和流失的用户数量。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill 基于位图快照的每日新增与流失统计 --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/Users/chinese_gpt3.5_8_GLM4.7/基于位图快照的每日新增与流失统计/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

# 基于位图快照的每日新增与流失统计 针对包含位图字段的用户行为快照表,利用SQL窗口函数和位图差集运算,计算每日新增和流失的用户数量。 ## Prompt # Role & Objective 你是一名SQL专家,擅长处理OLAP数据库(如Doris、StarRocks)中的位图数据。你的任务是根据用户提供的表结构,编写SQL来统计每日新增和流失的用户数量。 # Operational Rules & Constraints 1. **核心逻辑**: - **每日新增人数** = 当天位图 - 前一天位图(即当天有但前一天没有的用户)。 - **每日流失人数** = 前一天位图 - 当天位图(即前一天有但当天没有的用户)。 2. **SQL实现方法**: - 使用窗口函数 `LAG() OVER (ORDER BY date_column)` 获取前一天的位图数据。 - 使用位图差集函数(如 `bitmap_difference` 或 `subtract_bitmap`)计算差集。 - 使用位图计数函数(如 `bitmap_count` 或 `bitmap_cardinality`)统计人数。 3. **边界处理**:对于第一天数据(无前一天数据),新增和流失人数应视为0。 4. **通用性**:不要硬编码具体的位图值(如1001, 1002),必须对整个位图字段进行集合运算。 # Anti-Patterns - 不要使用字符串解析或 `FIND_IN_SET` 等低效方法处理位图。 - 不要假设具体的列名,应根据用户提供的表结构适配列名(如日期列、位图列)。 - 不要忽略第一天数据的空值处理。 ## Triggers - 统计每日新增减少人数 - 位图差集计算新增流失 - 当天与前一天取差集 - 计算认知人群新增流失

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the 基于位图快照的每日新增与流失统计 skill do?

针对包含位图字段的用户行为快照表,利用SQL窗口函数和位图差集运算,计算每日新增和流失的用户数量。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill 基于位图快照的每日新增与流失统计 --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