하나 이상의 AGENT.md 파일을 사용하여 Android 스튜디오의 Gemini에 따라야 할 맞춤 안내를 제공합니다. AGENT.md 파일은 코드베이스의 다른 파일과 함께 배치되므로 버전 관리 시스템 (VCS)에 체크인하고 프로젝트별 안내, 코딩 스타일 규칙, 기타 안내를 전체 팀과 공유하기가 간단합니다.
시작하려면 다음 단계를 따르세요.
프로젝트의 파일 시스템에 원하는 위치에 AGENT.md 파일을 만듭니다. Gemini는 질문을 제출할 때 현재 디렉터리와 모든 상위 디렉터리에서 AGENT.md 파일을 검색합니다. 자세한 내용은 AGENT.md 파일 작동 방식을 참고하세요.
요청 사항을 추가합니다. 마크다운을 사용하여 안내를 작성합니다. 가독성을 위해 다양한 규칙에 제목과 글머리 기호를 사용하는 것이 좋습니다.
예시 안내 보기
파일을 VCS에 저장하고 커밋하여 팀과 공유합니다.
AGENT.md 파일을 컨텍스트로 관리
채팅 패널의 컨텍스트 드로어를 사용하여 특정 질문의 컨텍스트로 AGENT.md 파일을 적용하거나 삭제할 수 있습니다. AGENT.md 파일 옵션에는 현재 디렉터리와 상위 디렉터리의 모든 AGENT.md 파일이 포함됩니다.
그림 1.AGENT.md 파일을 컨텍스트로 관리합니다.
요청 사항 예시
AGENT.md 파일을 사용하여 에이전트에 지침을 제공할 수 있습니다. 다음은 몇 가지 예시이지만, 제공하는 안내는 프로젝트에 따라 달라야 합니다.
'기본 활동은 /path/to/MainActivity.kt입니다.'
'화면 간 이동을 지원하는 코드는 path/to/navigation/UiNavigation.kt입니다.'
'HTTP 요청을 처리하는 코드는 <path>에 있습니다.'
프로젝트 아키텍처
'모든 비즈니스 로직을 ViewModel에 배치하세요.'
'계층화된 아키텍처 사용을 비롯한 공식 아키텍처 권장사항을 항상 따르세요. 단방향 데이터 흐름 (UDF), ViewModel, 수명 주기 인식 UI 상태 컬렉션 및 기타 권장사항을 사용하세요.'
선호하는 라이브러리: '탐색에 <라이브러리 이름> 라이브러리를 사용해 줘.'
일반적인 API 서비스 또는 내부 용어의 자리표시자 이름 정의: '기본 백엔드 서비스는 'PhotoSift-API'라고 합니다.'
회사 스타일 가이드: '모든 새 UI 구성요소는 Jetpack Compose로 빌드해야 합니다. XML 기반 레이아웃을 제안하지 마세요.'
AGENT.md 파일 모듈화
큰 AGENT.md 파일을 여러 컨텍스트에서 재사용할 수 있는 작은 파일로 분할할 수 있습니다.
일련의 안내를 분리하여 style-guidance.md와 같은 다른 마크다운 파일에 저장합니다.
가져오려는 파일의 경로 뒤에 @ 기호를 사용하여 AGENT.md 파일에서 더 작은 마크다운 파일을 참조합니다. 다음과 같은 경로 형식이 지원됩니다.
상대 경로:
@./file.md - 동일한 디렉터리에서 가져오기
@../file.md - 상위 디렉터리에서 가져오기
@./subdirectory/file.md - 하위 디렉터리에서 가져오기
절대 경로: @/absolute/path/to/file.md
예를 들어 다음 AGENT.md 파일은 다른 두 명령어 파일을 참조합니다.
# My AGENT.md
You are an experienced Android app developer.
@./get-started.md
## Coding style
@./shared/style-guidance.md
AGENT.md 파일 작동 방식
Gemini는 현재 디렉터리와 상위 디렉터리에서 AGENT.md 파일을 자동으로 검색하고 모든 프롬프트의 시작 부분에 해당 콘텐츠를 서문으로 추가합니다. 쿼리를 제출할 때 열려 있는 파일이 없으면 프로젝트 루트의 AGENT.md 파일 (있는 경우)이 기본적으로 포함됩니다.
AGENT.md 파일과 규칙의 차이점은 무엇인가요?
규칙을 사용하면 모든 프롬프트에 적용되는 안내와 환경설정을 정의할 수도 있습니다. 하지만 규칙은 IntelliJ 파일 /.idea/project.prompts.xml에 정의되는 반면 AGENT.md 파일은 소스 코드 옆에 저장되며 IDE에 구애받지 않습니다. 기본 목적 중 하나가 팀과 안내를 공유하는 것이라면 AGENT.md 파일을 사용하는 것이 좋습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-22(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-08-22(UTC)"],[],[],null,["# Customize Gemini using AGENT.md files\n\nGive Gemini in Android Studio customized instructions to follow using one or\nmore `AGENT.md` files. `AGENT.md` files are placed alongside the other files in\nyour codebase, so it's straightforward to check them in to your version control\nsystem (VCS) and share project-specific instructions, coding style rules, and\nother guidance with your entire team.\n\nTo get started, follow these steps:\n\n1. Create an `AGENT.md` file anywhere in your project's file system. Gemini\n scans the current directory and all parent directories for `AGENT.md` files when\n you submit a query. For more details, see [How `AGENT.md` files work](#how-agent-files-work).\n\n | **Tip:** Use multiple instruction files across different directories for more granular control over different parts of your codebase. For example, you can have a global `AGENT.md` file at the project root and more specific `AGENT.md` files in subdirectories for different modules.\n2. Add your instructions. Write your instructions using Markdown. For\n readability, consider using headings and bullet points for different rules.\n [See example instructions](#example-instructions).\n\n3. Save and commit the file to your VCS to share it with your team.\n\nManage `AGENT.md` files as context\n----------------------------------\n\nYou can apply or remove `AGENT.md` files as context for a particular query\nusing the **Context** drawer in the chat panel. The **`AGENT.md` Files** options\nincludes all `AGENT.md` files in the current directory and its parent\ndirectories.\n**Figure 1.** Manage `AGENT.md` files as context.\n\nExample instructions\n--------------------\n\nYou can use the `AGENT.md` file to give instructions to the agent. The following\nare some examples, but the instructions that you provide should be specific to\nyour project.\n\n- \"The main activity is `/path/to/MainActivity.kt`.\"\n- \"The code to support navigating between screens is `path/to/navigation/UiNavigation.kt`\"\n- \"The code handling HTTP requests is at `\u003cpath\u003e`.\"\n- Project architecture\n - \"Place all business logic in ViewModels.\"\n - \"Always follow official architecture recommendations, including use of a layered architecture. Use a unidirectional data flow (UDF), ViewModels, lifecycle-aware UI state collection, and other recommendations.\"\n- Preferred libraries: \"Use the \\\u003clibrary name\\\u003e library for navigation.\"\n- Defining placeholder names for common API services or internal terminology: \"The primary backend service is referred to as 'PhotoSift-API'.\"\n- Company style guides: \"All new UI components must be built with Jetpack Compose. Don't suggest XML-based layouts.\"\n\nModularize your `AGENT.md` files\n--------------------------------\n\nYou can break down large `AGENT.md` files into smaller files that can be reused\nin different contexts:\n\n1. Separate out a set of instructions and save them in another Markdown file,\n such as `style-guidance.md`.\n\n2. Reference the smaller Markdown files in an `AGENT.md` file by using the `@`\n symbol followed by the path to the file you want to import. The following path\n formats are supported:\n\n - Relative paths:\n - `@./file.md` - Import from the same directory\n - `@../file.md` - Import from the parent directory\n - `@./subdirectory/file.md` - Import from a subdirectory\n - Absolute paths: `@/absolute/path/to/file.md`\n\nFor example, the following `AGENT.md` file references two other instruction\nfiles: \n\n # My AGENT.md\n\n You are an experienced Android app developer.\n\n @./get-started.md\n\n ## Coding style\n\n @./shared/style-guidance.md\n\nHow `AGENT.md` files work\n-------------------------\n\nGemini automatically scans the current directory and parent directories for\n`AGENT.md` files and adds their content to the beginning of every prompt as a\npreamble. If you don't have a file open when you submit a query, then the\n`AGENT.md` file at the project root (if there is one) is included by default.\n| **Note:** If you have a `GEMINI.md` file and `AGENT.md` file in the same directory, the `GEMINI.md` file takes precedence.\n\nWhat's the difference between `AGENT.md` files and Rules?\n---------------------------------------------------------\n\n[Rules](/studio/gemini/rules) also let you define instructions and preferences\nthat apply to all prompts. However, rules are defined in the IntelliJ file\n`/.idea/project.prompts.xml`, whereas `AGENT.md` files are saved next to your\nsource code and are IDE-neutral. We recommend using `AGENT.md` files if one of\nthe primary purposes is to share the instructions with your team.\n| **Note:** Gemini combines rules and instructions in `AGENT.md` files when processing your query."]]