← スキル一覧に戻る
name: makefile-executor
description: Analyzes Makefiles to understand their targets and executes the appropriate make command based on user intent. Specializes in parsing self-documenting Makefiles that use the

makefile-executor
by softleader
Slctl is a command line interface against SoftLeader Services
⭐ 2🍴 1📅 2026年1月19日
SKILL.md
name: makefile-executor
description: Analyzes Makefiles to understand their targets and executes the appropriate make command based on user intent. Specializes in parsing self-documenting Makefiles that use the ## comment convention.
Makefile
本 skill 旨在分析專案根目錄下的 Makefile,理解其中定義的 targets,並在適當的時機執行它們。
核心能力
- 解析
Makefile: 讀取Makefile內容,識別可用的targets、變數和它們之間的依賴關係。 - 意圖映射: 將使用者的指令 (例如「安裝相依套件」、「用 Java 17 跑測試」) 映射到最符合的
make指令,包含必要的參數。 - 執行指令: 安全地執行
make指令。
工作流程
- 探索 (Discovery): 檢查
Makefile是否存在。若存在,優先執行make help來取得專案作者提供的指令清單。 - 分析 (Analysis): 如果
make help不足,則直接讀取Makefile內容。本 skill 會:- 尋找
target: ## comment格式來理解target的用途。 - 尋找
VARIABLE ?= default_value格式來識別可被覆寫的參數。 - 分析
target: dependency1 dependency2格式來理解執行順序。
- 尋找
- 映射 (Mapping): 根據分析結果,將使用者的需求轉換為一個具體的
make指令,包含必要的OPTION=value前綴。 - 執行 (Execution): 在執行前向使用者確認即將運行的完整指令及其預期作用,然後透過
Bashtool 執行。
Makefile 寫法分析與慣例
本 skill 的設計基於對良好實踐 Makefile 的分析,特別是你提供的範例:
-
自文件化註解 (
##):- 格式:
target-name: ## 說明文字... - 作用: 讓
Makefile變得可讀且易於維護的關鍵。本 skill 會利用此資訊來理解target的意圖。
- 格式:
-
helpTarget:- 作用: 一個好的
Makefile應提供helptarget,自動解析並印出說明選單。 - 本 skill 的應用: skill 會優先嘗試執行
make help,這是最可靠的探索方式。
- 作用: 一個好的
-
分類註解 (
##@):- 格式:
##@ Category Name - 作用: 在
help輸出中對targets進行分組,讓 skill 能更好地理解指令的領域(例如:開發、部署)。
- 格式:
-
變數與參數 (
?=and$(call ...)):- 格式:
VAR ?=或ifeq ($(strip $(VAR)),) - 作用:
?=表示如果變數未被設定,則給予預設值,這暗示了此變數可由外部傳入。ifeq檢查則常用於強制要求傳入變數。 - 本 skill 的應用: skill 會識別這些模式,來判斷執行
make指令時是否可以或必須提供VAR=value這樣的參數。
- 格式:
-
目標依賴 (
target: dependency):- 格式:
redeploy: undeploy deploy - 作用: 定義了
target的執行順序。在執行redeploy之前,make會先確保undeploy和deploy都被執行。 - 本 skill 的應用: 這幫助 skill 理解一個指令可能包含的多個步驟。
- 格式:
執行範例
情境: 使用者說:「我要用 Java 17 跑測試。」
Skill 的思考與行動流程:
- 意圖分析: 使用者的意圖是「跑測試」,並帶有參數「Java 17」。
- 探索
Makefile:- 偵測到
Makefile,執行make help。
- 偵測到
- 分析
help輸出與檔案內容:- 從
help中找到test: ## Clean and test the compiled code.,確認make test是正確指令。 - 從
help的Usage: OPTION=<value> make <target>推斷可以傳遞參數。 - 進一步分析
Makefile原始碼,找到testtarget 的指令mvn test -e $(call java_version)。 - 追溯
java_versionfunction,發現它使用了JAVA變數:$(if $(filter-out "",$(JAVA)),-D'java.version=$(JAVA)',)。
- 從
- 映射 Target 與參數:
- 確認
make test是正確的 target。 - 確認可以透過設定
JAVA變數來指定 Java 版本。 - 組合出最終指令:
JAVA=17 make test。
- 確認
- 準備執行:
- (向使用者確認) "我將執行
JAVA=17 make test來用 Java 17 執行測試,是否繼續?"
- (向使用者確認) "我將執行
- 執行:
run_shell_command("JAVA=17 make test")
スコア
総合スコア
65/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です


