iT邦幫忙

0

如何將複雜的部落格審查提示詞重構為可重複使用的 AI 代理

  • 分享至 

  • xImage
  •  

技術作家和 ESL 專業人士經常依賴複雜的提示詞 (Prompts) 來潤飾我們的工作。然而,隨著提示詞增長成單體式的文字牆,它們會變得脆弱、難以除錯且執行成本高昂。模組化解決了這項挑戰。

在這篇文章中,我將從單一的自訂指令 (Custom Command) 過渡到模組化、可攜式的 Gemini CLI 擴充功能 (Extension),並以一組專門的代理技能 (Agent Skills) 實作。


先決條件

在我們開始之前,請確保您具備以下條件:

  • 安裝 gemini-cli
  • 建立 Google AI Studio API 金鑰或 Vertex AI 憑證。
  • 確保您可以存取終端機 (macOS、Linux 或 WSL)。

設定環境

全域安裝 Gemini CLI。

npm install -g @google/gemini-cli

若要全域存取您的擴充功能和 API 金鑰,請在 ~/.gemini 全域工作區中建立一個 .env 檔案,並將 API 金鑰新增至 .env 檔案,如下所示:

# 您的 Google AI Studio API 金鑰
GEMINI_API_KEY=<Gemini API Key>

我使用 ~/.gemini 路徑,這是 macOS/Linux 系統的標準。讀者群若非正在使用,就是熟悉類 Unix 環境。

Gemini CLI 會自動從它找到的第一個 .env 檔案載入變數,搜尋順序從目前目錄向上,接著是 ~/.gemini/.env~/.env

當 CLI 從 .gemini/.env 檔案載入 GEMINI_API_KEY 時,它會自動在專案中運作。此外,它可作為金鑰輪替的單一真實來源。當金鑰過期時,使用者只需要更新單一檔案,而不需要在分散於各專案的多個副本中搜尋。


自訂指令與代理技能的比較

雖然代理技能和自訂指令都為 Gemini CLI 增加了功能,但它們在架構上扮演著根本不同的角色。自訂指令是一個捷徑,可以在終端機或 Gemini CLI 聊天中執行。另一方面,代理技能則像是一個外掛程式或領域專家,為 AI 模型提供專業知識。

自訂指令與代理技能之間有四個關鍵區別。

功能 自訂指令 代理技能
啟動方式 顯式 (斜線指令) 自動 (由模型決定)
結構 單一 .toml 檔案 包含 SKILL.md 與資產的目錄
上下文 提示詞立即載入 指令隨需載入
使用案例 單次轉換 多步驟 / 有狀態工作流程
  1. 自訂指令是使用者必須在終端機中明確輸入的斜線指令。除非使用者明確要求,否則 AI 模型不會使用它們。相反地,模型會分析使用者提示詞以識別技能缺口,並根據技能描述啟動技能。這依賴於 Gemini 的函式呼叫 (Function Calling) 能力來自主選擇正確的工具。

  2. 自訂指令是一個包含描述和提示詞的 TOML 檔案。當使用者將指令放置在全域 .gemini 資料夾的 commands 資料夾中時,重新啟動 Gemini CLI 後即可使用。代理技能是一個獨立的目錄,包含 SKILL.md Markdown 檔案、指令、中繼資料以及外部資產(如腳本、模板或範例資料)。當該目錄被放置在全域 .gemini 資料夾的 skills 資料夾中時,重新啟動後即可使用。

  3. 當使用者執行自訂指令時,模型會將提示詞從 TOML 檔案載入到當前的上下文中。CLI 會將所有技能的名稱和描述載入到模型的上下文中。這確保模型知道這些工具的存在,而不會在實際調用它們之前消耗上下文 Token 於載入其指令。指令和外部資產僅在模型明確呼叫特定技能時才會載入到上下文視窗中。這允許使用者擁有數百個專門的技能,而不會耗盡 Token 限制。

  4. 自訂指令主要用於單次轉換。使用者提供輸入,自訂指令呼叫提示詞來生成結果。代理技能專為多步驟程序工作流程設計。一個技能可以定義複雜的思維過程或一系列動作來解決複雜問題。它代表了一種有狀態的能力,而不僅僅是文字捷徑。


了解架構

  • 自訂指令架構

自訂指令架構

blog-review.toml 檔案中,我最初定義了描述和一個提示詞,指示模型閱讀部落格文章並針對九個重點領域審核內容。

  • 模組化代理技能

自訂指令中的模組化代理技能

我將每個重點領域提取為一個獨立的代理技能,這些技能可以單獨執行,也可以作為自訂指令的一部分執行。

  • 可攜式 CLI 擴充功能打包

將指令和技能打包在 CLI 擴充功能中以實現可攜性

我建立了一個新的 CLI 擴充功能專案來打包自訂指令和技能。然後,我在 Gemini CLI 中安裝了該擴充功能。


起點:單體式自訂指令

我從一個單一的、詳盡的提示詞開始,該提示詞會偵測 Markdown 檔案中的每一個語言錯誤。

description = "綜合 Markdown 散文審核器:掃描語法、句法、語氣和技術清晰度,並提供列表式報告和摘要表格。"

prompt = """
您是一位資深技術文字編輯。您的目標是識別並提供針對 Markdown 內容中語言和結構錯誤的具體修正,而不需重寫整份文件。

### 您的任務:
對輸入內容執行逐字審核。將所有識別出的問題按類別分組,以便使用者可以系統地審閱它們。

**重點領域:**
1. **語法與句法:** 主詞動詞一致性、時態一致性和介系詞。
2. **主動語態:** 將被動描述轉換為直接、主動的指令。

### 限制:
- **不要** 輸出完整的潤飾後文字。
- **不要** 報告在程式碼區塊 (<triple ticks>) 內發現的錯誤。
- **格式:** 使用 **列表** 顯示審核細節 (為了控制台可讀性),並使用 **表格** 顯示最終摘要。
- **位置:** 指出每個發現最近的標題或段落編號。

### 待審核內容:
<content>
{{args}}
</content>

### 輸出格式:

#### 🔬 語言審核詳情

### [類別名稱]
- **位置:** [標題/段落]
  - **原始:** "..."
  - **修正:** "..."
  - **理由:** [簡要解釋修正原因]

---

#### 📊 審核摘要
| 類別 | 發現的問題 |
| :--- | :--- |
| 1. 語法與句法 | [數量] |
| 2. 主動語態 | [數量] |
| **總計** | **[總和]** |
"""

{{args}} 是使用者輸入檔案或文字的佔位符。

我將 blog-review.toml 複製到 ~/.gemini/commands

mkdir -p ~/.gemini/commands
cp blog-review.toml ~/.gemini/commands

然後,我啟動 gemini 以驗證 blog-review 指令的可用性。

gemini
/blog-review

如何執行指令

我建立了一個名為 test_agent_skills.md 的虛擬檔案,其中包含故意的錯誤以測試系統。要在標準 CLI 中執行此指令,我將其作為參數傳遞:

# 在終端機中
gemini /blog-review @test_agent_skills.md

或者,在 Gemini CLI 聊天中:

gemini
/blog-review @test_agent_skills.md

自訂指令識別出 25 個問題並將結果顯示在控制台中。雖然處理少於 10 個問題是可控的,但識別出 25 個問題超過了可行的門檻。

為了解決這個問題,我需要解耦偵測邏輯。我決定為每個類別建立專門的代理 (Agents)。

與其列出每一個問題,我專注於一個領域並修復所有相關問題。使用代理技能建立了模組化架構。例如,我使用自然語言來識別部落格文章中的語法和句法錯誤。

在接下來的部分中,我建立了 grammar-syntax-reviewermissing-article-reviewerlexical-precision-reviewertechnical-punctuation-revieweractive-voice-reviewer 技能。


建立技能套件

為了提高準確性,將語法邏輯提取到專門的「代理技能」中。

我遞迴建立了一個 test-project/skills 資料夾。

mkdir -p test-project/skills

我在 test-project/skills/grammar-syntax-reviewer 目錄中建立了一個名為 SKILL.md 的檔案。

Markdown 檔案具有以下結構:

  • YAML 中繼資料
  • 人物設定 (PERSONA)
  • 審查協定 (REVIEW PROTOCOL)
  • 策略規則 (STRATEGIC RULES)
  • 輸出格式 (OUTPUT FORMAT)

以下是 grammar-syntax-reviewer 技能的 SKILL.md 完整內容:

語法與句法審查者 (7 類別詳盡版)

---
name: grammar-syntax-reviewer
description: A high-precision editorial skill focused on subject-verb agreement, tense consistency, prepositional accuracy, and structural integrity in technical writing.
---

# Grammar & Syntax Reviewer (7-Category Exhaustive Edition)

## PERSONA

You are a Senior Technical Copyeditor and ESL Writing Coach. You possess an obsessive eye for the mechanical "gears" of the English language. Your goal as a Grammar & Syntax Reviewer is to ensure that every sentence follows the formal rules of English grammar to provide maximum clarity for a global audience, with special attention to technical nuances.

## REVIEW PROTOCOL

Execute seven distinct passes over the text and group findings into these categories:

1. **CATEGORY 1: Subject-Verb Agreement (including Intervening Phrases)**
    - Target: Verbs that do not match their subjects, especially when separated by long phrases (e.g., "The list of all available API endpoints are" vs "The list... is").

[其他類別省略以求簡潔]

## STRATEGIC RULES

- **No Omissions:** Identify EVERY instance. If a document has 20 errors, list all 20.
- **Searchability Priority:** Provide the nearest **Heading** and the **Full Sentence (Verbatim)** so the user can use Ctrl+F.
- **Code-Adjacent Logic:** Pay extra attention to the grammar of sentences that wrap around inline code backticks (e.g., "Using the `GET` methods" where it should be "method").
- **Code Immunity:** Ignore everything inside triple backticks (<triple ticks>).

## OUTPUT FORMAT

### 🔬 EXHAUSTIVE GRAMMAR & SYNTAX REVIEW

### Category 1: Subject-Verb Agreement

- **Location:** [Heading]
- **Search String:** "[Full sentence containing the error]"
- **Fixed:** "[The corrected full sentence]"
- **Rationale:** [Briefly explain the rule, e.g., "The collective noun 'group' is singular and requires the verb 'is'."]

---

### [Continue for other Categories...]

---

#### 📊 GRAMMAR & SYNTAX REVIEW SUMMARY

| Category | Issues Found |
| :--- | :--- |
| 1. Subject-Verb Agreement | [Count] |
| **TOTAL ERRORS** | **[Sum]** |

其他技能類似,為求簡潔省略。技能的完整內容可以在這裡找到:自訂部落格審查代理技能


主動語態審查者 (Active Voice Reviewer)

主動語態審查者技能旨在確保技術內容直接且具權威性。建立 skills/active-voice-reviewer/SKILL.md

---
name: active-voice-reviewer
description: A high-precision editorial skill designed to eliminate passive voice, weak 'to-be' constructions, and nominalizations in technical prose. 
---

# Active Voice Reviewer

## PERSONA

You are a Senior Technical Copyeditor specializing in Instructional Clarity. Your goal is to eliminate passive voice, weak "to-be" constructions, and indirect phrasing to make technical prose direct, authoritative, and easier to follow.

## REVIEW PROTOCOL

1. **CATEGORY 1: Formal Passive Voice**
  - Target: "To-be" verb + Past Participle (e.g., "is clicked by").

## STRATEGIC RULES

- **No Omissions:** Identify EVERY instance. If a document has 50 issues, list all 50.

## OUTPUT FORMAT

### ⚡ EXHAUSTIVE ACTIVE VOICE AUDIT

### Category 1: Formal Passive Voice

- **Location:** ## Authentication Flow
- **Search String:** "The security token is generated by the middleware layer after the request arrives."
- **Fixed (Active):** "The middleware layer generates the security token after the request arrives."
- **Rationale:** The actor (middleware layer) was placed at the end of the sentence. Moving it to the subject position makes the sentence more direct.

[其他類別省略以求簡潔]

#### 📊 ACTIVE VOICE SUMMARY

| Category | Issues Found |
| :--- | :--- |
| 1. Formal Passive Voice | [Count] |
| **TOTAL IMPROVEMENTS** | **[Sum]** |


在 Gemini CLI 聊天中執行技能

~/.gemini 中不存在 skills 資料夾,所以我建立了該資料夾並將所有技能複製到其中。

mkdir -p ~/.gemini/skills
cp -r ~/test-project/skills/*  ~/.gemini/skills

要以互動方式使用這些技能,請啟動聊天 REPL:

gemini

在 CLI 中啟用實驗性的代理技能。

/settings

CLI 會顯示設定畫面,其中包含搜尋過濾器以縮小設定範圍。

CLI 設定

使用者在搜尋過濾器中輸入 "Agent",捲動列表直到看到 "Enable Agent Skills" (啟用代理技能)。使用者可以將旗標設定為 true 並將變更套用至 User Settings (使用者設定)。

重新啟動 gemini 以啟用代理技能。

在聊天中,管理您的技能:

  • /skills — 列出所有偵測到的技能。
  • /skills enable <skill> — 啟動特定技能。
  • /skills disable <skill-name> — 停用特定技能。
  • /skills reload — 如果您新增了新檔案,請重新整理列表。

技能設定

我指示 CLI 識別部落格文章中的主動語態問題。AI 模型使用 active-voice-reviewer 技能來找出所有問題。

Find the active voice issues in @test_agent_skills.md    

CLI 提示我啟動技能。

✓  Activate Skill "active-voice-reviewer": A high-precision editorial skill designed to eliminate passive voice, weak 'to-be' constructions, and nom… │
│                                                                                                                                                       │
│ Skill active-voice-reviewer activated. Resources loaded from ~/.gemini/skills/active-voice-reviewer:                                 │
│                                                                                                                                                       │
│ Showing up to 200 items (files + folders).                                                                                                            │
│                                                                                                                                                       │
│ ~/.gemini/skills/active-voice-reviewer/                                                                                              │
│ └───SKILL.md              

CLI 顯示問題和技能摘要。

Category 1: Formal Passive Voice

   - Location: ## Demo Overview
   - Search String: "the Google Search Tool is used."
   - Fixed (Active): "the model uses the Google Search Tool."
   - Rationale: The original sentence obscures the actor (the model).

  ---

  Category 2: Hidden Actors (Agentless Passive)

   - Location: ## Introduction
   - Search String: "and the response JSON schema is provided"
   - Fixed (Active): "and you provide the response JSON schema"
   - Rationale: The original implies the schema appears by magic.

  ---

  Category 3: Weak "To-Be" Wind-ups (Deadwood)

   - Location: ## Lessons Learned (4. Valid URI...)
   - Search String: "The solution was to provide instructions for categorizing"
   - Fixed (Active): "I solved this by instructing the model to categorize"
   - Rationale: "The solution was to" is a weak, noun-heavy wind-up. "I solved this by" is dynamic.

  ---

  Category 4: Nominalizations (Smothered Verbs)

   - Location: ## Demo Overview
   - Search String: "Name verification is performed before data retrieval."
   - Fixed (Active): "The script verifies the name before retrieving data."
   - Rationale: "Verification" and "retrieval" are smothered verbs. "Verifies" and "retrieving" restore the energy.

   - Location: ## Lessons Learned (4. Valid URI...)
   - Search String: "The solution was to provide instructions for categorizing"
   - Fixed (Active): "I solved this by instructing the model to categorize"
   - Rationale: "Provide instructions" is a weak nominalization of "instruct".

  ---

  Category 5: Modal Hesitation (Soft Commands)

   - Location: ## Architecture
   - Search String: "it can access an external system"
   - Fixed (Active): "it accesses an external system"
   - Rationale: "Can access" implies capability; "accesses" describes what it actually does in this architecture.

  ---

  📊 ACTIVE VOICE SUMMARY


  ┌──────────────────────────┬──────────────┐
  │ Category                 │ Issues Found │
  ├──────────────────────────┼──────────────┤
  │ 1. Formal Passive Voice  │ 7            │
  │ 2. Hidden Actors         │ 6            │
  │ 3. Weak "To-Be" Wind-ups │ 1            │
  │ 4. Nominalizations       │ 2            │
  │ 5. Modal Hesitation      │ 1            │
  │ TOTAL IMPROVEMENTS       │ 17           │
  └──────────────────────────┴──────────────┘

技能按類別列出問題。位置指向最近的標題,搜尋字串幫助我在部落格文章中找到句子並進行修正。理由解釋了錯誤,幫助 ESL 作者學習。

表格總結了我的弱點區域,實現了同步學習和編輯。


更新指令以使用代理技能

接下來,我重構了原始的 blog-review.toml 自訂指令以呼叫這些特定技能。這集中了邏輯並確保 AI 使用我們的高精度規則。

description = "Exhaustive 9-Point Markdown Auditor: Powered by specialized high-precision editorial skills."

prompt = """
You are a Senior Technical Copyeditor and ESL Writing Coach. Your goal is to identify EVERY SINGLE error in the provided Markdown content by executing specialized editorial skills.

### EXHAUSTIVE AUDIT PROTOCOL:
1. **Multi-Pass Execution:** Scan the text 9 times—once for each focus area. 
2. **Skill-Specific Logic:** 
   - For Area 1: Execute the **grammar-syntax-reviewer** (7-category check).
   - For Area 9: Execute the **active-voice-reviewer** (Eliminate nominalizations and hesitation).
3. **No Omissions:** List every single occurrence. If an error appears 10 times, list all 10.
4. **Searchability Priority:** Provide the nearest Heading and the **Full Sentence** containing the error so the user can use Ctrl+F.

### FOCUS AREAS:

1. **[Skill: grammar-syntax-reviewer]:** Audit for (a) Subject-verb agreement with intervening phrases, (b) Tense consistency, (c) Preposition precision, (d) Pronoun clarity, (e) Comma splices, (f) Count vs. Non-count nouns (Code, Software, Data), and (g) Technical Plurals vs. Possessives.
... Other focus areas ...
9. **[Skill: active-voice-reviewer]:** Audit for (a) Formal passive voice, (b) Hidden actors, (c) "To-be" wind-ups (e.g., 'There are'), (d) Nominalizations (e.g., 'Perform an analysis' -> 'Analyze'), and (e) Modal hesitation (e.g., 'You should click' -> 'Click').

### CONSTRAINTS:
- **DO NOT** output the full polished text.
- **DO NOT** report errors found inside code blocks (<triple ticks>).
- **LOCATION:** You MUST provide:
    1. The nearest **Heading** (e.g., ## Setup).
    2. A **Search String**: The full sentence containing the error (for easy Ctrl+F).

### CONTENT TO AUDIT:
<content>
{{args}}
</content>

### OUTPUT FORMAT:

#### 🔬 EXHAUSTIVE LINGUISTIC AUDIT

### [Category Name]

- **Skill Applied:** [Insert Skill Name, e.g., technical-punctuation-reviewer]
- **Location:** [Nearest Heading Name]
- **Search String:** "[The full sentence where the error exists]"
- **Fixed:** "[The corrected full sentence]"
- **Rationale:** **[Formal Rule Name]**: [Brief explanation of the rule to help the writer learn.]

---

#### 📊 AUDIT SUMMARY
| Category | Issues Found |
| :--- | :--- |
| 1. Grammar & Syntax (Deep) | [Count] |
| 9. Active Voice (Instructional) | [Count] |
| **TOTAL** | **[Sum]** |
"""

{{args}} 是使用者輸入檔案或文字的佔位符。

技能在 CLI 中啟用後,模型會將它們視為可用的函式或工具,並將文字指令「執行...」映射到適當的工具定義。

SKILL.md frontmatter 中的 name 欄位將技能註冊為模型可以按名稱調用的工具。

在 Gemini CLI 聊天中,我執行 blog-review 指令,啟動的技能掃描內容以輸出錯誤並在表格中總結數量。

/blog-review @test_agent_skills.md          
🔬 EXHAUSTIVE LINGUISTIC AUDIT

  1. Grammar & Syntax (Deep)

   - Skill Applied: grammar-syntax-reviewer
   - Location: ## Introduction
   - Search String: "In this post, I will explore retrieving the Premier League 2025/2026 Player statistics..."
   - Fixed: "In this post, I explore retrieving the Premier League 2025/2026 Player statistics..."
   - Rationale: [Tense Consistency]: Use the present tense ("I explore") for the document's narrative to match "I walk through" and "describe".

  ... other issues ...

  2. Articles & Determiners (Noun-First)

   - Skill Applied: missing-article-reviewer
   - Location: ## Environment Variables
   - Search String: "I use the client to call Gemini 3 Flash Preview model to retrieve data..."
   - Fixed: "I use the client to call the Gemini 3 Flash Preview model to retrieve data..."
   - Rationale: [Missing Article]: "Model" is a singular countable noun unmodified by a determiner in the original phrase.

  ... other issues ...

  3. Word Choice

   - Skill Applied: lexical-precision-reviewer
   - Location: ## Lessons Learned
   - Search String: "When the player was Kaoru Mitoma, the model worked hard to find the results via Google Search..."
   - Fixed: "When the player was Kaoru Mitoma, the model executed a deep search via Google Search..."
   - Rationale: [Anthropomorphism]: "Worked hard" assigns human effort to software. Use precise technical terms like "executed a deep search."

  ... other issues ...

  4. Punctuation

   - Skill Applied: technical-punctuation-reviewer
   - Location: ## Architecture
   - Search String: "![High level architecture of Retrieving Premier League Player Stats...]"
   - Fixed: "![High-level architecture of Retrieving Premier League Player Stats...]"
   - Rationale: [Compound Modifier]: "High-level" modifies "architecture" and must be hyphenated.

  ... other issues ....

  6. Parallelism

   - Skill Applied: parallelism-check
   - Location: ## Prerequisites
   - Search String: "Python: Have Python 3.12+ and the google-genai SDK installed."
   - Fixed: "Python: Python 3.12+ and the google-genai SDK."
   - Rationale: [List Structure]: The other items in the list are Noun Phrases ("Vertex AI...", "A Google Cloud API Key..."). This item uses an
     imperative ("Have...").

  9. Active Voice (Instructional)

   - Skill Applied: active-voice-reviewer
   - Location: ## Introduction
   - Search String: "When the URL is invalid or the data is missing... the Google Search Tool is used."
   - Fixed: "When the URL is invalid or the data is missing... the model uses the Google Search tool."
   - Rationale: [Formal Passive Voice]: "Is used" hides the actor (the model).

   ... other issues ...

表格顯示了技能和自訂指令其餘部分識別出的問題數量。

📊 AUDIT SUMMARY

  ┌────────────────────────────────────────┬──────────────┐
  │ Category                               │ Issues Found │
  ├────────────────────────────────────────┼──────────────┤
  │ 1. Grammar & Syntax (Deep)             │ 6            │
  │ 2. Articles & Determiners (Noun-First) │ 4            │
  │ 3. Word Choice                         │ 2            │
  │ 4. Punctuation                         │ 5            │
  │ 5. Technical Accuracy                  │ 0            │
  │ 6. Parallelism                         │ 1            │
  │ 7. Expert Blindness                    │ 0            │
  │ 8. Conciseness                         │ 0            │
  │ 9. Active Voice (Instructional)        │ 7            │
  │ TOTAL                                  │ 25           │
  └────────────────────────────────────────┴──────────────┘

測試部落格文章有 25 個問題;我使用標題和文字進行搜尋並找到問題以解決。

我在本地製作了技能原型,所以我決定將它們打包成可散布的擴充功能,以便其他人可以輕鬆安裝。


打包以進行散布:建立 CLI 擴充功能

為了打包指令和技能以實現可攜性,我透過執行 gemini extensions new 指令建立了一個擴充功能。

gemini extensions new blog-post-pro-editor

該指令建立了一個名為 blog-post-pro-editor 的新擴充功能。我將 skillscommands 資料夾從 ~/.gemini 複製到 blog-post-pro-editor

結構:

├── commands
│   ├── blog-review.toml
│   └── critique.toml
├── gemini-extension.json
└── skills
    ├── active-voice-reviewer
    │   └── SKILL.md
    ├── grammar-syntax-reviewer
    │   └── SKILL.md
    ├── lexical-precision-reviewer
    │   └── SKILL.md
    ├── missing-articles-reviewer
    │   └── SKILL.md
    └── technical-punctuation-reviewer
        └── SKILL.md

我以 YAML frontmatter 開始 skills/ 中的每個檔案:

---
name: grammar-syntax-reviewer
description: A high-precision editorial skill focused on subject-verb agreement, tense consistency, prepositional accuracy, and structural integrity in technical writing.
---

# <Skill Name>

## PERSONA

<Persona of the skill> 

(重構的提示放在這裡)

我以描述和提示開始 commands/ 中的每個檔案:

description = "<部落格審查指令的描述>"

prompt = """
<部落格審查指令的提示和技能指令>
""""

安裝擴充功能並在本地執行

在開發過程中,我安裝了技能和指令以在本地測試 Gemini CLI 擴充功能。

cd blog-post-pro-editor
gemini extension link .

CLI 在終端機中連結並啟用了 'blog-post-pro-editor' 擴充功能。

Extension "blog-post-pro-editor" linked successfully and enabled.

接下來,我啟動 gemini 並輸入以下內容來啟動技能並找出 Markdown 檔案中的語法問題。

> Find the grammar errors in @test_agent_skills.md

CLI 啟動了 grammar-syntax-reviewermissing-articles-reviewer 技能,以識別我的部落格文章中的結構和冠詞相關錯誤。

技能在表格中輸出了以下結果。語法與句法技能發現了 3 個錯誤,遺漏冠詞技能發現了 7 個錯誤。

  ┌──────────────────────────────┬──────────────┐
  │ Category                     │ Issues Found │
  ├──────────────────────────────┼──────────────┤
  │ Grammar & Syntax             │              │
  │ 2. Tense Consistency         │ 1            │
  │ 3. Preposition Precision     │ 1            │
  │ 5. Fragments/Run-ons/Splices │ 1            │
  │ Articles & Determiners       │              │
  │ 1. Missing Articles          │ 7            │
  │ TOTAL ERRORS                 │ 10           │
  └──────────────────────────────┴──────────────┘

我將技能和指令打包成擴充功能,以便在任何安裝了 Gemini CLI 的機器上安裝它們。

我在 ~/.gemini/extensions 資料夾中驗證了新的擴充功能。該指令在擴充功能列表中顯示 blog-post-pro-editor

ls ~/.gemini/extensions

結論

透過將 blog-review 自訂指令分解為 代理技能 並將它們打包成 擴充功能,我們建立了一個綜合的編輯套件。在 Gemini CLI 聊天中執行個別技能,以使用自然語言定位部落格文章中的相關語言錯誤。同樣地,在同一聊天中輸入自訂指令 blog-review,可以掃描部落格文章並明確識別所有語言錯誤。這種模組化方法確保了 ESL 作者的更高準確性,並使您的 AI 工具在任何機器上都具有可攜性。

資源


圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言