{"id":"7e9fcf3b-a046-4641-a8a2-375f1b5374b6","shortId":"5LwhnS","kind":"skill","title":"311-frameworks-spring-jdbc","tagline":"Use when you need to write or review programmatic JDBC with Spring — including JdbcClient (Spring Framework 7+) as the default API, JdbcTemplate only where batch/streaming APIs require JdbcOperations, NamedParameterJdbcTemplate for legacy named-param code, parameterized SQL, RowM","description":"# Spring JDBC — JdbcClient (Spring Framework 7+)\n\nApply Spring JDBC guidelines with JdbcClient as the default; use JdbcTemplate / NamedParameterJdbcTemplate only for legacy code or APIs not covered by JdbcClient (batch updates, KeyHolder, RowCallbackHandler streaming).\n\n**What is covered in this Skill?**\n\n- Parameterized SQL (never concatenate user input)\n- JdbcClient fluent API (Spring Framework 7+) — preferred for queries and updates\n- Named parameters via JdbcClient; NamedParameterJdbcTemplate for legacy migration\n- RowMapper, query(Class), and records\n- Batch operations and generated keys (JdbcTemplate / JdbcOperations where needed)\n- Safe handling of generated keys (KeyHolder; single-row JdbcClient updates)\n- Service-layer @Transactional boundaries\n- Read-only transactions (@Transactional(readOnly = true))\n- Safe single-row access (optional() / findFirst() vs queryForObject)\n- Streaming large result sets (RowCallbackHandler, ResultSetExtractor)\n- DataAccessException handling (DuplicateKeyException, EmptyResultDataAccessException)\n- @JdbcTest slice testing with @Sql fixtures\n\n**Scope:** Apply recommendations based on the reference rules and good/bad code examples.\n\n## Constraints\n\nBefore applying any Spring JDBC changes, ensure the project compiles. If compilation fails, stop immediately. After applying improvements, run full verification.\n\n- **MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change\n- **SAFETY**: If compilation fails, stop immediately\n- **VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements\n- **SQL INJECTION**: Never concatenate untrusted input into SQL strings — always use bind parameters\n- **BEFORE APPLYING**: Read the reference for detailed rules and good/bad patterns\n\n## When to use this skill\n\n- Review Java code for Spring JDBC (JdbcTemplate, JdbcClient, NamedParameterJdbcTemplate)\n- Apply best practices for Spring JDBC data access in Java code\n- Detect and fix SQL injection risks in JDBC code\n- Improve transaction boundaries or exception handling for JDBC operations\n\n## Workflow\n\n1. **Read reference and assess project context**\n\nRead `references/311-frameworks-spring-jdbc.md` and inspect the current project setup before proposing changes.\n\n2. **Gather scope and decide target improvements**\n\nIdentify requested outcomes, constraints, and the minimum safe set of changes to apply.\n\n3. **Apply framework-aligned changes**\n\nImplement or refactor configuration/code following the reference patterns and project conventions.\n\n4. **Run verification and report results**\n\nExecute appropriate build/tests and summarize what changed, what was verified, and any follow-up actions.\n\n## Reference\n\nFor detailed guidance, examples, and constraints, see [references/311-frameworks-spring-jdbc.md](references/311-frameworks-spring-jdbc.md).","tags":["311","frameworks","spring","jdbc","cursor","rules","java","jabrena","agent-skills","ai-skills","claude","claude-code"],"capabilities":["skill","source-jabrena","skill-311-frameworks-spring-jdbc","topic-agent-skills","topic-ai-skills","topic-claude","topic-claude-code","topic-claude-code-skills","topic-claude-code-subagents","topic-claude-skills","topic-cursor-agent","topic-cursor-ai","topic-cursor-skills","topic-cursorai","topic-github-copilot"],"categories":["cursor-rules-java"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/jabrena/cursor-rules-java/311-frameworks-spring-jdbc","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add jabrena/cursor-rules-java","source_repo":"https://github.com/jabrena/cursor-rules-java","install_from":"skills.sh"}},"qualityScore":"0.631","qualityRationale":"deterministic score 0.63 from registry signals: · indexed on github topic:agent-skills · 362 github stars · SKILL.md body (2,845 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-26T12:53:36.922Z","embedding":null,"createdAt":"2026-04-18T22:02:13.366Z","updatedAt":"2026-04-26T12:53:36.922Z","lastSeenAt":"2026-04-26T12:53:36.922Z","tsv":"'/mvnw':206,223 '1':301 '2':319 '3':339 '311':1 '4':356 '7':22,49,94 'access':149,278 'action':377 'align':343 'alway':242 'api':26,31,67,91 'appli':50,171,184,199,212,231,247,271,338,340 'appropri':363 'assess':305 'base':173 'batch':72,113 'batch/streaming':30 'best':272 'bind':244 'boundari':137,293 'build/tests':364 'chang':188,214,318,336,344,368 'class':110 'clean':224,228 'code':40,65,180,264,281,290 'compil':192,194,207,210,217 'concaten':86,236 'configuration/code':348 'constraint':182,329,384 'context':307 'convent':355 'cover':69,79 'current':313 'data':277 'dataaccessexcept':160 'decid':323 'default':25,58 'detail':252,380 'detect':282 'duplicatekeyexcept':162 'emptyresultdataaccessexcept':163 'ensur':189 'exampl':181,382 'except':295 'execut':362 'fail':195,218 'findfirst':151 'fix':284 'fixtur':169 'fluent':90 'follow':349,375 'follow-up':374 'framework':3,21,48,93,342 'framework-align':341 'frameworks-spring-jdbc':2 'full':202 'gather':320 'generat':116,125 'good/bad':179,255 'guidanc':381 'guidelin':53 'handl':123,161,296 'identifi':326 'immedi':197,220 'implement':345 'improv':200,232,291,325 'includ':18 'inject':234,286 'input':88,238 'inspect':311 'java':263,280 'jdbc':5,15,45,52,187,267,276,289,298 'jdbcclient':19,46,55,71,89,103,131,269 'jdbcoper':33,119 'jdbctemplat':27,60,118,268 'jdbctest':164 'key':117,126 'keyhold':74,127 'larg':155 'layer':135 'legaci':36,64,106 'mandatori':204 'migrat':107 'minimum':332 'mvn':209,227 'name':38,100 'named-param':37 'namedparameterjdbctempl':34,61,104,270 'need':9,121 'never':85,235 'oper':114,299 'option':150 'outcom':328 'param':39 'paramet':101,245 'parameter':41,83 'pattern':256,352 'practic':273 'prefer':95 'programmat':14 'project':191,306,314,354 'propos':317 'queri':97,109 'queryforobject':153 'read':139,248,302,308 'read-on':138 'readon':143 'recommend':172 'record':112 'refactor':347 'refer':176,250,303,351,378 'references/311-frameworks-spring-jdbc.md':309,386,387 'report':360 'request':327 'requir':32 'result':156,361 'resultsetextractor':159 'review':13,262 'risk':287 'row':130,148 'rowcallbackhandl':75,158 'rowm':43 'rowmapp':108 'rule':177,253 'run':201,205,222,357 'safe':122,145,333 'safeti':215 'scope':170,321 'see':385 'servic':134 'service-lay':133 'set':157,334 'setup':315 'singl':129,147 'single-row':128,146 'skill':82,261 'skill-311-frameworks-spring-jdbc' 'slice':165 'source-jabrena' 'spring':4,17,20,44,47,51,92,186,266,275 'sql':42,84,168,233,240,285 'stop':196,219 'stream':76,154 'string':241 'summar':366 'target':324 'test':166 'topic-agent-skills' 'topic-ai-skills' 'topic-claude' 'topic-claude-code' 'topic-claude-code-skills' 'topic-claude-code-subagents' 'topic-claude-skills' 'topic-cursor-agent' 'topic-cursor-ai' 'topic-cursor-skills' 'topic-cursorai' 'topic-github-copilot' 'transact':136,141,142,292 'true':144 'untrust':237 'updat':73,99,132 'use':6,59,243,259 'user':87 'verif':203,358 'verifi':221,225,229,371 'via':102 'vs':152 'workflow':300 'write':11","prices":[{"id":"eca2f3ac-062b-4664-90ff-c236fcd6e693","listingId":"7e9fcf3b-a046-4641-a8a2-375f1b5374b6","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"jabrena","category":"cursor-rules-java","install_from":"skills.sh"},"createdAt":"2026-04-18T22:02:13.366Z"}],"sources":[{"listingId":"7e9fcf3b-a046-4641-a8a2-375f1b5374b6","source":"github","sourceId":"jabrena/cursor-rules-java/311-frameworks-spring-jdbc","sourceUrl":"https://github.com/jabrena/cursor-rules-java/tree/main/skills/311-frameworks-spring-jdbc","isPrimary":false,"firstSeenAt":"2026-04-18T22:02:13.366Z","lastSeenAt":"2026-04-26T12:53:36.922Z"}],"details":{"listingId":"7e9fcf3b-a046-4641-a8a2-375f1b5374b6","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"jabrena","slug":"311-frameworks-spring-jdbc","github":{"repo":"jabrena/cursor-rules-java","stars":362,"topics":["agent-skills","ai-skills","claude","claude-code","claude-code-skills","claude-code-subagents","claude-skills","cursor-agent","cursor-ai","cursor-skills","cursorai","github-copilot","intellij-idea","java","prompting","system-prompts"],"license":"apache-2.0","html_url":"https://github.com/jabrena/cursor-rules-java","pushed_at":"2026-04-26T12:50:01Z","description":"A curated and opinionated collection of Skills and Agents to be used in modern SDLC workflows for Java Enterprise development with your favorite AI Agent harness.","skill_md_sha":"8e07b24d548d84fded22fbcc9d746e97966152ce","skill_md_path":"skills/311-frameworks-spring-jdbc/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/jabrena/cursor-rules-java/tree/main/skills/311-frameworks-spring-jdbc"},"layout":"multi","source":"github","category":"cursor-rules-java","frontmatter":{"name":"311-frameworks-spring-jdbc","license":"Apache-2.0","description":"Use when you need to write or review programmatic JDBC with Spring — including JdbcClient (Spring Framework 7+) as the default API, JdbcTemplate only where batch/streaming APIs require JdbcOperations, NamedParameterJdbcTemplate for legacy named-param code, parameterized SQL, RowMapper mapping to records, batch operations, transactions, safe handling of generated keys, DataAccessException handling, read-only transactions, streaming large result sets, and @JdbcTest slice testing. This should trigger for requests such as Review Java code for Spring JDBC (JdbcTemplate, JdbcClient, NamedParameterJdbcTemplate); Apply best practices for Spring JDBC data access in Java code; Detect and fix SQL injection risks in JDBC code; Improve transaction boundaries or exception handling for JDBC operations. Part of cursor-rules-java project"},"skills_sh_url":"https://skills.sh/jabrena/cursor-rules-java/311-frameworks-spring-jdbc"},"updatedAt":"2026-04-26T12:53:36.922Z"}}