| name | write-tag |
| description | Use when you need to write a payload to a single NFC tag — provide the payload (URL, text, or raw NDEF) and present the tag to the reader. |
Write Tag
Write a single payload to an NFC tag. Supports URL records, plain text records, and raw NDEF data. The skill verifies tag detection, writes the payload, reads it back to confirm, and logs the operation for audit.
When to use
- User has a single tag to program with a known payload.
- Payload is URL, plain text, or raw NDEF bytes.
- User wants an audit trail of what was written.
Inputs to gather
- Payload value — the URL, text, or raw bytes to write.
- Payload type —
url | text | ndef-raw (defaults to url if not given).
- Optional label — human-readable tag name for the log (e.g. "Office Door").
Procedure
- Verify
nfc-list is available (which nfc-list).
- Prompt user to present the tag to the reader.
- Run
nfc-list to detect the tag and capture its UID. Fail with a clear message if no tag is detected.
- Compose the NDEF record based on payload type:
url: Use nfcpy or libnfc NDEF library to encode a URI record (or construct manually if not available).
text: Encode as plain UTF-8 text record.
ndef-raw: Pass bytes directly.
- Write the payload to the tag using
nfc-mfclassic write (for MIFARE Classic) or nfc-mfultralight write (for NTAG21x), adjusting sector/page offsets as needed.
- Read the tag back immediately to verify the write succeeded.
- Log the operation to
${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/nfc-ops/state/write-log.jsonl with:
- Timestamp (ISO 8601).
- Tag UID (hex).
- Payload type.
- Payload value (plaintext; no binary dumps for brevity).
- Label (if provided).
- Success/failure status.
Output / side effects
- The tag now contains the written payload.
write-log.jsonl is appended with a new entry.
- User sees confirmation: "Write successful. Tag UID: . Payload: ."
Safety / constraints
- Read-back verification is mandatory. If the read-back payload does not match, report failure and do not log success.
- No plaintext passwords in logs. If the payload is sensitive, truncate or summarize in the log.
- Tag lock state: If the tag is locked, inform the user and decline to write. Suggest
inspect-tag to check lock status.