| name | datastore-review |
| description | Audit all DataStore usage in the project for correctness, security, and best practices. Checks for session locking, pcall usage, schema versioning, budget management, and common anti-patterns. |
/datastore-review — DataStore Audit
Delegate to: datastore-architect
Steps:
- Search for all DataStore usage:
grep -rn "DataStoreService" src/
- Search for all MemoryStore usage:
grep -rn "MemoryStoreService" src/
- Search for all BindToClose handlers:
grep -rn "BindToClose" src/
- Search for PlayerAdded / PlayerRemoving:
grep -rn "PlayerAdded\|PlayerRemoving" src/
Check each DataStore operation for:
Critical (must fix):
Important (should fix):
Nice to have:
Output:
Generate a report with findings organized by severity:
# DataStore Review
## Scope
Files analyzed: X
DataStore references found: Y
MemoryStore references found: Z
## Critical Findings
1. **[filepath:line]**: [issue]
- Impact: [data loss / duplication / exploit]
- Fix: [specific code change]
## Important Findings
...
## Anti-Patterns Detected
...
## Recommended Architecture
[If no DataStore code exists yet, suggest the recommended architecture pattern:]
- ServerStorage/PlayerData/PlayerDataService.lua (main API)
- ServerStorage/PlayerData/SessionLock.lua (lock mechanism)
- ServerStorage/PlayerData/Schema.lua (current schema + migrations)
- ServerStorage/PlayerData/Serializer.lua (compress/decompress)
If no DataStore code exists yet, suggest the recommended architecture pattern and offer to scaffold it via datastore-architect.