Use when implementing tenant resolution, database or schema isolation, tenant-aware JPA, reactive tenant context, migrations, caching, jobs, or authorization in Spring Boot 3.
SkillScore88Maintained
Automatic
◆Coding pack
Last verified 9/25/2026
What it changes
Passed 21 of 24 test cases with the skill, and 19 of 24 without it.
Without skill79%
With skill88%
Checks it passed that the model alone missed
The response requires restricting repository access outside audited administrative workflows.
The response mandates explicit tenant filtering within native SQL queries to prevent cross-tenant data access.
The response derives tenant identity from authenticated credentials or verified token claims rather than relying solely on caller-supplied headers.
3 fixed18 passed either way2 still failing1 broke
Pass-rate lift
+8 pp
Tokens
-12%
Agent turns
0%
Response time
-24%
Model gemini-3.6-flashMeasured 9/25/2026v221 of 24 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 3 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 3
Prompt
We are building a Spring Boot REST API for our SaaS platform and need to implement request interceptors to manage tenant context safely across incoming API calls. Could you write a Java filter implementation that extracts tenant context from incoming requests and sets up the execution context for downstream services? Please provide the filter class code along with a brief explanation of the key architectural safeguards used.
What was checked, without and with the skill
Checked
Without skill
With skill
The response derives tenant identity from authenticated credentials or verified token claims rather than relying solely on caller-supplied headers.
Missed
Passed
The implementation includes a try-finally block that clears the ThreadLocal tenant state upon request completion.
Passed
Passed
case-01 · gemini-3.6-flash · 9/25/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md48 linessingle file
Multi-Tenancy
Treat tenant identity as an authorization boundary, not a query convenience.
Choose an isolation model
Database per tenant: strongest isolation and highest operational cost.
Schema per tenant: strong logical isolation with shared infrastructure.
Shared schema with tenant_id: simplest operations, but every data path must enforce scope.
Document the model and prohibit unrestricted repository access outside audited administration.
Resolve tenant identity
Derive tenant from a verified token claim, trusted host mapping, or authenticated API key.
Reject missing, unknown, disabled, or conflicting tenant identifiers.
Never trust a public X-Tenant-Id header by itself.
Clear servlet thread-local state in finally; use Reactor Context for reactive flows.
Enforce isolation
Resolve tenant before opening a Hibernate session, transaction, or R2DBC connection.
Include tenant in unique constraints, cache keys, idempotency keys, and object paths.
Prevent cross-tenant joins and unrestricted native queries.
Authorize support impersonation explicitly and audit the actor, tenant, reason, and duration.
Operations
Run migrations per database/schema with resumable progress and version reporting.
Propagate tenant explicitly into messages, scheduled jobs, batch parameters, and async tasks.
Apply quotas and bounded tenant labels for noisy-neighbor visibility.
Test attempted cross-tenant reads, writes, cache access, and job execution.
Examples
See examples/good-tenant-filter.java and examples/bad-tenant-filter.java.