skills/ip-geo-distribution/SKILL.md
Geolocate a batch of IPv4 addresses and produce a Markdown distribution table — Chinese IPs broken down by province (incl. HK/MO/TW), foreign IPs by country, with counts and percentages. Optionally exports CSV. Uses the free ip-api.com batch endpoint (no key, no signup, HTTP only, 15 batches × 100 IPs per minute). Use when the user pastes a list of IPs and asks for "IP 分布", "IP 归属地分布", "省份分布", "where are these IPs from", "geolocate these IPs", or wants an IP-region breakdown table.
npx skillsauth add realroc/skills ip-geo-distributionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Resolves an arbitrary list of IPv4 addresses to country (and Chinese province) and outputs a clean distribution table.
ip, country_code, country, region, bucketUses ip-api.com 批量接口 (http://ip-api.com/batch):
字段:status,country,countryCode,regionName,query。
省份准确率 80-90%(移动 4G/5G 出口 IP 偶有归错),国家级 ≈ 99%。
按用户提供方式接收输入:
--ips 参数(逗号分隔)或写入临时文件传 --file--file <path>,脚本自动识别每行一个 / 逗号分隔 / JSON 数组三种格式cat ips.txt | python3 scripts/lookup_ips.py --stdin如果列表超过 ~5000 IPs,先告诉用户预计耗时(按 1500 IPs/min 估算)并征求确认。
python3 scripts/lookup_ips.py \
--file /tmp/ips.txt \
[--csv /tmp/result.csv] \
[--raw /tmp/raw.json]
或直接传 IPs:
python3 scripts/lookup_ips.py --ips "1.2.3.4,5.6.7.8,..."
脚本会:
countryCode 分桶(CN 走省份映射,HK/MO/TW 单列,其它进国家桶)--csv,同时落盘 CSV--raw,把 ip-api 原始 JSON 落盘把脚本的 stdout 内容原样回给用户。前面加一句简短总览("X 个 IP,其中国内 Y 个,海外 Z 个"),后面可以挑 1-2 个数据洞察补充(top 省份占比、海外集中度等)。
不要再二次加工省份名(脚本已经映射成中文)。
status: fail,脚本会把它们汇到 "查询失败" 列表里单独列出。regionName 为空:极少见的边界 IP,归到 中国-未知 桶,提醒用户人工核查。status: fail 全批次失败 → 等 60s 再重试一次;仍失败则把这批 IP 报告给用户。## 总体概览
| 区域 | 数量 | 占比 |
|------|------|------|
| 中国大陆 | 1102 | 94.43% |
| 港澳台 | 20 | 1.71% |
| 海外 | 45 | 3.86% |
## 国内(含港澳台,按省份/地区)
| 省份/地区 | 数量 | 占比 |
|----------|------|------|
| 广东 | 289 | 24.76% |
| 北京 | 99 | 8.48% |
| ...
## 海外(按国家)
| 国家 | 数量 | 占比 |
|------|------|------|
| 美国 | 17 | 1.46% |
| ...
development
Screen MongoDB conversation collections for script-driven abuse (prompt-injection templates, curl/empty user agents, probe-word floods, sessionless calls, multi-account IPs). Produces a two-tier triage report (confirmed abuse / suspicious) plus a multi-account IP list and a ban candidate CSV. Use when asked to find script callers, prompt-injection attempts, abnormal high-frequency users, accounts bypassing the web UI, or "who is using my AI as a cron job".
development
Audit or rewrite a prompt into a six-section issue spec (Goal / Constraints / Non-goals / Verification / Architecture notes / Existing context) before any code gets generated. Use when the user pastes a vague request and asks for implementation, or explicitly says they want to frame an issue properly. Triggers on: prompt spec, audit this prompt, check my prompt, what's missing in this prompt, frame this issue, rewrite as a prompt spec, convert to issue spec, make this an issue, issue framing.
testing
GitHire's six-step AI-native engineering method: frame the issue, sandbox, AI execute, AI review, architect decision, ship. Use when planning or executing real work with AI agents — issue framing, prompt writing, PR review gating, architect handoff — or anytime humans-frame-AI-execute-architects-verify applies. Triggers on: use githire, githire methodology, issue-first onboarding, ai-native workflow, frame this issue, prompt spec, architect review, first PR for a candidate, hire through real PRs.
development
Automate Shumei-based user violation-rate audits from MongoDB user and conversation collections, producing a CSV sorted by per-user request violation rate. Use when asked to screen users for forbidden/risky content, compute user-level violation rates, audit newly registered/free/suspicious users, or rerun a similar report with custom user filters, conversation filters, and a Shumei input-event key.