koopos/hermes/baby-app
Claude Code and agent skill by koopos/hermes
- community
Checking that the SKILL.md file is still in the repository.
React Native Expo baby tracking app at ~/github/baby/. Covers app structure, SQLite schema/conventions, screen patterns, and recurring modifications. Triggered when working on this specific project.
Install
npx vskill@latest install koopos/hermes/baby-appSKILL.md
The same SKILL.md was published earlier as koopos/hermes/baby-app.
baby-app
Project at ~/github/baby/. React Native Expo app for tracking a baby's feeding, solid food, weight, height, vaccines, diapers, and AD supplements.
Project Structure
Key Conventions
SQLite Schema (recordsRepository.js)
- Uses
expo-sqlitewithgetDatabase()/initDatabase()pattern. ensureColumn(db, 'col', 'TYPE')for backward-compatible migrations — always use this when adding new columns to avoid recreating the table.recordstable core columns:id, record_type, feed_type, duration, notes, solid_food, created_at, recorded_at. Additional columns added via migration:vaccine_dose, hospital, vaccinated_at, weight, height.
Adding a New Column to records
- Add migration in
initDatabase():await ensureColumn(db, 'col_name', 'TEXT DEFAULT ""); - Update
addRecord()params and SQL INSERT. - Update
updateRecord()params and SQL UPDATE. - Add state variable(s) in the screen.
- Wire into form inputs, load in
useEffect, pass to save function.
Pitfalls
SafeArea + Modal/Overlay 位置
- `apiKeyOverlay` 被状态栏遮挡:弹窗
position: 'absolute'+justifyContent: 'center'时,Android 凹口屏的状态栏高度不计入,导致弹窗偏上内容被切。修复:外层justifyContent: 'flex-start',用useSafeAreaInsets()获取顶部安全边距,在包裹层加paddingTop: Math.max(insets.top, 24)。对所有全屏 overlay(Modal、Picker、DateTimePicker 弹窗)都适用此模式。
Android TextInput secureTextEntry 禁用粘贴
- `secureTextEntry: true` 时 Android 系统禁用粘贴菜单(安全限制)。修复:移除
secureTextEntry,改用明文输入 +autoCapitalize="none"+autoCorrect={false}配合隐私说明文字。API Key 类敏感输入不需要遮蔽,因为粘贴便利性优先级更高(用户从密码管理器复制比手敲更安全)。若必须遮蔽,另开"显示/隐藏"切换按钮而非依赖系统安全模式。
时区边界偏移
- `new Date(y, m - 1, d).getDay()` 时区边界偏移:在 GMT+8 时区,
new Date(2026, 4, 1)(5月1日当地午夜 00:00)等价于 UTC 4月30日 16:00,getDay()返回的是4月30日的星期几,导致整个月历错位。即使传入12(noon)也不能完全消除歧义。正确修复:始终使用 UTC 方法,不依赖本地时区。
```js // ❌ 错误:依赖本地时区,getDay() 在某些设备上可能返回前一天的星期 const firstDay = new Date(viewYear, viewMonth - 1, 1, 12); const dow = firstDay.getDay();
// ✅ 正确:Date.UTC + getUTCDay() 永远基于 UTC 日历 const utcDate = Date.UTC(viewYear, viewMonth - 1, 1); const firstDay = new Date(utcDate); const dow = firstDay.getUTCDay(); const daysInMonth = new Date(Date.UTC(viewYear, viewMonth, 0)).getUTCDate(); `` 影响范围:calendarCells 的 startOffset 计算、getWeekdayIndex` 函数。这两个函数必须同时修复,否则 offset 和单元格内的星期标签会不一致。
Dangling variable in scope cleanup
- When removing old state variables (e.g.
vaccinatedAt), also remove anysetXxxcalls that reference them insidehandleSave's "clear form" block. A leftoversetVaccinatedAtreferencing aconst d = new Date()from olduseEffectscope will cause a "d is not defined" error. Always audit the reset block after removing any state.
Missing recordedAt re-initialization
- Removing
recordedAtstate (thinking it's not needed) breaks the editable time input. TherecordedAtstate +setRecordedAtinitializer must be kept — it drives the form's time input field, even when the screen is locked to one record type.
patch corruption of long JSX
- AddRecordScreen's JSX is ~200 lines. Using
patchon a section that spans the middle of JSX can silently drop the trailing</View>,</ScrollView>,</KeyboardAvoidingView>,</SafeAreaView>,);, andconst styles =. Alwaysread_filethe full file (or at least the last 50 lines + line count) before patching to know the true end state. For large JSX rewrites, replace the entire{condition ? () : ()}block as one unit rather than patching sub-lines.
cardStyles.card paddingHorizontal must be 0
- When the SVG inside a card has a fixed pixel width (e.g. 340px), the card's
paddingHorizontalmust be 0 or the SVG will overflow the card boundaries. KeeppaddingVerticalfor spacing, but horizontally the SVG and card edge must align.
``js // ❌ paddingHorizontal: 6 → SVG 340px overflows by 12px total // ✅ paddingHorizontal: 0 → SVG fits exactly paddingHorizontal: 0, paddingVertical: 12, ``
ensureColumn tableName 参数
- 第 4 个参数
tableName默认为'records'。对baby_profile表加列时必须显式传入'baby_profile',否则迁移不生效,导致 "no such column" 错误。
``js // ✅ 正确 await ensureColumn(db, 'birth_weight', 'TEXT DEFAULT ""', 'baby_profile'); await ensureColumn(db, 'birth_height', 'TEXT DEFAULT ""', 'baby_profile'); // ❌ 错误:会检查 records 表而不是 baby_profile await ensureColumn(db, 'birth_weight', 'TEXT DEFAULT ""'); ``
baby_profile vs records
- 两张独立的表。
baby_profile存宝宝静态信息(name, birthday, birth_weight, birth_height);records存每条事件日志(喂养、体检等)。两张表加字段都走ensureColumn迁移模式。
Adding a New Record Type to AddRecordScreen
ensureColumn— database migration ininitDatabase.addRecord— INSERT SQL + params.updateRecord— UPDATE SQL + params.- Add state variables (
useState). useEffectloadRecord — callsetRecordType(record.feed_type)so edit mode restores the right type chip.handleSave— addif (isXxx) { validate } else { ... }branches, each calling the right save function.- JSX — add to
['辅食', '体检', ...]type chip array, then addisXxx ? (<>...</>) : (<>...</>)branch in form. - Audit reset block in
handleSave— ensure everysetXxxhas a matchinguseStatein scope.
Navigation
TabNavigator.jsdefines bottom tabs.AddRecordScreenis registered asAddRecord: { component, label }.- Other screens navigate to AddRecord via
navigation.navigate('AddRecord', { recordType?, recordId? }). recordIdpresent → edit mode;recordTypepresent → pre-select type.
Screen: AddRecordScreen (current)
Two-type mode: ['辅食', '体检']. recordType state drives which form renders.
辅食表单: 时长(分钟), 辅食内容, 体重(kg), 身高(cm), 喂养时间, 备注.
体检表单: 月龄(个月), 体重(kg), 身高(cm), 备注.
durationfield is reused: minutes for 辅食, month count for 体检.weight/heightstored as TEXT in DB (not real numbers) —decimal-padkeyboard.- Edit mode:
useEffectcallssetRecordType(record.feed_type)to restore chip selection. - Save uses
addRecord/updateRecordfrom recordsRepository.
Screen: MeScreen (成长概览)
The profile/home screen. Key patterns:
- Focus-to-refresh: uses
useFocusEffect(useCallback(() => { load...(); return () => {}; }, []))to reload data every time the screen gains focus. Always wrap inuseCallbackto prevent infinite loops. - `GrowthChart` 组件 (
src/components/GrowthChart.js):纯 SVG 折线图,分体重/身高两张独立卡片。 - Props:
weightRecords,heightRecords(各为[{age, value}]数组),birthWeight(number|null),birthHeight(number|null),maxAge。 - 出生数据在组件内部拼接到月龄 0 位置。
- WHO 参考曲线:三条线 P3(低端虚线)/ 中位数(灰色实线)/ P97(高端虚线),线性插值。浅色填充带 P3–P97 范围(透明度 16%)。
- 参考线颜色为灰色
#CCCCCC,与实测折线(体重蓝#4A9EFF/ 身高珊瑚#FF6E68)明确区分。 - 图例:实测值 / 标准区间 / 标准中位。
- card paddingHorizontal 必须为 0:SVG 固定宽度 340px,若 card 有水平 padding 会导致溢出。
- Chart data assembly: merge
birth_weight/birth_heightat month 0 frombaby_profilewithweight/heightfromrecordswherefeed_type = '体检'.getCheckupRecords()inrecordsRepositoryfetches all checkup records sorted byduration(age in months). - MeScreen + GrowthChart 数据组装:从
baby_profile取birth_weight/birth_height,从getCheckupRecords()取体检记录过滤weight/height,分别传weightRecords/heightRecordsprop。判断条件为checkupRecords.length > 0 || profile?.birth_weight || profile?.birth_height。
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/software-development/baby-app/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/koopos/hermes/baby-app)