Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Spec-Driven Development with spec-kit

Spec-Kit (GitHub Spec Kit) คือ Framework สำหรับเขียนสเปก (Specification) แบบเป็นระบบ เพื่อใช้เป็น “ตัวกลาง” ระหว่าง

👉 การวางแผนงาน (Planning)

👉 ทีม Dev เขียนโค้ดจริง (Implementation)

👉 AI Agents เช่น GitHub Copilot / Cursor / ChatGPT

มันเป็นเครื่องมือที่ทำให้ทีมสามารถ ออกแบบงาน – แตกสเปก – ทำ task – แล้วให้ AI สร้างโค้ดตามแผน ได้อย่างเป็นมาตรฐาน

GitHub Spec Kit.

✅ สรุปแบบเข้าใจง่าย

Spec-Kit = Template + Convention + Tools ที่ช่วยให้คุณเขียนเอกสารสเปกได้เป็นระบบ เช่น:

  • spec.md → ระบุ Goal, Context, Constraints
  • plan.md → แผนงานและ Component Design
  • tasks.md → TO-DO แบบละเอียดสำหรับให้ AI ใช้สร้างโค้ดจริง
  • context/ → เก็บ Business Context / API Contract
  • models/ → เก็บ Data Model / DTO
  • providers/ → กำหนดว่าต้องใช้ AI ไหนในการ generate อะไร

สุดท้ายคุณสามารถรัน

spec validate
spec plan
spec code
spec tasks

เพื่อให้ Spec-Kit ช่วยจัดโครงสร้างโปรเจกต์ + สร้างโค้ดตามสเปกโดยอัตโนมัติ

🎯 Spec-Kit ถูกสร้างขึ้นเพื่อแก้ปัญหาอะไร?

1) ทุกคนเขียนสเปกไม่เหมือนกัน

Spec-Kit บังคับรูปแบบ → ทำให้สเปกอ่านง่ายและเป็นมาตรฐาน

2) AI เขียนโค้ดเกินสcope

Spec-Kit → จำกัด Scope และบริบทที่ AI จะใช้ → ได้โค้ดตรงสเปก ไม่เพี้ยน

3) การ Generate Code จาก AI ไม่คงที่

Spec-Kit → ให้ Framework ช่วยให้ผลลัพธ์สม่ำเสมอ

GitHub Spec Kit Get Started

🧩 ส่วนประกอบหลัก (สำคัญมาก)

Folder ตัวอย่าง:

my-project/
  spec.md
  plan.md
  tasks.md
  context/
    business.md
  models/
    product.json
  providers/
    openai.yaml

รายละเอียด:

ไฟล์ หน้าที่
spec.md เป้าหมาย, ขอบเขต, ความต้องการ
plan.md สถาปัตยกรรม, Flow, Diagram
tasks.md Job list / task list ให้ AI เขียนตาม
context/ Business Context, API Contract
models/ Data Model, JSON Schema
providers/ ชี้ว่าใช้ AI อะไร run code (OpenAI / local / etc.)

💡 Spec-Kit ใช้ทำอะไรได้?

✔ ออกแบบระบบ (Architecture Design)

✔ ออกแบบ Clean Architecture

✔ ออกแบบ API (Backend / Frontend)

✔ ใช้สร้างโค้ด (Generate code)

✔ ควบคุมการทำงานของ AI ให้เป็นมาตรฐาน

เหมาะมากสำหรับ:

  • CRUD App (Product / Todo)
  • Microservice
  • Next.js + WebAPI
  • Clean Architecture
  • Dapper / EF Core
  • DevOps Pipeline

💻 ตัวอย่างคำสั่งที่ใช้จริง

pip install spec-kit
spec init      # เริ่มโปรเจกต์ใหม่
spec plan      # สร้าง plan.md
spec tasks     # แตกงาน task ละเอียด
spec code      # generate โค้ดตามสเปก

🔥 ตัวอย่าง spec.md (ย่อ)

# Product CRUD System

## Goal
สร้างระบบ CRUD Product ด้วย Next.js + C# WebAPI + MSSQL

## Requirements
- ProductUI: Next.js 15
- ProductAPI: .NET 8 WebAPI + Dapper
- MSSQL LocalDB

## Constraints
- ใช้ Clean Architecture
- Pagination ใน UI

About

Spec-Driven Development with spec-kit

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors