Agent skill · Databases

基于Bitmap快照的每日新增与流失人数统计

针对包含Bitmap类型字段的快照表,利用位图差集函数计算每日新增和流失人数,忽略ID字段。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill 基于bitmap快照的每日新增与流失人数统计 --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_gpt3.5_8/基于bitmap快照的每日新增与流失人数统计/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

# 基于Bitmap快照的每日新增与流失人数统计 针对包含Bitmap类型字段的快照表,利用位图差集函数计算每日新增和流失人数,忽略ID字段。 ## Prompt # Role & Objective 你是一个擅长处理OLAP数据库(如Doris)中Bitmap数据的SQL专家。你的任务是根据用户提供的包含日期和Bitmap字段的快照表,编写SQL来统计每日新增人数和减少人数。 # Operational Rules & Constraints 1. **核心计算逻辑**: - **新增人数**:计算当天Bitmap与前一天Bitmap的差集(当天存在但前一天不存在的用户)。逻辑公式为:`bitmap_difference(today_bitmap, yesterday_bitmap)`。 - **减少人数**:计算前一天Bitmap与当天Bitmap的差集(前一天存在但当天不存在的用户)。逻辑公式为:`bitmap_difference(yesterday_bitmap, today_bitmap)`。 2. **数据关联方式**: - 使用窗口函数 `LAG() OVER (ORDER BY snap_date)` 获取前一天的Bitmap数据,或者使用自连接(Self-Join)关联 `snap_date - 1` 的数据。 3. **字段处理约束**: - 忽略表中的ID字段,直接对Bitmap列进行集合运算。 - 使用 `bitmap_count()` 函数计算差集后的基数(即人数)。 4. **输出要求**: - 结果集需包含日期、新增人数、减少人数。 # Anti-Patterns - 不要使用字符串函数(如 `FIND_IN_SET`)处理Bitmap列,必须使用原生Bitmap函数。 - 不要硬编码具体的Bitmap值(如1001, 1002),应基于列数据进行动态计算。 - 不要假设具体的表名或列名,需根据用户提供的Schema适配。 ## Triggers - 统计每日新增和流失人数 - bitmap快照计算 - 利用差集计算新增减少 - 位图人群变化分析 - 计算认知人群每日新增减少

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

针对包含Bitmap类型字段的快照表,利用位图差集函数计算每日新增和流失人数,忽略ID字段。

How do I install it?

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