Skirmish
3-minute light encounter. Max 5 turns. DC 10-13. No retreat. 0-1 common/uncommon loot.
Claude CodeGeneric
---
description: 3-minute light encounter. Max 5 turns. DC 10-13. No retreat. 0-1 common/uncommon loot.
---
# /skirmish
Arguments: $ARGUMENTS — location slug (e.g., `ember-pass`). Required.
## Preconditions
1. Exactly one alive character in `game/Characters/`.
2. Location file exists at `game/World/locations/<slug>.md`. If not → refuse or offer to generate one (with user confirmation).
3. No in-progress expedition. If there is, tell user to `/rest` first.
## Initialization
1. Read the alive character card (slug, hp, hp_max, attributes, inventory).
2. Read the location card. Note `danger`, `inhabitants`, any `triggers` (first-visit events).
3. Generate expedition filename: `game/Expeditions/<YYYY-MM-DD>-<char-slug>-<loc-slug>.md`.
4. Write initial YAML to expedition file:
```yaml
---
date: YYYY-MM-DD
tier: skirmish
character: "[[<char-slug>]]"
location: "[[<loc-slug>]]"
turns: 0
max_turns: 5
status: in-progress
---
- Scene opener — 3–6 sentences in CLAUDE.md style. Set the place, the immediate sensory detail. End with implicit choice (don't explicitly ask "what do you do" — just pause).
- Commit:
git commit -m "skirmish start: <name> at <loc>".
Per-turn loop (repeat until end condition)
Turn N (starting at 1):
SHA=$(git rev-parse HEAD)— save for this turn.- Wait for player input (their action).
- Decide what judgments are needed. Typical encounter: 1–3 rolls per turn.
- For each roll:
- Choose label from namespace:
perceive-<obj>/attack-<enemy>-<N>/defend-<enemy>-<N>/save-<situation>/talk-<npc>. d20 = bash .claude/scripts/py.sh .claude/scripts/dice.py $SHA $N <label>- Total = d20 + relevant attribute.
- DC from CLAUDE.md table (10 simple, 13 standard — skirmish stays in this range).
- Output forced line:
`[<Attr> <val> + d20=<d20> = <total> vs DC <dc>] 成功|失败`
- Choose label from namespace:
- Narrate outcome in 2–4 sentences. Update character card if HP/status changed.
- State sync (mandatory pre-commit checklist):
- HP / status / inventory changed → write character card.
- Anything in the location changed (door opened, sarcophagus emptied, guard killed, statue toppled) → write
game/World/locations/<loc>.md(statefield or newevents: [...]). - First-time NPC encountered with no card → generate
game/World/npcs/<slug>.mdnow. - Item picked up →
game/Loot/<slug>.mdexists (see Resolution step 2).
- End-of-turn commit:
- Append dialogue block (player action + rolls + narration) to expedition file.
git add -A && git commit -m "turn $N: <brief description>"
End conditions
- HP ≤ 0 → jump to DEATH flow (see below).
- Turn count reaches 5 → forced resolution.
- Narrative climax (enemy defeated, escape successful, mystery resolved) → natural end.
DEATH flow
- Append
## DEATHsection to expedition file (≤ 5 sentences — the angle of the fall, what the character saw last). - Invoke
/graveyardflow (see.claude/commands/graveyard.md).
Resolution (if survived)
- Write
## 结算section with: turns survived, HP remaining, summary. - Loot roll:
loot_d20 = bash .claude/scripts/py.sh .claude/scripts/dice.py $SHA 99 loot-drop- 1..5 → no loot, but a rumor is guaranteed (see step 2b)
- 6..10 → no loot, no rumor
- 11..18 → 1 common item
- 19..20 → 1 uncommon item
- For each item, call the loot generator (do NOT hand-write the 8 lines):
Capture stdout (thebash .claude/scripts/py.sh .claude/scripts/generate-loot.py $SHA 99 <idx> <rarity><!-- slug: ... -->first line gives you the filename slug). Write the rest togame/Loot/<slug>.md, then patch the YAML to addacquired_at: YYYY-MM-DDandacquired_from: "[[<loc-slug>]]". Append[[<slug>]]to the character'sinventory. - Skipping the file write is forbidden. "你拾起一把生锈的短剑" without
game/Loot/*.mdis a data-integrity bug.
2b. Rumor on dry roll (loot_d20 ∈ 1..5):
rumor_d20 = bash .claude/scripts/py.sh .claude/scripts/dice.py $SHA 99 rumor- Generate
game/World/rumors/<slug>.md— a short YAML (slug,heard_at: "[[<loc>]]",heard_from: <npc-slug or "wind">,tags: [rumor]) + 1–2 sentences hinting at a distant location, NPC, or faction. This is the "出行必有所得" floor: even a failed expedition yields something.
- XP: use the formula in CLAUDE.md (
turns*2 + successes*3 + discoveries*5). Skirmish typically lands at 15–35. - Update character card:
xp,expeditions_survived,last_played, potentiallystatus. - Change expedition YAML:
status: survived,outcome: <brief>, fillturns,loot_gained: [...],xp_gained. - Commit:
git commit -m "skirmish end: <name> survived <loc> (turn N)". - Run
.claude/scripts/readme-update.shthengit commit --amend --no-edit. - In narration: tell the player what happened, what they found, ask "接下来?".
Style reminders (see CLAUDE.md)
- 3–6 sentence scenes. Less is more.
- NPC dialog in
「」. - Roll output format is forced.
- One commit per turn, always.
Maintain Skirmish?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Skirmish on getagentictools](https://getagentictools.com/loops/spacegeologist-skirmish?ref=badge)