Lecture 4: Your First Skill: Hello World Practice
Lecture 4: Your First Skill: Hello World Practice
Create your first AI Skill hands-on, completing the leap from theory to practice.
1. Preparation
1.1 Register a Coze Account
- Visit https://www.coze.cn
- Register with phone number or Douyin account
- Complete real-name authentication (if publishing to store)
1.2 Understand Coze Interface
1 | ┌─────────────────────────────────────────────────────────┐ |
2. Create Your First Skill: Weather Assistant
2.1 Create Bot
- Click "Create Bot"
- Fill in basic information:
- Name: Weather Assistant
- Description: Helps you check weather for cities across China
- Icon: Upload or select system icon
- Click "Confirm"
2.2 Configure Persona & Response Logic
In the "Persona & Response Logic" area, enter:
1 | # Role |
2.3 Add Weather Query Plugin
- Click "+" on the right side of "Plugins"
- Search "weather"
- Select "Moji Weather" or "Seniverse Weather" plugin
- Click "Add"
2.4 Test Your Skill
In the right preview area, enter:
1 | How's the weather in Beijing today? |
Expected output:
1 | Today's weather in Beijing is sunny, temperature 15-25°C, air quality is good, suitable for outdoor activities. |
3. Advanced: Make Your Skill Smarter
3.1 Add Workflow
Create a new workflow "weather_workflow":
1 | Start node |
3.2 Workflow Detailed Configuration
Parameter extraction node:
1 | # Use large model to extract parameters |
Weather query node:
1 | # Call Moji weather plugin |
Suggestion generation node:
1 | prompt = """ |
3.3 Bind Workflow to Bot
- Return to Bot edit page
- Add "weather_workflow" in the "Workflow" area
- Add in "Persona & Response Logic":
1 | When user asks about weather, call weather_workflow workflow to get weather information. |
4. Code Implementation: Build Weather Skill from Scratch
If you want to implement with code, here's a complete example:
4.1 Project Structure
1 | weather-skill/ |
4.2 Core Code
main.py
import json
from intent import IntentClassifier
from weather_api import WeatherAPI
## 🎓 AI 编程实战课程
想系统学习 AI 编程?程序员晚枫的 **AI 编程实战课** 帮你从零上手!
- 👉 **课程报名**:[点击这里报名,前3讲免费试听](https://r7up9.xetslk.com/s/1uP5YW)
- 👉 **免费试看**:[B站免费试看前3讲,先看看适不适合自己](https://www.bilibili.com/cheese/play/ss982042944)
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 程序员晚枫 - Python自动化办公与AI编程!

