shared-layer
Where code that several features use lives.
The rule
Agents read this text as written when they write and review code.
Put what two or more features use at the top of src/, in a folder named for its kind:
components/— shared components, grouped by subject once there are enough to group:components/ui/for the design system's primitives,components/icons/,components/markdown/.layouts/— the frames routes share, each named with aLayoutsuffix, the parts only they use, and the root document.providers/— the context providers wrapped around the app, each with the context it provides.hooks/,utils/,types/,constants/— as in a feature.styles/andassets/— stylesheets, fonts and images.- The folders the framework's rules add.
Code one feature uses stays in that feature. When a second feature needs it, move it here and update the imports; when a shared file is down to one user, move it back into that feature.
Then features/ is the product, the top of src/ is what holds it up, and shared code is found by kind without opening a feature.
Examples
The check flags the incorrect code and passes the correct code; the agent judges what the check cannot see. Each example is a small repo, because this rule looks across files. It opens on the file that matters; the other files are the repo around it.
Incorrect
Correct
interface Params {label: string;}// Correct: two features use it, so it sits in the shared components, in the// group for the design system's primitives.export const StatusBadge = ({ label }: Params) => <span className="badge">{label}</span>;
Configure
- Block
"blocking"Stops a run when a file the run changed breaks the rule. - AdviseDefault
"advisory"Reports it and hands it to the refactor agent. Never stops a run. - Off
"off"Not checked. Use it when your own linter already enforces the rule.
Add this to your lightsout.config.json, then change the value.
{"standards-rule-settings": {"shared-layer": "advisory"}}