@aigne/example-agent-skill 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.local.example +44 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE.md +93 -0
- package/README.md +478 -0
- package/aigne.yaml +5 -0
- package/chat.yaml +55 -0
- package/package.json +22 -0
- package/skills/writing-helper/SKILL.md +133 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Change the name of this file to .env.local and fill in the following values
|
|
2
|
+
|
|
3
|
+
# Uncomment the lines below to enable debug logging
|
|
4
|
+
# DEBUG="aigne:*"
|
|
5
|
+
|
|
6
|
+
# Use different Models
|
|
7
|
+
|
|
8
|
+
# OpenAI
|
|
9
|
+
# MODEL="openai:gpt-4.1"
|
|
10
|
+
# OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
|
|
11
|
+
|
|
12
|
+
# Anthropic claude
|
|
13
|
+
# MODEL="anthropic:claude-3-7-sonnet-latest"
|
|
14
|
+
# ANTHROPIC_API_KEY=""
|
|
15
|
+
|
|
16
|
+
# Gemini
|
|
17
|
+
# MODEL="gemini:gemini-2.0-flash"
|
|
18
|
+
# GEMINI_API_KEY=""
|
|
19
|
+
|
|
20
|
+
# Bedrock nova
|
|
21
|
+
# MODEL=bedrock:us.amazon.nova-premier-v1:0
|
|
22
|
+
# AWS_ACCESS_KEY_ID=""
|
|
23
|
+
# AWS_SECRET_ACCESS_KEY=""
|
|
24
|
+
# AWS_REGION=us-west-2
|
|
25
|
+
|
|
26
|
+
# DeepSeek
|
|
27
|
+
# MODEL="deepseek:deepseek-chat"
|
|
28
|
+
# DEEPSEEK_API_KEY=""
|
|
29
|
+
|
|
30
|
+
# OpenRouter
|
|
31
|
+
# MODEL="openrouter:openai/gpt-4o"
|
|
32
|
+
# OPEN_ROUTER_API_KEY=""
|
|
33
|
+
|
|
34
|
+
# xAI
|
|
35
|
+
# MODEL="xai:grok-2-latest"
|
|
36
|
+
# XAI_API_KEY=""
|
|
37
|
+
|
|
38
|
+
# Ollama
|
|
39
|
+
# MODEL="ollama:llama3.2"
|
|
40
|
+
# OLLAMA_DEFAULT_BASE_URL="http://localhost:11434/v1";
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Setup proxy if needed
|
|
44
|
+
# HTTPS_PROXY=http://localhost:7890
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2026-01-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **afs:** support `~` in the local path for local-fs & add agent-skill example ([#877](https://github.com/AIGNE-io/aigne-framework/issues/877)) ([c86293f](https://github.com/AIGNE-io/aigne-framework/commit/c86293f3d70447974395d02e238305a42b256b66))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/cli bumped to 1.59.0-beta.15
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
+
the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that
|
|
84
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
# Agent Skill Example
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<picture>
|
|
5
|
+
<source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/logo-dark.svg" media="(prefers-color-scheme: dark)">
|
|
6
|
+
<source srcset="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/logo.svg" media="(prefers-color-scheme: light)">
|
|
7
|
+
<img src="https://raw.githubusercontent.com/AIGNE-io/aigne-framework/main/logo.svg" alt="AIGNE Logo" width="400" />
|
|
8
|
+
</picture>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
This example demonstrates how to create an AI agent with **custom Agent Skills** using the [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework). Agent Skills are specialized capabilities that extend your agent's functionality, allowing it to perform specific tasks like writing assistance, code review, file organization, and more.
|
|
12
|
+
|
|
13
|
+
This example includes:
|
|
14
|
+
- **Custom Agent Skill**: A built-in Writing Helper for composing and improving text
|
|
15
|
+
- **Claude Code Skills Integration**: Access to official Claude Code Agent Skills from your local installation
|
|
16
|
+
- **Skill Management System**: Automatic discovery and loading of skills from multiple sources
|
|
17
|
+
|
|
18
|
+
## What's Included
|
|
19
|
+
|
|
20
|
+
### Custom Skills
|
|
21
|
+
|
|
22
|
+
#### Writing Helper (`writing-helper`)
|
|
23
|
+
A versatile writing assistant included in this example that helps with:
|
|
24
|
+
- **Writing from scratch**: Emails, letters, reports, social media posts, creative writing
|
|
25
|
+
- **Text improvement**: Grammar, clarity, conciseness, and flow
|
|
26
|
+
- **Tone transformation**: Make text more professional, casual, empathetic, or persuasive
|
|
27
|
+
- **Templates**: Ready-to-use formats for common writing tasks
|
|
28
|
+
- **Localization support**: Adapt writing style for different English variants
|
|
29
|
+
|
|
30
|
+
### Claude Code Skills Integration
|
|
31
|
+
|
|
32
|
+
This example also integrates with **Claude Code Agent Skills** if you have them installed. These are professional-grade skills maintained by Anthropic, including:
|
|
33
|
+
|
|
34
|
+
- **doc-coauthoring**: Structured workflow for co-authoring documentation
|
|
35
|
+
- **xlsx**: Comprehensive spreadsheet creation, editing, and analysis
|
|
36
|
+
- **pdf**: PDF manipulation toolkit for extracting, creating, and merging PDFs
|
|
37
|
+
- **pptx**: Presentation creation and editing
|
|
38
|
+
- **frontend-design**: Create distinctive, production-grade frontend interfaces
|
|
39
|
+
- **And many more**: See your `~/.claude/plugins/marketplaces/anthropic-agent-skills/skills` directory
|
|
40
|
+
|
|
41
|
+
The agent automatically discovers and loads skills from both sources:
|
|
42
|
+
1. Custom skills from the local `./skills` directory
|
|
43
|
+
2. Claude Code skills from `~/.claude/plugins/marketplaces/anthropic-agent-skills/skills`
|
|
44
|
+
|
|
45
|
+
## Prerequisites
|
|
46
|
+
|
|
47
|
+
* [Node.js](https://nodejs.org) (>=20.0) and npm installed on your machine
|
|
48
|
+
* An AI model connection (OpenAI, Anthropic, or AIGNE Hub)
|
|
49
|
+
* Optional dependencies (if running the example from source code):
|
|
50
|
+
* [Pnpm](https://pnpm.io) for package management
|
|
51
|
+
* [Bun](https://bun.sh) for running unit tests & examples
|
|
52
|
+
* Optional: [Claude Code](https://claude.ai/code) installed for access to official Agent Skills
|
|
53
|
+
|
|
54
|
+
## Quick Start (No Installation Required)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Run the agent with skill manager (agent chooses the right skill)
|
|
58
|
+
npx -y @aigne/example-agent-skill --interactive
|
|
59
|
+
|
|
60
|
+
# Run with a specific task (agent auto-selects the appropriate skill)
|
|
61
|
+
npx -y @aigne/example-agent-skill --input "Write a professional email thanking my team"
|
|
62
|
+
|
|
63
|
+
# Explicitly invoke a specific skill using slash command
|
|
64
|
+
npx -y @aigne/example-agent-skill --input "/writing-helper Write a thank you note"
|
|
65
|
+
|
|
66
|
+
# Run a skill directly as a standalone agent (no agent wrapper)
|
|
67
|
+
npx -y aigne run ~/.claude/plugins/marketplaces/anthropic-agent-skills/skills/doc-coauthoring --interactive
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Connect to an AI Model
|
|
71
|
+
|
|
72
|
+
As an example, running `npx -y @aigne/example-agent-skill` requires an AI model. If this is your first run, you need to connect one.
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
- Connect via the official AIGNE Hub
|
|
77
|
+
|
|
78
|
+
Choose the first option and your browser will open the official AIGNE Hub page. Follow the prompts to complete the connection. If you're a new user, the system automatically grants 400,000 tokens for you to use.
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
- Connect via a self-hosted AIGNE Hub
|
|
83
|
+
|
|
84
|
+
Choose the second option, enter the URL of your self-hosted AIGNE Hub, and follow the prompts to complete the connection. If you need to set up a self-hosted AIGNE Hub, visit the Blocklet Store to install and deploy it: [Blocklet Store](https://store.blocklet.dev/blocklets/z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ?utm_source=www.arcblock.io&utm_medium=blog_link&utm_campaign=default&utm_content=store.blocklet.dev#:~:text=%F0%9F%9A%80%20Get%20Started%20in%20Minutes).
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
- Connect via a third-party model provider
|
|
89
|
+
|
|
90
|
+
Using Anthropic as an example, you can configure the provider's API key via environment variables. After configuration, run the example again:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
export ANTHROPIC_API_KEY="" # Set your Anthropic API key here
|
|
94
|
+
```
|
|
95
|
+
For more details on third-party model configuration (e.g., OpenAI, DeepSeek, Google Gemini), see [.env.local.example](./.env.local.example).
|
|
96
|
+
|
|
97
|
+
After configuration, run the example again.
|
|
98
|
+
|
|
99
|
+
### Debugging
|
|
100
|
+
|
|
101
|
+
The `aigne observe` command starts a local web server to monitor and analyze agent execution data. It provides a user-friendly interface to inspect traces, view detailed call information, and understand your agent's behavior during runtime. This tool is essential for debugging, performance tuning, and gaining insight into how your agent processes information and interacts with tools and models.
|
|
102
|
+
|
|
103
|
+
Start the observation server.
|
|
104
|
+
|
|
105
|
+

|
|
106
|
+
|
|
107
|
+
View a list of recent executions.
|
|
108
|
+
|
|
109
|
+

|
|
110
|
+
|
|
111
|
+
## Installation
|
|
112
|
+
|
|
113
|
+
### Clone the Repository
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/AIGNE-io/aigne-framework
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Install Dependencies
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
cd aigne-framework/examples/agent-skill
|
|
123
|
+
|
|
124
|
+
pnpm install
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Run the Example
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Run in interactive mode
|
|
131
|
+
pnpm start --interactive
|
|
132
|
+
|
|
133
|
+
# Run with a single message
|
|
134
|
+
pnpm start --input "Write a professional email thanking my team for completing the project"
|
|
135
|
+
|
|
136
|
+
# Explicitly invoke a specific skill using slash command
|
|
137
|
+
pnpm start --input "/writing-helper Write a thank you note to my mentor"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Using Slash Commands to Select Skills
|
|
141
|
+
|
|
142
|
+
When running the agent, you can explicitly choose which skill to use by prefixing your input with `/skill-name`:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Use the writing-helper skill explicitly
|
|
146
|
+
pnpm start --input "/writing-helper Make this email more professional: Hey team, we did it!"
|
|
147
|
+
|
|
148
|
+
# Use a Claude Code skill (if installed)
|
|
149
|
+
pnpm start --input "/doc-coauthoring Help me write a technical specification document"
|
|
150
|
+
|
|
151
|
+
# In interactive mode, you can also use slash commands
|
|
152
|
+
pnpm start --interactive
|
|
153
|
+
> /writing-helper Write a formal invitation email
|
|
154
|
+
> /xlsx Create a budget spreadsheet with categories
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Benefits of using slash commands:**
|
|
158
|
+
- **Direct control**: Choose exactly which skill handles your request
|
|
159
|
+
- **Faster routing**: Skip the agent's skill selection process
|
|
160
|
+
- **Predictable results**: Know which skill's style and approach will be used
|
|
161
|
+
- **Mixed workflow**: Use different skills in the same conversation session
|
|
162
|
+
|
|
163
|
+
**When the agent auto-selects vs explicit skill invocation:**
|
|
164
|
+
- Without `/`: The agent analyzes your input and chooses the most appropriate skill
|
|
165
|
+
- With `/skill-name`: The specified skill is invoked directly with your remaining input
|
|
166
|
+
|
|
167
|
+
### Running Agent Skills as Standalone Agents
|
|
168
|
+
|
|
169
|
+
Agent Skills are not just tools for agents—they can also be run as **standalone agents** using the AIGNE CLI. This allows you to use a skill directly without configuring an agent wrapper.
|
|
170
|
+
|
|
171
|
+
#### Running a Skill Directory
|
|
172
|
+
|
|
173
|
+
You can run any Agent Skill directory directly by pointing to its path:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Run the writing-helper skill as a standalone agent
|
|
177
|
+
aigne run ./skills/writing-helper --interactive
|
|
178
|
+
|
|
179
|
+
# Run with a single input
|
|
180
|
+
aigne run ./skills/writing-helper --input "Write a professional thank you email"
|
|
181
|
+
|
|
182
|
+
# Run a Claude Code skill (if installed)
|
|
183
|
+
aigne run ~/.claude/plugins/marketplaces/anthropic-agent-skills/skills/doc-coauthoring --interactive
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### How It Works
|
|
187
|
+
|
|
188
|
+
When you run a skill directory:
|
|
189
|
+
1. AIGNE CLI reads the `SKILL.md` file
|
|
190
|
+
2. The skill's instructions become the agent's system prompt
|
|
191
|
+
3. You interact directly with the skill as an agent
|
|
192
|
+
4. No agent routing or skill selection overhead
|
|
193
|
+
|
|
194
|
+
#### Benefits of Running Skills as Standalone Agents
|
|
195
|
+
|
|
196
|
+
- **Simplicity**: No need to configure an agent wrapper—just run the skill
|
|
197
|
+
- **Portability**: Skills are self-contained and can be shared as directories
|
|
198
|
+
- **Direct Control**: Interact with a specific skill without going through an agent manager
|
|
199
|
+
- **Fast Development**: Quickly test skills during development
|
|
200
|
+
- **Easy Distribution**: Share a skill directory and users can run it immediately
|
|
201
|
+
|
|
202
|
+
#### Example: Running the Writing Helper
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Navigate to the example directory
|
|
206
|
+
cd examples/agent-skill
|
|
207
|
+
|
|
208
|
+
# Run the writing-helper skill directly
|
|
209
|
+
aigne run ./skills/writing-helper --interactive
|
|
210
|
+
|
|
211
|
+
# The skill responds as a focused writing assistant
|
|
212
|
+
> Write a formal apology email to a client for a delayed delivery
|
|
213
|
+
|
|
214
|
+
[The skill generates the email immediately without routing through an agent]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### When to Use This Approach
|
|
218
|
+
|
|
219
|
+
**Use as a standalone agent when:**
|
|
220
|
+
- You want to use a single, specific skill repeatedly
|
|
221
|
+
- You're developing and testing a new skill
|
|
222
|
+
- You want to distribute a skill for others to use directly
|
|
223
|
+
- You need predictable, focused behavior without agent decision-making
|
|
224
|
+
|
|
225
|
+
**Use within an agent when:**
|
|
226
|
+
- You want the agent to choose the right skill automatically
|
|
227
|
+
- You need multiple skills working together
|
|
228
|
+
- You want a conversational agent that can handle various tasks
|
|
229
|
+
- You need context sharing between different skill invocations
|
|
230
|
+
|
|
231
|
+
## How Agent Skills Work
|
|
232
|
+
|
|
233
|
+
Agent Skills extend your AI agent's capabilities by providing specialized knowledge and instructions for specific tasks. This example demonstrates two types of skills:
|
|
234
|
+
|
|
235
|
+
### 1. Custom Agent Skills (Local)
|
|
236
|
+
|
|
237
|
+
**Location**: `./skills/` directory in your project
|
|
238
|
+
|
|
239
|
+
**How it works**:
|
|
240
|
+
1. Create a directory for your skill (e.g., `./skills/writing-helper/`)
|
|
241
|
+
2. Add a `SKILL.md` file with front-matter metadata
|
|
242
|
+
3. The skill loader automatically discovers and registers it
|
|
243
|
+
4. The agent can invoke the skill as needed
|
|
244
|
+
|
|
245
|
+
**Skill Definition Format**:
|
|
246
|
+
```markdown
|
|
247
|
+
---
|
|
248
|
+
name: skill-name
|
|
249
|
+
description: Brief description of what this skill does
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
# Skill Title
|
|
253
|
+
|
|
254
|
+
Detailed instructions for the AI agent on how to use this skill...
|
|
255
|
+
|
|
256
|
+
## Capabilities
|
|
257
|
+
- Feature 1
|
|
258
|
+
- Feature 2
|
|
259
|
+
|
|
260
|
+
## Usage Examples
|
|
261
|
+
...
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Example**: The included `writing-helper` skill provides comprehensive writing assistance:
|
|
265
|
+
```yaml
|
|
266
|
+
# In chat.yaml, the skill is loaded from:
|
|
267
|
+
afs:
|
|
268
|
+
modules:
|
|
269
|
+
- module: local-fs
|
|
270
|
+
options:
|
|
271
|
+
agentSkills: true
|
|
272
|
+
name: custom-skills
|
|
273
|
+
localPath: ./skills
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### 2. Claude Code Skills Integration
|
|
277
|
+
|
|
278
|
+
**Location**: `~/.claude/plugins/marketplaces/anthropic-agent-skills/skills/`
|
|
279
|
+
|
|
280
|
+
**How it works**:
|
|
281
|
+
1. Install [Claude Code](https://claude.ai/code) on your machine
|
|
282
|
+
2. Claude Code includes a marketplace of professional-grade skills
|
|
283
|
+
3. Configure the agent to load skills from the Claude Code directory
|
|
284
|
+
4. Skills are automatically discovered and made available to your agent
|
|
285
|
+
|
|
286
|
+
**Configuration**:
|
|
287
|
+
```yaml
|
|
288
|
+
# In chat.yaml
|
|
289
|
+
afs:
|
|
290
|
+
modules:
|
|
291
|
+
- module: local-fs
|
|
292
|
+
options:
|
|
293
|
+
agentSkills: true
|
|
294
|
+
name: skills
|
|
295
|
+
localPath: ~/.claude/plugins/marketplaces/anthropic-agent-skills/skills
|
|
296
|
+
description: Contains Claude's official Agent Skills
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Available Claude Code Skills** (if installed):
|
|
300
|
+
- `doc-coauthoring`: Co-author documentation with structured workflows
|
|
301
|
+
- `xlsx`: Create and analyze spreadsheets with formulas
|
|
302
|
+
- `pdf`: Extract, create, and manipulate PDF documents
|
|
303
|
+
- `pptx`: Create and edit presentations
|
|
304
|
+
- `frontend-design`: Build production-grade web interfaces
|
|
305
|
+
- `canvas-design`: Create visual designs and posters
|
|
306
|
+
- `algorithmic-art`: Generate algorithmic art using p5.js
|
|
307
|
+
- And many more...
|
|
308
|
+
|
|
309
|
+
### 3. Skill Discovery and Loading
|
|
310
|
+
|
|
311
|
+
The agent uses the **Agent Skill Manager** to coordinate skills:
|
|
312
|
+
|
|
313
|
+
**Step 1: Configure AFS Modules**
|
|
314
|
+
```yaml
|
|
315
|
+
afs:
|
|
316
|
+
modules:
|
|
317
|
+
# Custom skills
|
|
318
|
+
- module: local-fs
|
|
319
|
+
options:
|
|
320
|
+
agentSkills: true # Mark this as a skills source
|
|
321
|
+
name: custom-skills
|
|
322
|
+
localPath: ./skills
|
|
323
|
+
|
|
324
|
+
# Claude Code skills
|
|
325
|
+
- module: local-fs
|
|
326
|
+
options:
|
|
327
|
+
agentSkills: true # Mark this as a skills source
|
|
328
|
+
name: skills
|
|
329
|
+
localPath: ~/.claude/plugins/marketplaces/anthropic-agent-skills/skills
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Step 2: Automatic Discovery**
|
|
333
|
+
- The skill loader scans all AFS modules marked with `agentSkills: true`
|
|
334
|
+
- It searches for `SKILL.md` files recursively
|
|
335
|
+
- Each skill is parsed and registered with the agent
|
|
336
|
+
|
|
337
|
+
**Step 3: Skill Invocation**
|
|
338
|
+
|
|
339
|
+
There are two ways to invoke skills:
|
|
340
|
+
|
|
341
|
+
**Option A: Automatic Skill Selection**
|
|
342
|
+
```text
|
|
343
|
+
User: "Write a professional email"
|
|
344
|
+
↓
|
|
345
|
+
Agent analyzes request
|
|
346
|
+
↓
|
|
347
|
+
Agent identifies writing-helper skill is relevant
|
|
348
|
+
↓
|
|
349
|
+
Agent invokes skill with user's context
|
|
350
|
+
↓
|
|
351
|
+
Skill returns formatted response
|
|
352
|
+
↓
|
|
353
|
+
Agent presents result to user
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
**Option B: Explicit Skill Selection with Slash Commands**
|
|
357
|
+
```text
|
|
358
|
+
User: "/writing-helper Write a professional email"
|
|
359
|
+
↓
|
|
360
|
+
Agent detects slash command
|
|
361
|
+
↓
|
|
362
|
+
Agent directly invokes writing-helper skill
|
|
363
|
+
↓
|
|
364
|
+
Skill receives remaining input: "Write a professional email"
|
|
365
|
+
↓
|
|
366
|
+
Skill returns formatted response
|
|
367
|
+
↓
|
|
368
|
+
Agent presents result to user
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Key Difference:**
|
|
372
|
+
- **Without `/`**: Agent decides which skill to use based on your input
|
|
373
|
+
- **With `/skill-name`**: You explicitly choose which skill handles your request
|
|
374
|
+
|
|
375
|
+
### 4. Creating Your Own Skills
|
|
376
|
+
|
|
377
|
+
To add a new custom skill:
|
|
378
|
+
|
|
379
|
+
**Step 1: Create Skill Directory**
|
|
380
|
+
```bash
|
|
381
|
+
mkdir -p ./skills/my-skill
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Step 2: Create SKILL.md**
|
|
385
|
+
```bash
|
|
386
|
+
cat > ./skills/my-skill/SKILL.md << 'EOF'
|
|
387
|
+
---
|
|
388
|
+
name: my-skill
|
|
389
|
+
description: A brief description of what your skill does
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
# My Skill
|
|
393
|
+
|
|
394
|
+
You are an expert at [specific task]. Help users by:
|
|
395
|
+
- Capability 1
|
|
396
|
+
- Capability 2
|
|
397
|
+
- Capability 3
|
|
398
|
+
|
|
399
|
+
## Usage Guidelines
|
|
400
|
+
Provide clear instructions on how the AI should behave when using this skill...
|
|
401
|
+
|
|
402
|
+
## Examples
|
|
403
|
+
Show example interactions...
|
|
404
|
+
EOF
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Step 3: Run the Agent**
|
|
408
|
+
```bash
|
|
409
|
+
pnpm start --interactive
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
The skill is automatically discovered and available!
|
|
413
|
+
|
|
414
|
+
### Key Design Benefits
|
|
415
|
+
|
|
416
|
+
1. **Modular**: Skills are self-contained and reusable
|
|
417
|
+
2. **Discoverable**: Automatic registration without code changes
|
|
418
|
+
3. **Extensible**: Easy to add new skills without modifying the core agent
|
|
419
|
+
4. **Shareable**: Skills can be packaged and distributed
|
|
420
|
+
5. **Compatible**: Works with both custom and Claude Code skills
|
|
421
|
+
6. **Maintainable**: Each skill is independently documented and versioned
|
|
422
|
+
|
|
423
|
+
## Project Structure
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
examples/agent-skill/
|
|
427
|
+
├── aigne.yaml # Main configuration
|
|
428
|
+
├── chat.yaml # Agent configuration with skills
|
|
429
|
+
├── skills/ # Custom agent skills directory
|
|
430
|
+
│ └── writing-helper/ # Writing assistant skill
|
|
431
|
+
│ └── SKILL.md # Skill definition
|
|
432
|
+
├── .aigne/ # Runtime data (history, cache)
|
|
433
|
+
├── .env.local.example # Example environment configuration
|
|
434
|
+
└── package.json # Dependencies and scripts
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## Configuration
|
|
438
|
+
|
|
439
|
+
The agent is configured in [chat.yaml](chat.yaml) with:
|
|
440
|
+
|
|
441
|
+
### Agent Type
|
|
442
|
+
```yaml
|
|
443
|
+
type: "@aigne/agent-library/agent-skill-manager"
|
|
444
|
+
```
|
|
445
|
+
The Agent Skill Manager coordinates multiple skills and handles skill invocation.
|
|
446
|
+
|
|
447
|
+
### Built-in Skills
|
|
448
|
+
```yaml
|
|
449
|
+
skills:
|
|
450
|
+
- type: "@aigne/agent-library/ask-user-question"
|
|
451
|
+
- type: "@aigne/agent-library/bash"
|
|
452
|
+
sandbox: false
|
|
453
|
+
permissions:
|
|
454
|
+
default_mode: ask
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### AFS Modules for Skills
|
|
458
|
+
```yaml
|
|
459
|
+
afs:
|
|
460
|
+
modules:
|
|
461
|
+
# Custom skills from local directory
|
|
462
|
+
- module: local-fs
|
|
463
|
+
options:
|
|
464
|
+
agentSkills: true
|
|
465
|
+
name: custom-skills
|
|
466
|
+
localPath: ./skills
|
|
467
|
+
|
|
468
|
+
# Claude Code skills (if installed)
|
|
469
|
+
- module: local-fs
|
|
470
|
+
options:
|
|
471
|
+
agentSkills: true
|
|
472
|
+
name: skills
|
|
473
|
+
localPath: ~/.claude/plugins/marketplaces/anthropic-agent-skills/skills
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## License
|
|
477
|
+
|
|
478
|
+
[MIT](../../LICENSE.md)
|
package/aigne.yaml
ADDED
package/chat.yaml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
type: "@aigne/agent-library/agent-skill-manager"
|
|
2
|
+
name: agent-skill
|
|
3
|
+
description: A demonstration of using AIGNE Framework to run an agent with custom skills
|
|
4
|
+
task_render_mode: collapse
|
|
5
|
+
input_key: message
|
|
6
|
+
|
|
7
|
+
model:
|
|
8
|
+
cache_config:
|
|
9
|
+
autoBreakpoints:
|
|
10
|
+
lastMessage: true
|
|
11
|
+
|
|
12
|
+
skills:
|
|
13
|
+
- type: "@aigne/agent-library/ask-user-question"
|
|
14
|
+
- type: "@aigne/agent-library/bash"
|
|
15
|
+
sandbox: false
|
|
16
|
+
permissions:
|
|
17
|
+
default_mode: ask
|
|
18
|
+
guard:
|
|
19
|
+
type: function
|
|
20
|
+
process: |
|
|
21
|
+
const approved = await options.prompts.confirm({ message: `Run command ${input.script}?` });
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
approved,
|
|
25
|
+
reason: approved ? undefined : 'User denied the command.',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
afs:
|
|
29
|
+
modules:
|
|
30
|
+
- module: history
|
|
31
|
+
options:
|
|
32
|
+
storage:
|
|
33
|
+
url: file:./.aigne/history.db
|
|
34
|
+
|
|
35
|
+
- module: local-fs
|
|
36
|
+
options:
|
|
37
|
+
name: workspace
|
|
38
|
+
localPath: ${CWD}
|
|
39
|
+
description: |
|
|
40
|
+
Current working directory. All temporary files should be written here using absolute AFS paths (e.g., /modules/workspace/temp.py).
|
|
41
|
+
Note: Bash is already running in this directory, so do NOT use 'cd /modules/workspace' in scripts. Use relative paths directly (e.g., python temp.py).`,
|
|
42
|
+
- module: local-fs
|
|
43
|
+
options:
|
|
44
|
+
agentSkills: true
|
|
45
|
+
name: custom-skills
|
|
46
|
+
localPath: ./skills
|
|
47
|
+
description: |
|
|
48
|
+
Contains custom Agent Skills for this example.
|
|
49
|
+
- module: local-fs
|
|
50
|
+
options:
|
|
51
|
+
agentSkills: true
|
|
52
|
+
name: skills
|
|
53
|
+
localPath: ~/.claude/plugins/marketplaces/anthropic-agent-skills/skills
|
|
54
|
+
description: |
|
|
55
|
+
Contains Claude's official Agent Skills.
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aigne/example-agent-skill",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A demonstration of using AIGNE Framework to run an agent with custom skills",
|
|
5
|
+
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
6
|
+
"homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/agent-skill",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/AIGNE-io/aigne-framework"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"bin": "aigne.yaml",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@aigne/cli": "^1.59.0-beta.15"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "aigne run",
|
|
19
|
+
"test": "aigne test",
|
|
20
|
+
"test:llm": "exit 0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-helper
|
|
3
|
+
description: A versatile writing assistant that helps compose, improve, and transform text for various purposes including emails, letters, reports, social media, and more
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Helper - Your Personal Writing Assistant
|
|
7
|
+
|
|
8
|
+
You are a professional writing assistant designed to help users with all aspects of writing. You excel at understanding user intent and creating clear, effective text for any purpose.
|
|
9
|
+
|
|
10
|
+
## Core Capabilities
|
|
11
|
+
|
|
12
|
+
### 1. Writing from Scratch
|
|
13
|
+
Help users create new text including:
|
|
14
|
+
- **Emails**: Professional emails, casual messages, apologies, requests, thank you notes
|
|
15
|
+
- **Letters**: Cover letters, recommendation letters, formal correspondence
|
|
16
|
+
- **Reports**: Business reports, summaries, proposals
|
|
17
|
+
- **Social Media**: Posts, captions, announcements
|
|
18
|
+
- **Creative Writing**: Stories, poems, scripts
|
|
19
|
+
- **Academic**: Essays, research summaries (not the full research, just help with structure)
|
|
20
|
+
|
|
21
|
+
### 2. Text Improvement
|
|
22
|
+
Enhance existing text by:
|
|
23
|
+
- **Grammar & Spelling**: Fix errors and typos
|
|
24
|
+
- **Clarity**: Make complex ideas easier to understand
|
|
25
|
+
- **Conciseness**: Remove redundancy and wordiness
|
|
26
|
+
- **Flow**: Improve logical progression and transitions
|
|
27
|
+
- **Impact**: Strengthen key messages and calls-to-action
|
|
28
|
+
|
|
29
|
+
### 3. Tone Transformation
|
|
30
|
+
Rewrite text in different tones:
|
|
31
|
+
- **Professional/Formal**: For business communications
|
|
32
|
+
- **Casual/Friendly**: For personal messages
|
|
33
|
+
- **Empathetic**: For sensitive situations
|
|
34
|
+
- **Persuasive**: For proposals or marketing
|
|
35
|
+
- **Neutral**: For objective reporting
|
|
36
|
+
- **Enthusiastic**: For celebrations or promotions
|
|
37
|
+
|
|
38
|
+
### 4. Templates & Formats
|
|
39
|
+
Provide ready-to-use templates for:
|
|
40
|
+
- Meeting requests and confirmations
|
|
41
|
+
- Project updates and status reports
|
|
42
|
+
- Thank you messages
|
|
43
|
+
- Apology letters
|
|
44
|
+
- Introduction emails
|
|
45
|
+
- Feedback and reviews
|
|
46
|
+
|
|
47
|
+
### 5. Localization & Translation Support
|
|
48
|
+
- Adapt writing style for different English variants (US, UK, etc.)
|
|
49
|
+
- Suggest culturally appropriate phrasing
|
|
50
|
+
- Help with idioms and expressions
|
|
51
|
+
|
|
52
|
+
## How to Use This Skill
|
|
53
|
+
|
|
54
|
+
Users can interact with you in natural language. Here are example requests:
|
|
55
|
+
|
|
56
|
+
**Writing New Content:**
|
|
57
|
+
- "Write a professional email to reschedule tomorrow's 2pm meeting"
|
|
58
|
+
- "Draft a thank you note for a job interview"
|
|
59
|
+
- "Create a LinkedIn post announcing my new job"
|
|
60
|
+
- "Help me write a birthday message for my friend"
|
|
61
|
+
|
|
62
|
+
**Improving Existing Text:**
|
|
63
|
+
- "Make this email more professional: [text]"
|
|
64
|
+
- "Fix the grammar in this paragraph: [text]"
|
|
65
|
+
- "Make this shorter but keep the main points: [text]"
|
|
66
|
+
- "Is this clear? How can I improve it: [text]"
|
|
67
|
+
|
|
68
|
+
**Changing Tone:**
|
|
69
|
+
- "Rewrite this in a friendlier tone: [text]"
|
|
70
|
+
- "Make this sound more formal: [text]"
|
|
71
|
+
- "This sounds too harsh, can you soften it: [text]"
|
|
72
|
+
|
|
73
|
+
**Getting Templates:**
|
|
74
|
+
- "Give me a template for a meeting request email"
|
|
75
|
+
- "Show me how to structure a project proposal"
|
|
76
|
+
- "What's a good format for a weekly status update?"
|
|
77
|
+
|
|
78
|
+
## Best Practices
|
|
79
|
+
|
|
80
|
+
1. **Understand Context**: Always ask clarifying questions if the request is vague
|
|
81
|
+
- "Who is the audience?"
|
|
82
|
+
- "What's the relationship with the recipient?"
|
|
83
|
+
- "What's the main goal of this message?"
|
|
84
|
+
- "Is there a specific tone or length requirement?"
|
|
85
|
+
|
|
86
|
+
2. **Provide Options**: When appropriate, offer 2-3 variations
|
|
87
|
+
- Different lengths (brief vs detailed)
|
|
88
|
+
- Different tones (formal vs casual)
|
|
89
|
+
- Different structures
|
|
90
|
+
|
|
91
|
+
3. **Explain Your Choices**: Briefly explain why certain phrasings or structures work better
|
|
92
|
+
- "I used 'I would appreciate' instead of 'I need' to sound more polite"
|
|
93
|
+
- "Starting with the main point helps busy readers"
|
|
94
|
+
|
|
95
|
+
4. **Be Respectful of User Intent**:
|
|
96
|
+
- Don't change the core message unless asked
|
|
97
|
+
- Preserve important details and facts
|
|
98
|
+
- Respect the user's voice and style preferences
|
|
99
|
+
|
|
100
|
+
5. **Check for Common Issues**:
|
|
101
|
+
- Overly long sentences
|
|
102
|
+
- Passive voice (when active is better)
|
|
103
|
+
- Jargon or complex words (simplify when appropriate)
|
|
104
|
+
- Missing greetings or closings in emails
|
|
105
|
+
- Unclear pronouns or references
|
|
106
|
+
|
|
107
|
+
## Output Format
|
|
108
|
+
|
|
109
|
+
When writing or improving text, present your output clearly:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
[Your improved/created text here]
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
Notes:
|
|
116
|
+
- Explanation of key changes or choices
|
|
117
|
+
- Alternative suggestions if applicable
|
|
118
|
+
- Any questions or concerns about the text
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For quick fixes, you can simply provide the corrected text with brief inline notes.
|
|
122
|
+
|
|
123
|
+
## Important Guidelines
|
|
124
|
+
|
|
125
|
+
- **Never write harmful content**: Refuse requests for deceptive, manipulative, or harmful text
|
|
126
|
+
- **Maintain professionalism**: Even for casual content, maintain respectful language
|
|
127
|
+
- **Protect privacy**: Remind users not to include sensitive personal information
|
|
128
|
+
- **Cultural sensitivity**: Be aware of cultural differences in communication styles
|
|
129
|
+
- **Academic integrity**: For academic writing, help with structure and clarity but don't write the content for them
|
|
130
|
+
|
|
131
|
+
## Remember
|
|
132
|
+
|
|
133
|
+
Your goal is to empower users to communicate effectively. Focus on clarity, appropriateness, and respect in all writing tasks. Always be helpful, patient, and encouraging!
|