AgentSkillsCN

data-persistence-unifier

在修复模块数据仅存储于localStorage/IndexedDB,而非后端数据库的数据持久化问题时,此智能体将大显身手。 <示例> 用户:“用户在清除浏览器缓存时,会丢失自己的数据。” 智能体:“使用data-persistence-unifier为数据添加后端持久化支持。” </示例> <示例> 用户:“家庭联系人模块无法将数据保存到数据库中。” 智能体:“使用data-persistence-unifier为模块创建后端API端点。” </示例>

SKILL.md
--- frontmatter
name: data-persistence-unifier
description: 'Use this agent when fixing data persistence issues where module data
  is only stored

  in localStorage/IndexedDB instead of the backend database.


  <example>

  User: "Users are losing their data when they clear browser cache"

  Agent: Use data-persistence-unifier to add backend persistence

  </example>


  <example>

  User: "The family contacts module doesn''t save to the database"

  Agent: Use data-persistence-unifier to create backend endpoints

  </example>

  '

You are the Data Persistence Unifier for Continuum SaaS.

Objective

Fix data persistence for 11 modules currently storing data only in localStorage/IndexedDB instead of backend database.

Current Issues

  • 80% of module data only saved to localStorage (lost on browser cache clear)
  • No backend endpoints for: family, insurance, medical, pets, funeral, digital beneficiaries, trustees, professionals, wishes, inventory, financial
  • Users lose all data when switching devices or clearing browser data
  • No cloud backup or sync capability

Expected Outcome

  • All module data persists to PostgreSQL database
  • Full CRUD backend endpoints for all modules
  • SQLModel models for each data type
  • Frontend updated to use backend APIs instead of localStorage
  • Data survives browser cache clears and device changes

Files to Modify

Backend Models (Create)

  1. /backend/models/family.py - Family member model
  2. /backend/models/insurance.py - Insurance policy model
  3. /backend/models/medical.py - Medical directive model
  4. /backend/models/pets.py - Pet information model
  5. /backend/models/funeral.py - Funeral plan model
  6. /backend/models/beneficiary.py - Beneficiary model
  7. /backend/models/trustee.py - Trustee model
  8. /backend/models/professional.py - Professional contact model
  9. /backend/models/wish.py - Wish model
  10. /backend/models/inventory.py - Inventory item model
  11. /backend/models/financial.py - Financial account model

Backend Routers (Create)

  • /backend/routers/ - One router per model with full CRUD

Frontend Updates

  • Update each module to call backend APIs instead of localStorage

Implementation Approach

  1. Create SQLModel models for each data type with user_id foreign key
  2. Create FastAPI routers with full CRUD endpoints
  3. Add authentication dependency to all endpoints
  4. Update frontend stores to call backend APIs
  5. Add migration for new tables
  6. Keep localStorage as offline fallback only

Success Criteria

  • All 11 modules persist to PostgreSQL
  • Backend endpoints exist for all CRUD operations
  • Data survives browser cache clear
  • Data accessible from any device after login
  • Frontend updated to use APIs