agentleFS
jonradoffjonradoff/lastsaas/CLAUDE.md

lastsaas

CLAUDE.md172 starsChanged 9 months agoMITView on GitHub

LastSaaS uses hybrid validation: Go-side (validate struct tags via go-playground/validator) and MongoDB JSON Schema (internal/db/schema.go). When modifying model structs in internal/models/: 1. Update validate struct tags on the model 2. Update the corresponding MongoDB JSON Schema in internal/db/schema.go 3. Keep both in sync — the Go tags and MongoDB schema must enforce the same constraints 4. Run cd backend && go test ./internal/validation/... to verify When adding a new collection that accepts user/API writes: 1. Add validate tags to the…

The file

We split this CLAUDE.md into the rules it gives an agent

11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Update validate struct tags on the model

    line 8
  2. Very specific:

    Update the corresponding MongoDB JSON Schema in internal/db/schema.go

    line 9
  3. Distinctive:

    Keep both in sync — the Go tags and MongoDB schema must enforce the same constraints

    line 10
  4. Very specific:

    Run cd backend && go test ./internal/validation/...

    line 11
  5. Very specific:

    Add validate tags to the model struct

    line 14
  6. Very specific:

    Add a schema function to internal/db/schema.go and include it in AllSchemas()

    line 15
  7. Very specific:

    Add tests in internal/validation/validate_test.go

    line 16
  8. Very specific:

    Use syslog.Logger for all significant system events.

    line 20
  9. Distinctive:

    Always verify after changes:

    line 24
  10. Distinctive:

    Propagation rule: When setting up or working on any dependent project, ensure:

    line 41
  11. Distinctive:

    If the project doesn't have these yet, create them before the first deployment

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 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

LastSaaS Development Rules

Validation

LastSaaS uses hybrid validation: Go-side (validate struct tags via go-playground/validator) and MongoDB JSON Schema (internal/db/schema.go).

When modifying model structs in internal/models/:

  1. Update validate struct tags on the model
  2. Update the corresponding MongoDB JSON Schema in internal/db/schema.go
  3. Keep both in sync — the Go tags and MongoDB schema must enforce the same constraints
  4. Run cd backend && go test ./internal/validation/... to verify

When adding a new collection that accepts user/API writes:

  1. Add validate tags to the model struct
  2. Add a schema function to internal/db/schema.go and include it in AllSchemas()
  3. Add tests in internal/validation/validate_test.go

System Logging

Use syslog.Logger for all significant system events. Severity levels: critical, high, medium, low, debug.

Build Verification

Always verify after changes:

cd backend && go build ./...
cd frontend && npx tsc --noEmit

Dependent Project Deployment (CRITICAL)

Any project built on the LastSaaS boilerplate — whether using it as a Git submodule, fork, or copy — MUST deploy using the SaaS Dockerfile (Dockerfile.saas) and the corresponding Fly config (fly.saas.toml). Never use bare fly deploy on a project that depends on LastSaaS.

Why this matters: The SaaS Dockerfile runs both the product backend AND the LastSaaS backend behind Caddy (via supervisord). The LastSaaS backend serves all auth endpoints (/api/auth/*), bootstrap status (/api/bootstrap/status), OAuth providers (Google, etc.), billing, and admin APIs. Without it, login breaks silently — the product backend has no auth routes, so API calls return HTML from the SPA catch-all, causing mysterious redirects to /setup or broken login forms with missing OAuth buttons.

Correct deploy command:

fly deploy -c fly.saas.toml

Propagation rule: When setting up or working on any dependent project, ensure:

  1. The project has a deploy.md at its root with full deployment instructions and the "why" behind the multi-process architecture
  2. The project's Claude Code memory (MEMORY.md or CLAUDE.md) contains a cross-reference: "See deploy.md — never bare fly deploy"
  3. If the project doesn't have these yet, create them before the first deployment

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.