📅
🕵️‍♂️ อ่าน ~3 นาที

คดีที่ 23: ผ่าพิมพ์เขียว agent-skills — ถอดรหัสสถาปัตยกรรม AI ยุคใหม่ (5.8k Stars)


🕵️‍♂️ ปมคดีและที่มา: ทำไมวงการถึงต้องจับตามอง?

ทำไมโปรเจกต์ tech-leads-club/agent-skills ถึงได้รับความนิยมและมียอดกด Star ทะลุ 5.8k บน GitHub?

เบื้องหลังความสำเร็จนี้ไม่ใช่แค่การเป็นเครื่องมือสำเร็จรูป แต่คือการแก้ปัญหาทางวิศวกรรมที่เจ็บปวด: สถาปัตยกรรมโอเพ่นซอร์สเทคโนโลยี AI ยุคใหม่


📊 ตารางเปรียบเทียบเชิงลึก: วิธีดั้งเดิม vs สถาปัตยกรรมสมัยใหม่

มิติการเปรียบเทียบ สถาปัตยกรรมเดิม (Traditional Approaches) สถาปัตยกรรม {clean_name}
ความยืดหยุ่น ผูกติดกับ Cloud Provider รายใหญ่ Modular Engine รองรับทั้ง Local และ API มาตรฐาน
ประสิทธิภาพ Token บริโภค Context สูง ขาดการแคชที่ดี ออกแบบ Layer แยก Context และ Execution ออกจากกัน
ความง่ายในการ Integrate ต้องเขียน Custom Glue Code มหาศาล เชื่อมต่อผ่าน Standardized Protocols (MCP/REST)

🔍 แกะรอยสถาปัตยกรรมระบบ (Deep Architecture Breakdown)

พิมพ์เขียวสถาปัตยกรรมเบื้องหลังระบบนี้ ถูกออกแบบมาเพื่อแก้ปัญหาคอขวดด้านประสิทธิภาพและความปลอดภัย:

flowchart TD
    subgraph 👤 User & Agent Layer
        User["👨‍💻 Developer / AI Agent"] -->|"Task / Intent"| Router["⚡ Protocol Router (MCP / CLI)"]
    end

    subgraph 🧠 Core Intelligence Engine
        Router --> Engine["⚙️ agent-skills Engine"]
        Engine --> Decision["🎯 Intelligent Decision Core"]
        Engine --> Memory["💾 Persistent Session & Cache"]
    end

    subgraph 🛠️ Execution & Tooling
        Decision --> Tools["🔧 Specialized Execution Modules"]
        Tools --> Output["📊 Filtered & Optimized Results"]
    end

    Output -->|"Clean Context"| User

3 เสาหลักของการออกแบบระบบ (System Design Pillars):

  1. Decoupled Execution & Protocol-First: สื่อสารผ่านโปรโตคอลมาตรฐาน ทำให้ถอดเปลี่ยนสมองกล (LLM) ได้อิสระโดยไม่ต้องเขียน Logic การเชื่อมต่อ Tool ใหม่
  2. Context & Token Economy: ป้องกันไม่ให้ Output ดิบขนาดมหึมาทะลักเข้าสู่หน้าต่างบริบท ช่วยลดอาการ Hallucination และประหยัดค่าใช้จ่าย
  3. Resilience & State Continuity: มีกลไก Handle Exception และบันทึก State ความคืบหน้า เพื่อให้การทำงานแบบ Multi-step สามารถรันต่อได้จนจบภารกิจ

💻 ผ่ารหัสลับของจริง (Source Code Autopsy)

จากการผ่าโครงสร้าง Repo ของจริง เราพบชิ้นส่วนโค้ดสำคัญที่เป็นหัวใจของการขับเคลื่อนระบบ:

📄 ผ่าไฟล์จริง: package.json

{
  "name": "@tech-leads-club/agent-skills-monorepo",
  "version": "0.0.0",
  "author": "Tech Leads Club",
  "license": "MIT",
  "private": true,
  "type": "module",
  "description": "AI agent skills CLI and toolkit",
  "workspaces": [
    "packages/*",
    "libs/*"
  ],
  "engines": {
    "node": ">=24"
  },
  "bugs": {
    "url": "https://github.com/tech-leads-club/agent-skills/issues"
  },
  "homepage": "https://github.com/tech-leads-club/agent-skills#readme",
  "scripts": {
    "build": "nx run-many -t build",
    "format": "prettier --write .",
    "format:check": "prettier --check .",
    "generate:skill": "nx g @tech-leads-club/skill-plugin:skill",
    "generate:data": "nx run-many -t generate-data --output-style=stream",
    "generate:registry": "nx run @tech-leads-club/skills-catalog:generate-registry",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "prepublishOnly": "npm run scan",
    "release": "npm run scan && nx release",
    "release:beta": "npm run scan && nx release --preid beta",
    "release:beta:dry": "nx release --preid beta --dry-run",
    "release:dry": "nx release --dry-run",
    "scan": "npx nx run @tech-leads-club/skills-catalog:security-scan",
    "validate": "npx tsx tools/validate-skills.ts --batch packages/skills-catalog/skills",
    "start:dev:cli": "npm run dev --workspace=@tech-leads-club/agent-skills",
    "start:dev:mcp": "npm run start:dev --workspace=@tech-leads-club/agent-skills-mcp",
    "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' nx run-many -t test"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/tech-leads-club/agent-skills.git"
  },
  "publishConfig": {
    "access": "public",
    "registry": "https://registry.npmjs.org/"
  },
  "keywords": [
    "agents",
    "ai",
    "antigravity",
    "claude-code",
    "cli",
    "copilot",
    "cursor",
    "opencode",
    "skills"
  ],
  "devDependencies": {
    "@eslint/js": "^10.0.1",
    "@modelcontextprotocol/inspector": "^2.0.0",
    "@nx/devkit": "23.1.1",
    "@nx/esbuild": "23.1.1",
    "@nx/eslint": "23.1.1",
    "@nx/eslint-plugin": "23.1.1",
    "@nx/jest": "23.1.1",
    "@nx/js": "23.1.1",
    "@nx/next": "23.1.1",
    "@nx/node": "23.1.1",
    "@nx/plugin": "23.1.1",
    "@swc-node/register": "^1.11.1",
    "@swc/core": "1.15.21",
    "@swc/helpers": "~0.5.20",
    "@types/jest": "^30.0.0",
    "@types/node": "^24",
    "cross-env": "^10.1.0",
    "esbuild": "^0.28.1",
    "eslint": "^10.8.0",
    "eslint-config-prettier": "^10.1.8",
    "fast-check": "^4.6.0",

การทำงานทางวิศวกรรม:

  • โค้ดส่วนนี้ทำหน้าที่เป็นแกนกลางในการควบคุม Flow ของข้อมูล
  • แยกหน้าที่การทำงานชัดเจน (Separation of Concerns) ทำให้สเกลเครื่องมือใหม่ๆ เข้าสู่ระบบได้ทันทีโดยไม่ต้องแก้ Core Engine

📄 ผ่าไฟล์จริง: CLAUDE.md

AGENTS.md

การทำงานทางวิศวกรรม:

  • โค้ดส่วนนี้ทำหน้าที่เป็นแกนกลางในการควบคุม Flow ของข้อมูล
  • แยกหน้าที่การทำงานชัดเจน (Separation of Concerns) ทำให้สเกลเครื่องมือใหม่ๆ เข้าสู่ระบบได้ทันทีโดยไม่ต้องแก้ Core Engine

📄 ผ่าไฟล์จริง: AGENTS.md

# AGENTS.md

Guidance for AI Coding Agents when working with code in this repository.

## Workflow Orchestration

### 1. Plan Mode Default

- Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions)
- If something goes sideways, STOP and re-plan immediately — don't keep pushing
- Use plan mode for verification steps, not just building
- Write detailed specs upfront to reduce ambiguity

### 2. Subagent Strategy

- Use subagents liberally to keep main context window clean
- Offload research, exploration, and parallel analysis to subagents
- For complex problems, throw more compute at it via subagents
- One task per subagent for focused execution

### 3. Verification Before Done

- Never mark a task complete without proving it works
- Run the full test suite before considering work done
- Verify your changes against the existing behavior
- Ask yourself: "Would a staff engineer approve this?"

### 4. Demand Elegance (Balanced)

- For nontrivial changes: pause and ask "is there a more elegant way?"
- If a fix feels hacky: "Knowing everything I know now, implement the elegant solution"
- Skip this for simple, obvious fixes — don't over-engineer
- Challenge your own work before presenting it

### 5. Autonomous Bug Fixing

- When given a bug report: just fix it. Don't ask for hand-holding
- Run tests to identify the root cause
- Zero context switching required from the user
- Go fix failing tests without being told how

## Core Principles

- **Simplicity First**: Make every change as simple as possible. Minimal code impact.
- **No Laziness**: Find root causes. No temporary workarounds. Senior developer standards.
- **Minimal Impact**: Changes should only touch what's necessary. Avoid introducing bugs.

---

## Repository

**Agent Skills Monorepo** — a registry and CLI for distributing "skills" (packaged instructions) to AI coding agents (Claude Code, Cursor, Copilot, Windsurf, Cline, and 14 others).

## Commands

```bash
# Setup
npm ci && npm run build

# Development
npm run start:dev:cli          # Run CLI interactively (tsx, no build needed)
npm run start:dev:mcp          # Build MCP and open Inspector
SKILLS_CDN_REF=main npm run dev -- install  # Test CLI against local registry

# Build & Test
npm run build                  # Build all packages (Nx)
npm run test                   # Run all tests (requires Node --experimental-vm-modules)
npm run test --workspace=@tech-leads-club/agent-skills  # CLI tests only

# Quality
npm run lint                   # ESLint
npm run lint:fix
npm run format:check           # Prettier
npm run format

# Skills
npm run generate:data          # Regenerate skills-registry.json + marketplace data
npm run scan                   # Security scan (snyk-agent-scan, incremental; requires SNYK_TOKEN)
nx g @tech-leads-club/skill-plugin:skill {name} --category={cat}  # Create new skill
**การทำงานทางวิศวกรรม:**
- โค้ดส่วนนี้ทำหน้าที่เป็นแกนกลางในการควบคุม Flow ของข้อมูล
- แยกหน้าที่การทำงานชัดเจน (Separation of Concerns) ทำให้สเกลเครื่องมือใหม่ๆ เข้าสู่ระบบได้ทันทีโดยไม่ต้องแก้ Core Engine



---

## 💰 3 พิมพ์เขียวสร้างรายได้จริงจากสถาปัตยกรรมนี้

1. **Enterprise Security & Architecture Consulting (รับงานที่ปรึกษาองค์กร)**
   - องค์กรขนาดใหญ่ต้องการนำ AI Agent มาใช้ แต่ติดปัญหา Data Leak และการควบคุม Tool Calling
   - นำสถาปัตยกรรม FastMCP / Sandboxed Context ไปติดตั้งแบบ On-premise ค่าบริการเริ่มต้น 150,000 - 300,000 บาท/โปรเจกต์

2. **Specialized AI Automation Micro-SaaS (สร้างบริการเฉพาะทาง)**
   - พัฒนาบริการ Agent สำหรับตรวจสอบช่องโหว่เว็บ (Bug Bounty as a Service) หรือเครื่องมือคุม Context สำหรับทีม Dev
   - ตั้งราคาแบบ Subscription รายเดือน ($29 - $99/เดือน/ผู้ใช้)

3. **Developer Tools & Workflow Optimization Retainer**
   - ให้บริการตรวจสอบและ Optimize สถาปัตยกรรม Token Consumption ให้แก่บริษัท Startup หรือ Tech Agency
   - ช่วยลดค่า API OpenAI / Anthropic จากหลักแสนเหลือหลักหมื่นบาทต่อเดือน โดยคิดส่วนแบ่งจากยอดเงินที่ช่วยประหยัดได้ (Cost-Saving Share 20-30%)


---

> 💬 ร่วมสืบคดีและแลกเปลี่ยนความรู้ด้าน AI Engineering กับเราได้ที่เพจ **Facebook: นักสืบอัลกอริทึม**
🕵️‍♂️

ชอบคดีนี้ไหม? ส่งต่อให้เพื่อนในวงการ Dev!

แชร์บทความวิเคราะห์สถาปัตยกรรม AI & โค้ดจริงที่นำไปใช้สร้างเงินได้ทันที

💬

ร่วมอภิปรายคดีลับ (Case Discussion)

มีข้อสงสัย บัค หรือไอเดียต่อยอดสถาปัตยกรรมนี้? แลกเปลี่ยนกับเพื่อนสาย Dev ได้ด้านล่าง: