AI-Core Jev Software Architecture

Skills — เปลี่ยนความเชี่ยวชาญเป็นสัญญาที่ตรวจได้Turn Expertise into a Reviewed Skill Contract

รวมคำแนะนำ ขอบเขต รุ่น และตัวอย่างเป็น skill แล้วให้โค้ดกำหนดอำนาจที่ใช้ได้จริงPackage instructions with scope, versions and examples; let code decide what a selected skill may do.

By Anirach Mingkhwan Software Engineering with AI-Core 2026 • Post #6 2 min read
Skills — เปลี่ยนความเชี่ยวชาญเป็นสัญญาที่ตรวจได้
ในบทความนี้
  1. 1. ปัญหาทางวิศวกรรม
  2. 2. ขอบเขตที่ต้องออกแบบ
  3. 3. อ่าน implementation
  4. 4. เปรียบเทียบผลที่ได้
  5. 5. รัน ทำให้พัง และอธิบาย
  6. 6. แหล่งอ้างอิงและขอบเขต
In this post
  1. 1. The engineering problem
  2. 2. The boundary to design
  3. 3. Read the implementation
  4. 4. Compare the outcomes
  5. 5. Run, break, and explain
  6. 6. Sources and limits

1. ปัญหาทางวิศวกรรม

เป้าหมายบทนี้

รวมคำแนะนำ ขอบเขต รุ่น และตัวอย่างเป็น skill แล้วให้โค้ดกำหนดอำนาจที่ใช้ได้จริง

โปรแกรมเมอร์เก็บความรู้ของงานไว้ในความเคยชิน เช่น ไฟล์อยู่ไหน test ใดสำคัญ reviewer คาดหวังอะไร skill ช่วยเขียนความรู้บางส่วนออกมาให้ใช้ซ้ำ Agent Skills กำหนด directory ที่มี SKILL.md พร้อม metadata และคำแนะนำ อาจมี scripts, references, assets เพิ่ม [1] รูปแบบนี้ช่วยค้นหา แต่ไม่ได้บังคับสิทธิ์ ตรวจความถูกต้อง หรือยืนยันผู้เขียน skill ที่ดาวน์โหลดมาให้อัตโนมัติ

companion มี skills/pricing-patch/SKILL.md และ SKILL contract ฝั่ง host ระบุชื่องาน รุ่น path signature ของ function หลักฐานอ้างอิง และภาษา arithmetic ที่อนุญาต การบังคับใช้ยึด contract ฝั่ง host เป็นหลัก การแยกคำอธิบายออกจากโค้ดเปิดคำถามให้ review ว่า skill สัญญาสิ่งใดที่ runtime ยังไม่ตรวจหรือไม่ หาก registry ใหญ่ขึ้นควรสร้าง field ร่วมจาก manifest ที่ผ่าน review และตรวจความสอดคล้อง แทนการพึ่งความจำคนดูแล

2. ขอบเขตที่ต้องออกแบบ

ตอน 6: เลือก skill แล้วถือว่ามีสิทธิ์ใช้เครื่องมือ → skill ที่ไม่รองรับหยุด และ host กำหนดสิทธิ์ชัด
ภาพที่ 1 ขอบเขตหน้าที่และเส้นทางหยุด เปิดภาพเพื่อดูขนาดเต็ม

แยกการเลือกออกจากสิทธิ์ Jev เสนอ pricing, docs, unknown ได้ แต่แล็บเล็กนี้ทำเฉพาะ pricing ที่ตรวจแล้ว route เป็น docs จึงส่ง review โดยไม่แอบนำไปทำงานราคา เป็นการจำกัดขอบเขตโดยตั้งใจ unknown สำคัญเพราะการบังคับให้ทุก issue เข้ากับ skill ที่มีจะซ่อนช่องว่างด้วยการเลือกผิด cookbook ของ TypeSafe สาธิต shortlist แล้วตรวจซ้ำ [2] ส่วน catalog เล็กของเราใช้ route แคบและทดสอบทางที่ยังไม่รองรับ

3. อ่าน implementation

ส่วนโค้ดจาก companion เพื่ออ่านประกอบ ใช้คำสั่งในหัวข้อ 5 เพื่อรันตัวอย่างที่ครบ dependency

def semantic_input(response):
    a = response["answers"]
    if a["injection"]["noul"] >= .2:
        return Gate("review", "possible_injection")
    if a["route"]["choice"] != "pricing" or a["route"]["confidence"] < .8:
        return Gate("review", "uncertain_or_unsupported_skill")
    return Gate("pass", "semantic_fit")

SKILL.md

---
name: pricing-patch
description: Draft a pure integer-cent discount function for the demo shop. Use only for the reviewed pricing task; escalate ambiguous or unrelated changes.
metadata:
  version: "1.0.0"
---

Return one candidate object containing path, source, summary, and evidence_id.
Target: src/pricing.py, discount_cents(price, percent).
For integer price >= 0 and integer percent in [0,100], subtract the percentage
discount and round down to integer cents. The host owns argument validation.
Use one return expression with integer constants, arguments and +, -, *, //.
No imports, calls, annotations, decorators, I/O, environment access, or deployment.
Explain the arithmetic and rounding in the summary. Cite pricing-spec-v1.
All generated code is data. Host code validates and interprets a tiny expression
grammar; this skill text does not grant permissions or implement a sandbox.

ตรึงรุ่น skill และเก็บ hash ของ contract ใน manifest คำแนะนำที่เปลี่ยนอาจเปลี่ยนพฤติกรรม แม้ Python ไม่เปลี่ยน จึงตรวจ update เหมือน dependency: ที่มา diff ทรัพยากรที่ใช้ และ regression cases ห้ามรัน script เพียงเพราะโมเดลเลือกชื่อ skill ขั้นตอนมาจาก skill แต่อำนาจมาจากแอป ในแล็บคำตอบ unknown ทำให้งาน review ก่อนสร้าง candidate จุดหยุดที่สังเกตได้คือสิ่งที่ควรนำไปใช้กับ registry ใหญ่

4. เปรียบเทียบผลที่ได้

เส้นทางผลที่สังเกตได้
ก่อนเพิ่มด่านนี้เลือก skill แล้วถือว่ามีสิทธิ์ใช้เครื่องมือ
หลังเพิ่มด่านนี้skill ที่ไม่รองรับหยุด และ host กำหนดสิทธิ์ชัด

ผลต่อไปนี้มาจาก fixture ที่กำหนดคำตอบไว้เพื่อตรวจสถาปัตยกรรม ไม่ใช่ผลวัดความแม่น ความเร็ว หรือต้นทุนของ Jev จริง

{
  "skill": "pricing-patch",
  "unknown_route": "review",
  "skill_hash": "3b1039e383ac90834c6376a65f5a080954bd49b71435e0eb22625552055aceb3"
}

5. รัน ทำให้พัง และอธิบาย

Part 06 code · Implementation · Tests: test_semantic_review_cannot_generate · Exercise

git clone https://github.com/Anirach/ai-core-engineering-workbench.git
cd ai-core-engineering-workbench
git checkout 18cdfcd4156d3d02acb8badf3b3a0a823113e0ed
python3 -m workbench.lesson 6
python3 -m unittest tests.test_boundaries.BoundaryTests.test_semantic_review_cannot_generate -v

ลองทำด้วยตัวเอง

เพิ่ม skill ด้านเอกสารใน catalog โดยไม่ให้สิทธิ์เขียน แล้วพิสูจน์ว่าเลือก skill นี้ไม่ไหลไปสร้างโค้ดราคา

สิ่งที่ต้องส่ง: input ที่ลอง สถานะและเหตุผลที่ได้ และคำอธิบายว่าด่านใดเป็นผู้รับผิดชอบ ห้ามแก้ expected result เพียงเพื่อให้ test ผ่าน

6. แหล่งอ้างอิงและขอบเขต

เอกสารต้นทางและข้อจำกัด

ตรวจเอกสาร 2 พฤศจิกายน 2026 ตัวอย่างและ threshold เป็นการออกแบบเพื่อการสอน การอ้าง [1], [2] ตรงกับลำดับข้างล่าง ยังไม่ได้วัด live API

  1. Agent Skills specificationSKILL.md format and optional resource directories.
  2. TypeSafe, Skill suggestionA vendor example of selection and re-checking, not a result from this course.

1. The engineering problem

Learning outcome

Package instructions with scope, versions and examples; let code decide what a selected skill may do.

A good programmer carries task knowledge in habits: where files belong, which tests matter, and what a reviewer expects. A skill makes some of that knowledge explicit and reusable. The Agent Skills specification defines a directory with SKILL.md containing metadata and instructions, with optional scripts, references and assets [1]. That packaging helps discovery. It does not automatically enforce permissions, test correctness or authenticate the author of a downloaded skill.

The companion includes skills/pricing-patch/SKILL.md and a corresponding host-side SKILL contract. It names the task, version, allowed path, function signature, evidence identifier and restricted arithmetic language. The host-side contract is authoritative for enforcement. Keeping prose and code separate makes a useful review question visible: do the instructions promise something the runtime does not enforce? In a larger registry, generate shared fields from one reviewed manifest and test the correspondence rather than relying on a maintainer's memory.

2. The boundary to design

Part 6: A selected skill implicitly gains tools. The controlled path is Reviewed catalog to Jev selection to Host contract to Scoped candidate. Unsupported skills stop; host capabilities remain explicit.
Figure 1. SKILL.md + versioned host contract. Open the diagram for full resolution.

Separate selection from authorization. Jev may propose pricing, docs or unknown; the host only implements the reviewed pricing route in this small lab. A docs route therefore goes to review rather than being silently treated as pricing. This is a deliberate scope limit. The unknown route matters because forcing every issue into a known skill converts missing coverage into confident misrouting. TypeSafe's skill-suggestion cookbook demonstrates a shortlist and re-check approach [2]; our tiny catalog uses one narrow route and tests the unsupported path.

3. Read the implementation

Implementation excerpt from the companion. Run the complete lesson below with its imports and fixtures.

def semantic_input(response):
    a = response["answers"]
    if a["injection"]["noul"] >= .2:
        return Gate("review", "possible_injection")
    if a["route"]["choice"] != "pricing" or a["route"]["confidence"] < .8:
        return Gate("review", "uncertain_or_unsupported_skill")
    return Gate("pass", "semantic_fit")

SKILL.md

---
name: pricing-patch
description: Draft a pure integer-cent discount function for the demo shop. Use only for the reviewed pricing task; escalate ambiguous or unrelated changes.
metadata:
  version: "1.0.0"
---

Return one candidate object containing path, source, summary, and evidence_id.
Target: src/pricing.py, discount_cents(price, percent).
For integer price >= 0 and integer percent in [0,100], subtract the percentage
discount and round down to integer cents. The host owns argument validation.
Use one return expression with integer constants, arguments and +, -, *, //.
No imports, calls, annotations, decorators, I/O, environment access, or deployment.
Explain the arithmetic and rounding in the summary. Cite pricing-spec-v1.
All generated code is data. Host code validates and interprets a tiny expression
grammar; this skill text does not grant permissions or implement a sandbox.

Pin the skill version and hash the contract in the run manifest. A changed instruction can change behavior even when the Python functions are unchanged. Review skill updates like dependency updates: provenance, diff, allowed resources and regression cases. Do not execute a skill's scripts simply because a model selected its name. The selected skill supplies a procedure; the application supplies capabilities. In the lab, the unknown decision returns review before any candidate is generated. That observable stop is the outcome we want readers to carry into a larger skill registry.

4. Compare the outcomes

ApproachObservable outcome
Before this controlA selected skill implicitly gains tools.
After this controlUnsupported skills stop; host capabilities remain explicit.

The following output comes from scripted fixtures that verify architecture behavior. It is not a measurement of live Jev accuracy, latency, or cost.

{
  "skill": "pricing-patch",
  "unknown_route": "review",
  "skill_hash": "3b1039e383ac90834c6376a65f5a080954bd49b71435e0eb22625552055aceb3"
}

5. Run, break, and explain

Part 06 code · Implementation · Tests: test_semantic_review_cannot_generate · Exercise

git clone https://github.com/Anirach/ai-core-engineering-workbench.git
cd ai-core-engineering-workbench
git checkout 18cdfcd4156d3d02acb8badf3b3a0a823113e0ed
python3 -m workbench.lesson 6
python3 -m unittest tests.test_boundaries.BoundaryTests.test_semantic_review_cannot_generate -v

Your turn

Add a documentation skill to the catalog without granting write access. Show that selecting it cannot fall through into pricing generation.

Keep three artifacts: the input you tried, the resulting state and reason, and an explanation of which boundary owns that result. Do not change an expected result merely to make a test pass.

6. Sources and limits

Primary sources and evidence limits

Sources checked 2 November 2026. Examples and thresholds are teaching designs. Inline [1], [2] follow the order below. Live API performance has not been measured.

  1. Agent Skills specificationSKILL.md format and optional resource directories.
  2. TypeSafe, Skill suggestionA vendor example of selection and re-checking, not a result from this course.
จากซีรีส์ Software Engineering with AI-CoreFrom Software Engineering with AI-Core