Fastapi Notification Module Skillのロゴ

Fastapi Notification Module Skill

コミュニティ
jiushiwon
fastapi-notification-module-skill

Python FastAPI 通知模块技能。面向已有 FastAPI 项目的开发者,提供短信发送、邮件推送、站内消息、推送通知等能力的快速集成。触发词:"短信验证码"、"发送短信"、"发送邮件"、"站内消息"、"通知模块"、"sms"、"email"、"mail"、"notification"。

概要

公開者jiushiwon
リポジトリwg-skills
スキル名fastapi-notification-module-skill
スター
123
フォーク
38
同梱ファイル
1
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    jiushiwonがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Fastapi Notification Module Skill」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/python/fastapi-module/fastapi-notification-module-skill
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jiushiwon/wg-skills.git /tmp/wg-skills
mkdir -p .claude/skills
cp -r /tmp/wg-skills/vibeCoding/backend/python/fastapi-module/fastapi-notification-module-skill .claude/skills/fastapi-notification-module-skill
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでFastapi Notification Module Skillを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にFastapi Notification Module Skillを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Fastapi Notification Module Skillは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

FastAPI Notification Module Skill

面向已有 FastAPI 项目的开发者,快速集成通知能力。

能力清单

能力说明
短信发送验证码/通知短信
邮件推送HTML/文本邮件/模板邮件
站内消息系统通知/未读消息
推送通知极光/FCM
消息模板模板管理和渲染

触发场景

用户说"帮我加短信"或"集成通知"时触发。

核心实现

依赖配置

bash
# 短信
pip install aliyun-python-sdk-core

# 邮件
pip install aiosmtpd jinja2

# 站内消息
pip install redis

配置

python
# config.py
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    # 短信配置
    sms_access_key: str = ""
    sms_secret_key: str = ""
    sms_sign_name: str = ""
    sms_template_code: str = ""
    
    # 邮件配置
    mail_host: str = "smtp.qq.com"
    mail_port: int = 587
    mail_username: str = ""
    mail_password: str = ""
    
    # Redis 配置
    redis_host: str = "localhost"
    redis_port: int = 6379

数据模型

python
# models.py
from sqlalchemy import Column, BigInteger, String, Text, Integer, DateTime, Enum as SQLEnum
from database import Base
import enum

class NotificationType(str, enum.Enum):
    SYSTEM = "system"
    SMS = "sms"
    EMAIL = "email"
    PUSH = "push"

class Notification(Base):
    __tablename__ = "wg_notification"
    
    id = Column(BigInteger, primary_key=True, autoincrement=True)
    user_id = Column(String(50), nullable=False, index=True)
    title = Column(String(200), nullable=False)
    content = Column(Text, nullable=False)
    type = Column(SQLEnum(NotificationType), default=NotificationType.SYSTEM)
    link = Column(String(500))
    is_read = Column(Integer, default=0)
    created_at = Column(DateTime, server_default=func.now())

class SmsCode(Base):
    __tablename__ = "wg_sms_code"
    
    id = Column(BigInteger, primary_key=True, autoincrement=True)
    phone = Column(String(20), nullable=False, index=True)
    code = Column(String(10), nullable=False)
    template_code = Column(String(50))
    expire_time = Column(DateTime)
    used = Column(Integer, default=0)
    created_at = Column(DateTime, server_default=func.now())

服务层

python
# services/notification_service.py
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest
import random
import string
import redis

class NotificationService:
    def __init__(self):
        self.sms_client = AcsClient(
            settings.sms_access_key,
            settings.sms_secret_key,
            'cn-hangzhou'
        )
        self.redis = redis.Redis(
            host=settings.redis_host,
            port=settings.redis_port,
            decode_responses=True
        )
    
    # 短信验证码
    async def send_sms_code(self, phone: str, template_code: str = None):
        code = ''.join(random.choices(string.digits, k=6))
        
        # 调用短信API
        request = CommonRequest()
        request.set_accept_format('json')
        request.set_domain('dysmsapi.aliyuncs.com')
        request.set_method('POST')
        request.set_protocol_type('https')
        request.set_version('2017-05-25')
        request.set_action_name('SendSms')
        
        request.add_query_param('PhoneNumbers', phone)
        request.add_query_param('SignName', settings.sms_sign_name)
        request.add_query_param('TemplateCode', template_code or settings.sms_template_code)
        request.add_query_param('TemplateParam', f'{{"code":"{code}"}}')
        
        response = self.sms_client.do_action_with_exception(request)
        
        # 保存验证码到 Redis
        key = f"sms:code:{phone}"
        self.redis.setex(key, 300, code)  # 5分钟过期
        
        return code
    
    async def verify_sms_code(self, phone: str, code: str) -> bool:
        key = f"sms:code:{phone}"
        saved_code = self.redis.get(key)
        if saved_code == code:
            self.redis.delete(key)
            return True
        return False
    
    # 发送邮件
    async def send_email(self, to: str, subject: str, content: str):
        import aiosmtplib
        from email.mime.text import MIMEText
        
        msg = MIMEText(content, 'html', 'utf-8')
        msg['Subject'] = subject
        msg['From'] = settings.mail_username
        msg['To'] = to
        
        await aiosmtplib.send(
            msg,
            hostname=settings.mail_host,
            port=settings.mail_port,
            username=settings.mail_username,
            password=settings.mail_password,
            use_tls=True
        )
    
    # 站内消息
    async def send_notification(
        self,
        user_id: str,
        title: str,
        content: str,
        notification_type: NotificationType = NotificationType.SYSTEM,
        link: str = None
    ):
        notification = Notification(
            user_id=user_id,
            title=title,
            content=content,
            type=notification_type,
            link=link
        )
        db.add(notification)
        db.commit()
        
        # Redis 推送
        self.redis.publish(f"notification:{user_id}", json.dumps({
            "title": title,
            "content": content,
            "type": notification_type.value
        }))
        
        return notification
    
    # 获取未读消息
    async def get_unread_notifications(self, user_id: str) -> List[Notification]:
        return db.query(Notification).filter(
            Notification.user_id == user_id,
            Notification.is_read == 0
        ).order_by(Notification.created_at.desc()).all()

API 路由

python
# routers/notification.py
from fastapi import APIRouter, Depends

router = APIRouter(prefix="/api/notification", tags=["通知"])

@router.post("/sms/send")
async def send_sms(phone: str):
    await notification_service.send_sms_code(phone)
    return ApiResponse.ok(None)

@router.post("/sms/verify")
async def verify_sms(phone: str, code: str):
    valid = await notification_service.verify_sms_code(phone, code)
    return ApiResponse.ok(valid)

@router.post("/email/send")
async def send_email(to: str, subject: str, content: str):
    await notification_service.send_email(to, subject, content)
    return ApiResponse.ok(None)

@router.post("/send")
async def send_notification(
    user_id: str,
    title: str,
    content: str,
    notification_type: NotificationType = NotificationType.SYSTEM
):
    await notification_service.send_notification(user_id, title, content, notification_type)
    return ApiResponse.ok(None)

@router.get("/unread")
async def get_unread(user_id: str):
    notifications = await notification_service.get_unread_notifications(user_id)
    return ApiResponse.ok(notifications)

不做

  • 不负责短信/邮件服务商账号配置
  • 不处理复杂的推送策略
  • 不提供 UI 相关代码

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Fastapi Notification Module Skill」では何ができますか?

Python FastAPI 通知模块技能。面向已有 FastAPI 项目的开发者,提供短信发送、邮件推送、站内消息、推送通知等能力的快速集成。触发词:"短信验证码"、"发送短信"、"发送邮件"、"站内消息"、"通知模块"、"sms"、"email"、"mail"、"notification"。

TypingMindでFastapi Notification Module Skillを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Fastapi Notification Module Skillはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにFastapi Notification Module Skillをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/python/fastapi-module/fastapi-notification-module-skillを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Fastapi Notification Module Skillを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Fastapi Notification Module Skillで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもFastapi Notification Module Skillを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Fastapi Notification Module Skill」は無料ですか?

はい。jiushiwonがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇