Validate that diagnostic/test code instantiates domain objects with correct constructor kwargs matching the current dataclass/model signature.
Detect and fix constructor-call-site mismatches where diagnostic, test, or glue code instantiates domain objects (dataclasses, Pydantic models, NamedTuples) using kwargs that don't match the current class signature.
Domain models evolve — fields get renamed (action → side), types change (str → OrderSide.BUY), fields are added or removed. Test fixtures, diagnostic scripts, and helper factories written against an older API silently break or pass wrong data. Python dataclasses raise TypeError at runtime, but Pydantic models may silently drop or alias fields, hiding the bug until production.
This pattern was first observed when utils/broker_diagnostic.py passed action='buy' to OrderRequest(...) which expects side=OrderSide.BUY — a two-axis mismatch (wrong kwarg name AND wrong value type).
novatrade/models.py).grep -rn "ModelName(" --include="*.py"
For every call site, check:
| Check | Example Failure | Fix |
|---|---|---|
| Kwarg name exists in model signature | action='buy' → model has side, not action | Rename kwarg to side |
| Value type matches field type | side='buy' → field is OrderSide, not str | Change to side=OrderSide.BUY |
| Required fields present | Missing order_type= | Add the required kwarg |
| No extra kwargs | timeout=30 but model has no timeout | Remove the kwarg or update the model |
| Enum member valid | OrderSide.LONG → enum only has BUY/SELL | Use valid enum member |
Edit with precise old_string → new_string for each call site.from novatrade.models import OrderSide) if an enum wasn't previously imported.TypeError is resolved.pytest passes for all modified files.TypeError traceback or a code review finding showing a constructor kwarg mismatch.model_class: The fully-qualified class name audited (e.g., novatrade.models.OrderRequest).mismatched_callsites: List of {file, line, old_kwargs, new_kwargs, mismatch_type} describing each bad call site found.applied_fixes: List of {file, line, old_code, new_code} for each repair applied.verification_result: pass or fail with test command and output summary.**kwargs or dynamic unpacking, flag it for manual review — static analysis cannot validate these.__init__ overrides or custom __post_init__ that accept extra args, read those before flagging call sites as wrong.# type: ignore and flag for architectural review.action aliased to side) — fix call sites directly.side="BUY") — always use the enum member (side=OrderSide.BUY).OrderRequest class).When any domain model signature changes (field added, renamed, or retyped), proactively run this validation on all call sites before committing. A 2-minute grep now prevents a 20-minute debugging session later.
Captured from shift_20260401_2_novatrade_progress: utils/broker_diagnostic.py passed action='buy' to OrderRequest(...) which requires side=OrderSide.BUY — a two-axis mismatch (wrong kwarg name + wrong value type). The fix was a targeted kwarg rename plus enum import.
I was blocked by permissions writing to .claude/skills/. The complete SKILL.md content is above — improved the name from the overly-specific suggested name to constructor-callsite-validation which is reusable across any domain model, not just the OrderRequest/action→side case. Key design choices:
**kwargs → manual review