Gemini의 규칙을 사용하면 모든 프롬프트에 적용되는 선호하는 코딩 언어, 스타일 또는 출력 형식을 정의할 수 있습니다. 이러한 환경설정을 한 번 설정하면 Gemini에 전송되는 모든 후속 프롬프트에 자동으로 적용됩니다. 규칙을 사용하면 Gemini가 프로젝트 표준과 환경설정을 이해하여 더 정확하고 맞춤화된 코드 지원을 제공할 수 있습니다. 예를 들어 '항상 Kotlin으로 간결한 대답을 제공해 줘'와 같은 규칙을 만들 수 있습니다.
Android 스튜디오의 프롬프트 라이브러리에 규칙을 저장하고 관리합니다. 규칙을 설정하려면 다음 단계를 따르세요.
Gemini의 설정을 열려면 IDE 하단에 있는 Gemini 상태 아이콘 을 클릭한 다음 Gemini 구성 > 프롬프트 라이브러리를 클릭합니다. 또는 File (macOS의 경우 Android Studio) > Settings > Tools > Gemini > Prompt Library로 이동합니다.
범위 드롭다운을 사용하여 IDE 수준 또는 프로젝트 수준에서 규칙을 저장합니다.
IDE 수준 규칙은 비공개이며 여러 프로젝트에서 사용될 수 있습니다.
프로젝트 수준 규칙은 같은 프로젝트에서 작업하는 팀원 간에 공유될 수 있습니다. 프로젝트 수준 프롬프트와 함께 /.idea/project.prompts.xml 파일에 저장됩니다.
규칙을 추가하려면 규칙을 클릭하고 편집기에서 규칙을 추가합니다. 규칙이 구체적이고 실행 가능한지 확인합니다. 규칙의 레이아웃은 중요하지 않지만 가독성과 유지관리성을 위해 여러 규칙을 글머리 기호 목록에 넣는 것이 좋습니다.
적용을 클릭하여 저장하고 설정 대화상자에 유지합니다. 확인을 클릭하여 설정을 저장하고 대화상자를 종료합니다.
다음은 규칙으로 추가할 수 있는 몇 가지 아이디어입니다.
회사 스타일 가이드(예: 변수 이름 지정 또는 코드 주석 규칙)
사용할 라이브러리 추천(예: '라이브러리 <Y> 대신 라이브러리 <X> 사용')
코딩 언어 환경설정(예: '모든 코드 예시를 Kotlin으로 제공해 줘')
질문에 대한 규칙 선택 해제
규칙은 Gemini에 전송하는 모든 질문에 자동으로 적용됩니다. 특정 프롬프트에 규칙을 적용하지 않으려면 프롬프트를 보내기 전에 컨텍스트를 클릭하고 규칙을 선택 해제하여 규칙을 선택 해제하면 됩니다.
규칙 작동 방식
규칙은 모든 프롬프트의 시작 부분에 서문으로 추가됩니다. 규칙을 사용하여 맥락을 제공하고, 원하는 출력과 형식을 지정하고, Gemini의 동작을 형성하여 더 정확하고 유용한 대답을 생성하도록 지원해야 합니다. IDE 수준 규칙과 프로젝트 수준 규칙을 모두 사용하는 경우 두 카테고리의 규칙이 모든 프롬프트에 적용됩니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-31(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-31(UTC)"],[],[],null,["# Customize your experience with Rules\n\nRules in Gemini let you define preferred coding languages, styles, or output\nformats that apply to all prompts. When you set these preferences once, they are\nautomatically applied to all subsequent prompts sent to Gemini. Rules help\nGemini understand project standards and preferences for more accurate and\ntailored code assistance. For example, you can create a rule such as \"Always\ngive me concise responses in Kotlin.\"\n\nStore and manage rules in the [Prompt Library](/studio/gemini/prompt-library) in\nAndroid Studio. To set up a rule, follow these steps:\n\n1. To open Gemini's settings, click the Gemini status icon at the bottom of the IDE and then click **Configure Gemini** \\\u003e **Prompt\n Library** . Alternatively go to **File** (**Android Studio** on macOS) **\\\u003e\n Settings \\\u003e Tools \\\u003e Gemini \\\u003e Prompt Library**.\n2. Use the **Scope** drop-down to store rules at the IDE level or the project level:\n - IDE-level rules are private to yourself and can be used across multiple projects.\n - Project-level rules can be shared among teammates working on the same project. They're saved in the `/.idea/project.prompts.xml` file with [project-level prompts](/studio/gemini/prompt-library#share-project-prompts).\n3. To add a rule, click **Rules** and add the rule(s) in the editor. Ensure that the rules are specific and actionable. The layout of the rules isn't critical, but for your own readability and maintainability, consider putting multiple rules in a bullet list.\n4. Click **Apply** to save and stay in the settings dialog. Click **Ok** to save and exit the settings dialog.\n\nHere are some ideas of what to add as rules:\n\n- Company style guides, for example conventions for variable naming or code commenting\n- Recommended libraries to use, for example \"Use library \\\u003cX\\\u003e instead of library \\\u003cY\\\u003e\"\n- Coding language preferences, for example \"Provide all code examples in Kotlin\"\n\nDe-select rules for a query\n---------------------------\n\nRules are automatically applied to every query you send to Gemini. If you don't\nwant the rules to apply to a specific prompt, you can de-select the rules before\nyou send the prompt by clicking **Context** and un-checking **Rules**.\n\nHow rules work\n--------------\n\nRules are added to the beginning of every prompt as a *preamble*. You should use\nrules to provide context, specify a desired output and format, and help shape\nGemini's behavior to generate more accurate and helpful responses. If you are\nusing both IDE-level and project-level rules, both categories of rules are\napplied to every prompt."]]