compare-gradle-builds
它能做什么
这项技能比较 Tuist 中记录的两次 Gradle 构建,例如两个分支的构建。适合开发 Android 或 JVM 项目、想找出构建变慢原因的开发者。
适用场景
- ✓当功能分支上的 Gradle 构建变慢时。
- ✓当两次 Gradle 构建之间缓存使用或任务结果发生变化时。
- ✓当你希望获得 Gradle 构建退化摘要并附带修复建议的时候。
技能链接
https://github.com/tuist/tuist/blob/main/skills/skills/compare-gradle-builds/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请比较我最新的 Gradle 构建和主分支,并告诉我哪些任务变慢了。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会找到这两次构建,读取它们的耗时和任务结果,比较缓存命中情况,然后总结退化和改进的地方。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Compare Gradle Builds
Quick Start
You'll typically receive two build identifiers (IDs, dashboard URLs, or branch names). Follow these steps using the Tuist MCP tools:
- Use
list_gradle_buildsto find builds on each branch. - Use
get_gradle_buildfor both base and head builds. - Use
list_gradle_build_tasksto fetch task-level details for both builds. - Compare duration, status, cache hit rates, and task outcomes.
- Summarize regressions, improvements, and recommendations.
If only one identifier is provided, use the project's default branch as the baseline.
Step 1: Resolve Builds
If base/head are build IDs or dashboard URLs
Fetch each directly with get_gradle_build(build_run_id: "<id>").
If base/head are branch names
List recent builds on each branch and pick the latest:
list_gradle_builds(account_handle: "...", project_handle: "...", git_branch: "<branch>", page_size: 1)
Then fetch full details with get_gradle_build(build_run_id: "<id>").
Defaults
- If no base is provided, use the project's default branch (usually
main). - If no head is provided, detect the current git branch with
git rev-parse --abbrev-ref HEAD.
Step 2: Compare Top-Level Metrics
After fetching both builds, compare:
| Metric | What to check |
|---|---|
duration_ms |
Flag if head is >10% slower than base |
status |
Flag if base succeeded but head failed |
tasks_local_hit_count |
Compare local cache hit counts |
tasks_remote_hit_count |
Compare remote cache hit counts |
tasks_executed_count |
Compare how many tasks ran (higher means more cache misses) |
cacheable_tasks_count |
Note if the cacheable task count changed |
cache_hit_rate |
(local_hits + remote_hits) / cacheable_tasks_count * 100 |
requested_tasks |
Ensure both builds ran the same tasks for a fair comparison |
gradle_version / java_version |
Note environment differences that affect comparability |
Compute the cache miss delta: base_executed - head_executed. Positive means head has fewer executions (improvement). Negative means regression.
Step 3: Drill Into Tasks
Use list_gradle_build_tasks for both builds. Compare duration_ms and outcome per task path.
Look for:
- Tasks that changed from
local_hitorremote_hittoexecuted(cache invalidation). - Tasks that changed from
executedtolocal_hitorremote_hit(cache improvement). - Tasks that changed to
failed(new failures). - New tasks that appeared in the head build.
- Tasks with significant duration increases.
Sort by absolute time difference to find the biggest regressions.
Filtering tasks
Use the outcome filter to focus on specific task states:
list_gradle_build_tasks(build_run_id: "<id>", outcome: "executed")to see only executed tasks.list_gradle_build_tasks(build_run_id: "<id>", outcome: "failed")to see failures.list_gradle_build_tasks(build_run_id: "<id>", cacheable: true)to see only cacheable tasks.
Step 4: Investigate Duration Regressions
If the head build is significantly slower:
- Check if
requested_tasksdiffer (different task sets are not directly comparable). - Check if cache hit rate dropped, which would explain longer builds.
- Look for tasks that changed from cache hits to
executed. - Check if
gradle_versionorjava_versionchanged, which can affect performance. - Compare individual task durations to find the biggest contributors.
Step 5: Investigate Cache Changes
Compare task-level cache behavior:
- Hit rate dropped: Possible causes include dependency changes, build configuration changes, or Gradle version updates that alter cache keys.
- Hit rate improved: Likely due to better cache warming or fewer source changes.
- Task count changed: New modules or tasks added/removed.
- Outcome changes: Tasks moving between
up_to_date,local_hit,remote_hit, andexecutedreveal cache effectiveness.
Step 6: Check Build Context
Compare environment details:
gradle_versionandjava_version: Different versions can affect build times and cache validity.is_ci: CI vs local builds may have different performance characteristics.git_branchandgit_commit_sha: Verify the builds are from the expected commits.root_project_name: Ensure both builds are from the same project structure.
Summary Format
Produce a summary with:
- Overall verdict: Better, worse, or neutral compared to base.
- Duration: Absol
常见问题
它比较哪些内容?
耗时、状态、缓存命中率和任务结果。
我需要 Tuist 吗?
需要。它使用 Tuist 的工具读取 Gradle 构建数据。
可以从链接开始吗?
可以。它可以从构建 ID、仪表盘链接或分支名称开始。
详情
作者的原始描述
Compares two Gradle build runs to identify duration regressions, cache changes, and task outcome differences. Can be invoked with build IDs, dashboard URLs, or branch names.
repo: tuist/tuist
热度
- GitHub 星标
- 5.9k
- 排名
- #14541
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
analyze-selective-testing
5.9k帮你的智能体检查 Xcode 选择性测试跳过未改动测试目标的效果,并找出两次运行之间跳过情况变化的原因。
compare-builds
5.9k帮你的智能体比较两次 Xcode 构建,找出变慢的构建、缓存使用的变化和新出现的问题。
compare-bundles
5.9k帮你的智能体比较两个应用包,找出体积变化、新增或删除的文件以及平台差异。
compare-cache-runs
5.9k帮你的智能体比较两次缓存运行,找出缓存命中率的变化,并解释缓存失效的原因。