garmin-health-data
CLAUDE.md122 starsChanged 14 months agoApache-2.0View on GitHub
The most important source of truth is the /README.md file, which contains the latest information about the project. You MUST read and understand the README.md file in order to provide accurate and relevant responses and coding assistance. The README.md file includes: - Introduction: Project overview, objectives, and features for extracting Garmin Connect health data to a local SQLite database. - Features: Comprehensive data extraction, automatic deduplication, FIT file processing, and flexible authentication. - Installation: Installation instructions via pip or from…
- Installs packages
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
19 rules. About 0 are common, 10 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Use SQLFluff to format the DDL file (configured in pyproject.toml):
- Distinctive: line 45
When modifying the schema:
- Very specific: line 46
Update tables.ddl with new/modified table definitions.
- Very specific: line 47
Update corresponding SQLAlchemy model in models.py to match.
- Distinctive: line 82
Autoflake: Remove unused imports and variables.
- Very specific: line 85
Docstring format: Use :param and :return format.
- Distinctive: line 95
Before completing any code changes:
- Very specific: line 126
Test naming: Use test_* pattern for test functions.
- Distinctive: line 128
Fixtures: Use pytest fixtures for common setup.
- Distinctive: line 132
When working with authentication code:
- Distinctive: line 134
Use environment variables or secure credential storage.
- Very specific: line 135
Follow existing patterns in garmin_health_data/auth.py.
- Distinctive: line 140
When adding new data processors:
- Very specific: line 142
Use SQLAlchemy models from models.py.
- Distinctive: line 145
Use upsert patterns for deduplication.
- Very specific: line 149
Don't pass triple-quoted strings to sqlalchemy.text(...): docformatter may treat them as docstrings and append a period (DO NOTHING becomes …
- Distinctive: line 153
When modifying CLI commands:
- Very specific: line 154
Use Click framework (existing in garmin_health_data/cli.py).
- Distinctive: line 157
Follow existing command structure and naming conventions.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
README.md
The most important source of truth is the /README.md file, which contains the latest information about the project. You MUST read and understand the README.md file in order to provide accurate and relevant responses and coding assistance.
The README.md file includes:
- Introduction: Project overview, objectives, and features for extracting Garmin Connect health data to a local SQLite database.
- Features: Comprehensive data extraction, automatic deduplication, FIT file processing, and flexible authentication.
- Installation: Installation instructions via pip or from source.
- Quick Start: Authentication setup and basic usage examples.
- Usage: Detailed commands for data extraction, initialization, and status checking.
- Data Categories: Complete list of available data types with extraction frequency.
- Database Schema: Schema documentation with inline comments, SQLite adaptations, and table structure.
- Repository Structure: Overview of code organization (
garmin_health_data/,tests/). - Development: Setup instructions for contributors.
- Comparisons: Feature comparison with other tools (garmindb, garmy, etc.).
Database Schema Architecture
Following the openetl pattern, the database schema is defined in garmin_health_data/tables.ddl:
- tables.ddl: Single source of truth for database schema with inline SQL comments.
- models.py: SQLAlchemy ORM models for data processing ONLY (not schema generation).
- db.py: Executes tables.ddl to create schema automatically.
Schema Documentation
Inline comments in tables.ddl are preserved in the SQLite database and can be viewed:
sqlite3 garmin_data.db "SELECT sql FROM sqlite_master WHERE type='table' AND name='activity';"Formatting DDL Files
Use SQLFluff to format the DDL file (configured in pyproject.toml):
python -m sqlfluff fix garmin_health_data/tables.ddlMaking Schema Changes
When modifying the schema:
- Update
tables.ddlwith new/modified table definitions. - Update corresponding SQLAlchemy model in
models.pyto match. - Format with SQLFluff.
- Users must re-initialize the database or manually apply changes.
Code Execution Environment
This project uses standard Python packaging with development dependencies specified in pyproject.toml.
Installation
# Install package in development mode
pip install -e ".[dev]"Running Tests
# Run all tests with coverage
pytest
# Run specific test file
pytest tests/test_processor.py
# Run with verbose output
pytest -vFormatting Standards
This project follows the same code quality standards as openetl:
Python Formatting
- Black: Line length 88, Python 3.9+ target.
- Autoflake: Remove unused imports and variables.
- Docformatter: Format docstrings consistently.
- Type hints: Required for all function parameters and return values.
- Docstring format: Use
:paramand:returnformat.
SQL Formatting
- SQLFluff: Format SQL files (configured in
pyproject.toml). - Dialect: SQLite.
- Style: Leading commas, 88 character line length.
Quality Checklist
Before completing any code changes:
- Module docstring present
- Imports properly organized and sorted, no unused imports
- All functions have type hints
- All docstrings use
:paramand:returnformat - Proper spacing and blank lines throughout file
- Black-compliant format
- No trailing whitespace
- Consistent indentation (4 spaces)
- Periods at the end of ALL sentences (comments, docstrings, log messages)
- No line longer than 88 characters
- Final newline at end of file
Automated Formatting
Format Python files:
python -m black garmin_health_data/
python -m autoflake --in-place --remove-all-unused-imports -r garmin_health_data/
python -m docformatter --in-place -r garmin_health_data/Format SQL files:
python -m sqlfluff fix garmin_health_data/tables.ddlTesting Requirements
- Coverage: Maintain high test coverage for all new code.
- Test naming: Use
test_*pattern for test functions. - Test organization: Mirror source structure in
tests/directory. - Fixtures: Use pytest fixtures for common setup.
Authentication Handling
When working with authentication code:
- Never hardcode credentials.
- Use environment variables or secure credential storage.
- Follow existing patterns in
garmin_health_data/auth.py. - Respect token expiration and refresh logic.
Data Processing Patterns
When adding new data processors:
- Follow existing patterns in
garmin_health_data/processor.py. - Use SQLAlchemy models from
models.py. - Implement proper error handling and logging.
- Handle NULL values and missing data gracefully.
- Use upsert patterns for deduplication.
Raw SQL Strings (docformatter Footgun)
Don't pass triple-quoted strings to sqlalchemy.text(...): docformatter may treat them as docstrings and append a period (DO NOTHING becomes DO NOTHING.), corrupting the SQL. Use implicitly concatenated regular string literals instead. See #44 / #45.
CLI Development
When modifying CLI commands:
- Use Click framework (existing in
garmin_health_data/cli.py). - Provide helpful error messages.
- Include progress indicators for long-running operations.
- Follow existing command structure and naming conventions.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

