Claude Code Plugins

Community-maintained marketplace

Feedback

階層IDの競合安全な採番(counters 方式)

@small-java-world/todo-manage
0
0

>

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name 階層IDの競合安全な採番(counters 方式)
description REQ/TSK/SUB の三階層IDを同時作成でも重複させないため、counters(scope,last) を トランザクションでインクリメントして採番する手法。ユニーク違反時は指数バックオフでリトライする。

使い方

  • scope 例: REQ, REQ-001.TSK, REQ-001.TSK-001.SUB
  • 1 Tx 内で SELECT ... FOR UPDATEUPDATE last=last+1
  • 失敗(ユニーク違反)が発生した場合はバックオフしてリトライ

手順(擬似)

  1. BEGIN
  2. SELECT last FROM counters WHERE scope=:scope FOR UPDATE
  3. UPDATE counters SET last=last+1 WHERE scope=:scope
  4. COMMIT
  5. hier_id = f"{scope}-{last:03}" を生成

  • examples/id_alloc.sql