agentleFS
datallmhubdatallmhub/claude-governance/java-react/CLAUDE.md

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 —…

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
  1. Very specific:

    Tenant isolation: every repository query MUST filter by organizationId.

    line 15
  2. Very specific:

    Public IDs only: use publicId (UUID) in all URLs and API responses.

    line 17
  3. Distinctive:

    Flyway immutability: never edit an existing migration.

    line 19
  4. Very specific:

    All business exceptions extend TaskFlowException.

    line 36
  5. Very specific:

    Every RestTemplate/WebClient: 5s connect timeout, 30s read timeout.

    line 42
  6. Distinctive:

    Every service method accessing business data must verify ownership and permissions against the current organization and user.

    line 46
  7. Very specific:

    Always handle isLoading and isError in data-fetching components.

    line 61
  8. Distinctive:

    Every repository integration test must verify organization isolation (cross-tenant data must not be accessible).

    line 84

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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 expose id (Long).
  • No secrets in code: tokens, passwords, keys always via @Value or @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 *Request and *Response records 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> or Slice<T>. Never unbounded List<T>.
  • FetchType.LAZY on 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 — never any.
  • Fetch logic in /api only — never inside a component or hook.
  • shadcn/ui components everywhere — no raw HTML elements.
  • Always handle isLoading and isError in 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. Never allowedOrigins("*").

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

SituationAction
Change < 10 linesTargeted diff only — never rewrite the full file
New DB change neededNew V{n}__description.sql — never edit existing migration
New fileOnly if no existing file can be extended

Available Commands

CommandPurpose
/gov-checkAudit current file against governance rules
/security-reviewSecurity 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 @Async jobs. 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 use Page<T> or Slice<T>.
  • CORS: configured for localhost:5173 (dev) and taskflow.app (prod) only. Never use allowedOrigins("*") in production.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.