Custom Prompts
Deprecated
Custom Prompts ถูก deprecated แล้ว OpenAI แนะนำให้ใช้ Skills แทน สำหรับ reusable instructions ที่ Codex สามารถเรียกใช้ได้ทั้งแบบ explicit และ implicit
Custom Prompts คืออะไร
Custom Prompts ช่วยให้คุณแปลงไฟล์ Markdown เป็น reusable prompts ที่เรียกใช้ได้เป็น slash commands ใน Codex CLI และ IDE extension คุณสมบัติหลัก:
- ต้องเรียกใช้แบบ explicit (ไม่ automatic)
- เก็บในเครื่องที่
~/.codex— ไม่สามารถแชร์ข้าม repositories ได้
ขั้นตอนการตั้งค่า
1. สร้าง prompts directory
mkdir -p ~/.codex/prompts
2. สร้างไฟล์ prompt
ตัวอย่างไฟล์ ~/.codex/prompts/draftpr.md:
---
description: Prep a branch, commit, and open a draft PR
argument-hint: [FILES=<paths>] [PR_TITLE="<title>"]
---
Create a branch named `dev/<feature_name>` for this work.
If files are specified, stage them first: $FILES.
Commit the staged changes with a clear message.
Open a draft PR on the same branch. Use $PR_TITLE when supplied; otherwise write a concise summary yourself.
3. Restart Codex
รีสตาร์ท Codex เพื่อโหลด prompt ใหม่
Metadata ที่รองรับ
| Field | คำอธิบาย |
|---|---|
description | แสดงใน command menu |
argument-hint | แสดง parameter ที่คาดหวัง |
ประเภทของ Placeholders
| ประเภท | ไวยากรณ์ | ตัวอย่าง |
|---|---|---|
| Positional | $1 ถึง $9 | $1 สำหรับ argument แรก |
| Named | $VARIABLE_NAME | $FILE หรือ $TICKET_ID |
Literal $ | $$ | ใช้ $$ เพื่อแสดง $ |
Named placeholders ใช้ KEY=value syntax เมื่อเรียกใช้
การเรียกใช้งาน
/prompts:draftpr FILES="src/pages/index.astro" PR_TITLE="Add hero animation"
Codex จะ expand placeholders และส่ง result เป็น message
หมายเหตุการ Migration
สำหรับ shared, reusable instructions ให้ใช้ Skills แทน Custom Prompts เนื่องจาก Skills รองรับ:
- การแชร์ข้าม repositories ได้
- Implicit invocation (Codex เลือกใช้โดยอัตโนมัติ)
- การแจกจ่ายผ่าน plugins
- Directory scope ที่ยืดหยุ่นกว่า