Skip to content

Commit 973a82f

Browse files
committed
chore: Add CLAUDE.md to register code standards with Claude agent
1 parent 6ed3c0d commit 973a82f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Claude Code conventions for this repo
2+
3+
## Python style
4+
5+
- **f-strings for all logging.** Use `_logger.info(f"...")` — never `%s` interpolation.
6+
- **Keyword-only arguments.** Add `*` to function definitions to make all parameters keyword-only, even when there is only one parameter.
7+
- **Unused parameters.** Prefix unused function parameters with `_` (e.g. `_old_value`, `_initiator`) and add type hints to every parameter, used or not.
8+
- **StrEnum for known string sets.** When a parameter or constant is drawn from a fixed set of strings, define a `StrEnum` for it rather than using bare string literals.
9+
10+
## SQLAlchemy
11+
12+
- **Derive schema metadata from models.** Never hardcode table names, column names, or column types as strings. Reference them from the SQLAlchemy model (e.g. `Model.__table__.c.column_name`) and compile types with `col.type.compile(dialect=engine.dialect)`.
13+
- **Single transaction per logical operation.** Wrap all related DDL or DML mutations in one `with engine.connect() as conn` / `conn.commit()` block.
14+
- **Log migrations.** Every migration step (ALTER TABLE, backfill, index creation) should log before it runs and handle `OperationalError` for concurrent deployments gracefully.
15+
16+
## Data safety
17+
18+
- **Never delete or overwrite data files without explicit confirmation.** Use `sqlite://` (in-memory) or a `tempfile` for smoke tests and migration verification — never reference or delete files under `data/`.

0 commit comments

Comments
 (0)