ワンクリックで
workspace-state-refactor
Refactor or extend workspace state/store logic while preserving behavior and keeping responsibilities clean.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Refactor or extend workspace state/store logic while preserving behavior and keeping responsibilities clean.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | workspace-state-refactor |
| description | Refactor or extend workspace state/store logic while preserving behavior and keeping responsibilities clean. |
Use this skill for any work touching src/app/store/workspace.store*.ts, document lifecycle, autosave, evaluation projection, or the store-to-UI binding layer.
.codex/skills/workspace-state-refactor/state-patterns.md — concrete Zustand patterns, responsibility map, anti-patternsThe workspace store is split across four files — understand each before editing:
| File | Responsibility |
|---|---|
src/app/store/workspace.store.types.ts | WorkspaceState, WorkspaceStateData, WorkspaceStateActions — the full typed interface |
src/app/store/workspace.store.state.ts | Pure state shape helpers — initial state, state selectors, derived values |
src/app/store/workspace.store.runtime.ts | Autosave timer, debounce orchestration, save-revision coordination |
src/app/store/workspace.store.ts | Main Zustand create() — wires all actions, delegates to runtime and state helpers |
workspace.store.ts
├── initialize() → loads documents from Tauri, sets activeDocumentId
├── selectDocument() → loads document content, runs engine projection
├── setRawText() → updates rawText, triggers engine re-projection, schedules autosave
├── createDocument() → Tauri create → reload → select new
├── deleteDocument() → Tauri delete → reload → select next
├── archiveActiveDocument() → Tauri archive → reload
├── saveNow() → immediate Tauri save (bypasses debounce)
└── [autosave timer] → in workspace.store.runtime.ts
src/features/editor/workspace-projection.ts owns the engine-to-editor projection:
rawText: string{ lines: CalculationLine[], tables: TableBlockAnalysis[] }setRawText() and selectDocument() in the storeanalyzeDocument() directly from components — always go through the storesrc/features/settings/settings.store.ts owns:
themePreference: ThemePreferenceaiEnabled: booleanlocale: stringdefaultCurrency: stringDo not mix settings state into the workspace store.
state-patterns.md for Zustand patterns specific to this repo.workspace.store.types.ts to understand the full state interface.WorkspaceScreen.tsx, WorkspaceEditorPane.tsx, WorkspaceInspectorPane.tsx.npm run typecheck && npm run build.docs/ARCHITECTURE.md if the responsibility split changes.workspace.store.runtime.ts, not in the main store.WorkspaceStateData and WorkspaceStateActions interfaces in workspace.store.types.ts.docs/ARCHITECTURE.md — for any responsibility split or boundary changesdocs/API_CONTRACTS.md — if store action signatures changedocs/STATUS_GAP_ANALYSIS.md — when store-related gaps are resolvedImplement or improve tray, quick popup, global shortcut, single-instance, and restore behavior for the Windows-first Tauri 2 app.
Use this skill for React + TypeScript implementation, refactoring, and review tasks involving components, hooks, props typing, children typing, refs, effects, context, reducers, events, forms, utility functions, async UI state, generic components, type modeling, module/export conventions, and React architecture decisions. Trigger this skill when creating or refactoring React TypeScript code and when choosing the right abstraction boundary for maintainable React applications.
Use this skill for any UI work in numpad — shadcn components, theming, shell layout, feature UI, settings dialogs, inspector panels, or Windows 11-like desktop productivity styling.
Implement or extend optional, review-first AI infrastructure for numpad without compromising deterministic engine authority.
Align docs/ with the real implementation — remove stale claims, add missing details, correct wrong file names, and update contracts.
Refactor and extend the deterministic calculation engine while preserving correctness and explicit domain boundaries.