Skip to content

Convention for variant rules within a plugin #6

@wzslr321

Description

@wzslr321

Some plugins have rules that are mutually exclusive variants of the same
domain - pick one based on what the project uses. Navigation is the first
concrete case (auto_route vs go_router in #5), but the same shape will show up
elsewhere: state management alternatives, form libraries, architecture
flavors, etc.

We need a convention for this, because without one each variant rule ends up
with its own globs: block and they overlap. In navigation, **/*_route.dart
pulls both variants into context even though only one applies.

Proposal:

  • Selector rule owns all the path globs for the domain. Its job is to load on
    any relevant file, detect which variant the project uses, and instruct the
    agent to pull in the right one.
  • Variant rules carry no globs. They load by description only
    (agent-requested), triggered by the selector.
  • Cross-references between rules use names (the navigation-auto-route rule),
    not paths (rules/navigation-auto-route.md). Path-based references break once
    the file is generated into claude-rules/ or cursor-rules/.

Alternative:
Separate plugin for every case.

Concrete trigger: #5 (navigation), discussion #5 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions