Readme.skill — AI-Native 开发者档案生成器
You (the AI agent invoking this skill) will read local Claude Code + Codex CLI
- Kiro (AWS) + Trae (ByteDance) data, compute a fixed set of dimensions, and
render a Markdown profile under
./output/in the user's requested language (Chinese by default; English when the user asks in English or explicitly requests English). You do all of the work — read the files withRead, query sqlite viaBash, and synthesize the prose yourself. Do not write helper scripts; the skill is the recipe.
支持的 4 个 AI 编程工具(任一缺失都自动降级跳过):
- Claude Code (
~/.claude/) — Step 2- Codex CLI (
~/.codex/) — Step 3- Kiro CLI / IDE (
~/.kiro/+~/.local/share/kiro-cli/) — Step 3b- Trae IDE (
~/Library/Application Support/Trae/+ 项目.trae/) — Step 3c
默认行为:对外分享版 —— 项目名匿名、敏感信息脱敏。 如果用户明确说"私人版 / 不要脱敏 / show real names",跳过匿名步骤。
Step 1 — 准备
cd <repo-with-this-skill> # e.g. ~/Projects/Readme.skill
mkdir -p output
DATE=$(date +%Y%m%d)
Decide anonymization mode (default = on). Build an in-memory mapping
real_path → "项目 A/B/C" as you encounter project paths in later steps.
Use the same mapping consistently across all sections.
Step 2 — 读取 Claude Code 数据 (~/.claude/ + 项目 .claude/)
2.1 预聚合统计(最权威,先看这个)
Read ~/.claude/stats-cache.json. Extract:
| 字段 | 含义 |
|---|---|
totalSessions | session 总数 |
totalMessages | 消息总数 |
firstSessionDate | 首个 session ISO 时间 |
longestSession.{duration,messageCount,timestamp} | 最长 session |
hourCounts | {hour: count} 24h 热力 |
modelUsage[model].{inputTokens,outputTokens,cacheReadInputTokens,cacheCreationInputTokens} | 每模型 token 细分 |
dailyActivity[].{date,messageCount,sessionCount,toolCallCount} | 每日活跃 |
dailyModelTokens[].{date,tokensByModel} | 每日按模型 token |
派生量(你来算):
claude_tokens_spent = Σ (inputTokens + outputTokens + cacheCreationInputTokens)—— 真实新付费 tokenclaude_cache_read = Σ cacheReadInputTokens—— 缓存复用,反映 prompt-caching 熟练度cache_to_spent_ratio = claude_cache_read / claude_tokens_spent—— 比值越大越熟
2.2 Slash-command 热度
~/.claude/history.jsonl —— 每行 {display, timestamp, project, sessionId}。
# Top 15 slash commands
jq -r 'select(.display | startswith("/")) | (.display | split(" ")[0])' \
~/.claude/history.jsonl | sort | uniq -c | sort -rn | head -15
# 总条数 vs 命令条数 vs 直接 prompt 条数
total=$(wc -l < ~/.claude/history.jsonl)
cmd=$(jq -r 'select(.display | startswith("/")) | .display' ~/.claude/history.jsonl | wc -l)
echo "total=$total cmd=$cmd plain=$((total - cmd))"
记录:/effort、/plan、/skill*、/usage、/clear、/resume、/compact、/init 各自次数。
2.3 项目分布 (~/.claude/projects/)
Each subdir is one project; per-project *.jsonl files = sessions.
The dir name encodes the absolute path with / → - (ambiguous when the
original path itself contains -).
# Top 15 by session-file count
for d in ~/.claude/projects/*/; do
n=$(ls "$d"*.jsonl 2>/dev/null | wc -l | tr -d ' ')
echo "$n $(basename "$d")"
done | sort -rn | head -15
To recover the canonical real path (so you can run git log later), read
the cwd field from the first JSONL in each dir:
head -1 ~/.claude/projects/<encoded>/*.jsonl 2>/dev/null \
| jq -r 'select(.cwd) | .cwd' | head -1
2.4 计划与 skill 自研
Claude Code 的 plan 文件目录不是固定值。默认在 ~/.claude/plans,
但用户可以通过 plansDirectory 改到项目工作目录下,例如
"./.claude/plans"。统计 plans 时必须先解析候选 plan 目录,不能只枚举
~/.claude/plans/*.md。
解析规则:
- 先从
~/.claude/projects/*/*.jsonl的cwd字段恢复 Claude Code 访问过的项目根目录。 - 对每个项目根目录,按 Claude Code settings 优先级读取:
.claude/settings.local.json>.claude/settings.json>~/.claude/settings.json> default。 - 如果有效 settings 中存在
plansDirectory:- 绝对路径保持不变;
~/...展开为$HOME/...;./...或其他相对路径按该项目根目录解析。
- 如果没有配置,使用默认
~/.claude/plans。 - 把所有候选目录下的
*.md真实路径去重后,再统计 plan 数量和标题。
# Plan titles (first # heading of each plan) from all resolved plan dirs.
# Include ~/.claude/plans plus any per-project plansDirectory targets.
# Count plan files by file count, not by title extraction success.
plan_count=<resolved-plan-file-count>
for f in <resolved-plan-files>; do
awk '/^# / { sub(/^# /, ""); print; exit }' "$f"
done
ls ~/.claude/skills/ | wc -l # skills installed / authored
ls ~/.claude/tasks/ | wc -l # tasks tracked
ls ~/.claude/todos/ | wc -l
2.4b Skill 清单(AI 基础设施采集)
For each ~/.claude/skills/*/SKILL.md and ~/.codex/skills/*/SKILL.md,
use the Read tool to inspect the frontmatter (top of file, between --- markers). Extract name and the full description as YAML semantics dictate.
Support all four YAML scalar styles:
| 写法 | 处理 |
|---|---|
单行: description: foo bar | 直接取冒号后内容 |
引号: description: "foo bar" 或 'foo bar' | 去掉首尾引号 |
> folded(多行折叠) | join indented continuation lines with spaces |
| literal(多行保留) | preserve line breaks |
停止条件:遇到下一个未缩进的 frontmatter key(行首无空格且形如 key:),或遇到关闭的 --- 行。如果 description 字段缺失,回落到 <目录名> (no description)。
绝不使用 head \| grep —— 那会把 >/\| 多行风格静默截断到只剩 >,这是 v2.2 之前的真实 bug。务必 Read 完整 frontmatter 后按 YAML 语义解析。
枚举候选 skill 目录:
ls -d ~/.claude/skills/*/ ~/.codex/skills/*/ 2>/dev/null
然后对每个目录:Read 它的 SKILL.md 头部 ~30 行 → 按上表解析 YAML → 输出 <source>|<name>|<full_description>。
记录每个 skill 是「自建」还是「安装」。如果 skill 目录下有 git remote 指向用户自己的 repo,标记为自建;否则标记为安装。
2.5 配置深度
Read ~/.claude/settings.json. Count:
hooks个数(结构化自动化能力)mcpServers个数(外部能力接入)permissions.defaultMode
Step 3 — 读取 Codex CLI 数据 (~/.codex/)
3.1 SQLite (read-only)
The primary analytics store is ~/.codex/state_5.sqlite, table threads.
Always open with mode=ro so you can never write:
SQ='sqlite3 file:'"$HOME"'/.codex/state_5.sqlite?mode=ro&immutable=1'
# Aggregate
$SQ "SELECT COUNT(*), SUM(tokens_used), MIN(created_at), MAX(created_at) FROM threads;"
# Model breakdown (note: empty/NULL model = older sessions, label as 'Codex (未标注)')
$SQ "SELECT COALESCE(NULLIF(model,''),'Codex(未标注)'), COUNT(*), SUM(tokens_used) \
FROM threads GROUP BY 1 ORDER BY 3 DESC;"
# Reasoning effort distribution (xhigh / high / medium / low / unspecified)
$SQ "SELECT COALESCE(NULLIF(reasoning_effort,''),'unspecified'), COUNT(*) \
FROM threads GROUP BY 1 ORDER BY 2 DESC;"
# Top 15 working dirs
$SQ "SELECT cwd, COUNT(*), SUM(tokens_used) FROM threads \
WHERE cwd != '' GROUP BY cwd ORDER BY 2 DESC LIMIT 15;"
# Hour-of-day heatmap
$SQ "SELECT strftime('%H', datetime(created_at,'unixepoch')), COUNT(*) \
FROM threads GROUP BY 1 ORDER BY 1;"
# Day-of-activity timeseries
$SQ "SELECT date(created_at,'unixepoch'), COUNT(*) FROM threads GROUP BY 1;"
# Sample titles + first user messages for keyword extraction (titles only — no body)
$SQ "SELECT title FROM threads WHERE title != '' ORDER BY created_at DESC LIMIT 200;"
$SQ "SELECT first_user_message FROM threads WHERE first_user_message != '' \
ORDER BY created_at DESC LIMIT 200;"
# CLI versions used (Codex evolution signal)
$SQ "SELECT cli_version, COUNT(*) FROM threads WHERE cli_version != '' \
GROUP BY 1 ORDER BY 2 DESC LIMIT 10;"
# --- 以下为 v2.0 新增查询 ---
# 月度聚合(Evolution 曲线用)
$SQ "SELECT strftime('%Y-%m', datetime(created_at,'unixepoch')), COUNT(*), \
SUM(tokens_used), COALESCE(NULLIF(model,''),'unknown') \
FROM threads GROUP BY 1,4 ORDER BY 1,3 DESC;"
# CLI 版本时间线(Evolution 曲线用)
$SQ "SELECT cli_version, MIN(date(created_at,'unixepoch','localtime')), \
MAX(date(created_at,'unixepoch','localtime')), COUNT(*) \
FROM threads WHERE cli_version != '' GROUP BY 1 ORDER BY 2;"
# 每项目 token 消耗(双工具编排分析用)
$SQ "SELECT cwd, COALESCE(NULLIF(model,''),'unknown'), COUNT(*), SUM(tokens_used) \
FROM threads WHERE cwd != '' GROUP BY 1,2 ORDER BY 1,4 DESC;"
3.2 Codex 全局历史
~/.codex/history.jsonl — {session_id, ts, text}. Sample for keywords:
wc