claude-governance / java-react
CLAUDE.md35 starsChanged 5 months agoMITView on GitHub
Multi-tenant SaaS — Spring Boot 3.3 / React 18. Each organization is strictly isolated at the data level. Developer level: see dev-level.md. Violations here are bugs, not style issues. Architecture - controller → service → repository. No layer skipping. - Controllers may: validate requests, map DTOs, extract auth context, call services. - Controllers must not: access repositories, implement business rules, manage transactions. DTOs - Separate *Request and *Response records for every endpoint. - Entities never leave the persistence layer —…
In this repository6 other files it gives its agents.
- angular-only/CLAUDE.mdCLAUDE.md
- nestjs-react/CLAUDE.mdCLAUDE.md
- nextjs/CLAUDE.mdCLAUDE.md
- python-fastapi-react/CLAUDE.mdCLAUDE.md
- react-only/CLAUDE.mdCLAUDE.md
- vue-only/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Tenant isolation: every repository query MUST filter by organizationId.
- Very specific: line 17
Public IDs only: use publicId (UUID) in all URLs and API responses.
- Distinctive: line 19
Flyway immutability: never edit an existing migration.
- Very specific: line 36
All business exceptions extend TaskFlowException.
- Very specific: line 42
Every RestTemplate/WebClient: 5s connect timeout, 30s read timeout.
- Distinctive: line 46
Every service method accessing business data must verify ownership and permissions against the current organization and user.
- Very specific: line 61
Always handle isLoading and isError in data-fetching components.
- Distinctive: line 84
Every repository integration test must verify organization isolation (cross-tenant data must not be accessible).
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TaskFlow — Claude Code Governance
Project Context
Multi-tenant SaaS — Spring Boot 3.3 / React 18.
Each organization is strictly isolated at the data level.
Developer level: see dev-level.md.
CRITICAL — Non-negotiable
Violations here are bugs, not style issues.
- Tenant isolation: every repository query MUST filter by
organizationId. Never query by entity ID alone. - organizationId source: extract from JWT claims (security context) only. Never from request body, path variable, or query parameter.
- Public IDs only: use
publicId(UUID) in all URLs and API responses. Never exposeid(Long). - No secrets in code: tokens, passwords, keys always via
@Valueor@ConfigurationProperties. - Flyway immutability: never edit an existing migration. Always create a new versioned script.
Backend Rules
Architecture
controller → service → repository. No layer skipping.- Controllers may: validate requests, map DTOs, extract auth context, call services.
- Controllers must not: access repositories, implement business rules, manage transactions.
DTOs
- Separate
*Requestand*Responserecords for every endpoint. - Entities never leave the persistence layer — services expose DTOs only.
- Naming:
CreateTaskRequest,TaskResponse,UpdateTaskRequest.
Exceptions
- All business exceptions extend
TaskFlowException. - Handled exclusively in
GlobalExceptionHandler.
Data access
- Collection endpoints must return
Page<T>orSlice<T>. Never unboundedList<T>. FetchType.LAZYon all@OneToMany. Use explicit JPQL fetch joins.- Every
RestTemplate/WebClient: 5s connect timeout, 30s read timeout.
Authorization
- Authentication does not imply authorization.
- Every service method accessing business data must verify ownership and permissions against the current organization and user.
Correct repository signature example
Page<Task> findByProjectPublicIdAndOrganizationId(
UUID projectPublicId, Long organizationId, Pageable pageable);Frontend Rules
unknown+ type guard — neverany.- Fetch logic in
/apionly — never inside a component or hook. - shadcn/ui components everywhere — no raw HTML elements.
- Always handle
isLoadingandisErrorin data-fetching components. - Global state →
/store. Local state → component.
Security Rules
Validation
- Backend:
@Valid+ Bean Validation at controller layer. - Frontend: Zod + react-hook-form at form layer.
Logging — never log
email, accessToken, refreshToken, password, user full name.
CORS
- Dev:
localhost:5173. Prod:taskflow.app. NeverallowedOrigins("*").
Testing Rules
- Service layer: JUnit 5 + Mockito.
- Repository layer: Testcontainers integration tests.
- Every repository integration test must verify organization isolation (cross-tenant data must not be accessible).
Modification Rules
| Situation | Action |
| Change < 10 lines | Targeted diff only — never rewrite the full file |
| New DB change needed | New V{n}__description.sql — never edit existing migration |
| New file | Only if no existing file can be extended |
Available Commands
| Command | Purpose |
/gov-check | Audit current file against governance rules |
/security-review | Security checklist on current file |
/scaffold <domain> | Generate complete CRUD feature (entity, DTOs, service, controller, migration) |
/new-migration <description> | Generate next Flyway migration script |
Known Gotchas
- JWT expiry: access token = 15 min, refresh token = 7 days. Silent refresh handled by Axios interceptor in
/api/client.ts. Do not add manual refresh logic elsewhere. - WebSocket: real-time notifications use STOMP on
/ws. Never mix with REST endpoints or add REST logic inside STOMP handlers. - Email: notifications go through
@Asyncjobs. Never call the mail service synchronously from a controller — it will block the request thread. - Flyway order: migration FK constraints must respect table creation order. Always check dependencies before creating a new script.
- Pagination: task lists can exceed 10,000 rows. Never return unbounded
List<T>from collection endpoints — always usePage<T>orSlice<T>. - CORS: configured for
localhost:5173(dev) andtaskflow.app(prod) only. Never useallowedOrigins("*")in production.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

