CLAUDE.md
web-panel/CLAUDE.mdCLAUDE.md
Quality
73/100
Scores the file, not the repository.Length
1,644 words
14 headings · 5 code blocksRepository
15k
— · pushed 13 days agoLast changed
2 days ago
First indexed 2 days ago.1Use these rules as defaults, not as a reason to add ceremonial folders or wrapper layers.23## Core Principles45- Organize code around product capabilities, not framework vocabulary.6- Keep related UI, state, rules, and data access close until a real boundary justifies moving7 them apart.8- Dependencies point from composition and UI toward stable rules and narrow capabilities.9- Protect rendering code from business, state-management, and infrastructure complexity.10- Keep one source of truth and derive everything else.11- Apply KISS, YAGNI, and DRY together. Remove duplicated knowledge, not merely similar syntax.12- Prefer explicit, readable flow over clever abstractions and hidden behavior.1314## Screaming Architecture1516The repository structure and public APIs should reveal what the product does.1718Prefer:1920```text21features/22 checkout/23 search/24 account-security/25```2627Avoid making the application read primarily as:2829```text30components/31hooks/32services/33stores/34utils/35```3637Technical folders are useful inside a capability, where their owner is clear. Generic top-level38folders easily become dependency magnets with unclear ownership.3940Names should use product language. Prefer `useCheckoutSummary`, `reserveStock`, and41`AccountSecurityPanel` over `useData`, `processItems`, and `GenericPanel`.4243## Suggested Structure4445Start with the smallest structure that makes ownership obvious:4647```text48src/49 app/ startup, providers, router, global composition50 pages/ route-level composition51 features/52 <capability>/53 index.ts optional public API54 ui/ optional rendering components55 model/ optional state, view models, decisions56 api/ optional external data access57 lib/ optional feature-local pure helpers58 domains/ optional shared product rules and types59 shared/60 ui/ domain-free visual primitives61 api/ generic transport/query infrastructure62 lib/ genuinely generic pure helpers63```6465Folders are created when they contain a real responsibility. A small feature may be one cohesive66file. Do not create empty layers in anticipation of future complexity.6768## Dependency Direction6970- `app` installs providers, constructs dependencies, and composes the application.71- `pages` compose capabilities for a route. They do not own business rules or data protocols.72- A feature owns one user-recognizable capability end to end.73- Feature UI consumes its own model/view-model API, not raw infrastructure.74- Shared domain code contains reusable product rules and stays independent of React and I/O.75- `shared` contains only domain-free code. Product-specific code is not shared merely because76 two files use it.77- Avoid feature-to-feature imports. Compose features in a page, promote truly shared rules to a78 domain module, or introduce a named workflow when coordination is the actual responsibility.79- Cyclic imports are an architecture problem, not something to solve with a tooling workaround.8081For a simple feature, direct `ui -> model -> api` dependencies are sufficient. Introduce ports,82facades, dependency injection, or workflows only when they hide real complexity, enable83important tests, or separate unstable infrastructure.8485## Make Composition Read Like The Product8687Pages and other composition boundaries should use capability-level APIs.8889Prefer:9091```tsx92<CheckoutSummary />93<PlaceOrderButton />94```9596Over:9798```tsx99<Card>100 <Select options={paymentOptions} onChange={handlePaymentChange} />101 <Button onClick={handleSubmit}>Submit</Button>102</Card>103```104105The second version makes the page understand checkout behavior and low-level UI configuration.106That knowledge belongs to the checkout capability.107108This does not mean wrapping every native element or design-system primitive. Semantic HTML and109visual primitives are correct inside feature UI. Create a capability component when it hides110product behavior or gives composition code a clearer product-level API.111112Avoid "raw components" whose consumers must know internal options, state transitions, query113shapes, or protocol details. Avoid generic configuration-driven components that combine114unrelated product modes behind dozens of props.115116## UI Boundary117118- Components render data and translate DOM events into named user intents.119- Keep business decisions, data mapping, persistence, protocol handling, and multi-step async120 flows outside rendering components.121- UI receives render-ready values. It should not reconstruct domain meaning from raw DTOs.122- Prefer intent props and commands such as `onApprove`, `renameProject`, or `submitOrder` over123 generic `onChange`, `setState`, or `patch` APIs at capability boundaries.124- Keep ephemeral visual state local: focus, hover, open/closed, and uncommitted input usually125 belong in the component.126- Split components by responsibility and API clarity, not by arbitrary line limits.127- Prefer slots and composition over components with many layout modes and boolean props.128- Use semantic HTML and preserve accessibility behavior.129130A view-model hook is useful when it protects UI from state shape, async coordination, or business131decisions. Do not create a pass-through hook that only renames one value to satisfy a diagram.132133## State Ownership134135Choose the smallest correct owner:136137| State | Preferred owner |138| --- | --- |139| Ephemeral visual state | local component state |140| Uncommitted form state | the form or feature |141| URL/shareable navigation state | the router/URL |142| Remote server resource and cache | a query/cache layer |143| Shared capability state | that feature's model/store |144| Cross-capability process | a named workflow or app-level model |145146- A store is not a bucket for every value used by several components.147- Split state by capability and lifecycle, not by data type.148- Expose narrow selectors, hooks, or commands. Do not expose a complete mutable store to all UI.149- Store transitions should express user or domain intent, not generic object mutation.150- Derive values instead of storing synchronized copies.151- Do not use effects to keep two pieces of application state synchronized.152- React Context is suitable for dependency injection or stable scoped state. Avoid one broad153 app context whose every update rerenders unrelated consumers.154155State-library choice is an implementation detail. Architecture should survive replacing it156without rewriting pages and rendering components.157158## Effects And Async Work159160- Use effects to synchronize with external systems, not to calculate render data or handle user161 events.162- Start event-driven work from the event or model command that owns it.163- Every subscription, timer, listener, or in-flight operation must have a clear owner and164 cleanup path.165- The owning feature/model defines pending, success, empty, error, retry, and cancellation166 semantics.167- Prevent stale async results and race conditions where users can trigger overlapping work.168- Do not hide failures with broad `catch` blocks or silently convert errors into empty data.169170## Data And Infrastructure171172- Treat network responses, storage, URL input, files, and third-party SDK output as untrusted.173- Validate and normalize data at the boundary where it enters the application.174- Map transport DTOs and external errors into product-oriented values before they reach UI.175- Keep raw `fetch`, storage APIs, SDK calls, and protocol details out of rendering components.176- Keep a feature-specific API adapter inside the feature until it has a real shared consumer.177- Introduce a client, repository, gateway, service, or facade only when its responsibility is178 distinct and useful.179- Avoid wrapper chains that only forward calls. One clear adapter is better than180 `Client -> Service -> Facade` without separate responsibilities.181- Inject infrastructure when tests, multiple implementations, lifecycle, or unstable external182 APIs justify it. Do not introduce dependency injection for every pure helper.183184## Component And Hook APIs185186- Component and hook APIs describe product intent, not internal implementation.187- Avoid boolean prop combinations that create unclear or invalid modes. Prefer explicit variants188 or separate components.189- Avoid passing raw query results, stores, SDK clients, or large configuration objects through190 component trees.191- Keep public props small and cohesive. A component that needs unrelated groups of props likely192 owns too many responsibilities.193- Custom hooks encapsulate React state, lifecycle, or reusable reactive behavior. Pure194 calculations remain plain functions.195- Do not use `useEffect`, `useMemo`, `useCallback`, or `memo` by habit. Use them for correctness196 or measured performance needs.197- Do not duplicate server or domain state into component state merely to make it editable.198 Create an explicit draft only when the UX requires commit/cancel semantics.199200## Public Boundaries201202- Export the smallest useful public surface of a feature.203- Consumers should use a feature's public components, hooks, commands, and types, not deep204 internal paths.205- Keep implementation-only state, DTOs, adapters, and helpers private.206- Do not create barrel files everywhere. Use a public entry point only where a real boundary207 exists.208- A reusable abstraction should have a clear owner and at least one current reason to exist.209- Avoid generic `core`, `common`, `helpers`, `services`, or `utils` modules that collect210 unrelated responsibilities.211212## Growing The Architecture213214Start local and promote code only after pressure appears:215216- A second consumer may justify shared domain code, but similar code is not automatically the217 same knowledge.218- Repeated external integration logic may justify a shared adapter.219- A process coordinating several capabilities may justify a named workflow.220- A large feature may split into smaller capabilities when they have distinct responsibilities221 and lifecycles.222- Separate packages are useful when an enforceable boundary, independent reuse, or independent223 lifecycle outweighs their maintenance cost.224225Do not begin a small application with every possible layer, package, provider, repository,226facade, and design pattern. Strong architecture makes growth cheaper; it does not predict every227future requirement.228229## Testing230231- Test product behavior and public contracts, not implementation trivia.232- Test pure rules with unit tests.233- Test feature models and async transitions without rendering where practical.234- Test components through accessible user behavior.235- Test infrastructure mapping and validation at external boundaries.236- Keep end-to-end tests for critical user journeys.237- Mock external systems and unstable boundaries, not every internal function.238- Add tests proportional to risk, especially for validation, permissions, races, retries,239 cancellation, and regressions.240241## Review Checklist242243Before finishing a change, ask:244245- Does the file location make its owner obvious?246- Does composition code read in product language?247- Is UI protected from raw state, DTOs, infrastructure, and business decisions?248- Is there one source of truth?249- Are effects only synchronizing external systems?250- Is new shared code genuinely domain-free or genuinely shared?251- Does every abstraction remove current complexity?252- Can important behavior be tested without rendering the whole app?253- Did the change preserve accessibility, error handling, and cleanup?254- Is this the least code that clearly solves the current problem?255
Also in k1tbyte/Wand-Enhancer
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| k1tbyte/Wand-EnhancerAGENTS.md · 15k | AGENTS.md | buildstyletesting-strategysecurity+3 | 65/100 | 2 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago |
