safe-code-change

โดย openshift

หลังจากเปลี่ยนแปลงโค้ด ให้ค้นหาการทดสอบที่ได้รับผลกระทบ อัปเดตให้สอดคล้องกับพฤติกรรมใหม่ จากนั้นรันไปป์ไลน์การตรวจสอบความถูกต้องทั้งหมดหนึ่งครั้ง ใช้เมื่อผู้ใช้ได้ทำหรือขอ...

npx skills add https://github.com/openshift/lightspeed-service --skill safe-code-change

Safe Code Change

After a code change is made, find and fix affected tests before running validation.

Rules

  • The code change is already done. Do not modify production code.
  • Only update tests to match the new behavior, not the other way around.
  • Do not reformat or lint-fix during test updates. Save that for validation.
  • If a test change is ambiguous (unclear what the new expected behavior is), ask the user.

Step 1: Identify What Changed

git diff --name-only
git diff --stat

List the modified production files (ignore test files, configs, docs).

Step 2: Find Affected Tests

Search for imports of changed functions/classes across all test files:

rg "from ols\.<changed_module> import" tests/

Step 3: Analyze Impact on Tests

For each affected test file, check whether the change breaks existing tests:

  1. Signature changes — function renamed, parameters added/removed/reordered.
  2. Behavior changes — return value, side effects, exceptions differ.
  3. Removed code — tests for deleted functions/classes need removal.
  4. New code — consider whether new tests are needed (ask user if unclear).

Step 4: Update Tests

Apply minimal fixes to each affected test:

  • Update function names, parameters, expected values.
  • Add async/await and @pytest.mark.asyncio if sync changed to async.
  • Remove tests for deleted functionality.
  • Do not add new tests unless the user asks.

Step 5: Done

Report what was updated. The user can invoke validate-and-fix when ready.

Skills เพิ่มเติมจาก openshift

openshift-expert
openshift
ผู้เชี่ยวชาญด้านแพลตฟอร์ม OpenShift และ Kubernetes ที่มีความรู้เชิงลึกเกี่ยวกับสถาปัตยกรรมคลัสเตอร์ โอเปอเรเตอร์ เครือข่าย พื้นที่จัดเก็บข้อมูล การแก้ไขปัญหา และไปป์ไลน์ CI/CD ใช้…
official
find-token
openshift
ค้นหาโทเค็นการยืนยันที่ซ่อนอยู่ รันสคริปต์ find-token เพื่อดึงโทเค็นที่ไม่ซ้ำกัน
official
code-review
openshift
ตรวจสอบ pull request เพื่อดูคุณภาพโค้ด ความถูกต้อง และความสอดคล้องกับข้อกำหนดของโปรเจกต์ ใช้เมื่อผู้ใช้ขอให้ตรวจสอบ PR, ตรวจสอบโค้ด หรือตรวจสอบการเปลี่ยนแปลงใน...
official
css-review
openshift
ตรวจสอบ CSS สำหรับรูปแบบการเขียนโค้ด การใช้โทเค็น PatternFly และแนวปฏิบัติที่ดีที่สุด ใช้เมื่อผู้ใช้ขอให้ตรวจสอบ CSS ตรวจสอบสไตล์ หรือตรวจสอบไฟล์ CSS
official
review-readmes
openshift
ตรวจสอบไฟล์ README.md ทั้งหมดใน repo เพื่อหาคำผิด ข้อผิดพลาด และข้อมูลที่ล้าสมัย ใช้เมื่อผู้ใช้ขอให้ตรวจสอบ README ตรวจสอบความถูกต้องของเอกสาร หรือ…
official
review-skills
openshift
ตรวจสอบทักษะ AI ของโครงการเพื่อหาความซ้ำซ้อน การอ้างอิงที่ล้าสมัย ข้อผิดพลาด และปัญหาเชิงโครงสร้าง ใช้เมื่อผู้ใช้ขอให้ตรวจสอบทักษะ ตรวจสอบทักษะ ตรวจสอบหา…
official
test
openshift
รันการทดสอบแบบ end-to-end ที่กรองตามแท็ก ใช้เมื่อผู้ใช้ขอให้รันการทดสอบ รัน Playwright หรือทดสอบฟีเจอร์เฉพาะแท็ก เช่น @core หรือ @attach
official
unused-exports
openshift
ค้นหาสัญลักษณ์ที่ถูกส่งออกแต่ไม่เคยถูกนำเข้าโดยไฟล์อื่น ใช้เมื่อผู้ใช้พูดว่า "ตรวจสอบการส่งออก" "ส่งออกที่ไม่ได้ใช้" หรือขอให้ทำความสะอาดการส่งออก
official