Skip to content

docs(generic): coach the missing concept, not the parameter count - #122

Open
devill wants to merge 1 commit into
mainfrom
coach-the-missing-concept
Open

docs(generic): coach the missing concept, not the parameter count#122
devill wants to merge 1 commit into
mainfrom
coach-the-missing-concept

Conversation

@devill

@devill devill commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

The problem

The guide already asks for a better object, but the agent's default answer to it is a bag named after the function that takes it — a FooProps, an options object, { ...everything }. That clears the report and entrenches the smell: such an object is organised by method rather than by abstraction, so the next function invents another bag and the concept stays unnamed.

What I measured

On a real TypeScript codebase (a thumbnail editor, ~900 tests), five parameter lists were over the threshold. Three of the five re-listed the members of an entity the codebase had already named somewhere else — the props interface spelled out the fields instead of taking the existing type. The other two pointed at one concept that appeared independently in two files and had no name at all.

The tell was mechanical in one case: the component immediately passed four of its five props straight back out to a hook. Values that arrive together and leave together are an entity.

What the guide now says

Three additions, all terse, keeping the existing ROSE shape:

  1. Names domain-driven design as the tool for finding the entity — parameters that travel together are usually one of the domain's own nouns.
  2. Says to search the rest of the codebase for the same values appearing side by side. The combinations that recur are the real entity, and where one already carries a name, that name is the answer.
  3. Requires refactoring every site the entity fits, not only the line that fired. An abstraction used in one place is hidden, not introduced, and a call passing three of its fields is the same concept sitting under the threshold.

Testing

uv run pytest — the generic plugin's suite passes. 16 failures in plugins/typescript are identical with and without this change on origin/main (knip and comment sensors); they are not touched here.

Related

There is a blind spot no guide can reach: max-params counts parameters, so a props object is one parameter however many values it carries, and the guide never fires. Filed separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xb1JpxqxY9mtqzXgQKdBYS

The guide asks for a better object, but an agent's default answer is a bag
named after the function that takes it -- a FooProps, an options object. That
is organised by method rather than by abstraction, so the next function invents
another bag and the concept stays unnamed.

Measured on a real TypeScript codebase: five prop lists over the threshold, and
three of them re-listed the members of an entity the codebase had already named
somewhere else.

The guide now names domain-driven design as the tool for finding the entity,
says to search the codebase for the same values appearing side by side because
the combinations that recur are the real one, and asks for every fitting site
to be refactored rather than only the line that fired -- an abstraction used
once is hidden, not introduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant