首頁 / Skills / 開發提效 / Caveman 提交訊息
開發提效

Caveman 提交訊息

Julius BrusseeApache-2.0Skill 語言: 英文
授權已核對不含腳本
演示真實執行紀錄 · claude-opus-5-5 · 2026年10月
Write a commit message for this staged diff: ```diff --- a/src/auth/session.py +++ b/src/auth/session.py @@ -8,9 +8,15 @@ SESSION_TTL = timedelta(hours=12) def is_session_valid(session) -> bool: - return session.created_at + SESSION_TTL > datetime.now() + # created_at is stored in UTC; naive local now() made sessions expire + # early or late depending on the server's timezone. + return session.created_at + SESSION_TTL > datetime.now(timezone.utc) --- a/tests/test_session.py +++ b/tests/test_session.py @@ -20,3 +20,12 @@ def test_session_expires_after_ttl(): assert not is_session_valid(old) + + +def test_session_valid_on_non_utc_server(monkeypatch): + monkeypatch.setenv("TZ", "Asia/Shanghai") + time.tzset() + fresh = make_session(created_at=datetime.now(timezone.utc)) + assert is_session_valid(fresh) ``` Users on our Singapore and Shanghai servers were being logged out about 8 hours early. This fixes issue #214.
Skill: caveman-commit
fix(auth): compare session expiry against UTC now

created_at is stored in UTC, but expiry was checked against naive
local datetime.now(). On UTC+8 servers (Singapore, Shanghai) users
were logged out ~8 hours early.

Closes #214

The diff doesn't show any import changes, so check two things before you commit:

  • session.py needs timezone imported from datetime.
  • The test file needs time and timezone imported.

created_at also has to be timezone-aware. If it's ever stored as a naive datetime, comparing it with datetime.now(timezone.utc) will raise a TypeError.

Real run recorded with claude-code / claude-opus-5-5. Output is shown verbatim, unmodified.

它做什麼

依 Conventional Commits 格式為你的變更撰寫提交訊息:<類型>(<範圍>): <祈使句摘要>,最好不超過 50 個字元,最多 72 個。

運作方式

  1. 說 "write a commit"、"commit message",或輸入 /commit、/caveman-commit 時觸發。
  2. 只有原因不明顯時才寫內文;破壞性變更、安全修正、資料遷移與還原則一定寫內文。
  3. 不寫「本次提交做了……」、表情符號與 AI 署名行;除非你自己的規則要求加上署名 trailer。

適合情境

讓 git 歷史簡短、一致,方便日後除錯的人看懂。

需要了解

它只以程式碼區塊輸出提交訊息,不會暫存檔案、提交或修改上一次提交。

說明與風險

純指令檔:沒有腳本、不連網、不寫入檔案。 壓縮檔中另附原始儲存庫的 README、LICENSE 與 NOTICE。 它不會執行任何 git 指令。

SKILL.md 原文套件內共 4 個檔案