一键导入
project-state-management
Use when initializing, updating, or resuming project state with checkpointing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when initializing, updating, or resuming project state with checkpointing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | project-state-management |
| description | Use when initializing, updating, or resuming project state with checkpointing. |
| allowed-tools | Read, Write, Glob, Grep |
This skill teaches the Framework Developer Orchestrator how to track and persist project state across sessions, ensuring continuity and enabling seamless resumption of work.
The state management system maintains a single source of truth for:
State File Location: .framework-blueprints/00-project-state.json
Claude Code has a limited context window that gets compacted during long sessions. This causes:
Chat = Volatile Memory (gets compacted, loses details) Files = Persistent Memory (always accurate if maintained)
This skill enforces:
Initialize a new state file when:
/framework-dev{
"projectName": "",
"version": "1.0.0",
"createdAt": "",
"updatedAt": "",
"currentPhase": 1,
"phases": {
"1": { "status": "in_progress", "startedAt": "", "progress": 0 },
"2": { "status": "pending", "progress": 0 },
"3": { "status": "pending", "progress": 0 },
"4": { "status": "pending", "progress": 0 },
"5": { "status": "pending", "progress": 0 },
"6": { "status": "pending", "progress": 0 }
},
"decisions": [],
"modules": [],
"agents": [],
"handoffs": [],
"risks": [],
"checkpoints": [],
"criticalDetails": {
"ports": {},
"envVars": [],
"nonStandardPaths": {},
"apiQuirks": []
}
}
During long sessions, Claude's context window compacts. Details like:
JWT_SECRET_KEY environment variable namesrc/core/auth/ instead of src/auth/...get lost because they seem "minor" but are critical for correct code.
Create checkpoints at:
| Trigger | Action |
|---|---|
| Phase 50% complete | Generate state-summary-phase-N.md |
| Phase 100% complete | Generate full checkpoint + update state |
| Before long task | Capture current critical details |
| After error recovery | Re-capture state from files |
User runs /checkpoint | Full context refresh |
Create state-summary-phase-N.md with this structure:
# Phase [N] State Summary
**Generated:** [ISO timestamp]
**Phase:** [Name]
**Progress:** [X]%
## Critical Details (PRESERVE THESE)
### Environment Variables
- `DATABASE_URL`: Connection string for PostgreSQL
- `JWT_SECRET_KEY`: Used in src/core/auth/jwt.ts
- `REDIS_URL`: Cache connection (optional)
### Ports & Connections
- PostgreSQL: 5432
- Redis: 6379
- API Server: 3000
- Frontend Dev: 5173
### Non-Standard Paths
| Expected | Actual | Reason |
|----------|--------|--------|
| src/auth/ | src/core/auth/ | Grouped with core utilities |
| src/db/ | src/infrastructure/database/ | Hexagonal architecture |
### API Quirks
- POST /api/users returns 201, not 200
- All dates are ISO 8601 UTC, not local
- Pagination uses cursor, not offset
- Auth header format: `Bearer <token>` (space required)
### Variable Names (Exact)
- User ID field: `userId` (not `user_id` or `id`)
- Timestamp fields: `createdAt`, `updatedAt` (camelCase)
- JWT payload: `{ sub: userId, iat: timestamp, exp: timestamp }`
## Decisions Made This Phase
1. [D001] Chose PostgreSQL over MongoDB - [source URL]
2. [D002] Using Hexagonal Architecture - [source URL]
## Tasks Completed
- [x] T001: Database schema design
- [x] T002: Auth module structure
- [ ] T003: JWT implementation (in progress)
## Open Questions
- Should refresh tokens be stored in Redis or DB?
- Rate limiting strategy TBD
## Blockers
- None currently
NEVER do this:
// BAD: Overwrites detailed state with summary
{
"decisions": ["Used PostgreSQL"]
}
ALWAYS do this:
// GOOD: Preserves existing details, adds new
{
"decisions": [
...existingDecisions,
{
"id": "D003",
"topic": "Cache Strategy",
"choice": "Redis",
"source": "https://redis.io/docs/",
"reasoning": "Need sub-ms latency for session lookup",
"date": "2025-01-03T10:30:00Z"
}
]
}
// 1. READ current state
const currentState = await readFile('.framework-blueprints/00-project-state.json');
const state = JSON.parse(currentState);
// 2. MODIFY only what changed
state.decisions.push(newDecision);
state.updatedAt = new Date().toISOString();
state.phases["3"].progress = 75;
// 3. WRITE complete state back
await writeFile('.framework-blueprints/00-project-state.json', JSON.stringify(state, null, 2));
Update the state file IMMEDIATELY after every significant action:
| Event | State Fields to Update | Priority |
|---|---|---|
| Decision made | decisions[], updatedAt | IMMEDIATE |
| Module defined | modules[], updatedAt | IMMEDIATE |
| Agent assigned | agents[], updatedAt | IMMEDIATE |
| Task completed | phases[n].progress, updatedAt | IMMEDIATE |
| Risk identified | risks[], updatedAt | IMMEDIATE |
| Phase transition | currentPhase, phases[n].status | IMMEDIATE |
| Critical detail found | criticalDetails, updatedAt | IMMEDIATE |
When you encounter specifics, record them immediately:
{
"criticalDetails": {
"ports": {
"postgresql": 5432,
"redis": 6379,
"api": 3000
},
"envVars": [
{ "name": "DATABASE_URL", "description": "PostgreSQL connection", "required": true },
{ "name": "JWT_SECRET_KEY", "description": "JWT signing key", "required": true },
{ "name": "REDIS_URL", "description": "Redis connection", "required": false }
],
"nonStandardPaths": {
"auth": { "expected": "src/auth/", "actual": "src/core/auth/", "reason": "Core grouping" },
"config": { "expected": "src/config/", "actual": "src/bootstrap/config.ts", "reason": "Single file" }
},
"apiQuirks": [
"POST /users returns 201 not 200",
"All timestamps are UTC ISO 8601",
"Cursor pagination, not offset"
]
}
}
When the user returns to continue work:
Check for state file:
ls .framework-blueprints/00-project-state.json
Read state file:
cat .framework-blueprints/00-project-state.json
Find and read all checkpoint summaries:
ls .framework-blueprints/*/state-summary-*.md
cat .framework-blueprints/05-execution/state-summary-phase-5.md
Display resume summary to user
Confirm with user before proceeding
## Project Resume: [projectName]
**Last Updated:** [date]
**Current Phase:** [N] - [Name] ([X]% complete)
### Restored Critical Details
- Database: PostgreSQL on port 5432
- Auth: JWT with refresh tokens
- Non-standard paths detected and loaded
### Phase Progress
- [x] Phase 1: Discovery (100%)
- [x] Phase 2: Structure (100%)
- [x] Phase 3: API Planning (100%)
- [~] Phase 4: Agent Assignment (50%)
- [ ] Phase 5: Execution (0%)
- [ ] Phase 6: Integration (0%)
### Active Task
T-008: Assign frontend tasks to agents
### Open Blockers
None
**Resume from Phase 4?** (yes/no/review)
Before using state, validate:
function validateState(state: unknown): ValidationResult {
const errors: string[] = [];
const warnings: string[] = [];
// Required fields
const requiredFields = [
'projectName', 'version', 'createdAt', 'updatedAt',
'currentPhase', 'phases', 'decisions', 'modules',
'agents', 'handoffs', 'risks'
];
for (const field of requiredFields) {
if (!(field in state)) {
errors.push(`Missing required field: ${field}`);
}
}
// Phase consistency
const currentPhase = state.currentPhase;
for (let i = 1; i < currentPhase; i++) {
if (state.phases[String(i)]?.status !== 'completed') {
warnings.push(`Phase ${i} should be completed (current phase is ${currentPhase})`);
}
}
// Decision sources
state.decisions?.forEach((d, i) => {
if (!d.source) {
warnings.push(`Decision ${i} missing source URL`);
}
});
return { valid: errors.length === 0, errors, warnings };
}
If validation finds issues:
Create backups at:
/checkpoint).framework-blueprints/
├── 00-project-state.json # Current state
├── backups/
│ ├── state-2025-01-03T10-00-00Z-phase-transition.json
│ ├── state-2025-01-03T11-30-00Z-checkpoint.json
│ └── state-2025-01-03T12-00-00Z-manual.json
└── history/
└── decisions.log # Append-only decision log
# List available backups
ls -la .framework-blueprints/backups/
# Restore specific backup
cp .framework-blueprints/backups/state-2025-01-03T10-00-00Z.json \
.framework-blueprints/00-project-state.json
Before ANY write operation:
1. Read `.framework-blueprints/00-project-state.json`
- Know current phase and progress
- Load critical details (ports, paths, vars)
2. Read `.framework-blueprints/03-api-planning/api-contracts.md` (if exists)
- Know correct endpoints
- Know request/response schemas
3. Read latest `state-summary-phase-*.md` (if exists)
- Restore any "minor" details that matter
After ANY significant action:
1. Update `00-project-state.json` immediately
- Use Read-Modify-Write pattern
- Never overwrite with summary
2. If at 50% or 100% of phase:
- Generate `state-summary-phase-N.md`
- Include ALL critical details
3. Announce completion:
- "Task [X] finished and committed to blueprints"
- Signal that task details can be cleared from chat
During Phase 5 (Execution):
progress-tracker.mdupdatedAt timestamp00-project-state.jsonstate-summary-*.md filesapi-contracts.md if Phase 3+When an error occurs:
| Error | Likely Cause | Fix |
|---|---|---|
| 404 on API call | Wrong endpoint | Re-read api-contracts.md |
| Import not found | Wrong path | Grep for correct path |
| Type mismatch | Schema changed | Re-read api-contracts.md |
| Test failure | Outdated assumption | Re-read state-summary |
| Missing env var | Forgot to document | Add to criticalDetails |
handoff-protocol - Details on agent handoff proceduresllm-capability-matching - How to assign agents based on capabilitiesarchitecture-decision-records - ADR format for decisionsapi-design-principles - API contract designreferences/state-schema.jsonEnhanced planning system combining UltraPlan's 6-phase pipeline with Clear Thought's 11 structured thinking frameworks. Takes a plain-English idea and produces a complete, AI-executable implementation plan with rigorous thinking at every phase.
Use when defining API endpoints, designing request/response schemas, or establishing API contracts during framework planning.
Use when documenting architectural decisions, comparing technology options, or recording rationale for framework choices.
Use when selecting architecture patterns (MVC, hexagonal, clean, microservices) for a new project.
Use when creating or updating blueprint files in .framework-blueprints/ directory.
Use when designing CI/CD pipelines or creating GitHub Actions / GitLab CI configuration.