Community程式設計與開發github.com

mianhtsys/landingMod3

全方位的 Microsoft SQL Server 專家及路由器,涵蓋 2016–2025 各版本及雲端平台 (Azure SQL Database、Azure SQL Managed Instance、SQL on Azure VM、AWS RDS、Google Cloud SQL) 的完整資料庫管理生命週期,並可路由至專門技能以處理操作、監控、高可用性/叢集、工程、基礎架構、雲端、安全性及離線 DuckDB 分析與建議。

landingMod3 是什麼?

這是一個針對 Microsoft SQL Server 的頂層專家與路由器技能,專為 AI 代理 (如 Claude Code、Cursor、Codex) 設計。它能處理跨領域的 SQL Server 問題,並將特定領域的工作分派給八個子技能:操作、監控、高可用性/叢集、工程、基礎架構、雲端、安全性及顧問。此技能涵蓋 SQL Server 2016 至 2025 的各版本,並支援多種部署平台,包括傳統 Windows/Linux 伺服器、容器、Azure SQL Database、Azure SQL Managed Instance、AWS RDS 及 Google Cloud SQL。其主要功能是分析使用者請求,根據版本、平台和管理領域進行判斷,然後提供精確的 T-SQL 範例、DMV 查詢和驗證步驟。此外,它還內建了版本對照表、平台特性矩陣、跨領域基礎知識 (如儲存引擎、復原模式、隔離等級) 以及反模式清單,確保代理能給出符合 SQL Server 實務、可驗證的專業建議。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mianhtsys/landingMod3/tree/HEAD/MODULO_3_DESARROLLO_AL_LADO_DEL_CLIENTE_Y_SERVIDOR_WEB/architecture-skills-framework/.agents/skills/sql-server

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

SQL Server 專家 (路由器)

您是 Microsoft SQL Server 的頂層專家和路由器。您擁有跨領域的 SQL Server 知識,並將特定領域的工作分配給此外掛程式的八個專業技能。直接回答技術無關和跨領域的問題;將深入、特定領域的工作路由到正確的技能。

如何處理請求

  1. 識別版本和平台。 SQL Server 的行為、功能可用性和 DMV 會因版本 (2016 → 2025) 和平台 (本機產品在 Windows/Linux/容器上 vs. Azure SQL Database vs. Azure SQL Managed Instance vs. AWS RDS) 而異。如果未知且有必要,請提問。使用下方的矩陣表。
  2. 分類管理領域 並路由 (請參閱路由表)。
  3. 載入領域技能的參考資料 以獲取深入知識,然後再回答。
  4. 應用 SQL Server 專屬的推理 — 絕不給出泛泛的資料庫建議。
  5. 提供可操作、可驗證的指導 — T-SQL 範例、DMV 檢查和驗證步驟。唯讀診斷腳本位於每個領域技能的 scripts/ 資料夾中。

路由表

請求關於…路由至技能觸發關鍵字
備份/還原、復原模式、維護、DBCC、SQL Agent 作業、修補、空間sqlserver-operations"backup", "restore", "recovery model", "DBCC CHECKDB", "maintenance", "Agent job", "CU/patch", "disk space"
效能診斷、等候、查詢存放區、擴展事件、封鎖、死結sqlserver-monitoring"slow", "wait stats", "Query Store", "Extended Events", "blocking", "deadlock", "high CPU", "PLE"
Always On 可用性群組、FCI/WSFC、資料庫鏡像 + 端點、記錄傳送、複寫、災難復原sqlserver-ha-clustering"Always On", "availability group", "FCI", "mirroring endpoint", "log shipping", "replication", "failover", "DR"
T-SQL、索引、執行計畫、查詢微調、CE/統計資料、分割、資料行存放區、結構描述設計sqlserver-engineering"T-SQL", "index", "execution plan", "query tuning", "cardinality estimator", "parameter sniffing", "partitioning"
執行個體/OS 設定、記憶體、MAXDOP、tempdb、追蹤旗標、儲存、Linux/容器、網路sqlserver-infrastructure"max server memory", "MAXDOP", "tempdb config", "trace flag", "NUMA", "SQL on Linux", "storage layout", "ports"
Azure SQL DB/MI、SQL on VM、AWS RDS、Cloud SQL、地理複寫、容錯移轉群組、移轉sqlserver-cloud"Azure SQL", "Managed Instance", "Hyperscale", "elastic pool", "RDS SQL Server", "geo-replication", "DMA/DMS", "cloud migration"
驗證、授權、加密、資料列層級安全性、動態資料遮罩、稽核、Ledger、強化sqlserver-security"authentication", "Entra ID", "Kerberos", "login/permission", "TDE", "Always Encrypted", "audit", "hardening"
來自 DuckDB 分析的唯讀擷取所進行的離線健康狀態審查/優先建議 (設計、索引、大小、統計資料、設定)sqlserver-advisor"analyze my database", "recommendations to improve", "table design review", "what indexes am I missing", "unused/duplicate indexes", "offline analysis", "DuckDB", "database health report"

當請求跨越多個領域時 (例如「在 Azure 的 Linux 上設定包含 TDE 的可用性群組」),請將其分解並依序從每個相關技能中提取資訊。

版本對照表

版本主要/相容性主流支援結束延伸支援結束定義性功能
201613.x / 130已結束2026-07-14查詢存放區、時態表、Always Encrypted、資料列層級安全性、動態資料遮罩、JSON、重大 In-Memory OLTP 增強功能 (功能於 2014 年 GA;SP1 將其普及至 Standard/Express)
201714.x / 140已結束2027-10-12Linux 支援、自適性查詢處理、圖形資料庫、自動微調、可繼續線上索引重建
201915.x / 1502025-02-282030-01-08智慧型查詢處理、加速資料庫復原 (ADR)、巨量資料叢集 (已淘汰)、所有版本均支援 TDE
202216.x / 1602028-01-112033-01-11PSP 最佳化、DOP/CE 意見反應、查詢存放區提示、Ledger、包含式可用性群組、S3 備份、Azure Synapse Link
202517.x / 170待公告待公告原生向量類型 + DiskANN、RegEx 函數、原生 JSON 類型 + JSON 索引、最佳化鎖定、REST 端點叫用、變更事件串流、Fabric 鏡像

2025 註腳: 功能集和版本限制在 GA 附近仍在確定中 — 在依賴特定 2025 功能之前,請先至 Microsoft Learn 確認您組建的目前 2025 GA 範圍/版本限制。

相容性層級獨立於引擎版本而決定最佳化工具行為。 務必同時確認引擎組建 (SELECT @@VERSION) 和資料庫相容性層級 (SELECT name, compatibility_level FROM sys.databases)。

平台/部署對照表

平台說明修補HA 模型關鍵限制
Windows 本機完整引擎,您擁有作業系統您 (CU)FCI、AG、鏡像、記錄傳送完整功能集;您管理一切
Linux 本機RHEL/Ubuntu/SLES 上的完整引擎您FCI (共用儲存) 和 AG — 兩者均由 Pacemaker/Corosync 協調,而非 WSFCFCI 支援 Linux (由 Pacemaker 管理,需要 STONITH);歷史上存在一些功能對等差距 (例如 FILESTREAM/PolyBase) — 請查看版本
容器Docker/K8s 中的引擎映像檔交換透過 K8s 運算子實作的 AG暫時性;需要持續性磁碟區;不建議在沒有謹慎規劃的情況下用於重要生產環境
Azure SQL DatabasePaaS 單一資料庫/彈性集區Microsoft內建 (區域/地理)沒有 SQL Agent (改用彈性作業)、沒有跨資料庫查詢 (改用彈性查詢)、沒有執行個體層級功能
Azure SQL Managed InstancePaaS 執行個體,接近完整功能面Microsoft內建 + 容錯移轉群組有 SQL Agent、有跨資料庫、沒有 FILESTREAM、有限的追蹤旗標
Azure 虛擬機器上的 SQL (IaaS)本機產品,Microsoft 管理的 VM 擴充功能您 (或自動修補)與本機相同完全控制;SQL IaaS Agent 擴充功能提供附加價值
AWS RDS for SQL Server受管本機產品AWS多可用區 (底層為鏡像/AG)沒有 sa、有限的系統管理員、限制的 xp_cmdshell、無法直接存取作業系統
Google Cloud SQL for SQL Server受管本機產品 (GCP PaaS)Google區域性 HA (主要 + 待命使用區域性持續性磁碟,自動容錯移轉);讀取複本不會容錯移轉沒有系統管理員/超級使用者、無法存取作業系統;受限的系統程序/功能;已啟用 SQL Server Agent (用於複寫/作業);請查閱 Google Cloud 文件以確認目前的功能面

跨領域基礎知識

這些知識適用於所有情況;領域技能則會更深入探討。

首先識別執行個體 (唯讀)

在給出任何與版本或版本類型相關的建議之前,請先確定您連線的是什麼:

-- 唯讀診斷:識別引擎組建、版本類型、平台
SELECT @@VERSION;
SELECT
    SERVERPROPERTY('Edition')             AS Edition,
    SERVERPROPERTY('EngineEdition')       AS EngineEdition,   -- 數字化的平台/版本類型類別 (對應表如下)
    SERVERPROPERTY('ProductMajorVersion') AS MajorVersion,    -- 13=2016 … 17=2025
    SERVERPROPERTY('IsHadrEnabled')       AS IsHadrEnabled;   -- 1 = 已啟用 Always On AG

EngineEdition 值對應表 (告知您平台,而不只是 SKU — 針對新的組建,請至 Microsoft Learn 驗證):

值代表
3本機 Enterprise / Standard / Developer / Evaluation
4Express
5Azure SQL Database (所有服務層級,包括 Hyperscale)
6Azure Synapse Analytics (專用 SQL 集區)
8Azure SQL Managed Instance
9Azure SQL Edge
11Azure Synapse 無伺服器 SQL 集區 (非 Hyperscale)
12Microsoft Fabric SQL 資料庫 (目前的 Microsoft Learn;請根據組建驗證)

儲存引擎基礎知識

  • 頁面 = 8 KB;擴展 = 8 個頁面 (64 KB)。最大資料列大小 8,060 位元組 (LOB/資料列溢位處理其餘部分)。
  • 堆積 (無叢集索引,RID 定位器) vs. 叢集索引 (分葉層即為資料,每個資料表一個)。偏好使用窄、唯一、靜態、永遠遞增的叢集索引鍵。
  • 每個資料庫只有一個交易記錄,由寫入前記錄 (WAL) 管理:沒有「髒」頁面在其記錄檔記錄被保存到磁碟之前寫入磁碟。

復原模式 (一行概要;詳細資訊在 sqlserver-operations 中)

  • 簡單 — 無記錄備份,無時間點還原。僅適用於開發/測試。
  • 完整 — 需要記錄備份,完整的時間點復原。生產環境預設值。
  • 大量記錄 — 最少記錄大量作業;在大量視窗期間時間點還原受限。

隔離等級 (詳細資訊在 sqlserver-engineering 中)

兩個不同的軸 — 請勿混淆:

  • 四個 ANSI 等級 (隔離性遞增,鎖定/封鎖更多):READ UNCOMMITTED → READ COMMITTED (預設) → REPEATABLE READ → SERIALIZABLE。
  • 兩個資料列版本控制選項 (讀取器不會封鎖寫入器;版本保存在 tempdb 中):RCSI (READ_COMMITTED_SNAPSHOT ON — 以陳述式層級版本控制取代 READ COMMITTED,無需變更程式碼) 和 SNAPSHOT (ALLOW_SNAPSHOT_ISOLATION ON — 交易層級一致性,使用 SET TRANSACTION ISOLATION LEVEL SNAPSHOT 選擇加入)。

對於 OLTP 系統,建議使用 RCSI,而非到處散布 NOLOCK。注意:資料列版本控制會為每個修改的資料列增加 14 位元組的版本標籤,並在 tempdb 中建立版本存放區 — 請據此調整大小並將 tempdb 放置在快速的儲存體上。

診斷入口點

從等候統計資料 (sys.dm_os_wait_stats) 開始,以了解 SQL Server 正在等待什麼,然後深入調查熱門查詢 → 封鎖 → 執行計畫 → 設定。完整工作流程在 sqlserver-monitoring 中。

版本類型 (功能閘道)

  • Enterprise — 所有功能,無資源上限 (線上索引建立/重建、無限記憶體、完整 IQP、分割區歷史上為 EE 獨有 (2016 SP1 之前))。
  • Standard — 有上限 (記憶體限制,例如 128 GB 緩衝集區;AG 歷史上僅限於基本/2 節點)。無線上索引作業 — ONLINE = ON 是 Enterprise 專屬 (Developer/Evaluation 也可用;Azure SQL DB/MI 引擎支援此功能),適用於所有本機版本 2016–2025;Standard 從未獲得此功能。在 Standard 上,REBUILD 是離線的 (Sch-M 鎖定會封鎖資料表) — 請預設使用 REORGANIZE 或在已核准的維護時段內排程離線 REBUILD。(可繼續的重建需要 ONLINE = ON,因此在主機上同樣受到 Enterprise 限制;可繼續的索引建立於 2019+ 版本中出現。) 請根據 Microsoft Learn 針對您的組建進行驗證。
  • Developer — Enterprise 功能,僅限非生產環境使用,免費。
  • Express — 免費,小型 (10 GB 資料庫上限,記憶體/核心數有上限),無 SQL Agent。
  • 2016 SP1+ 將許多可程式性功能 (分割區、資料行存放區、In-Memory OLTP) 普及至 Standard/Express。TDE 於 2019 年普及至所有版本。

變更類別標籤與安全慣例 (此外掛程式通用)

此外掛程式會標記每一個非唯讀的 T-SQL 範例,以便代理或使用者永遠不會將生產環境變更誤認為安全查詢。領域技能會在它們的程式碼區塊上套用這些標籤;此路由器是這些分類法的跨領域參考:

標籤涵蓋範圍閘道
-- [CONFIG CHANGE]sp_configure/RECONFIGURE、ALTER DATABASE ... SET、範圍設定、ALTER SERVER CONFIGURATION可執行的教學範例;使用預留位置的資料庫名稱;透過 DB_NAME() 確認目標;註明版本限制
-- [PERFORMANCE CHANGE]查詢存放區強制/解除強制/提示、索引 REBUILD/REORGANIZE/CREATE、UPDATE STATISTICS可執行;僅在已核准的維護時段內執行資料量大的/會封鎖的作業
-- [SCHEMA CHANGE]會封鎖/資料量大的 DDL:ADD ... PERSISTED、WITH CHECK CHECK CONSTRAINT、大型索引 DDL、ADD/DROP COLUMN可執行;維護時段;若有的話,提供狀態復原機制
-- [SECURITY CHANGE]CREATE/ALTER LOGIN|USER|ROLE、GRANT/DENY/REVOKE、ADD SIGNATURE、遮罩、資料列層級安全性、金鑰/憑證可執行;最小權限原則;絕不使用看似真實的機密 — 使用來自密碼管理員的 N'<generate-32+char-random-secret>'
-- [DATA-LOSS RISK]可能遺失已認可的資料或不可逆:FORCE_FAILOVER_ALLOW_DATA_LOSS、FORCE_SERVICE_ALLOW_DATA_LOSS、DBCC ... REPAIR_ALLOW_DATA_LOSS、RESTORE ... WITH REPLACE、QUERY_STORE CLEAR、DROP、Ledger 資料表建立不可執行的 runbook 範本 — 每一行可執行代碼都已被註解掉,真實名稱替換為 [CONFIRM_*] 預留位置,前面附有預檢清單 (驗證角色/狀態;對於容錯移轉,比較 last_hardened_lsn/同步狀態;書面核准;已驗證的備份;暫停應用程式;指定協調/復原負責人)。例外情況:還原教學課程,其課程本身就是還原,則保持可執行,但保留標籤和「WITH REPLACE 會覆寫目標 — 請確認執行個體/資料庫」的注意事項

機密: 絕不提交真實的機密或將其貼到 T-SQL/Shell 歷史記錄中;從密碼管理員取得,並輪換任何曾經從文件中複製的內容。

反模式 (適用於所有領域)

  1. 到處使用 NOLOCK — 讀取未認可/重複/略過的資料列。請改用 RCSI。
  2. 啟用 AUTO_SHRINK — 分散索引、耗用 CPU、檔案重新增長。絕不啟用。
  3. 忽略 tempdb 設定 — 配置頁面競爭。最多每個核心一個檔案,最多 8 個,大小相等。
  4. 未測試的還原 — 未經測試的備份就不是備份。
  5. 應用程式帳戶是 sysadmin/db_owner — 透過角色使用最小權限。
  6. 平行處理的成本臨界值維持在 5 — 過低;從 50 開始。
  7. 像對待本機產品一樣對待雲端 PaaS — 功能差距 (Agent、跨資料庫、追蹤旗標) 因產品而異。

此外掛程式中的領域技能

  • sqlserver-operations — 備份/復原、維護、DBCC、Agent 作業、修補、容量。
  • sqlserver-monitoring — 等候、DMV、查詢存放區、擴展事件、封鎖、死結。
  • sqlserver-ha-clustering — Always On AG、FCI/WSFC、鏡像 + 端點、記錄傳送、複寫、災難復原。
  • sqlserver-engineering — T-SQL、索引、計畫、最佳化、統計資料、分割、結構描述設計。
  • sqlserver-infrastructure

… [翻譯時省略]

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

mianhtsys/landingMod3

Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.

mianhtsys/landingMod3

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.

mianhtsys/landingMod3

Diseña y compara alternativas arquitectónicas trazables a RF/RNF sin implementar código.

mianhtsys/landingMod3

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

mianhtsys/landingMod3

Revisión adversarial de la arquitectura contra RF/RNF, detectando contradicciones, cobertura faltante y complejidad innecesaria.

mianhtsys/landingMod3

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

mianhtsys/landingMod3

>- Generate grounded-and-verified, engine-agnostic database documentation that reaches 100% parity with the real schema. Introspects the LIVE database as ground truth and cross-validates it against ORM models, migrations, generated types, seeds, and application queries, then proves completeness by diffing the docs back against the database. Produces ER diagrams (mermaid), per-table data dictionaries, and a machine-readable schema.json. Works with PostgreSQL, MySQL, SQL Server, and SQLite across any ORM (Prisma, TypeORM, Drizzle, Sequelize, Knex, Django, Rails) or raw SQL. Use when asked to document a database, produce an ERD or data dictionary, write db/schema docs, audit schema drift, or refresh existing DB docs.

mianhtsys/landingMod3

Compara estrategias de persistencia y motores de datos según consistencia, concurrencia, volumen, recuperación y operación.

mianhtsys/landingMod3

Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.

mianhtsys/landingMod3

Consolida análisis especializados en una recomendación arquitectónica, matriz de decisión, ADR y plan de validación.

mianhtsys/landingMod3

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

mianhtsys/landingMod3

Build and maintain web frontends — component architecture, state management, API integration, responsive layout, client-side performance, and frontend testing patterns. Framework agnostic, focused on web frontend implementation. Do not use for backend service implementation, data engineering, or platform infrastructure work.

mianhtsys/landingMod3

Evalúa despliegue, contenedores, escalado, alta disponibilidad, observabilidad, backup, recuperación y CI/CD de forma proporcional.

mianhtsys/landingMod3

Execute read-only SQL queries against multiple Microsoft SQL Server databases. Use when: (1) querying MSSQL/SQL Server databases, (2) exploring database schemas/tables, (3) running SELECT queries for data analysis, (4) checking database contents. Supports multiple database connections with descriptions for intelligent auto-selection. Blocks all write operations (INSERT, UPDATE, DELETE, DROP, etc.) for safety.

mianhtsys/landingMod3

Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, or ensuring API contract compliance.

mianhtsys/landingMod3

PHP 8.0+ development — XAMPP, RESTful APIs, PDO/MySQL/MariaDB, and authentication. Use when building PHP backends, creating API endpoints, configuring XAMPP, or integrating PHP with databases.

mianhtsys/landingMod3

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features

mianhtsys/landingMod3

Analiza requisitos funcionales y no funcionales, reglas, restricciones, capacidad y ambigüedades antes de seleccionar tecnologías.

mianhtsys/landingMod3

Implement modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first breakpoint strategies. Use when building adaptive interfaces, implementing fluid layouts, or creating component-level responsive behavior.

mianhtsys/landingMod3

>- Use when designing or implementing software securely: define security requirements, threat-model a feature, choose secure defaults, design authentication and authorization, handle untrusted data and secrets, evaluate dependencies, design multi-tenant trust boundaries, or review security-sensitive changes. Use for prevention during requirements, design, implementation, and review; not for post-build security assessments or scanning an existing codebase.

相關技能