Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/lsampaioweb/ai-instructions/spring-boot-repositorygit clone --depth 1 https://github.com/lsampaioweb/ai-instructionsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/lsampaioweb/ai-instructions/spring-boot-repository)<a href="https://agentmods.dev/rules/lsampaioweb/ai-instructions/spring-boot-repository"><img src="https://agentmods.dev/badge/rules/lsampaioweb/ai-instructions/spring-boot-repository.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00898 |
| Opus 5 | $0.00000 | $0.00449 |
| Sonnet 5 | $0.00000 | $0.00180 |
| Haiku 4.5 | $0.00000 | $0.00090 |
Grade A, and why
spring-boot-repository scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Spring Boot Repository Engine
Naming Conventions
- Name repository interfaces with the
*Repositorysuffix (e.g.,HolidayRepository). - Name repository implementations with the
*RepositoryImplsuffix (e.g.,HolidayRepositoryImpl). - Name SQL configuration property records with the
*SqlConfigurationPropertiessuffix (e.g.,HolidaySqlConfigurationProperties). - Use resource entity names in repository identifiers (never
DataRepositoryorPersistenceRepository). - Name SQL property keys with the pattern
sql.<resource>.<operation>(e.g.,sql.holidays.find-by-id). - Name SQL column name constant classes with the
*SqlColumnssuffix (e.g.,UserSqlColumns,AccountSqlColumns).
Rules
- Defer the global ORM ban to
spring-boot-architecture.mdcand ORM dependency bans tospring-boot-pom.mdc. - Use
findById,findAll,findBy*,save,update, anddeleteByIdas the standard method name prefixes for repository interface methods. - Keep method names consistent with operation semantics across all repositories.
- Keep JDBC or JdbcClient as the default for relational persistence modules.
- Use interface + implementation separation (
XyzRepositoryinterface +XyzRepositoryImpl) for modules with multiple persistence adapters or higher domain complexity. - Use a single
@Repositoryclass without a separate interface for focused modules with a single persistence adapter. - Allow non-relational repository implementations only when the module is explicitly scoped to an approved non-relational store.
- Declare SQL column name constants in a
*SqlColumnsutility class within the feature package. - Use
*SqlColumnsconstants as all named parameter keys in SQL method calls. - Declare SQL result-set column-label constants in the repository implementation and reuse them for all
ResultSetreads. - Return
Optional<T>from all single-resource lookup methods (e.g.,findById). - Keep business orchestration out of repository methods.
- Parameterize all SQL executed by repositories.
- Build SQL parameter containers to be null-tolerant by omitting null entries or binding typed null values explicitly.
- Accept pagination parameters (offset, limit, sort column) as explicit method parameters for paginated queries.
- Keep SQL statements straightforward and readable; prefer simple joins, predicates, and direct projections over expression-heavy control-flow in SQL.
- Implement sortable pagination in SQL only when the user explicitly requires database-side sorting or the expected data volume makes application-side sorting unsuitable.
- When the user prefers simpler SQL and data volume constraints do not require database-side sorting, perform sorting in Java after retrieval using an allowlisted set of sortable fields.
- Externalize SQL statements into
@PropertySource-backed XML property files, one file per feature. - Declare
@PropertySourceon the@Configurationclass that owns theJdbcClientbean. - Access SQL statements through a
@ConfigurationPropertiesrecord namedXyzSqlConfigurationPropertieswithin the feature package. - Register
XyzSqlConfigurationPropertiesusing one explicit pattern: either@Component+@ConfigurationPropertieson the record, or@EnableConfigurationPropertieson the owning@Configurationclass. - Annotate
*SqlConfigurationPropertiesrecords with@Validatedand annotate each SQL field with@NotBlank. - Validate generated-key fallback results explicitly and throw a deterministic data-retrieval exception when no key is returned.
- Use
Locale.ROOTfor case normalization in machine-parsed string comparisons (e.g., SQL error-message feature detection). - Catch SQL exceptions at the repository boundary and wrap them in a feature-scoped exception; services must not re-wrap the same SQL failure.
- Fall back from
INSERT/UPDATE ... RETURNINGonly when exception evidence indicates the database does not supportRETURNING. - Rethrow unrelated SQL grammar errors.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 48 lines · 0 tokens per session scan A 0ed0d5fc0fa4
spring-boot-repository is a cursor rule published in the GitHub repository lsampaioweb/ai-instructions (1 stars, last pushed 13d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 898 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
prefer-assertions-over-defensive-checks
Prefer assertions over defensive checks when data is guaranteed to be valid.
as-contract-cast-smell
// ❌ WRONG — bypasses the family ContractSerializer seam const contract = JSON.parse(raw) as Contract; const contract = JSON.parse(raw) as Contract .
no-backward-compatibility
Do not add backward-compatibility shims or migration scaffolding.
postgresql
This guide defines the definitive best practices for writing clean, performant, and maintainable PostgreSQL SQL, focusing on modern conventions and avoiding common pitfalls.
query-optimization
查詢優化、EXPLAIN、index 設計與 RLS 效能測量.
ehs-ims-conventions
EHS IMS app — RBAC, data layer, tRPC, migrations, AI boundaries.