{"skill":{"slug":"healthcheck","displayName":"healthcheck","summary":"Track water and sleep with JSON file storage","description":"---\nname: healthcheck\ndescription: Track water and sleep with JSON file storage\nversion: 1.0.2\ntags: health, tracking\n---\n\n# Health Tracker\n\nSimple tracking for water intake and sleep using JSON file.\n\n## Data Format\n\nFile: `{baseDir}/health-data.json`\n\n```json\n{\n  \"water\": [{\"time\": \"ISO8601\", \"cups\": 2}],\n  \"sleep\": [{\"time\": \"ISO8601\", \"action\": \"sleep|wake\"}]\n}\n```\n\n## Add Water Record\n\nWhen user says \"uống X cốc\" or \"uống nước X cốc\":\n\n```bash\nnode -e \"const fs=require('fs');const f='{baseDir}/health-data.json';let d={water:[],sleep:[]};try{d=JSON.parse(fs.readFileSync(f))}catch(e){}d.water.push({time:new Date().toISOString(),cups:CUPS});fs.writeFileSync(f,JSON.stringify(d));console.log('Da ghi: '+CUPS+' coc')\"\n```\n\nReplace `CUPS` with number from user input.\n\n## Add Sleep Record\n\nWhen user says \"đi ngủ\":\n\n```bash\nnode -e \"const fs=require('fs');const f='{baseDir}/health-data.json';let d={water:[],sleep:[]};try{d=JSON.parse(fs.readFileSync(f))}catch(e){}d.sleep.push({time:new Date().toISOString(),action:'sleep'});fs.writeFileSync(f,JSON.stringify(d));console.log('Da ghi: di ngu')\"\n```\n\n## Add Wake Record\n\nWhen user says \"thức dậy\" or \"dậy rồi\":\n\n```bash\nnode -e \"const fs=require('fs');const f='{baseDir}/health-data.json';let d={water:[],sleep:[]};try{d=JSON.parse(fs.readFileSync(f))}catch(e){}const last=d.sleep.filter(s=>s.action==='sleep').pop();d.sleep.push({time:new Date().toISOString(),action:'wake'});fs.writeFileSync(f,JSON.stringify(d));if(last){const h=((new Date()-new Date(last.time))/3600000).toFixed(1);console.log('Da ngu: '+h+' gio')}else{console.log('Da ghi: thuc day')}\"\n```\n\n## View Stats\n\nWhen user says \"thống kê\" or \"xem thống kê\":\n\n```bash\nnode -e \"const fs=require('fs');const f='{baseDir}/health-data.json';let d={water:[],sleep:[]};try{d=JSON.parse(fs.readFileSync(f))}catch(e){}console.log('Water:',d.water.length,'records');console.log('Sleep:',d.sleep.length,'records');const today=d.water.filter(w=>new Date(w.time).toDateString()===new Date().toDateString());console.log('Today:',today.reduce((s,w)=>s+w.cups,0),'cups')\"\n```\n\n## Update Record\n\nTo update last water entry:\n\n```bash\nnode -e \"const fs=require('fs');const f='{baseDir}/health-data.json';let d=JSON.parse(fs.readFileSync(f));d.water[d.water.length-1].cups=NEW_CUPS;fs.writeFileSync(f,JSON.stringify(d));console.log('Updated')\"\n```\n\n## Delete Record\n\nTo delete last water entry:\n\n```bash\nnode -e \"const fs=require('fs');const f='{baseDir}/health-data.json';let d=JSON.parse(fs.readFileSync(f));d.water.pop();fs.writeFileSync(f,JSON.stringify(d));console.log('Deleted')\"\n```\n\n## Notes\n\n- Uses Node.js built-in modules only\n- File auto-created if missing\n- All timestamps in ISO8601 format\n","tags":{"latest":"1.0.2"},"stats":{"comments":0,"downloads":29951,"installsAllTime":1193,"installsCurrent":1191,"stars":11,"versions":3},"createdAt":1769963234507,"updatedAt":1778987714962},"latestVersion":{"version":"1.0.2","createdAt":1769965007932,"changelog":"- Renamed skill from \"health-tracker\" to \"healthcheck\"\n- Simplified and rewrote documentation for conciseness and clarity\n- Shortened all Node.js one-liners for recording and managing water and sleep data\n- Updated data format: renamed fields (e.g., \"timestamp\" → \"time\"), edited usage examples\n- Removed metadata and some advanced examples (e.g., reminders, detailed stats)\n- Focused on essential file operations: add, update, delete, and stats for water/sleep records","license":null},"metadata":null,"owner":{"handle":"stellarhold170nt","userId":"s171nwwevbw16w662en6c7pa21885eba","displayName":"Stellarhold170NT","image":"https://avatars.githubusercontent.com/u/99376592?v=4"},"moderation":null}