Mysql Guide Skill logo

Mysql Guide Skill

Community
jiushiwon
mysql-guide-skill

MySQL 学习与选型指南。面向需要了解 MySQL 的开发者,提供核心概念、安装部署、表结构设计、索引优化、事务原理、主从复制、与业务场景匹配推荐等(不含具体框架集成)。触发词:"MySQL 学习"、"MySQL 入门"、"MySQL 选型"、"MySQL 索引"、"MySQL 事务"、"MySQL 设计"、"SQL 优化"。

Overview

Publisherjiushiwon
Repositorywg-skills
Skill namemysql-guide-skill
Stars
123
Forks
38
Bundled files
3
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by jiushiwon on GitHub. Read the source before you install it.

Installation

Install the Mysql Guide Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/database/mysql-guide-skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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/database/mysql-guide-skill .claude/skills/mysql-guide-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Mysql Guide Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Mysql Guide Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Mysql Guide Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

MySQL Module Skill

面向已有后端项目的开发者,快速集成 MySQL 能力。

能力清单

能力说明
连接配置JDBC/连接池/环境变量配置
表结构设计DDL 建表/字段类型/约束
ORM 映射实体类/Repository/Service
索引优化索引设计/慢查询优化
事务处理声明式/编程式事务
主从复制读写分离/负载均衡

触发场景

用户说"帮我加 MySQL"或"集成 MySQL"时触发。

核心配置

Java (Spring Boot)

yaml
# application.yml
spring:
  datasource:
    url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:myapp}?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
    username: ${MYSQL_USER:root}
    password: ${MYSQL_PASSWORD:}
    driver-class-name: com.mysql.cj.jdbc.Driver
    hikari:
      maximum-pool-size: 10
      minimum-idle: 5
      connection-timeout: 30000

Python (FastAPI)

python
# config.py
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    mysql_host: str = "localhost"
    mysql_port: int = 3306
    mysql_user: str = "root"
    mysql_password: str = ""
    mysql_database: str = "myapp"

# database.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

engine = create_engine(
    f"mysql+pymysql://{user}:{password}@{host}:{port}/{database}",
    pool_size=10,
    max_overflow=20,
    pool_pre_ping=True
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

Go (Gin + GORM)

go
// config/config.go
package config

import (
    "fmt"
    "os"
)

type Config struct {
    MySQLHost     string
    MySQLPort     string
    MySQLUser     string
    MySQLPassword string
    MySQLDatabase string
}

func Load() *Config {
    return &Config{
        MySQLHost:     getEnv("MYSQL_HOST", "localhost"),
        MySQLPort:     getEnv("MYSQL_PORT", "3306"),
        MySQLUser:     getEnv("MYSQL_USER", "root"),
        MySQLPassword: getEnv("MYSQL_PASSWORD", ""),
        MySQLDatabase: getEnv("MYSQL_DATABASE", "myapp"),
    }
}

func (c *Config) DSN() string {
    return fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
        c.MySQLUser, c.MySQLPassword, c.MySQLHost, c.MySQLPort, c.MySQLDatabase)
}

func getEnv(key, defaultVal string) string {
    if val := os.Getenv(key); val != "" {
        return val
    }
    return defaultVal
}
go
// database/database.go
package database

import (
    "fmt"
    "log"
    "time"

    "gorm.io/driver/mysql"
    "gorm.io/gorm"
    "gorm.io/gorm/logger"
)

var DB *gorm.DB

func Init(dsn string) {
    var err error
    DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{
        Logger: logger.Default.LogMode(logger.Info),
    })
    if err != nil {
        log.Fatalf("连接 MySQL 失败: %v", err)
    }

    sqlDB, _ := DB.DB()
    sqlDB.SetMaxIdleConns(5)                  // 最小空闲连接
    sqlDB.SetMaxOpenConns(10)                 // 最大连接数
    sqlDB.SetConnMaxLifetime(30 * time.Minute) // 连接最大存活时间

    fmt.Println("MySQL 连接成功")
}

表结构设计

基础表模板

sql
CREATE TABLE `wg_user` (
  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` VARCHAR(50) NOT NULL COMMENT '用户名',
  `password` VARCHAR(255) NOT NULL COMMENT '密码',
  `nickname` VARCHAR(100) DEFAULT NULL COMMENT '昵称',
  `avatar` VARCHAR(500) DEFAULT NULL COMMENT '头像',
  `email` VARCHAR(100) DEFAULT NULL COMMENT '邮箱',
  `phone` VARCHAR(20) DEFAULT NULL COMMENT '手机号',
  `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态 0禁用 1正常',
  `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted_at` DATETIME DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_username` (`username`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';

索引设计原则

  1. 主键:自增 BIGINT
  2. 唯一索引:username、email、phone 等唯一字段
  3. 普通索引:常用于 WHERE/ORDER BY 的字段
  4. 复合索引:遵循最左前缀原则

事务处理

Java

java
@Service
public class UserService {

    @Transactional(rollbackFor = Exception.class)
    public void createUser(User user) {
        // 业务逻辑
        userRepository.save(user);
    }
}

Python

python
from sqlalchemy.orm import Session

def create_user(db: Session, user: User):
    with db.begin():
        db.add(user)
    # 自动提交或回滚

主从复制(读写分离)

配置示例

yaml
# Spring Boot 多数据源
spring:
  datasource:
    master:
      url: jdbc:mysql://master:3306/myapp
      hikari:
        maximum-pool-size: 20
    slave:
      url: jdbc:mysql://slave:3306/myapp
      hikari:
        maximum-pool-size: 10

不做

  • 不负责 MySQL Server 安装(用户自行安装或使用 Docker)
  • 不处理复杂的集群配置
  • 不提供数据迁移工具

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Mysql Guide Skill AI skill do?

MySQL 学习与选型指南。面向需要了解 MySQL 的开发者,提供核心概念、安装部署、表结构设计、索引优化、事务原理、主从复制、与业务场景匹配推荐等(不含具体框架集成)。触发词:"MySQL 学习"、"MySQL 入门"、"MySQL 选型"、"MySQL 索引"、"MySQL 事务"、"MySQL 设计"、"SQL 优化"。

Why use Mysql Guide Skill on TypingMind?

Because you install it once and use it with any model. Mysql Guide Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Mysql Guide Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/database/mysql-guide-skill. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Mysql Guide Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Mysql Guide Skill?

As many as you like. As long as a model supports skills, you can use Mysql Guide Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Mysql Guide Skill AI skill free?

Yes. It is published on GitHub by jiushiwon under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇