mod-010-avoid-splatted-kwargs-in-constructors

mod-010-avoid-splatted-kwargs-in-constructors is a cursor rule for Cursor from NVIDIA/physicsnemo. It costs 25 tokens per session (470 once invoked), scanned A, original, Apache-2.0.

A coding rule for model constructors, which are functions that create model objects. It recommends passing grouped configuration in an explicit dictionary instead of using `**kwargs`, which hides parameter names.

In plain words
What is it for?
It guides the design and review of Python model APIs that pass configuration to submodules.
Why use it?
Explicit parameters make the constructor easier to understand and reduce name conflicts and type-checking problems.

Cursor rule for Cursor ✓ vendor

Written for Cursor: installed under .cursor/.

Good fit It guides the design and review of Python model APIs that pass configuration to submodules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors
About the project

PhysicsNeMo is an open-source PyTorch framework for creating, training, and fine-tuning machine-learning models for physics, scientific computing, and engineering. Researchers and engineers use its reusable components and training recipes for applications such as aerodynamics, weather forecasting, structural mechanics, geophysics, and thermal design. The catalogue entries provide rules and skills for working with PhysicsNeMo projects.

NVIDIA/physicsnemo · 3,418 stars · on GitHub · developer.nvidia.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/NVIDIA/physicsnemo

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mod-010-avoid-splatted-kwargs-in-constructors

README.md
[![agentmods](https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors/github.svg)](https://agentmods.dev/rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors)
Your own site
<a href="https://agentmods.dev/rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors"><img src="https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mod-010-avoid-splatted-kwargs-in-constructors

Your own site · 80×15
<a href="https://agentmods.dev/rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors"><img src="https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-010-avoid-splatted-kwargs-in-constructors.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 470 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.00470
Opus 5.5 $0.00010 $0.00188
Sonnet 5.5 $0.00005 $0.00094
Haiku 4.5 $0.00003 $0.00047

Measured 2mo ago against content hash 938721fdde9f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mod-010-avoid-splatted-kwargs-in-constructors scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/mod-010-avoid-splatted-kwargs-in-constructors.mdc · 67 lines

What it actually says

When designing model constructor APIs, rule MOD-010 should be followed. Explicitly reference "Following rule MOD-010, which recommends explicit Dict parameters instead of splatted kwargs..." when deciding constructor parameter design.

MOD-010: Avoid splatted kwargs in model constructors

Description:

Passing splatted arguments like **kwargs_for_submodules should be avoided in model constructors as it might create conflicts in the names of these kwargs and makes the API unclear.

Instead, it is recommended to pass non-splatted arguments in the form of a Dict when configuration for submodules needs to be passed through. This makes parameter passing explicit and avoids naming conflicts.

Rationale:

Splatted kwargs obscure the actual parameters being passed, make type checking impossible, and can lead to subtle bugs from name conflicts. Explicit dictionary parameters make the API clearer and enable better IDE support and error detection.

Example:

# Good: Explicit dict parameter
class MyModel(Module):
    def __init__(
        self,
        input_dim: int,
        output_dim: int,
        encoder_config: Optional[Dict[str, Any]] = None
    ):
        encoder_config = encoder_config or {}
        self.encoder = Encoder(input_dim=input_dim, **encoder_config)

# Usage:
model = MyModel(
    input_dim=64,
    output_dim=32,
    encoder_config={"hidden_dim": 128, "num_layers": 3}
)

Anti-pattern:

# WRONG: Splatted kwargs
class MyModel(Module):
    def __init__(
        self,
        input_dim: int,
        output_dim: int,
        **encoder_kwargs  # WRONG: Unclear what's accepted
    ):
        self.encoder = Encoder(input_dim=input_dim, **encoder_kwargs)
        # Risk of name conflicts, unclear API

# Usage - unclear what parameters are valid:
model = MyModel(input_dim=64, output_dim=32, hidden_dim=128, num_layers=3)
# Are hidden_dim and num_layers for MyModel or Encoder? Unclear!
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 67 lines · 25 tokens per session scan A 938721fdde9f

Subscribe to this mod's changes

mod-010-avoid-splatted-kwargs-in-constructors is a cursor rule published in the GitHub repository NVIDIA/physicsnemo (3,418 stars, last pushed yesterday), licensed Apache-2.0. It adds 25 tokens to every session and 470 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

mod-010-avoid-splatted-kwargs-in-constructors compared with cursor rules from other repositories

mod-010-avoid-splatted-kwargs-in-constructors next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
mod-010-avoid-splatted-kwargs-in-constructorsNVIDIA/physicsnemoCursor rule3.4kyesterdayApache-2.0A25Cursor
python_libstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
typescriptstreamlit/streamlitCursor rule46kyesterdayApache-2.0A5,351Cursor
specsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
workflowsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
skillsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
python_testsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor