legacy-cutover
Use when running Step 4 of legacy refactoring protocol — writes one use case worth of new code in internal/<module>/, switches DI, ensures pytest stays green, and appends to REFACTOR_LOG.md. Triggers on '/legacy-cutover <module> --usecase=<name>' or when user asks to 'переписати register', 'cutover register', 'переписування у нову папку'.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 15
- Forks
- 13
01 前言 Front Matter
- name
- legacy-cutover
- description
- Use when running Step 4 of legacy refactoring protocol — writes one use case worth of new code in internal/<module>/, switches DI, ensures pytest stays green, and appends to REFACTOR_LOG.md. Triggers on '/legacy-cutover <module> --usecase=<name>' or when user asks to 'переписати register', 'cutover register', 'переписування у нову папку'.
- allowed-tools
- Read, Write, Edit, Bash, Glob
- argument-hint
- <module-name> --usecase=<name>
- disable-model-invocation
- false
03 SKILL.md 正文
legacy-cutover — Step 4 один атомарний use case за виклик
Пише один use case у internal/<module>/, перемикає DI у server.py (DI-точка демо; у твоєму проєкті це може бути container.py чи аналог), запускає тести, дописує REFACTOR_LOG.md. Один виклик skill = один атомарний коміт.
Аргументи
<module-name>— імʼя нового модуля (наприкладaccount)--usecase=<name>— імʼя use case (наприкладregister,verify_email,reset_password)
Стратегії chunking (3 варіанти, обери у PLAN.md)
- 1 use case = 1 коміт (default) Напр. Register: domain.User + RegisterUseCase + UsersRepo.Insert + EmailSender.SendWelcome — все в одному комміті. Підходить для простих use cases (<200 LOC).
- Дрібніше — 4 коміти на use case
- Commit 1:
domain/user.py(entity + sentinel errors) - Commit 2:
infra/users_repo.py(тільки Insert) - Commit 3:
app/register_usecase.py - Commit 4:
ports/handler.py+ DI swap Підходить коли use case > 200 LOC або коли хочеш дрібніший git bisect.
- Commit 1:
- За HTTP endpoint
1 коміт = 1 endpoint (
POST /registerповністю). Підходить коли є contract tests і працюємо contract-driven.
Стратегія для конкретного циклу зафіксована у PLAN.md секція 5.
Inputs
PLAN.md(з/legacy-plan --phase=finalize)LEGACY/<module>.md(як reference)tests/<module>/(мають бути зелені)
Output
- Нові файли у
internal/<module>/ - Зміна DI у
server.py(один рядок, або гібрид, поки решта use case ще на legacy) REFACTOR_LOG.mdдописаний один рядокPLAN.mdсекція «Шматки міграції» —- [ ]стає- [x]
Шаблон зміни DI
# server.py
# from internal.users import setup as account_setup # ← коментуємо
from internal.account import setup as account_setup # ← новий імпорт
Один рядок. Без феверфлагів, без branch-toggle.
Acceptance criteria
- diff ≤ 500 LOC (інакше skill попереджає «розбий на дрібніше chunking»)
- pytest зелений ДО і ПІСЛЯ
REFACTOR_LOG.mdдописаний рядок у форматі- <date>: <usecase> cutover · <result> · <next>PLAN.mdсекція "Шматки міграції" оновлена:- [x] <usecase>- Жоден файл у
internal/users/**не змінений (path-rules guard)
REFACTOR_LOG.md auto-append
Після успішного коміту skill дописує рядок:
- 2026-04-16: register cutover · pytest green, latency unchanged · далі verify_email
Якщо тест червоний:
- 2026-04-16: register cutover · pytest RED — UsersRepo.Insert повертає None · revert
Examples
/legacy-cutover account --usecase=register
git log --oneline # має зʼявитися 1 коміт у internal/account/
pytest # все зелене
/legacy-cutover account --usecase=verify_email
/legacy-cutover account --usecase=reset_password
# після останнього use case — окремий коміт на видалення старого
Anti-patterns
- Не змішуй use cases в одному виклику —
--usecase=register,verify_email— погана ідея. Один skill call = один атомарний коміт = один git revert у разі регресії. - Не редагуй
internal/users/**всередині cutover — path rules заборонять. Якщо потребуєш — це окремий skill (поки не існує). - Не закінчуй cutover без оновлення REFACTOR_LOG — це auto-rule з CLAUDE.md, не «постарайся».
04 同仓库更多 Skills
release
Run the whole local release pipeline in order, stopping at each human gate. Triggers on "run the release", "prepare a release", "/release", "зроби реліз", "підготуй реліз". Drives the four stages back to back — bump-version → curate-changelog → release-notes → check-docs-drift — pausing after each so the human reviews the diff before the next stage. Prepares everything in the working tree; never tags, commits, or pushes. The tag push (which fires CI) stays the human's action.
release-notes
Draft partner-facing release notes from the same commits as the changelog. Triggers on "draft release notes", "release notes for the next version", "/release-notes", "нотатки релізу", "release notes партнеру". Same input as curate-changelog, different audience and tone: a short, benefit-first narrative for a user or partner — "what's new for you" — not a categorized engineer's list. Keeps only changes a user actually notices; drops internal refactors and tooling. Prints the notes to the chat to seed a GitHub Release description or a partner announcement. Writes no file.
curate-changelog
Curate the [Unreleased] section of docs/CHANGELOG.md from git history. Triggers on "curate the changelog", "update the changelog", "/curate-changelog", "онови changelog", "курування журналу". Reads git log since the last tag, FILTERS out what a reader never feels (test/ci/chore/merge), GROUPS commits about one feature into one bullet, and REWRITES technical subjects into plain language under the six Keep a Changelog categories (Added/Changed/Deprecated/ Removed/Fixed/Security). The result must have FEWER lines than the raw log — that is the proof of curation, not a dump. Leaves the edit in the working tree; never commits or pushes.
codify-rule
Turn a repeated mistake into a durable, path-scoped rule in .claude/rules/. Triggers on "codify this rule", "make a rule so this doesn't happen again", "/codify-rule", "закодифікуй правило", "петля помилка-правило". Use only when the same mistake showed up TWICE (twice = a pattern, once = noise). Names the wrong shape and the right shape with one short example of each, scopes the rule to the paths that matter, and leaves the edit in the working tree so the next agent on this repo inherits the fix. Edits only .claude/rules/; never commits or pushes.
check-docs-drift
Find and fix where docs/api.md fell behind the code. Triggers on "check for doc drift", "is the API doc up to date", "/check-docs-drift", "перевір дрейф документації", "docs drift". Runs the deterministic scripts/check-docs-drift.py (parses the public NoteBook methods with ast, compares to what docs/api.md documents — NO LLM finds the gap), reports the drift, and PROPOSES the doc edit that closes it. The gap is found by parsing; the agent writes the missing documentation in the doc's existing style. Edits only docs/; never commits or pushes.
bump-version
Decide and apply the next semver for a release. Triggers on "bump the version", "what version is next", "/bump-version", "простав версію", "яка наступна версія". Reads the next number from the deterministic scripts/next-version.sh (NEVER guesses it), explains in plain language WHICH part moved and why (e.g. "MINOR, because a feat landed: filter notes by tag"), edits the version line in pyproject.toml, and proposes the matching `git tag vX.Y.Z`. The number is decided by a rule; the agent explains and applies — the human confirms the tag. Never pushes a tag itself.