koopos/hermes/baby-app

Claude Code and agent skill by koopos/hermes

Trust tier 2
  • community
LLM review pending
Source check pending

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-app

SKILL.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

src/
screens/ # One file per screen (e.g. AddRecordScreen.js)
components/
GrowthChart.js # Pure SVG line chart for weight/height over age
db/
recordsRepository.js # All SQLite operations
navigation/
TabNavigator.js

Key Conventions

SQLite Schema (recordsRepository.js)
  • Uses expo-sqlite with getDatabase() / initDatabase() pattern.
  • ensureColumn(db, 'col', 'TYPE') for backward-compatible migrations — always use this when adding new columns to avoid recreating the table.
  • records table 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
  1. Add migration in initDatabase(): await ensureColumn(db, 'col_name', 'TEXT DEFAULT "");
  2. Update addRecord() params and SQL INSERT.
  3. Update updateRecord() params and SQL UPDATE.
  4. Add state variable(s) in the screen.
  5. 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 any setXxx calls that reference them inside handleSave's "clear form" block. A leftover setVaccinatedAt referencing a const d = new Date() from old useEffect scope will cause a "d is not defined" error. Always audit the reset block after removing any state.
Missing recordedAt re-initialization
  • Removing recordedAt state (thinking it's not needed) breaks the editable time input. The recordedAt state + setRecordedAt initializer 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 patch on a section that spans the middle of JSX can silently drop the trailing </View>, </ScrollView>, </KeyboardAvoidingView>, </SafeAreaView>, );, and const styles =. Always read_file the 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 paddingHorizontal must be 0 or the SVG will overflow the card boundaries. Keep paddingVertical for 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
  1. ensureColumn — database migration in initDatabase.
  2. addRecord — INSERT SQL + params.
  3. updateRecord — UPDATE SQL + params.
  4. Add state variables (useState).
  5. useEffect loadRecord — call setRecordType(record.feed_type) so edit mode restores the right type chip.
  6. handleSave — add if (isXxx) { validate } else { ... } branches, each calling the right save function.
  7. JSX — add to ['辅食', '体检', ...] type chip array, then add isXxx ? (<>...</>) : (<>...</>) branch in form.
  8. Audit reset block in handleSave — ensure every setXxx has a matching useState in scope.
Navigation
  • TabNavigator.js defines bottom tabs. AddRecordScreen is registered as AddRecord: { component, label }.
  • Other screens navigate to AddRecord via navigation.navigate('AddRecord', { recordType?, recordId? }).
  • recordId present → edit mode; recordType present → pre-select type.
Screen: AddRecordScreen (current)

Two-type mode: ['辅食', '体检']. recordType state drives which form renders.

辅食表单: 时长(分钟), 辅食内容, 体重(kg), 身高(cm), 喂养时间, 备注.

体检表单: 月龄(个月), 体重(kg), 身高(cm), 备注.

  • duration field is reused: minutes for 辅食, month count for 体检.
  • weight/height stored as TEXT in DB (not real numbers) — decimal-pad keyboard.
  • Edit mode: useEffect calls setRecordType(record.feed_type) to restore chip selection.
  • Save uses addRecord / updateRecord from 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 in useCallback to 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_height at month 0 from baby_profile with weight/height from records where feed_type = '体检'. getCheckupRecords() in recordsRepository fetches all checkup records sorted by duration (age in months).
  • MeScreen + GrowthChart 数据组装:从 baby_profile 取 birth_weight/birth_height,从 getCheckupRecords() 取体检记录过滤 weight/height,分别传 weightRecords/heightRecords prop。判断条件为 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/koopos/hermes/baby-app/badge)](https://verified-skill.com/skills/koopos/hermes/baby-app)

Something wrong with this skill or its page? Tell us.