Token导航 LogoToken导航

Agent Skill · 研究检索

compile-analysis(编译分析)

compile-analysis 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

compile-analysis 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 41,891。

总安装 1,128周安装 47GitHub Stars 18下载 376核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:compile-analysis(编译分析)
来源仓库:https://github.com/openharmonyinsight/openharmony-skills
仓库路径:skills/compile-analysis
安装命令:
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill compile-analysis
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill compile-analysis

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

compile-analysis 用于分析 ACE Engine 项目中单个源文件的编译效率。适合识别构建过程中的性能瓶颈,如编译时间、内存开销和头文件依赖。提供详细的编译指标报告,帮助优化构建速度和资源使用。需确保项目中有 analyze_compile.sh 脚本且具备执行权限。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/compile-analysis

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

compile-analysis 怎么安装?

在终端执行 npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill compile-an…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

compile-analysis 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

compile-analysis 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

compile-analysis 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

compile-analysis 用的人多吗?

公开数据是累计安装 1,128 次,近一周安装 47 次,下载 376 次,GitHub 18 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

compile-analysis 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
compile-analysis

编译分析 · 本页

1,12818只读未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Compilation Efficiency Analysis Skill

Analyze compilation efficiency for individual source files in the ACE Engine project. This skill provides detailed insights into compilation time, resource overhead, and header file dependencies to help identify optimization opportunities.

Overview

Compilation analysis helps identify performance bottlenecks in the build process by measuring:

  • Compilation time - How long a file takes to compile
  • Resource overhead - Peak memory usage during compilation
  • Header dependencies - Tree structure of included headers

Critical Requirements:

  • ⚠️ The analyze_compile.sh script can be executed from the current project directory
  • ⚠️ Extracted compilation commands MUST be executed in the out/{product} directory (not from the project root)
  • ⚠️ All analysis results MUST be based on actual execution - no speculation or estimation
  • ⚠️ Header dependencies MUST be parsed using the built-in parse_ii.py script to analyze .ii files - do not use alternative methods

Use this analysis when:

  • Investigating slow compilation times
  • Identifying files with excessive dependencies
  • Optimizing build performance
  • Understanding include relationships

Analysis Workflow

Step 1: Locate Source File

Identify the target source file for analysis. Source files in ace_engine typically follow patterns:

  • frameworks/core/components_ng/base/frame_node.cpp
  • frameworks/bridge/declarative_frontend/engine/js_engine.cpp

Step 2: Find OpenHarmony Root

The analysis scripts automatically locate the OpenHarmony root directory by searching for the .gn file marker. Navigate to the OpenHarmony root directory to ensure proper path resolution.

Step 3: Choose Analysis Mode

Option A: Full Analysis (Execute + Display Results)

./.claude/skills/compile-analysis/scripts/analyze_compile.sh <source-file> [product-name]

Example:

./.claude/skills/compile-analysis/scripts/analyze_compile.sh frameworks/core/components_ng/base/frame_node.cpp rk3568

Option B: Save Reusable Compilation Script

Generate a standalone script that can be executed multiple times for performance testing:

./.claude/skills/compile-analysis/scripts/analyze_compile.sh <source-file> [product-name] --save-script

This creates out/{product}/compile_single_file_{name}.sh with:

  • Automatic environment setup
  • Performance monitoring (time + memory)
  • Generation of.ii and.o files
  • Repeatable execution for benchmarking

Step 4: Interpret Results

The analysis produces three key outputs:

  1. Compilation command - Full compiler command with all flags
  2. Performance metrics:

- Elapsed time (format: MM:SS.mm) - Peak memory usage in KB

  1. Dependency tree - Hierarchical view of header inclusions

When using --save-script, a reusable script is generated for repeated performance testing.

Key Scripts

analyze_compile.sh (Main Script)

Primary entry point for compilation analysis. Orchestrates the entire analysis workflow:

Usage:

# Full analysis with execution
./.claude/skills/compile-analysis/scripts/analyze_compile.sh <source-file> [product-name]

# Save standalone compilation script
./.claude/skills/compile-analysis/scripts/analyze_compile.sh <source-file> [product-name] --save-script

Arguments:

  • source-file - Path to the source file (relative to ace_engine root or absolute)
  • product-name - Target product (default: rk3568)
  • --save-script - Save enhanced compilation command to reusable script file

Workflow:

  1. Extracts compilation command from ninja build files
  2. Generates enhanced compilation command with instrumentation
  3. (Optional) Saves script to out/{product}/compile_single_file_{name}.sh
  4. Executes compilation with time and memory profiling
  5. Parses.ii preprocessed file to extract dependencies
  6. Displays comprehensive results

Output with --save-script:

  • Generates a standalone bash script at out/{product}/compile_single_file_{name}.sh
  • Script includes automatic environment setup
  • Performance monitoring (compilation time + peak memory)
  • Can be executed multiple times for performance comparisons
  • Useful for benchmarking and optimization validation

get_compile_command.py

Extracts the complete compilation command for a source file from the ninja build system.

Usage (from ace_engine root):

# Display commands only
python3 ./.claude/skills/compile-analysis/scripts/get_compile_command.py \
  <source-file> <openharmony_root>/out/<product>

# Save enhanced command (with performance monitoring)
python3 ./.claude/skills/compile-analysis/scripts/get_compile_command.py \
  <source-file> <openharmony_root>/out/<product> --save-enhanced

Example:

# From ace_engine directory
python3 ./.claude/skills/compile-analysis/scripts/get_compile_command.py \
  frameworks/core/components_ng/base/frame_node.cpp \
  /home/sunfei/workspace/openHarmony/out/rk3568 --save-enhanced

Features:

  • Parses ninja build files to locate compilation rules
  • Extracts compiler flags, defines, and include paths
  • Generates two versions:

1. Original command (with ccache for development) 2. Enhanced command (without ccache, with -save-temps for analysis)

  • Can save commands to standalone scripts for repeated execution

Output:

  • Original compilation command
  • Enhanced compilation command with instrumentation
  • Optional: Saved script files for reuse

- --save: Creates {file}_compile_command.sh (original command) - --save-enhanced: Creates compile_single_file_{file}.sh (enhanced with monitoring)

parse_ii.py

Analyzes.ii preprocessed files to extract and display header file dependencies.

Usage:

python3 ./.claude/skills/compile-analysis/scripts/parse_ii.py <ii-file>

Features:

  • Parses.ii files (preprocessed C++ source)
  • Extracts #include directives targeting foundation/arkui/
  • Builds dependency tree structure
  • Displays tree with Unicode box-drawing characters

Output Format:

头文件的依赖关系树:
└── foundation/arkui/ace_engine/frameworks/core/components_ng/base/frame_node.h
    └── foundation/arkui/ace_engine/frameworks/core/components_ng/base/ui_node.h
        ├── foundation/arkui/ace_engine/frameworks/core/pipeline/base/element.h
        └── ...

Understanding the Results

Compilation Time

Format: MM:SS.mm (minutes:seconds.milliseconds)

  • Fast: < 5 seconds (typical for small files)
  • Moderate: 5-15 seconds
  • Slow: > 15 seconds (may indicate optimization opportunities)

Peak Memory

Reported in kilobytes (KB)

  • Typical: 100,000 - 500,000 KB (100-500 MB)
  • High: > 500,000 KB - may indicate excessive template instantiation or header dependencies

Dependency Tree

The tree shows hierarchical include relationships:

  • Each level represents an #include directive
  • Multiple children indicate multiple includes in a file
  • Deep trees suggest heavy dependency chains

Optimization indicators:

  • Wide trees (many direct includes) - Consider header consolidation
  • Deep trees (long chains) - Look for circular dependencies or excessive forwarding
  • Duplicate paths - Header guards missing or include order issues

Common Use Cases

Analyzing Header File Dependencies

When you need to analyze the header file dependency structure of a source file:

Important: This workflow ONLY uses .ii files generated by compilation scripts. No other dependency analysis methods are used.

Workflow:

  1. Check if .ii file exists in out/{product}/obj/ directory
  2. If .ii exists → Parse it directly with parse_ii.py
  3. If .ii doesn't exist → Generate it using compilation script, then parse
  4. Always save the dependency tree to out/{product}/{file_name}_dependency_tree.txt

Example using Claude:

# User request: "分析 frame_node.cpp 的头文件依赖"
# Claude's response:

# Step 1: Check for existing .ii file
# ✓ Found: out/rk3568/obj/.../frame_node.ii

# Step 2: Parse .ii file and save dependency tree
python3 ./.claude/skills/compile-analysis/scripts/parse_ii.py \
  out/rk3568/obj/.../frame_node.ii \
  --output out/rk3568/frame_node_dependency_tree.txt

# Output:
# 头文件的依赖关系树:
# └── foundation/arkui/ace_engine/frameworks/core/components_ng/base/frame_node.h
#     ├── foundation/arkui/ace_engine/frameworks/core/components_ng/base/ui_node.h
#     │   ├── foundation/arkui/ace_engine/frameworks/core/pipeline/base/element.h
#     │   └── foundation/arkui/ace_engine/base/memory/ace_type.h
#     └── foundation/arkui/ace_engine/frameworks/core/components_ng/property/property.h
#
# ✓ 依赖树已保存到: out/rk3568/frame_node_dependency_tree.txt

If.ii file doesn't exist:

# User request: "这个文件依赖了多少头文件 text_theme.cpp"
# Claude's response:

# Step 1: Check for existing .ii file
# ✗ .ii file not found

# Step 2: Check for compilation script
# ✓ Found: out/rk3568/compile_single_file_text_theme.sh

# Step 3: Generate .ii file by running compilation script
cd out/rk3568
bash compile_single_file_text_theme.sh

# Step 4: Parse .ii file and save dependency tree
python3 ../../.claude/skills/compile-analysis/scripts/parse_ii.py \
  obj/.../text_theme.ii \
  --output text_theme_dependency_tree.txt

# Output:
# 头文件的依赖关系树:
# └── foundation/arkui/ace_engine/frameworks/core/components/text/text_theme.h
#     ├── ...
#
# ✓ 依赖树已保存到: out/rk3568/text_theme_dependency_tree.txt
#
# 统计信息:
# - 总计依赖: 47 个头文件
# - 最大深度: 6 层

If neither.ii nor script exists:

# User request: "头文件依赖关系 button_pattern.cpp"
# Claude's response:

# Step 1: Check for existing .ii file
# ✗ .ii file not found

# Step 2: Check for compilation script
# ✗ Compilation script not found

# Step 3: Generate compilation script first
python3 ./.claude/skills/compile-analysis/scripts/get_compile_command.py \
  frameworks/core/components_ng/pattern/button_pattern.cpp \
  <openharmony_root>/out/rk3568 --save-enhanced

# ✓ Script generated: out/rk3568/compile_single_file_button_pattern.sh

# Step 4: Generate .ii file by running script
cd out/rk3568
bash compile_single_file_button_pattern.sh

# Step 5: Parse .ii file and save dependency tree
python3 ../../.claude/skills/compile-analysis/scripts/parse_ii.py \
  obj/.../button_pattern.ii \
  --output button_pattern_dependency_tree.txt

# ✓ 依赖树已保存到: out/rk3568/button_pattern_dependency_tree.txt

Trigger phrases:

  • "分析这个文件的头文件依赖"
  • "头文件依赖关系"
  • "这个文件依赖了多少头文件"
  • "analyze header dependencies"
  • "header dependency tree"
  • "how many header files"

Output file naming:

  • Format: {file_name}_dependency_tree.txt
  • Location: out/{product}/
  • Example: out/rk3568/frame_node_dependency_tree.txt

Constraints:

  • ✅ MUST parse .ii files using parse_ii.py
  • ✅ MUST use compilation scripts to generate .ii if needed
  • ✅ MUST save dependency tree to out/{product}/{file_name}_dependency_tree.txt
  • ❌ DO NOT use other dependency analysis tools (like clang -E, gcc -M, etc.)
  • ❌ DO NOT attempt manual dependency parsing

Standalone Compilation of Individual Files

When you need to compile a single file in isolation (for testing, debugging, or verification):

Important: This workflow ONLY uses pre-generated compilation scripts. No other compilation methods are used.

Workflow:

  1. Check if compilation script exists: out/{product}/compile_single_file_{name}.sh
  2. If script exists → Execute it directly
  3. If script doesn't exist → Generate it first, then execute

Example using Claude:

# User request: "单独编译 frame_node.cpp"
# Claude's response:

# Step 1: Check for existing script
# ✓ Found: out/rk3568/compile_single_file_frame_node.sh

# Step 2: Execute the script
cd out/rk3568
bash compile_single_file_frame_node.sh

# Output:
# 编译时间: 0:08.23
# 峰值内存: 234567 KB
# ✓ 已生成: obj/.../frame_node.ii obj/.../frame_node.o

If script doesn't exist:

# User request: "单编 text_theme.cpp"
# Claude's response:

# Step 1: Check for existing script
# ✗ Script not found: out/rk3568/compile_single_file_text_theme.sh

# Step 2: Generate script first
python3 ./.claude/skills/compile-analysis/scripts/get_compile_command.py \
  frameworks/core/components/text/text_theme.cpp <openharmony_root>/out/rk3568 --save-enhanced

# ✓ Script generated: out/rk3568/compile_single_file_text_theme.sh

# Step 3: Execute the script
cd out/rk3568
bash compile_single_file_text_theme.sh

Trigger phrases:

  • "单独编译这个文件"
  • "编译单个文件"
  • "单编文件"
  • "独立编译文件"
  • "compile single file"
  • "compile individual file"
  • "standalone compile"

Constraints:

  • ✅ MUST use existing compile_single_file_{name}.sh scripts
  • ✅ MUST generate script if it doesn't exist before compilation
  • ❌ DO NOT use ninja, make, or other build tools directly
  • ❌ DO NOT attempt manual compilation commands

Extracting and Saving Compilation Commands

When you need to extract or save compilation commands for later use:

Save standalone script with performance monitoring:

./.claude/skills/compile-analysis/scripts/analyze_compile.sh \
  frameworks/core/components_ng/base/frame_node.cpp rk3568 --save-script

# Script saved to: out/rk3568/compile_single_file_frame_node.sh
# Execute later: cd out/rk3568 && bash compile_single_file_frame_node.sh

Extract command only without execution:

python3 ./.claude/skills/compile-analysis/scripts/get_compile_command.py \
  frameworks/core/components_ng/base/frame_node.cpp \
  <openharmony_root>/out/rk3568 --save-enhanced

This is useful for:

  • Creating reusable compilation scripts
  • Setting up performance benchmarking
  • Generating reproducible build environments
  • Isolating specific file compilation for testing

Investigating Slow Builds

When incremental builds are slower than expected:

  1. Identify slow-compiling files by reviewing build log timestamps
  2. Run analysis on slow files: ./analyze_compile.sh <slow-file>
  3. Check dependency tree depth and breadth
  4. Look for frequently included heavy headers

Optimizing Header Dependencies

To reduce unnecessary recompilation:

  1. Analyze dependency tree for common patterns
  2. Identify headers included by many files
  3. Consider forward declarations instead of full includes
  4. Use precompiled headers (PCH) for stable dependencies

Before/After Comparisons

Measure optimization impact using saved scripts:

  1. Generate baseline script: ./analyze_compile.sh <file> rk3568 --save-script cd out/rk3568
  2. Run baseline measurement: bash compile_single_file_{name}.sh # Record: 编译时间: 0:15.23, 峰值内存: 456789 KB
  3. Apply optimizations (reduce includes, forward declarations, etc.)
  4. Run comparison measurement: bash compile_single_file_{name}.sh # Record: 编译时间: 0:08.45, 峰值内存: 234567 KB
  5. Compare results to quantify improvements

The saved script ensures identical compilation conditions for fair comparison.

Troubleshooting

Issue: "找不到编译规则" (Compilation rule not found)

Cause: Source file path doesn't match build database Solutions:

  • Ensure the file is in the ace_engine directory structure
  • Check if the file has been built before (run full build first)
  • Verify path format: use relative path from ace_engine root

Issue: "找不到.ii 文件" (.ii file not found)

Cause: Compilation with -save-temps failed or file not created Solutions:

  • Check if enhanced compilation command succeeded
  • Verify compiler supports -save-temps=obj flag
  • Manually search obj directory: find out/<product>/obj -name "*.ii"

Issue: Dependency tree shows few files

Cause: parse_ii.py filters for foundation/arkui/ prefix only Solutions:

  • This is expected behavior - focuses on arkui-specific headers
  • System headers are intentionally excluded
  • Modify target_prefix in parse_ii.py to include other paths

Best Practices

  • Start with full build: Ensure project has been built at least once
  • Use relative paths: Provide paths relative to ace_engine root
  • Product-specific analysis: Specify product name if not using default rk3568
  • Compare benchmarks: Track changes over time with saved results
  • Focus on hot paths: Prioritize analysis on frequently modified files

Additional Resources

Reference Files

For detailed workflows and advanced usage:

  • references/workflow.md - Comprehensive workflow guide
  • references/optimization.md - Optimization strategies and patterns

Example Files

Working examples in examples/:

  • examples/example-analysis.sh - Complete analysis example
  • examples/example-output.txt - Sample output with interpretation

Integration with Build System

This skill integrates with the OpenHarmony GN/Ninja build system:

  • Reads build metadata from out/<product>/ directory
  • Parses toolchain.ninja for compiler rules
  • Extracts file-specific compilation commands from ninja files
  • Generates instrumentation-compatible commands for analysis

The enhanced compilation command modifies the original command by:

  1. Removing ccache (to get accurate timing)
  2. Adding -save-temps=obj (to generate.ii files)
  3. Wrapping with /usr/bin/time (to measure resources)
  4. Suppressing related warnings (-Wno-undefined-bool-conversion)

This ensures accurate measurements while maintaining compilation compatibility.

平台分布

Codex

38.16%
按下载量换算143

Claude

27.06%
按下载量换算102

Cursor

19.66%
按下载量换算74

Gemini CLI

8.78%
按下载量换算33

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills