Phase 4 / Ep 19: Develop Your First Skill From Scratch —— "Package Tracking" Practical Application

⏱ Est. reading time: 4 min Updated on 4/13/2026

🎯 Learning Objective: Hands-on development of a complete custom Skill.

1. Goal: Package Tracking Skill

We will develop a package-tracker Skill, enabling the Agent to query logistics status based on a tracking number.

2. Create Directory Structure

cd ~/.openclaw/agents/personal/skills/
mkdir -p package-tracker/scripts

Final structure:

package-tracker/
├── SKILL.md            # Skill Definition (Required)
├── scripts/
│   └── track.sh        # Query Script
└── examples/
    └── usage.md        # Usage Example

3. Write SKILL.md

name: package-tracker
description: Queries logistics status based on tracking numbers, supporting major express companies like SF Express, YTO Express, ZTO Express, etc.
version: 1.0.0
author: your-name
tags: [logistics, tracking, utility]
permissions: [network]

# Package Tracking Skill

## Usage Scenarios
Use this skill when the user provides a tracking number and asks about logistics status.

## Operation Steps
1. Extract the tracking number from the user message (usually 10-20 digits or alphanumeric characters)
2. Automatically identify the express company (based on the tracking number prefix)
3. Call scripts/track.sh <tracking_number> <express_company_code>
4. Parse the returned JSON data
5. Display to the user in a timeline format

## Express Company Codes
- SF: SF Express
- YTO: YTO Express
- ZTO: ZTO Express
- STO: STO Express
- YD: Yunda Express

## Output Format Example
📦 Tracking Number: SF1234567890
🏢 Express Company: SF Express
📍 Current Status: Out for delivery

Logistics Track:
⏰ 04-06 09:30 - Out for delivery, courier Zhang San 138xxxx
⏰ 04-06 06:00 - Arrived at Beijing Chaoyang Distribution Center
⏰ 04-05 18:00 - Departed from Shenzhen

## Error Handling
- Incorrect tracking number format: Prompt for correct format
- No results found: Suggest checking the tracking number or retrying later
- API timeout: Inform the user to wait

4. Write Helper Script

#!/bin/bash
# scripts/track.sh
# $1 = Tracking Number, $2 = Express Company Code
curl -s "https://api.kuaidi100.com/query?num=$1&company=$2"
chmod +x scripts/track.sh

5. Local Testing

# Restart Agent to load new Skill
openclaw gateway restart

# Verify Skill is loaded
openclaw skills list
# → package-tracker  v1.0.0  ✅ loaded

# Test conversation
openclaw chat "Help me track package SF1234567890"

6. Development Tips

  • Keep SKILL.md concise: No more than 1000 characters to reduce Token consumption
  • Be specific with instructions: Provide clear operation steps to the Agent, avoid ambiguity
  • Complete error handling: Tell the Agent how to respond to each exceptional situation
  • Usage examples: Place real-world usage examples in examples/

Next Episode Preview: Ep 20, Advanced Skill Development — Multi-script collaboration, Resources directory, Cross-Agent sharing.