author-contributions by microsoft/vscode
npx skills add https://github.com/microsoft/vscode --skill author-contributions当被要求查找特定作者在某个分支上(与主分支或其他上游分支相比)贡献的所有文件时,请遵循此流程。目标是生成一个人类和LLM都能使用的简单表格。
此技能涉及许多顺序的 git 命令。将其委托给一个子代理,提示如下:
查找作者 "Full Name" 在分支
<branch>上(与<upstream>相比)贡献的每个文件。通过文件重命名追踪贡献。返回一个 Markdown 表格,列包括:状态(DIRECT 或 VIA_RENAME)、文件路径和行数(+/-)。最后包含一个摘要行。
git log --format="%an <%ae>" <upstream>..<branch> | sort -u
将请求的人员与其确切的 --author= 字符串匹配。不要猜测——短用户名不会匹配完整的显示名称(通过 git log 或 GitHub MCP get_me 工具解决)。
git log --author="<Exact Name>" --format="%H" <upstream>..<branch>
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
对于每个提交哈希,提取涉及的文件:
git diff-tree --no-commit-id --name-only -r <hash>
将所有结果合并到一个集合中(author_files)。
对于分支上的每个提交(不仅仅是作者的),提取重命名信息:
git diff-tree --no-commit-id -r -M <hash>
解析带有 R 状态的行以构建映射:new_path → {old_paths}。
git diff --name-only <upstream>..<branch>
这些是分支合并时将实际生效的文件。
对于步骤 4 中的每个文件:
author_files 中 → DIRECTauthor_files 中 → VIA_RENAMEgit diff --stat <upstream>..<branch> -- <file1> <file2> ...
将结果格式化为 Markdown 表格:
| Status | File | +/- |
|--------|------|-----|
| DIRECT | src/vs/foo/bar.ts | +120/-5 |
| VIA_RENAME | src/vs/baz/qux.ts | +300 |
| ... | ... | ... |
**总计:N 个文件,+X/-Y 行**
.py 脚本,运行它,然后删除它。--author 进行子字符串匹配,但你必须验证匹配到的是正确的人(例如,寻找 "Josh S." 时不要匹配到 "Joshua Smith")。使用 GitHub MCP get_me 工具或 git log 输出来解析正确的全名。contrib/chat/ → agentSessions/ → sessions/ 的移动。重命名映射必须进行传递性遍历。import subprocess, os
os.chdir('<repo_root>')
UPSTREAM = 'main'
AUTHOR = '<Author Name>' # 通过 `git log` 或 GitHub MCP `get_me` 解析
# 步骤 2: 作者的文件
commits = subprocess.check_output(
['git', 'log', f'--author={AUTHOR}', '--format=%H', f'{UPSTREAM}..HEAD'],
text=True).strip().split('\n')
author_files = set()
for h in (c for c in commits if c):
files = subprocess.check_output(
['git', 'diff-tree', '--no-commit-id', '--name-only', '-r', h],
text=True).strip().split('\n')
author_files.update(f for f in files if f)
# 步骤 3: 来自所有提交的重命名映射
all_commits = subprocess.check_output(
['git', 'log', '--format=%H', f'{UPSTREAM}..HEAD'],
text=True).strip().split('\n')
rename_map = {} # new_name -> set(old_names)
for h in (c for c in all_commits if c):
out = subprocess.check_output(
['git', 'diff-tree', '--no-commit-id', '-r', '-M', h],
text=True, timeout=5).strip()
for line in out.split('\n'):
if not line:
continue
parts = line.split('\t')
if len(parts) >= 3 and 'R' in parts[0]:
rename_map.setdefault(parts[2], set()).add(parts[1])
# 步骤 4: 合并差异
diff_files = subprocess.check_output(
['git', 'diff', '--name-only', f'{UPSTREAM}..HEAD'],
text=True).strip().split('\n')
# 步骤 5: 分类
results = []
for f in (x for x in diff_files if x):
if f in author_files:
results.append(('DIRECT', f))
else:
# 遍历重命名链
chain, to_check = set(), [f]
while to_check:
cur = to_check.pop()
if cur in chain:
continue
chain.add(cur)
to_check.extend(rename_map.get(cur, []))
chain.discard(f)
if chain & author_files:
results.append(('VIA_RENAME', f))
# 步骤 6: 统计信息
if results:
stat = subprocess.check_output(
['git', 'diff', '--stat', f'{UPSTREAM}..HEAD', '--'] +
[f for _, f in results], text=True)
print(stat)
# 步骤 7: 表格
for kind, f in sorted(results, key=lambda x: x[1]):
print(f'| {kind:12s} | {f} |')
print(f'\n总计:{len(results)} 个文件')
按照上述流程操作后,运行此脚本以交叉检查作者修改的文件与分支差异。你可以包含或不包含 src/vs/sessions 目录来执行此操作。
AUTHOR=""
# 1. 查找作者在此分支上(不在 main 上)的提交
git log main...HEAD --author="$AUTHOR" --format="%H"
# 2. 获取所有那些提交中涉及的唯一文件,排除 src/vs/sessions/
git log main...HEAD --author="$AUTHOR" --format="%H" \
| xargs -I{} git diff-tree --no-commit-id -r --name-only {} \
| sort -u \
| grep -v '^src/vs/sessions/'
# 3. 与分支差异交叉引用,仅保留与 main 相比仍有更改的文件
git log main...HEAD --author="$AUTHOR" --format="%H" \
| xargs -I{} git diff-tree --no-commit-id -r --name-only {} \
| sort -u \
| grep -v '^src/vs/sessions/' \
| while read f; do git diff main...HEAD --name-only -- "$f" 2>/dev/null; done \
| sort -u
每周安装数
185
代码库
GitHub 星标数
183.0K
首次出现
2026年2月17日
安全审计
安装于
gemini-cli185
github-copilot185
codex185
kimi-cli185
amp185
opencode185
When asked to find all files a specific author contributed to on a branch (compared to main or another upstream), follow this procedure. The goal is to produce a simple table that both humans and LLMs can consume.
This skill involves many sequential git commands. Delegate it to a subagent with a prompt like:
Find every file that author "Full Name" contributed to on branch
<branch>compared to<upstream>. Trace contributions through file renames. Return a markdown table with columns: Status (DIRECT or VIA_RENAME), File Path, and Lines (+/-). Include a summary line at the end.
git log --format="%an <%ae>" <upstream>..<branch> | sort -u
Match the requested person to their exact --author= string. Do not guess — short usernames won't match full display names (resolve via git log or the GitHub MCP get_me tool).
git log --author="<Exact Name>" --format="%H" <upstream>..<branch>
For each commit hash, extract touched files:
git diff-tree --no-commit-id --name-only -r <hash>
Union all results into a set (author_files).
For every commit on the branch (not just the author's), extract renames:
git diff-tree --no-commit-id -r -M <hash>
Parse lines with R status to build a map: new_path → {old_paths}.
git diff --name-only <upstream>..<branch>
These are the files that will actually land when the branch merges.
For each file in step 4:
author_files → DIRECTauthor_files → VIA_RENAMEgit diff --stat <upstream>..<branch> -- <file1> <file2> ...
Format the result as a markdown table:
| Status | File | +/- |
|--------|------|-----|
| DIRECT | src/vs/foo/bar.ts | +120/-5 |
| VIA_RENAME | src/vs/baz/qux.ts | +300 |
| ... | ... | ... |
**Total: N files, +X/-Y lines**
.py script, run it, then delete it.--author does substring matching but you must verify the right person is matched (e.g., don't match "Joshua Smith" when looking for "Josh S."). Use the GitHub MCP get_me tool or git log output to resolve the correct full name.contrib/chat/ → agentSessions/ → sessions/. The rename map must be walked transitively.import subprocess, os
os.chdir('<repo_root>')
UPSTREAM = 'main'
AUTHOR = '<Author Name>' # Resolve via `git log` or GitHub MCP `get_me`
# Step 2: author's files
commits = subprocess.check_output(
['git', 'log', f'--author={AUTHOR}', '--format=%H', f'{UPSTREAM}..HEAD'],
text=True).strip().split('\n')
author_files = set()
for h in (c for c in commits if c):
files = subprocess.check_output(
['git', 'diff-tree', '--no-commit-id', '--name-only', '-r', h],
text=True).strip().split('\n')
author_files.update(f for f in files if f)
# Step 3: rename map from ALL commits
all_commits = subprocess.check_output(
['git', 'log', '--format=%H', f'{UPSTREAM}..HEAD'],
text=True).strip().split('\n')
rename_map = {} # new_name -> set(old_names)
for h in (c for c in all_commits if c):
out = subprocess.check_output(
['git', 'diff-tree', '--no-commit-id', '-r', '-M', h],
text=True, timeout=5).strip()
for line in out.split('\n'):
if not line:
continue
parts = line.split('\t')
if len(parts) >= 3 and 'R' in parts[0]:
rename_map.setdefault(parts[2], set()).add(parts[1])
# Step 4: merge diff
diff_files = subprocess.check_output(
['git', 'diff', '--name-only', f'{UPSTREAM}..HEAD'],
text=True).strip().split('\n')
# Step 5: classify
results = []
for f in (x for x in diff_files if x):
if f in author_files:
results.append(('DIRECT', f))
else:
# walk rename chain
chain, to_check = set(), [f]
while to_check:
cur = to_check.pop()
if cur in chain:
continue
chain.add(cur)
to_check.extend(rename_map.get(cur, []))
chain.discard(f)
if chain & author_files:
results.append(('VIA_RENAME', f))
# Step 6: stats
if results:
stat = subprocess.check_output(
['git', 'diff', '--stat', f'{UPSTREAM}..HEAD', '--'] +
[f for _, f in results], text=True)
print(stat)
# Step 7: table
for kind, f in sorted(results, key=lambda x: x[1]):
print(f'| {kind:12s} | {f} |')
print(f'\nTotal: {len(results)} files')
After following the process above, run this script to cross-check files touched by an author against the branch diff. You can do this both with an without src/vs/sessions.
AUTHOR=""
# 1. Find commits by author on this branch (not on main)
git log main...HEAD --author="$AUTHOR" --format="%H"
# 2. Get unique files touched across all those commits, excluding src/vs/sessions/
git log main...HEAD --author="$AUTHOR" --format="%H" \
| xargs -I{} git diff-tree --no-commit-id -r --name-only {} \
| sort -u \
| grep -v '^src/vs/sessions/'
# 3. Cross-reference with branch diff to keep only files still changed vs main
git log main...HEAD --author="$AUTHOR" --format="%H" \
| xargs -I{} git diff-tree --no-commit-id -r --name-only {} \
| sort -u \
| grep -v '^src/vs/sessions/' \
| while read f; do git diff main...HEAD --name-only -- "$f" 2>/dev/null; done \
| sort -u
Weekly Installs
185
Repository
GitHub Stars
183.0K
First Seen
Feb 17, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli185
github-copilot185
codex185
kimi-cli185
amp185
opencode185
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
150,000 周安装
Agent Skills (agentskills.io) - 为AI智能体创建可移植技能的规范与工具
1 周安装
CI/CD流水线设置指南:自动化构建、测试与部署最佳实践
173 周安装
shadcn/ui 组件库使用指南:Radix UI + Tailwind CSS 可自定义前端组件集成
1 周安装
Web性能优化专家模式 | 核心Web指标、页面加载速度与渲染性能优化工具
1 周安装
API安全审查指南:OWASP API十大风险检测与自动化测试工具
1 周安装
TanStack Query Pro 使用指南:Next.js 16 数据获取、缓存与 SSR 优化
2 周安装