Automated summary
Enforces this project's coding conventions: complete docstrings (Description / Args / Returns) on every PHP and JavaScript function, no inline scripts in HTML, and sql/update.sql kept in sync with any database change.
Strengths
- Ships copy-ready PHPDoc and JSDoc templates plus explicit wrong-example snippets showing what is rejected
- States a firm no-inline-script rule while naming the single allowed exception (injecting config constants from PHP)
- Covers a third rule that is easy to miss: updating sql/update.sql whenever the schema changes
- Defines clear trigger conditions: writing functions, adding code, reviewing code, or asking about project style
Limitations
- Rules are tightly bound to this project's layout (assets/js/, sql/update.sql) and do not transfer unchanged to other repos
- No lint configuration or CI enforcement is included, so compliance depends entirely on the model following the text
- Comment language and expected level of detail are not explicitly specified
Use it whenever you write, modify, or review PHP or JavaScript code in this project and need the output to match its conventions.
Avoid it for other languages, other repositories, or projects that do not follow these docstring and separate-script conventions.
Security analysis
SafeThe skill contains only coding-standard guidance for PHP/JavaScript documentation, inline script avoidance, and HTML number-input conventions. It does not instruct destructive commands, secret exfiltration, network calls, obfuscated payloads, or safety-disabling behavior, and no tools are declared.
No concerns found
How this analysis is madeExamples
Write a PHP function getSparePartsByMachine(int $machineId, int $limit = 50) that returns the remaining spare parts for a machine, ordered by quantity ascending. Follow our coding standards.Review assets/js/repair_form.js and the repair form PHP template against our coding standards — check docstrings and flag any inline script.Add a save button to the repair form page that POSTs to /api/save_repair.php, using our project coding standards.name: coding-standards description: บังคับใช้มาตรฐานการเขียนโค้ดของโปรเจกต์นี้ ทุกฟังก์ชัน (PHP และ JavaScript) ต้องมี Docstring ครบถ้วน (Description / Args / Returns) และห้ามเขียน inline script ใน HTML ทุกกรณี Trigger เมื่อผู้ใช้ขอเขียนฟังก์ชัน, เพิ่มโค้ด, review โค้ด หรือถามเรื่อง coding style ของโปรเจกต์นี้
Coding Standards
กฎบังคับ 3 ข้อ
- ทุกฟังก์ชันต้องมี Docstring ครบ 3 ส่วน: Description · Args · Returns
- ห้ามเขียน inline script ใน HTML โดยเด็ดขาด
- หากมีการอัปเดตฐานข้อมูล ที่เกี่ยวข้อง ต้องอัปเดตไฟล์
sql/update.sqlด้วย
1. Docstring Standard
PHP — PHPDoc
ทุก function และ method ต้องมี PHPDoc block เหนือ declaration เสมอ
/**
* [Description] อธิบายหน้าที่ของฟังก์ชันนี้ในหนึ่งบรรทัดหรือมากกว่า
* ถ้ามีพฤติกรรมพิเศษหรือ side effect ให้อธิบายต่อในบรรทัดถัดไป
*
* @param type $paramName คำอธิบาย parameter นี้
* @param type $paramName2 คำอธิบาย parameter นี้
*
* @return type คำอธิบายค่าที่คืนกลับ; ถ้าไม่คืนค่าให้ระบุ void
*/
function myFunction(type $paramName, type $paramName2): type
{
// ...
}
ตัวอย่างที่ถูกต้อง:
/**
* ดึงรายการชิ้นส่วนอะไหล่ที่เหลืออยู่ทั้งหมดสำหรับเครื่องจักรที่กำหนด
* เรียงตามจำนวนคงเหลือจากน้อยไปมาก
*
* @param int $machineId รหัสเครื่องจักรที่ต้องการ
* @param int $limit จำนวนแถวสูงสุดที่ต้องการ (default 50)
*
* @return array array ของ associative array แต่ละแถวมีคีย์ part_id, part_name, qty
*/
function getSparePartsByMachine(int $machineId, int $limit = 50): array
{
// ...
}
ตัวอย่างที่ผิด (ห้ามทำ):
// ❌ ไม่มี docstring เลย
function getSparePartsByMachine(int $machineId): array
{
// ...
}
// ❌ มีแค่ชื่อ ไม่มี @param / @return
/**
* get spare parts
*/
function getSparePartsByMachine(int $machineId): array
{
// ...
}
JavaScript — JSDoc
ทุก function declaration, function expression, และ arrow function ที่ export หรือใช้งานข้ามไฟล์ต้องมี JSDoc block
/**
* [Description] อธิบายหน้าที่ของฟังก์ชันนี้
*
* @param {type} paramName คำอธิบาย parameter
* @param {type} paramName2 คำอธิบาย parameter
*
* @returns {type} คำอธิบายค่าที่คืนกลับ; ถ้าไม่คืนค่าให้ระบุ {void}
*/
function myFunction(paramName, paramName2) {
// ...
}
ตัวอย่างที่ถูกต้อง:
/**
* คำนวณ OEE (Overall Equipment Effectiveness) จากข้อมูล KPI ที่รับเข้ามา
* ผลลัพธ์จะอยู่ในช่วง 0–100 (หน่วยเป็น %)
*
* @param {number} availability อัตราความพร้อมใช้งาน (0–1)
* @param {number} performance อัตราประสิทธิภาพการผลิต (0–1)
* @param {number} quality อัตราคุณภาพ (0–1)
*
* @returns {number} ค่า OEE เป็น % ปัดทศนิยม 2 ตำแหน่ง
*/
function calculateOEE(availability, performance, quality) {
return parseFloat((availability * performance * quality * 100).toFixed(2));
}
2. No Inline Script
กฎ
- ห้าม
<script>tag ภายใน.php/.htmlfile ที่มีเนื้อหา JavaScript โดยตรง - JavaScript ทั้งหมดต้องอยู่ใน ไฟล์
.jsแยกต่างหาก ใต้assets/js/ - ยกเว้นกรณีที่จำเป็นต้อง inject ตัวแปร config จาก PHP ลง JS (เช่น
const BASE_URL = "<?= $url ?>";) — แต่ต้องจำกัดไว้แค่constdeclarations เท่านั้น ห้ามมีตรรกะหรือฟังก์ชันใดๆ ใน inline script - โหลดด้วย
<script src="...">เท่านั้น
ผิด — ห้ามทำ
<!-- ❌ inline script ใน PHP file -->
<button id="btnSave">Save</button>
<script>
document.getElementById('btnSave').addEventListener('click', function () {
fetch('/api/save_repair.php', { method: 'POST' });
});
</script>
ถูก — วิธีที่ถูกต้อง
<!-- ✅ โหลด JS จากไฟล์แยก -->
<button id="btnSave">Save</button>
<script src="../assets/js/repair_form.js"></script>
// assets/js/repair_form.js
/**
* ผูก event listener ให้ปุ่ม Save บนฟอร์มซ่อมบำรุง
* เรียกใช้ครั้งเดียวเมื่อ DOM พร้อม
*
* @param {string} apiUrl URL ของ endpoint ที่จะ POST ข้อมูลไป
*
* @returns {void}
*/
function initSaveButton(apiUrl) {
document.getElementById('btnSave').addEventListener('click', function () {
fetch(apiUrl, { method: 'POST' });
});
}
ข้อยกเว้นที่อนุญาต
| สิ่งที่อนุญาต | เหตุผล |
|---|---|
| <script src="..."> | โหลดไฟล์ภายนอก ไม่ใช่ inline |
| ตัวแปร config ที่ PHP inject ลงไป เช่น <script>const BASE_URL = "<?= $url ?>";</script> | ข้อมูล server-side ที่จำเป็นต้อง inject ณ runtime — ต้องจำกัดไว้แค่ const declarations เท่านั้น ห้ามมีตรรกะ |
3. UI Conventions — ช่องกรอกตัวเลข (number input)
กฎ
<input type="number">ทุกช่อง ให้ตั้งstep="1"(จำนวนเต็ม) เป็นค่าเริ่มต้น ทั้งจำนวนอะไหล่, ชั่วโมงงาน, ดาวน์ไทม์, เลขมิเตอร์ ฯลฯ ห้ามใช้step="any"/step="0.001"/step="0.25"เว้นแต่มีเหตุผลชัดเจนและระบุกำกับไว้- การ แสดงผล จำนวน ให้ตัด trailing zero ทิ้ง (เช่น
2.000 → 2,2.50 → 2.5)- JS: ใช้ helper
fmt()(toLocaleStringแบบmaximumFractionDigits:3ไม่มี min) - SQL:
TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM <col>))
- JS: ใช้ helper
ผิด — ห้ามทำ
<input type="number" id="qty" step="0.001">
<input type="number" id="hours" step="0.25">
ถูก
<input type="number" id="qty" min="1" step="1">
<input type="number" id="hours" min="0" step="1">
Checklist ก่อน commit
ตรวจข้อต่อไปนี้ทุกครั้งก่อนส่งโค้ด:
- [ ] ทุก function/method มี docstring ครบ 3 ส่วน (Description, Args, Returns)
- [ ] ไม่มี
<script>block ที่มี JS logic อยู่ใน HTML/PHP file - [ ] JS ใหม่ทุกชิ้นอยู่ใน
assets/js/*.js - [ ] ชื่อ parameter ใน docstring ตรงกับชื่อจริงใน signature
- [ ]
<input type="number">ใช้step="1"(จำนวนเต็ม) และการแสดงผลตัด.000ทิ้ง
ทำเมื่อ review โค้ดที่ไม่ผ่านมาตรฐาน
- ระบุทุก function ที่ขาด docstring พร้อม file:line
- ระบุทุก inline script พร้อม file:line
- เขียน docstring และ/หรือแยก JS ออกมาให้ครบ ก่อน proceed งานอื่น
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/coding-standards-enforcement-mryiqitt' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/coding-standards-enforcement-mryiqitt/download' --output '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md.part' && mv '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md.part' '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md' && test -s '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/coding-standards' && cp -R '.skill-downloads/coding-standards-enforcement-mryiqitt' '.claude/skills/coding-standards'Cursor
test -f '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md' && test -s '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/coding-standards' && cp -R '.skill-downloads/coding-standards-enforcement-mryiqitt' '.cursor/skills/coding-standards'Codex
test -f '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md' && test -s '.skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/coding-standards' && cp -R '.skill-downloads/coding-standards-enforcement-mryiqitt' '.agents/skills/coding-standards'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/coding-standards-enforcement-mryiqitt'openskills read 'coding-standards-enforcement-mryiqitt'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/coding-standards-enforcement-mryiqitt/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.