# Skill: Shared Write Law

slug: skill-shared-write-law · https://miscsubjects.com/a/skill-shared-write-law · updated 2026-07-22T09:52:12.442Z

---
name: shared-write-law
description: Use when about to edit any shared file in miscsubjects-pages, .claude/skills, or .agents/skills. Prevents write collisions and overwritten work.
---

# Shared Write Law — claim before edit

## Overview
Shared files in this build are edited by multiple agents. Editing without a claim causes collisions, overwritten work, and repeated fixes. This skill makes the existing AGENTS.md WRITE LAW automatic.

## When to Use
- Before editing any file under `miscsubjects-pages/`, `~/.claude/skills/`, or `~/.agents/skills/`.
- When resuming work on a file you edited earlier in the same session.
- When you see `FILE_CLAIM` DENIED or the file is already claimed.

## Core Pattern

```
Read file → FILE_CLAIM claim → Edit → FILE_CLAIM release
```

1. **Read the file first.** Never edit a file you have not read this session.
2. **Claim it** with `FILE_CLAIM claim`, passing the absolute path, agent holder, and 90-minute TTL.
3. **Only if the response starts with `CLAIMED:`** — edit the file.
4. **Release when done** with `FILE_CLAIM release`.

## Rules

- **DENIED means stop.** Read the file fresh, find who holds the claim, coordinate. Do not edit.
- **Claims are per-file.** Editing five files requires five claims.
- **Release after your last edit** in the session. Do not hold claims you are not actively using.
- **TTL is 90 minutes.** If your session crashes, the claim expires automatically.
- **Success prefix matters.** A `FILE_CLAIM` result starting with `CLAIMED:` succeeded. Parse that prefix, not substring matches on the word "error" elsewhere in the response.

## Red Flags — STOP and Claim

- "I'll just patch this quickly."
- "The file is probably free."
- "I'll check the claim after editing."
- Reading a file and immediately reaching for Edit/Write without FILE_CLAIM.

All of these cause the collisions the owner is tired of fixing.

## Common Mistakes

1. **Editing before claiming** → Claim first. If denied, do not proceed.
2. **Releasing with wrong holder string** → Use the same `agent:session-prefix` you claimed with.
3. **Assuming free because FILE_CLAIM check said FREE** → Claim anyway; FREE can change between check and edit.
4. **Editing a file another agent changed since your read** → Re-read, re-claim, merge changes.

## Verify

Before every edit, confirm: `Read` ✓ → `FILE_CLAIM claim` returned `CLAIMED:` ✓ → `Edit` ✓ → `FILE_CLAIM release` ✓.

