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-database-schemagit clone --depth 1 https://github.com/lsampaioweb/ai-instructionsWhat 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 | $0.00000 | $0.01201 |
| Opus 5 | $0.00000 | $0.00600 |
| Sonnet 5 | $0.00000 | $0.00240 |
| Haiku 4.5 | $0.00000 | $0.00120 |
Grade A, and why
spring-boot-database-schema 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 2d 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 — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Spring Boot Database-Schema Engine
Naming Conventions
- Use singular snake_case for table names; avoid generic tokens such as
tbl,data, orobj. - Name primary key columns as
<table_name>_id(never standaloneid). - Name foreign key columns as
<referenced_table_name>_id. - Name non-key columns with domain-qualified semantics (never standalone
name,value,type,status, ordate). - Name primary key constraints as
pk_<table_name>. - Name foreign key constraints as
fk_<source_table>_<target_table>. - Name unique constraints as
uq_<table_name>_<column_name>. - Name check constraints as
ck_<table_name>_<rule_name>. - Name non-unique indexes as
ix_<table_name>_<column_name>. - Name unique indexes as
ux_<table_name>_<column_name>. - For composite constraints or indexes, append column tokens in declaration order separated by underscores.
Rules
- Use PostgreSQL as the default relational system-of-record for CRUD modules unless request constraints require a different store.
- Default primary keys and row identifiers to
INTEGER. - Use
SMALLINTonly for clearly bounded low-cardinality domains expected to stay below 32,767 rows for the full lifecycle. - Use
BIGINTonly when stated scale expectations or lifetime cardinality can exceedINTEGERlimits. - Declare integer primary keys using
GENERATED ALWAYS AS IDENTITY. - Use
TEXTfor variable-length string columns with no business-rule length limit. - Use
VARCHAR(n)only when the domain enforces a maximum character length. - Use
NUMERIC(precision, scale)for monetary or decimal columns. - Use
DATEfor calendar-day business fields. - Use
TIMESTAMPTZ(timestamp with time zone) for event-time and audit fields. - Model application-owned closed-set domains through lookup/reference tables plus foreign-key columns in business tables.
- Keep a stable domain code column in each lookup/reference table for idempotent seed data and application mapping.
- Mark required columns with
NOT NULL. - Leave optional columns nullable by design.
- Keep delete mode, retention window, historical-table strategy, and archival behavior as explicit design decisions for every new business table.
- When the user prompt does not specify lifecycle, retention, archival, or delete semantics for a new table or column, treat the schema design as unresolved and ask the user before generating DDL.
- Add
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()andupdated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()to every business table. - Omit
created_atandupdated_ataudit columns only for pure lookup or reference tables with no lifecycle. - Declare columns in this order within every table: primary key, required foreign keys, business columns, optional foreign keys, audit columns (
created_at,updated_at) last. - Keep SQL DDL idempotent.
- Add succinct SQL comments before each business table, lookup/reference table, idempotent seed-data block, and non-obvious index.
- Place SQL DDL schema files under
src/main/resources/sql/db/. - Place SQL query files (XML property sources) directly under
src/main/resources/sql/. - Keep seed-data statements idempotent and stable across reruns, including lookup/reference seeds.
- Keep primary, unique, and foreign key constraints explicit in SQL DDL.
- Declare unique and check constraints as named
CONSTRAINTclauses (e.g.,CONSTRAINT uq_users_email UNIQUE (email)) rather than inline column keywords. - Declare both
ON DELETEandON UPDATEactions on every FK constraint. - Use
ON DELETE RESTRICTandON UPDATE CASCADEas the default FK action pair. - Use hard delete (physical
DELETE) only when the user explicitly confirms there is no soft-delete, archival, or historical-retention requirement. - Implement soft delete with a
deleted_at TIMESTAMPTZcolumn only when explicitly requested; document the retention and cleanup strategy alongside the schema change. - Use
ON DELETE CASCADEonly for child records with no independent existence. - Use
ON DELETE SET NULLonly for optional associations. - Add a
CREATE INDEX IF NOT EXISTSfor every foreign key column in SQL DDL. - Treat every non-foreign-key index as an explicit query-shape decision; when the user prompt does not justify that index, ask before generating it.
- Declare the FK column as nullable for every optional association that uses
ON DELETE SET NULL. - When a new relation introduces business-data deletion, retention, archival, or historical-movement consequences and the user prompt is silent, treat the delete behavior as unresolved and ask the user before finalizing the constraint action.
- When adding a FK constraint to a table with existing data, use
NOT VALIDto add the constraint without scanning existing rows, then runVALIDATE CONSTRAINTin a separate transaction. - For hierarchical or tree-structured data, declare a self-referencing FK on the parent column (e.g.,
parent_id REFERENCES same_table(id)) withON DELETE CASCADEwhen child nodes have no independent existence. - Keep domain invariants enforced by explicit SQL constraints and relation actions.
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.
- 2d ago First seen · 67 lines · 0 tokens per session scan A c65483d2bf23
spring-boot-database-schema is a cursor rule published in the GitHub repository lsampaioweb/ai-instructions (1 stars, last pushed 10d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,201 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
netlify-database-migration-from-extension
Switching to Netlify Database. Reference for the netlify-database skill.
cursorrules
You are an expert in Ruby on Rails, PostgreSQL, Hotwire (Turbo and Stimulus), and Tailwind CSS.
docker-database
Docker configuration for PostgreSQL database and Elasticsearch.
create-rls-policies
Guidelines for writing Postgres migrations.
supabase-migrations
You are a Postgres Expert who loves creating secure database schemas.
aws-rds-best-practices
AWS RDS PostgreSQL best practices - database configuration, connection management, authentication, backup, and performance optimization standards.