Skip to content

Agent Skills Framework

ByteBuddy's Agent Skills system provides a powerful, extensible framework for managing and using AI skills. Based on the open Agent Skills specification, it allows you to create, load, and manage skills that enhance AI capabilities for specific tasks.

🎯 Overview

What are Agent Skills?

Agent Skills are self-contained packages that provide specialized instructions, scripts, and resources to enhance AI capabilities for specific tasks. Each skill follows a standardized format and can be dynamically loaded and activated based on context.

Key Features

  • Open Specification: Full compatibility with Agent Skills open specification
  • Dynamic Loading: Skills load automatically from multiple directories
  • Context-Aware Activation: Skills activate based on conversation context
  • Resource Management: Access scripts, references, and assets from skills
  • Rule Integration: Skills seamlessly integrate with existing rule system
  • Built-in Tools: Comprehensive tools for skill discovery and management

📁 Directory Structure

Standard Skill Structure

.bytebuddy/
└── skills/                          # Skills root directory
    ├── algorithmic-art/             # Skill directory (name must match SKILL.md)
    │   ├── SKILL.md                 # Required, follows Agent Skills specification
    │   ├── LICENSE.txt              # License file (if license field references)
    │   ├── scripts/                 # Optional, executable code
    │   │   └── generate-art.py      # Example script
    │   ├── references/              # Optional, reference documentation
    │   │   └── REFERENCE.md         # Technical reference
    │   └── assets/                  # Optional, static resources
    │       └── templates/
    │           └── viewer.html      # Template file
    └── document-processing/         # Another skill
        └── SKILL.md

Skill Locations

ByteBuddy searches for skills in the following directories (in order):

  1. Global Directory: ~/.bytebuddy/skills/ (shared across all projects)
  2. Workspace Directory: 项目根目录/.bytebuddy/skills/ (project-specific)
  3. Built-in Directory: Internal system skills (read-only)

📝 Skill Format

SKILL.md File Format

markdown
---
name: skill-name # Required, 1-64 characters, lowercase letters, numbers, hyphens
description: Skill description # Required, 1-1024 characters
license: MIT # Optional, license information
compatibility: Compatibility notes # Optional, 1-500 characters
metadata: # Optional, arbitrary key-value pairs
  author: Author Name
  version: "1.0"
allowed-tools: Allowed tools # Optional, experimental feature
---

# Skill Title

Detailed instructions and guidance for using this skill...

## Usage Scenarios

- Scenario 1
- Scenario 2

## Examples

```bash
# Example command
echo "Using the skill"
```

Field Specifications

FieldRequiredConstraints
nameYes1-64 characters, lowercase letters, numbers, hyphens, cannot start or end with hyphen
descriptionYes1-1024 characters, describes skill functionality and use cases
licenseNoLicense name or reference to license file
compatibilityNo1-500 characters, environment requirements
metadataNoArbitrary key-value pairs for extended metadata
allowed-toolsNoSpace-separated list of tools (experimental)

Resource Directories

  1. scripts/: Executable code (Python, Bash, JavaScript, etc.)
  2. references/: Reference documentation (technical references, API docs, etc.)
  3. assets/: Static resources (templates, images, data files, etc.)

⚙️ Configuration

Basic Configuration

Add the following to your .bytebuddy/config.yaml:

yaml
name: My ByteBuddy Config
version: 0.0.1

skills:
  enabled: true
  autoActivate: true
  directories:
    - ~/.bytebuddy/skills
    - .bytebuddy/skills
  blacklist:
    - experimental-skill
  whitelist: []
  cache:
    enabled: true
    ttl: 300000

Configuration Options

OptionTypeDefaultDescription
enabledbooleantrueEnable/disable skills system
autoActivatebooleantrueAuto-activate skills based on context
directoriesstring[]["~/.bytebuddy/skills", ".bytebuddy/skills"]Directories to search for skills
blackliststring[][]Skills to exclude
whiteliststring[][]Skills to include (if empty, all skills allowed)
cache.enabledbooleantrueEnable skill caching
cache.ttlnumber300000Cache time-to-live in milliseconds

🛠️ Built-in Tools

ByteBuddy provides several built-in tools for managing skills:

1. List Skills

typescript
// Tool: list_skills
// Description: List all available skills
// Usage: AI can call this to discover available skills

2. Activate Skill

typescript
// Tool: activate_skill
// Description: Activate a specific skill
// Parameters: skillName (string)
// Usage: AI can activate skills based on context

3. Get Skill Resource

typescript
// Tool: get_skill_resource
// Description: Get skill resource file content
// Parameters: skillName (string), resourcePath (string)
// Usage: AI can access skill scripts and resources

4. Search Skills

typescript
// Tool: search_skills
// Description: Search skills by keyword
// Parameters: keyword (string), limit (number)
// Usage: AI can find relevant skills

5. Activate Skills by Context

typescript
// Tool: activate_skills_by_context
// Description: Auto-activate skills based on conversation context
// Parameters: context (string)
// Usage: AI can automatically activate relevant skills

🚀 Creating Your First Skill

Step 1: Create Skill Directory

bash
# Create skill directory
mkdir -p .bytebuddy/skills/my-first-skill

Step 2: Create SKILL.md

markdown
---
name: my-first-skill
description: My first custom skill for ByteBuddy
license: MIT
compatibility: Requires Python 3.8+
metadata:
  author: Your Name
  version: "1.0"
---

# My First Skill

This skill helps with specific development tasks...

## Usage Guide

1. Step 1: Describe the task
2. Step 2: Use the skill instructions
3. Step 3: Apply the results

## Examples

```python
# Example Python code
print("Using my first skill")
```

Step 3: Add Scripts (Optional)

bash
# Create scripts directory
mkdir -p .bytebuddy/skills/my-first-skill/scripts

# Create a Python script
cat > .bytebuddy/skills/my-first-skill/scripts/process.py << 'EOF'
#!/usr/bin/env python3
import json
import sys

def process_data(input_file):
    with open(input_file, 'r') as f:
        data = json.load(f)
    # Processing logic here
    return data

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: python process.py <input_file>")
        sys.exit(1)
    
    result = process_data(sys.argv[1])
    print(json.dumps(result, indent=2))
EOF

Step 4: Add References (Optional)

bash
# Create references directory
mkdir -p .bytebuddy/skills/my-first-skill/references

# Create reference documentation
cat > .bytebuddy/skills/my-first-skill/references/config.md << 'EOF'
# Configuration Reference

## Input Format

```json
{
  "data": "Data to process"
}

Output Format

json
{
  "result": "Processing result",
  "status": "success"
}

EOF


## 🔄 Skill Lifecycle

### 1. Loading

Skills are loaded automatically when ByteBuddy starts or when the skill directory changes.

### 2. Validation

Each skill is validated for:
- Correct SKILL.md format
- Valid metadata fields
- Resource file accessibility

### 3. Activation

Skills can be activated:
- **Automatically**: Based on conversation context
- **Manually**: Via AI tool calls
- **Programmatically**: Via configuration

### 4. Usage

Once activated, skills provide:
- Instructions to the AI
- Access to scripts and resources
- Enhanced capabilities for specific tasks

## 🎯 Best Practices

### Skill Design

1. **Single Responsibility**: Each skill should focus on one specific task
2. **Clear Documentation**: Provide comprehensive usage instructions
3. **Examples**: Include practical examples
4. **Error Handling**: Scripts should handle errors gracefully

### Performance

1. **Lazy Loading**: Resources load only when needed
2. **Caching**: Enable caching for better performance
3. **Minimal Dependencies**: Keep scripts lightweight

### Security

1. **Sandbox Execution**: Scripts run in isolated environments
2. **Input Validation**: Validate all inputs
3. **Permission Control**: Control resource access

## 📚 Examples

### Example 1: Code Review Skill

````markdown
---
name: code-review-assistant
description: AI-powered code review assistant with best practices
license: Apache-2.0
compatibility: Works with any programming language
metadata:
  author: ByteBuddy Team
  version: "1.2.0"
---

# Code Review Assistant

This skill helps with comprehensive code reviews...

## Review Checklist

- [ ] Code style and formatting
- [ ] Error handling
- [ ] Performance considerations
- [ ] Security vulnerabilities
- [ ] Test coverage

## Examples

```python
# Before review
def process_data(data):
    return data * 2

# After review with improvements
def process_data(data: List[int]) -> List[int]:
    """Process list of integers by doubling each element."""
    if not data:
        return []
    return [item * 2 for item in data]

### Example 2: Database Migration Skill

````markdown
---
name: database-migration
description: Database schema migration and data transformation
license: MIT
compatibility: PostgreSQL, MySQL, SQLite
metadata:
  author: Database Team
  version: "2.1.0"
---

# Database Migration Assistant

This skill helps with database migrations...

## Migration Steps

1. Backup existing data
2. Create migration scripts
3. Test migration
4. Apply migration
5. Verify results

## Examples

```sql
-- Migration script example
CREATE TABLE users_new (
    id SERIAL PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Data migration
INSERT INTO users_new (email, created_at)
SELECT email, created_at FROM users;
```

🔧 Advanced Usage

Skill Dependencies

Skills can declare dependencies in metadata:

yaml
metadata:
  dependencies: |
    python>=3.8
    requests>=2.25
    pandas>=1.3

Skill Versioning

Use semantic versioning in metadata:

yaml
metadata:
  version: "1.2.3"  # Major.Minor.Patch

Skill Testing

Create test scripts in the skill directory:

my-skill/
├── SKILL.md
├── scripts/
│   └── main.py
└── tests/
    └── test_main.py

🚨 Troubleshooting

Common Issues

  1. Skill Not Loading

    • Check SKILL.md format
    • Verify directory permissions
    • Check configuration settings
  2. Resources Not Accessible

    • Verify file paths
    • Check file permissions
    • Ensure correct resource references
  3. Activation Issues

    • Check context matching
    • Verify skill compatibility
    • Review skill metadata

Debug Commands

bash
# List all loaded skills
bytebuddy skills list

# Check skill details
bytebuddy skills show skill-name

# Reload skills
bytebuddy skills reload

# Clear skill cache
bytebuddy skills clear-cache

📖 Further Reading


Ready to enhance your AI capabilities? Start creating your own skills today and share them with the community!