src/autoskillit/skills_extended/arch-lens-state-lifecycle/SKILL.md
Create State Lifecycle architecture diagram showing field contracts, validation gates, and resume safety. Contract overlay lens answering "How is state corruption prevented?"
npx skillsauth add talont-org/autoskillit arch-lens-state-lifecycleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cognitive Mode: Perspective (Quality Overlay) Primary Question: "How is state corruption prevented?" Focus: Field Contracts, Validation Gates, Resume Safety, State Mutation Control
/autoskillit:arch-lens-state-lifecycle or /autoskillit:make-arch-diag stateNEVER:
run_in_background: true is prohibited)ALWAYS:
/autoskillit:mermaid skill using the Skill tool - this is MANDATORYtemp/arch-lens-state-lifecycle/...
save path to absolute by prepending the full CWD:
diagram_path = /absolute/cwd/temp/arch-lens-state-lifecycle/{filename}.md
This token is MANDATORY — the pipeline cannot proceed without it./autoskillit:arch-lens-state-lifecycle [context_path]
If a context_path positional argument is present:
context_pathIf no context_path is provided, skip this step and explore the full CWD in Step 1.
Spawn Explore subagents to investigate:
State Schema
Field Categories
Validation Gates
Resume Detection
State Updates
Contract Enforcement
| Category | Description | Fields | |----------|-------------|--------| | INIT_ONLY | Set once, never modify | {fields} | | INIT_PRESERVE | Keep on resume | {fields} | | MUTABLE | Can change freely | {fields} | | APPEND_ONLY | Can only grow | {fields} | | DERIVED | Computed, not stored | {fields} |
CRITICAL - Analyze Read/Write Direction: For EVERY state field and storage location:
Distinguish clearly:
Document:
Use flowchart with:
Direction: TB for contract enforcement flow
Subgraphs:
Node Styling:
detector class: INIT_ONLY fields (red - critical)gap class: INIT_PRESERVE fields (yellow - warning)phase class: MUTABLE fields (purple)handler class: APPEND_ONLY fields (orange)stateNode class: Validation gatesoutput class: State wrapper/accessorcli class: Resume detection tiersWrite the diagram to: {{AUTOSKILLIT_TEMP}}/arch-lens-state-lifecycle/arch_diag_state_lifecycle_{YYYY-MM-DD_HHMMSS}.md (relative to the current working directory)
After writing the diagram file, emit a structured output line:
IMPORTANT: Emit the structured output tokens as literal plain text with no markdown formatting on the token names. Do not wrap token names in
**bold**,*italic*, or any other markdown. The adjudicator performs a regex match on the exact token name — decorators cause match failure.
diagram_path = {absolute_path_to_diagram_file}
# State Lifecycle Diagram: {System Name}
**Lens:** State Lifecycle (Contract Overlay)
**Question:** How is state corruption prevented?
**Date:** {YYYY-MM-DD}
**Scope:** {What was analyzed}
## Field Lifecycle Categories
| Category | Description | Example Fields |
|----------|-------------|----------------|
| INIT_ONLY | Never modify after init | {fields} |
| INIT_PRESERVE | Keep on resume | {fields} |
| MUTABLE | Free to change | {fields} |
| APPEND_ONLY | Can only grow | {fields} |
## State Lifecycle Diagram
```mermaid
%%{init: {'flowchart': {'nodeSpacing': 50, 'rankSpacing': 60, 'curve': 'basis'}}}%%
flowchart TB
%% CLASS DEFINITIONS %%
classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;
classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef gap fill:#ff6f00,stroke:#ffa726,stroke-width:2px,color:#000;
subgraph Lifecycles ["FIELD LIFECYCLE CATEGORIES"]
direction TB
INIT_ONLY["INIT_ONLY<br/>━━━━━━━━━━<br/>id, request_id<br/>NEVER modify"]
INIT_PRESERVE["INIT_PRESERVE<br/>━━━━━━━━━━<br/>is_resuming<br/>Keep on resume"]
MUTABLE["MUTABLE<br/>━━━━━━━━━━<br/>current_state<br/>Freely change"]
APPEND_ONLY["APPEND_ONLY<br/>━━━━━━━━━━<br/>errors, history<br/>Only grow"]
end
subgraph Gates ["VALIDATION GATES"]
direction TB
GATE1["validate_required<br/>━━━━━━━━━━<br/>FAIL-FAST"]
GATE2["validate_lifecycle<br/>━━━━━━━━━━<br/>Contract check"]
GATE3["resume_safety<br/>━━━━━━━━━━<br/>Preserve check"]
end
subgraph Wrapper ["STATE WRAPPER"]
direction TB
ACCESSOR["StateAccessor<br/>━━━━━━━━━━<br/>Tracks mutations"]
MERGE["Merge Updates<br/>━━━━━━━━━━<br/>Auto-include"]
end
subgraph Resume ["RESUME DETECTION"]
direction TB
TIER1["Tier 1: Explicit<br/>━━━━━━━━━━<br/>flag=true"]
TIER2["Tier 2: Heuristic<br/>━━━━━━━━━━<br/>State exists"]
TIER3["Tier 3: Fresh<br/>━━━━━━━━━━<br/>No indicators"]
end
%% FLOW %%
INIT_ONLY --> GATE1
INIT_PRESERVE --> GATE2
MUTABLE --> GATE2
APPEND_ONLY --> GATE2
GATE1 --> GATE2
GATE2 --> GATE3
GATE3 --> ACCESSOR
ACCESSOR --> MERGE
MERGE --> TIER1
TIER1 --> TIER2
TIER2 --> TIER3
%% CLASS ASSIGNMENTS %%
class INIT_ONLY detector;
class INIT_PRESERVE gap;
class MUTABLE phase;
class APPEND_ONLY handler;
class GATE1,GATE2,GATE3 stateNode;
class ACCESSOR,MERGE output;
class TIER1,TIER2,TIER3 cli;
Color Legend: | Color | Category | Description | |-------|----------|-------------| | Red | INIT_ONLY | Never modify (critical) | | Yellow | INIT_PRESERVE | Preserved on resume | | Purple | MUTABLE | Freely modifiable | | Orange | APPEND_ONLY | Can only grow | | Teal | Gates | Validation gates | | Dark Teal | Wrapper | State mutation mechanism | | Dark Blue | Detection | Resume detection tiers |
| Lifecycle | Fresh Start | Resume | Violation Detection | |-----------|-------------|--------|---------------------| | INIT_ONLY | Cannot modify | Cannot modify | {detection} | | INIT_PRESERVE | Can modify | Cannot modify | {detection} | | MUTABLE | Can modify | Can modify | Never fails | | APPEND_ONLY | Can append | Can append | {detection} |
| Tier | Check | Result | |------|-------|--------| | 1 | Explicit flag | {what happens} | | 2 | Heuristic | {what happens} | | 3 | Fresh start | {what happens} |
---
## Pre-Diagram Checklist
Before creating the diagram, verify:
- [ ] LOADED `/autoskillit:mermaid` skill using the Skill tool
- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)
- [ ] Diagram will include a color legend table
---
## Related Skills
- `/autoskillit:make-arch-diag` - Parent skill for lens selection
- `/autoskillit:mermaid` - MUST BE LOADED before creating diagram
- `/autoskillit:arch-lens-process-flow` - For state machine view
- `/autoskillit:arch-lens-error-resilience` - For validation failure handling
development
Generate YAML recipes for .autoskillit/recipes/. Use when user says "make script skill", "generate script", "script a workflow", "write a script", "create a script", "new recipe", "write a pipeline", or when loaded by other skills for script formatting.
data-ai
Create Uncertainty Representation visualization planning spec showing error bar definitions, distribution-aware alternatives, and multi-seed variance protocols. Statistical lens answering "How is uncertainty honestly represented?"
data-ai
Create Temporal Dynamics visualization planning spec showing axis scaling (linear vs log), smoothing disclosure, epoch/step alignment, run aggregation (mean + variance bands), early-stopping markers, and wall-clock vs step-count x-axis. Temporal lens answering "Are training dynamics shown clearly and honestly?"
data-ai
Create Narrative Story Arc visualization planning spec showing visual consistency across the report (same color = same model everywhere), logical figure progression, redundant figure detection, and narrative dependency between figures. Narrative lens answering "Do the figures tell a coherent story across the report?"