principle-narrow-state-lifetime
WHEN mutable state outlives or outreaches the work that needs it, such as module globals, long-lived fields or reset hooks; NOT concurrent writers sharing one…
от mintuz★ 38 звёзд на GitHub
Установить principle-narrow-state-lifetime в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Narrow State Lifetime
Shrink mutable state toward request-owned values and explicit inputs, so each value lives no longer and reaches no wider than the work that uses it.
- For each mutable value, name the work that needs it: a request, an operation, a screen or the whole process. Find where it is set, who reads it and when it stops mattering.
- Move per-work values into that work. Prefer returned values over mutation, locals over fields, fields over module state and module state over globals. Pass inputs explicitly rather than reading them from shared context.
- When a fix resets, clears or locks a long-lived value so it behaves as if it were short-lived, treat that as the symptom. Shorten the value's lifetime instead.
- Preserve shared resources, such as clients, pools and caches, under explicit owners whose lifetime matches the resource. Do not push them into request scope. A spawned task, fiber, timer or background job is state too. Name the owner that cancels and awaits it, and end it with the work that needs it.
- Exercise overlapping work with different inputs, a failure followed by a fresh run, and abandoning work midway where that can happen. Shorter or flatter code is not evidence.
Distinct from: principle-separate-before-serializing-shared-state (concurrent writers share mutable state), principle-minimize-reader-load (an existing path is hard to trace through layers), principle-derive-from-one-owner (the same fact is computed or stored twice).
Done: each mutable value lives no longer or wider than its use, its inputs are explicit, and shared resources have a named owner.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл principle-narrow-state-lifetime?
WHEN mutable state outlives or outreaches the work that needs it, such as module globals, long-lived fields or reset hooks; NOT concurrent writers sharing one invariant, or tracing layers; scopes each value to its use with explicit inputs.
Как установить скилл principle-narrow-state-lifetime?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл principle-narrow-state-lifetime запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…