{"id":568016,"date":"2025-05-21T10:01:18","date_gmt":"2025-05-21T09:01:18","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=idea&#038;p=568016"},"modified":"2025-08-14T05:36:36","modified_gmt":"2025-08-14T04:36:36","slug":"coding-guidelines-for-your-ai-agents","status":"publish","type":"idea","link":"https:\/\/blog.jetbrains.com\/ko\/idea\/2025\/05\/coding-guidelines-for-your-ai-agents","title":{"rendered":"Coding Guidelines for Your AI Agents"},"content":{"rendered":"\n<p>As software developers, we invest significant time and effort learning various technologies, understanding design patterns, avoiding anti-patterns, and striving to write clean, maintainable code. Over the years, this knowledge becomes second nature, guiding our decisions as we design systems, write features, and review code.<\/p>\n\n\n\n<p>But the landscape is evolving fast.<\/p>\n\n\n\n<p>We\u2019re now entering a new era of software development, where <strong>AI agents<\/strong> are becoming our pair programmers, code reviewers, and even architects. These AI tools are powerful, but they\u2019re only as good as the instructions we provide. If we want these agents to generate code that\u2019s idiomatic, secure, maintainable, and aligned with our standards, we should communicate our intent very clearly to the agents to avoid any assumptions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why guidelines matter more than ever<\/strong><\/h2>\n\n\n\n<p>Nowadays, asking an AI agent to \u201ccreate a Spring Boot REST API\u201d will give you a working result, but it may:<\/p>\n\n\n\n<ul>\n<li>Miss pagination for list APIs.<\/li>\n\n\n\n<li>Use field injection instead of constructor injection.<\/li>\n\n\n\n<li>Skip error handling or logging.<\/li>\n\n\n\n<li>Not adhere to your project\u2019s package structure or naming conventions.<\/li>\n<\/ul>\n\n\n\n<p>This is where <strong>technology-specific coding guidelines<\/strong> come into play. They provide:<\/p>\n\n\n\n<ul>\n<li><strong>A clear standard<\/strong> for how code should be written in a given language or framework.<\/li>\n\n\n\n<li><strong>A reference point<\/strong> for developers to onboard quickly and write consistent code.<\/li>\n\n\n\n<li><strong>A contract<\/strong> to share with AI agents when prompting them to generate code.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Our goal: a living catalog of AI-friendly coding guidelines<\/strong><\/h2>\n\n\n\n<p>We\u2019re working on building a <strong>catalog of guidelines<\/strong> \u2013 a developer-centric and AI-ready resource that outlines best practices for commonly used technologies like Java, Spring Boot, Spring Data, Spring Security, Docker, Testcontainers, and more.<\/p>\n\n\n\n<p>The guidelines will include:<\/p>\n\n\n\n<ul>\n<li>Preferred coding styles and conventions<\/li>\n\n\n\n<li>Dos and Don\u2019ts (best practices vs. anti-patterns)<\/li>\n\n\n\n<li>Common \u201cgotchas\u201d to avoid<\/li>\n\n\n\n<li>Real-world code examples with explanations<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How this helps developers and AI agents alike<\/strong><\/h2>\n\n\n\n<p>For developers, this catalog becomes a <strong>trusted reference<\/strong> \u2013 something they can consult before implementing a feature, doing a code review, or mentoring a teammate.<\/p>\n\n\n\n<p>For AI agents, it becomes <strong>recommended guidelines<\/strong> \u2013 a set of standards you can paste into a prompt and instruct agents to follow when generating code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example use case<\/strong><\/h3>\n\n\n\n<p>You could start a prompt with:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>Generate a Spring Boot REST controller following these guidelines:<\/p>\n\n\n\n<ul>\n<li>Use constructor-based dependency injection<\/li>\n\n\n\n<li>Return <code>ResponseEntity<\/code> with proper status codes<\/li>\n\n\n\n<li>Validate input using <code>@Valid<\/code> and return meaningful error responses<\/li>\n\n\n\n<li>Avoid using <code>Optional<\/code> in request bodies<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<p>And the result? The generated code is more aligned with your expectations, saving time on refactoring and reviews.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to use guidelines with Junie<\/strong><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.jetbrains.com\/junie\/\" target=\"_blank\" rel=\"noopener\">Junie<\/a> is an autonomous AI coding agent from JetBrains. You can specify your coding style, best practices, and general preferences by specifying your desired guidelines in the <code>.junie\/guidelines.md<\/code> file so that Junie will follow them while generating code.<\/p>\n\n\n\n<p>Check out the <a href=\"https:\/\/github.com\/JetBrains\/junie-guidelines\" target=\"_blank\" rel=\"noopener\">junie-guidelines<\/a> repository, which has a catalog of guidelines for various technologies.&nbsp;<\/p>\n\n\n\n<p>You can add all the guidelines for various technologies that you are using into the <code>.junie\/guidelines.md<\/code> file and delegate tasks to Junie. Junie will take these guidelines into consideration while generating the code so that you don\u2019t have to add these guidelines in each prompt.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to use Junie guidelines in existing (legacy) projects?<\/h2>\n\n\n\n<p>For greenfield projects, you can use the guidelines from the catalog and start building your application. But what about existing applications that already follow certain conventions and patterns?<\/p>\n\n\n\n<p>You can ask Junie to create a <code>guidelines.md<\/code> file that includes the coding conventions being followed in the current codebase so far.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"725\" height=\"632\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/08\/junie-guidelines-prompt.png\" alt=\"\" class=\"wp-image-592469\"\/><\/figure>\n\n\n\n<p>Once the <code>guidelines.md<\/code> file is generated, you can tweak it to add more guidelines or update the existing ones as needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>This living catalog of AI-friendly coding guidelines is more than just documentation. It\u2019s a community-driven playbook designed to keep our codebases consistent, reliable, and future-ready. By pooling our collective expertise in areas like Java, Spring Boot, Docker, and Testcontainers, we\u2019ve created a single source of truth that benefits both human developers and AI-powered tools. Whether you\u2019re implementing a tricky feature, conducting a code review, or fine-tuning your AI prompts, these guidelines will save you time and prevent common pitfalls.<\/p>\n\n\n\n<p><strong>NOTE: Some guidelines are opinionated, and your views and those of the author may differ on certain points. Feel free to modify the guidelines to suit your needs and team preferences.<\/strong><\/p>\n\n\n\n<p>We plan to publish the first batch of guidelines soon and open it for community contributions. If you care about code quality in the age of AI, this is your chance to help define what good AI-generated code looks like.<\/p>\n\n\n\n<p>We are working on creating guidelines for various programming languages including <strong>Java<\/strong>, <strong>Kotlin<\/strong>, <strong>Python<\/strong>, <strong>Go<\/strong>, <strong>JavaScript<\/strong>\/<strong>TypeScript<\/strong>, etc.<\/p>\n\n\n\n<p>We invite you to visit the <a href=\"https:\/\/github.com\/JetBrains\/junie-guidelines\" target=\"_blank\" rel=\"noopener\">junie-guidelines<\/a> repository on GitHub, explore the existing sections, and, most importantly, contribute your own guidelines.<\/p>\n\n\n\n<p>Have a favorite pattern, a memorable gotcha, or an example that perfectly illustrates a best practice? Submit a pull request! Your contributions will not only strengthen the catalog but also help shape the future of AI-assisted development. Let\u2019s build this resource together and set a new standard for coding excellence.<\/p>\n","protected":false},"author":1517,"featured_media":568289,"comment_status":"closed","ping_status":"closed","template":"","categories":[8397],"tags":[8724,8759],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/idea\/568016"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/idea"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/types\/idea"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/users\/1517"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/comments?post=568016"}],"version-history":[{"count":9,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/idea\/568016\/revisions"}],"predecessor-version":[{"id":592481,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/idea\/568016\/revisions\/592481"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/media\/568289"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/media?parent=568016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/categories?post=568016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/tags?post=568016"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/cross-post-tag?post=568016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}