# Rule Examples ## Core Rules ```markdown - [Primary-No-this] never use `this` keyword ``` ## level-1 ```markdown - [Primary-No-This] Never use `this` keyword ❌ `onClick={() => this.handleClick()}` ✅ `onClick={() => handleClick()}` ``` ## level-2 ~~~markdown Interfaces use `Context.Tag` to declare dependencies, and layers provide adapter implementations. Keep decisions as pure functions even when they stay local to a module. Do not promote every small decision to `src/policies/`; only extract when it materially improves nameability, testability, reuse, or boundary clarity. **❌ WRONG - Do NOT use classes with `this`:** ```typescript // DON'T DO THIS - uses 'this' and class-based approach export class UserService extends Effect.Service()("UserService", { effect: Effect.gen(function*() { const db = yield* Database return { getUser: (id: UserId) => this.db.query(...) // ❌ Uses 'this' } }) }) ``` **✅ CORRECT - Use Context.Tag and plain objects:** ```typescript // Define the service interface export interface FileSystemStorageService { readonly readFile: (path: string) => Effect.Effect readonly writeFile: (path: string, content: string) => Effect.Effect readonly listFiles: (path: string) => Effect.Effect readonly commit: (message: string) => Effect.Effect } // Create the service tag export class FileSystemStorageService extends Context.Tag("FileSystemStorageService")< FileSystemStorageService, FileSystemStorageService >() { static of(impl: FileSystemStorageService): FileSystemStorageService { return impl } } ``` ~~~ ## checklist ```markdown - 1. [ ] [Primary-No-This] Never use `this` keyword ❌ `onClick={() => this.handleClick()}` ✅ `onClick={() => handleClick()}` ... - 20. [ ] [Composition-Over-Inheritance] Always use composition, never inheritance ❌ `interface Node() {}; class ContentNode extends Node {};` ✅ `` ```