agentleFS
crgarcia12crgarcia12/Liliput/.github/skills/state-management/SKILL.md

state-management

Skill4 starsChanged 4 months agoISCView on GitHub

Read, write, and maintain .spec2cloud/state.json across phases and increments. Defines the state schema, read/write protocol, and resume re-validation logic. Use when reading project state, updating state after task completion, or resuming from a previous session.

27 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use css-architecture, i18n and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Piyush8296Skill

    css-architecture

    CSS architecture, Tailwind patterns, responsive design, design tokens, and styling best practices. Use when implementing designs, setting up styling infrastructure, or debugging layout issues.

    Also in 3 projects that use this

  • lbednerSkill

    i18n

    Use when a code or template change introduces a new translation message key, in either the framework CLI (aegis/i18n/locales/) or a generated project's CLI (the app/i18n/locales/ template tree). Covers adding the real English string, stubbing the same key into every other locale for parity, and the separate translation PR that later replaces placeholders with reviewed native text.

    Also in 4 projects that use this

  • mijunriSkill

    database

    数据库脚本与操作规范。脚本放在 db_scripts 目录,遵循查询优化、事务、安全等实践。

    Also in 3 projects that use this

  • NVIDIASkill

    testing

    Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.

    Also in 6 projects that use this

  • 0xSeroSkill

    security

    Also in 4 projects that use this

  • klauswgSkill

    performance

    Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 20 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If in increment-delivery, parse currentIncrement and its steps to determine what's been done and what's next

    line 15
  2. Distinctive:

    Update the relevant section with the result of the task you just executed

    line 21
  3. Very specific:

    Update lastUpdated to the current ISO timestamp

    line 22
  4. Very specific:

    Write the updated state back to .spec2cloud/state.json

    line 23
  5. Distinctive:

    When operating in brownfield mode, the state includes additional fields for testability tracking and per-feature track assignment.

    line 56
  6. Very specific:

    When track is "hybrid", each increment in Phase 2 inherits its track from featureTracks.

    line 79
  7. Distinctive:

    If results match state → continue from where you left off

    line 89
  8. Distinctive:

    If results differ → update state to reflect reality, then continue

    line 90
  9. Very specific:

    BLOCKING: If state.json is invalid or inconsistent with actual artifacts, the resume skill will reconstruct the wrong position.

    line 103

“Common” is measured: kept by at least 6 in 10 of the 20 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

State Management

State lives in .spec2cloud/state.json. You read it at the start of every loop iteration and write it at the end.

Reading State

At the start of every loop iteration:

  1. Read .spec2cloud/state.json
  2. Parse currentPhase to determine where you are (setup, discovery, or increment-delivery)
  3. If in increment-delivery, parse currentIncrement and its steps to determine what's been done and what's next
  4. Parse humanGates to check which approvals have been granted

Writing State

At the end of every loop iteration:

  1. Update the relevant section with the result of the task you just executed
  2. Update lastUpdated to the current ISO timestamp
  3. Write the updated state back to .spec2cloud/state.json

State File Schema

See references/schema.md for the full JSON schema example and field descriptions.

Increment Object Fields

FieldTypeDescription
status"pending" | "in-progress" | "done"Overall increment delivery status. "done" only when Step 4 (Verify & Ship) completes.
stepsobjectPer-step status tracking: tests, contracts, implementation, verification.

Step Object Fields

StepKey FieldsDescription
testse2eSpecs, gherkinFiles, cucumberSteps, vitestFilesFiles generated for this increment's test scaffolding.
contractsapiContracts, sharedTypes, infraUpdatedContract artifacts for this increment.
implementationslices (api, web, integration)Per-slice tracking with modifiedFiles, failingTests, lastTestRun, iteration.
verificationregression, deployment, smokeTests, docsFull regression results, deployment URL, smoke test results, docs status.

Slice Dependencies (within implementation)

Contracts → api  (api slice reads contract types)
Contracts → web  (web slice reads contract types)
api + web → integration  (integration requires both slices done)
integration → verification  (verify requires all slices green)

Brownfield State Fields

When operating in brownfield mode, the state includes additional fields for testability tracking and per-feature track assignment.

FieldTypeDescription
brownfield.testability"full" | "partial" | "none"Overall testability verdict after the testability gate.
brownfield.track"A" | "B" | "hybrid"Delivery track: A (testable, green baseline), B (doc-only), or hybrid (mix per feature).
brownfield.testabilityChecklistobjectSix binary checks: canBuild, externalDepsReachable, apiExercisable, uiRenderable, devEnvExists, existingTestsRunnable.
brownfield.featureTracksobjectMap of featureId → "A" | "B". Only present when track is "hybrid".
brownfield.greenBaselineobjectTrack A metrics: per-feature scenarios count, testsPass boolean, lastVerified ISO timestamp.
brownfield.behavioralDocsobjectTrack B metrics: per-feature scenarios count and manualChecklist item count.

Brownfield State Transitions

TriggerPhaseState Updates
Extraction complete"B1"currentPhase: "B1", extraction output paths recorded in brownfield.extraction
Spec-Enable complete"B2"currentPhase: "B2", brownfield.prdGenerated: true, brownfield.frdCount: N
Testability gate complete"B3"currentPhase: "B3", brownfield.testability, brownfield.track, brownfield.testabilityChecklist recorded
Track A baseline green(still B3)brownfield.greenBaseline.features populated with per-feature test results
Track B docs complete(still B3)brownfield.behavioralDocs.features populated with per-feature scenario/checklist counts
Path selection (human gate)"assessment"brownfield.selectedPaths array recorded (e.g., ["modernize", "security"])
Assessment + planning done"increment-delivery"Increments generated, incrementPlan populated, delivery proceeds track-aware

When track is "hybrid", each increment in Phase 2 inherits its track from featureTracks. Track A increments follow the full test → contract → implement → verify cycle. Track B increments follow a doc-only path (behavioral docs + manual checklists instead of automated green baselines).

On Resume

  1. Read .spec2cloud/state.json
  2. Determine current increment and current step within it
  3. Re-validate by running the appropriate test suite:
    • Tests step: verify test files exist and compile
    • Implementation step: run tests for the current slice, compare to state
    • Verification step: check deployment status
  4. If results match state → continue from where you left off
  5. If results differ → update state to reflect reality, then continue

Mandatory Completion Checklist

The orchestrator MUST verify ALL of the following after every state write:

  • .spec2cloud/state.json is valid JSON (parseable without errors)
  • currentPhase reflects the actual phase the orchestrator is in
  • currentIncrement and increment step match the work just completed
  • lastUpdated timestamp is current
  • No fields are null/undefined that downstream skills depend on (e.g., adrs.nextNumber, incrementPlan)
  • State file is committed alongside the artifacts it describes (not orphaned)

BLOCKING: If state.json is invalid or inconsistent with actual artifacts, the resume skill will reconstruct the wrong position. Fix state before proceeding.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.