Files
sdlc/skills/maintain/SKILL.md
T
jiantw83andClaude Fable 5 2705771c20 feat(gate): 四階段模型閘門改為指定模型優先、能力標籤備援,並以 sdlc-gate 上鎖
What:plan、analyze、implement、maintain 四個 SKILL.md 的第一步從單純的能力標籤檢查,改為「模型閘門與階段上鎖」三段流程:先以 jsc-cli/tools/model-config.sh get {stage} 解析該階段的指定模型鏈,鏈上第一個當前 CLI 可用的模型即為必用模型;沒有設定指定模型時才退回 jsc-cli:models 的能力標籤檢查。閘門通過後執行 jsc-hooks/hooks/sdlc-gate.sh lock {stage} {current-model} 寫入鎖檔,並以 sdlc-gate.sh report 驗證。

Why:原本只驗能力標籤,同一標籤下模型可任意替換,階段中途換模型也無人攔阻,導致產出品質與可重現性不穩定。改為指定模型鏈優先可讓團隊明確指派每階段用哪個模型,標籤備援則保留未設定時的彈性;上鎖後由 hook 在每次 prompt 強制檢查,階段內換模型會被擋下。

How:每個技能的步驟一拆成三小步(解析模型鏈、驗證當前模型、上鎖並驗證鎖檔),各小步附完成條件;maintain 另加第四小步,明確規定只在換階段時重跑閘門,維護階段內跨專案不重複驗證。frontmatter description 同步更新。鎖定自 plan 起手生效,直到下一階段(如 analyze)的閘門重新上鎖前,強制沿用同一模型。

Who:jsc-sdlc 的 plan/analyze/implement/maintain 四個技能,及依賴其閘門行為的 jsc-hooks sdlc-gate hook。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 11:36:33 +08:00

31 lines
2.9 KiB
Markdown

---
name: maintain
description: SDLC maintenance stage. Gate on the designated model (model-config) or capability tags for the maintenance stage, lock the model via sdlc-gate, read projects still inside their maintenance window from MAINTAIN_CONTENTS, then run one sub agent per project: switch to develop or master, propose at least five maintenance actions, commit to a new branch, push, and PR. Update the last-maintained timestamp afterward. Use for periodic upkeep of delivered projects.
---
# maintain
Goal: run routine maintenance for every project in the maintenance contents page.
All wiki reads and writes go through `jsc-gitea:wiki`.
## Steps
1. **Model gate and stage lock**:
1. Resolve the maintain stage's designated model chain: run `jsc-cli/tools/model-config.sh get maintain`. If it prints a chain, the required model is the first entry of the chain the current CLI can use (fallbacks apply in chain order). If it prints nothing, fall back to the 「SDLC 階段需求」 table from `jsc-cli:models` (any listed model qualifies for maintenance).
2. If the current model is not the required model, or is missing from the mapping table, block the flow and tell the user which model to switch to. Completion condition: the current model satisfies the gate.
3. Lock the stage: run `jsc-hooks/hooks/sdlc-gate.sh lock maintain {current-model}`. From now until the next SDLC stage's gate runs, the sdlc-gate hook enforces this model on every prompt; switching models mid-stage gets blocked. Completion condition: the lock file is written, verified with `sdlc-gate.sh report`.
4. Run this gate only when the stage changes; inside the maintenance stage the lock already enforces the model, so never re-gate between projects.
2. Read `MAINTAIN_CONTENTS` via `jsc-gitea:wiki` and filter projects **still inside their maintenance window**: start date ≤ today, and (end date is NULL or ≥ today).
3. Every project **MUST run as a sub agent** with this flow:
1. Switch the project to the `develop` branch, falling back to `master`, and pull to latest.
2. Propose **at least five** maintenance methods and apply the ones that fit the project, for example:
- dependency updates (reuse `jsc-pkg:pkg-update`)
- security vulnerability scan and patching
- dead code and stale comment cleanup
- test coverage reinforcement
- docs and README synchronization
- build warning elimination
3. Commit the changes to a new branch per `jsc-git:commit`, push, then open a PR back to develop or master per `jsc-git:pr`.
4. Update the project's last-maintained field (the zh-TW column 「前次維護時間」) in `MAINTAIN_CONTENTS` to today.
4. The main agent reports the summary: maintenance methods applied per project, PR links, and failure reasons. The report and all generated wiki content, commits, and PR descriptions stay Traditional Chinese per the STE100 rule.