RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/AGENTS.md/photoprism/photoprism

AGENTS.md

internal/api/AGENTS.md
AGENTS.md

Quality

62/100

Scores the file, not the repository.

Length

290 words

4 headings · 0 code blocks

Repository

40k

— · pushed 0 days ago

Last changed

2 days ago

First indexed 2 days ago.
photoprism/photoprism/internal/api/AGENTS.mdRawGitHub
1# API Guidelines
2 
3**Last Updated:** April 9, 2026
4 
5## Handler Conventions
6 
7- Reuse limiter stacks such as `limiter.Auth` and `limiter.Login`, and use `limiter.AbortJSON` for `429` responses.
8- Lean on `api.ClientIP`, `header.BearerToken`, and the shared `Abort*` helpers instead of duplicating request parsing.
9- Compare secrets in constant time and set `Cache-Control: no-store` on sensitive responses.
10- Register routes in `internal/server/routes.go`.
11- New list endpoints should default to `count=100`, cap at `1000`, require `offset >= 0`, and document their parameters explicitly.
12- When a test or fixture needs portal mode, set `PHOTOPRISM_NODE_ROLE=portal` together with `PHOTOPRISM_JOIN_TOKEN`.
13 
14## Roles, Scopes & Sessions
15 
16- Map user roles through `acl.ParseRole(s)` and `acl.UserRoles[...]`; map client roles through `acl.ClientRoles[...]`.
17- Treat `RoleAliasNone` (`none`) and the empty string as `RoleNone`; default unknown client roles to `RoleClient`.
18- When checking JWT or client scopes, use `acl.ScopePermits` and `acl.ScopeAttrPermits` instead of handwritten parsing.
19- Use `AuthenticateAdmin`, `AuthenticateUser`, or `OAuthToken` helpers in tests rather than building auth flows manually.
20- Build client-session requests with `entity.AddClientSession(..., authn.GrantClientCredentials, nil)` and `AuthenticatedRequest(...)`.
21- Admin sessions may see `AdvertiseUrl` and `Database`; client and user sessions must not. `SiteUrl` and the client `storageNamespace` derived from it are safe to expose.
22 
23## Swagger & API Tests
24 
25- Annotate only routed handlers in `internal/api/*.go`; use full `/api/v1/...` paths and skip helper functions.
26- Regenerate API docs with `make fmt-go swag-fmt swag` or `make swag-json`; `make swag` may fetch modules, so confirm network access first.
27- While iterating, prefer focused runs such as `go test ./internal/api -run Cluster -count=1`.
28- Isolate config paths with `t.TempDir()` and reuse `NewConfig`, `CliTestContext`, and `NewApiTest()` helpers.
29- For negative permission checks, prefer OAuth client tokens over non-admin user fixtures.
30- Register `CreateSession(router)` only once per test router; a second registration panics on duplicate routes.
31 
32 

Commands it names

  • make fmt-go swag-fmt swag
  • make swag-json
  • make swag
  • go test ./internal/api -run Cluster -count=1

Sections

  • API Guidelines
  • Handler Conventions
  • Roles, Scopes & Sessions
  • Swagger & API Tests

What it covers

testcode-styletesting-strategyapi

Stack — with the evidence

go

(1.00)

eslint

(1.00)

ai-agent

(0.90)

vue

(0.70)

vite

(0.70)

vitest

(0.70)

javascript

(0.60)

docker

(0.60)

github-actions

(0.60)

Format

AGENTS.md

A plain-markdown README for coding agents, deliberately unopinionated: no frontmatter, no globs, no vendor keys. That minimalism is why it became the one file a dozen different agents will read, and why it carries the least per-file targeting power of any format here.

What the corpus says about it

Repository

Owner
photoprism
Language
—
License
—
Archived
no

All configs in this repo

Also in photoprism/photoprism

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
photoprism/photoprisminternal/config/AGENTS.md · 40kAGENTS.mdgoeslint+7databasedo-not46/1002 days ago
photoprism/photoprisminternal/entity/migrate/AGENTS.md · 40kAGENTS.mdgoeslint+7testtesting-strategydatabase63/1002 days ago
photoprism/photoprisminternal/photoprism/AGENTS.md · 40kAGENTS.mdgoeslint+7no sections39/1002 days ago
photoprism/photoprisminternal/service/cluster/AGENTS.md · 40kAGENTS.mdgoeslint+7buildtestapi76/1002 days ago
photoprism/photoprismpkg/AGENTS.md · 40kAGENTS.mdgoeslint+7teststylesecurity55/1002 days ago
photoprism/photoprisminternal/commands/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyle66/1002 days ago
photoprism/photoprism.claude/CLAUDE.md · 40kCLAUDE.mdgoeslint+7buildtestlint-formatstyle+796/1002 days ago
photoprism/photoprism.github/copilot-instructions.md · 40kCopilot instructionsgoeslint+7buildtestlint-formatstyle+590/1002 days ago
photoprism/photoprism.github/instructions/backend.instructions.md · 40kCopilot instructionsgoeslint+7testlint-formatstyletypes+483/1002 days ago
photoprism/photoprism.github/instructions/frontend.instructions.md · 40kCopilot instructionsgoeslint+7testlint-formatstyleagent-behaviour76/1002 days ago
photoprism/photoprismAGENTS.md · 40kAGENTS.mdgoeslint+8setupbuildtestlint-format+882/1002 days ago
photoprism/photoprismfrontend/AGENTS.md · 40kAGENTS.mdgovitest+7setupteststyletesting-strategy+176/1002 days ago
photoprism/photoprisminternal/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyletesting-strategy71/1002 days ago
Diff against internal/config/AGENTS.md Diff against internal/entity/migrate/AGENTS.md Diff against internal/photoprism/AGENTS.md Diff against internal/service/cluster/AGENTS.md Diff against pkg/AGENTS.md Diff against internal/commands/AGENTS.md Diff against .claude/CLAUDE.md Diff against .github/copilot-instructions.md Diff against .github/instructions/backend.instructions.md Diff against .github/instructions/frontend.instructions.md Diff against AGENTS.md Diff against frontend/AGENTS.md Diff against internal/AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
trick77/agents-md-syncAGENTS.md · 2AGENTS.mdtypescriptnode+4setupbuildteststyle+5100/1003 days ago
SkeneTechnologies/skene-cookbookAGENTS.md · 51AGENTS.mdpythoneslint+4setupbuildtestlint-format+7100/1002 days ago
duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5buildteststylearch+3100/1003 days ago
mui/material-uiAGENTS.md · 99kAGENTS.mdtypescriptjavascript+13setupbuildtestlint-format+9100/1003 days ago
n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16buildteststylearch+3100/1003 days ago
TryGhost/Ghoste2e/AGENTS.md · 55kAGENTS.mdtypescriptjavascript+12setupteststylearch+2100/1003 days ago
code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67kAGENTS.mdtypescriptbun+10setupbuildtestlint-format+6100/1002 days ago
ethereum/go-ethereumAGENTS.md · 51kAGENTS.mdgodocker+1buildtestlint-formatgit+1100/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack