קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בעזרת כללים ב-Gemini, אתם יכולים להגדיר שפות תכנות, סגנונות או פורמטים מועדפים של פלט שיחולו על כל ההנחיות. אם תגדירו את ההעדפות האלה פעם אחת, הן יחולו באופן אוטומטי על כל ההנחיות הבאות שתשלחו ל-Gemini. הכללים עוזרים ל-Gemini להבין את התקנים וההעדפות של הפרויקט כדי לספק עזרה מדויקת יותר בכתיבת קוד שמותאמת לצרכים שלכם. לדוגמה, אתם יכולים ליצור כלל כמו "תמיד תן לי תשובות תמציתיות ב-Kotlin".
אפשר לאחסן ולנהל כללים בספריית ההנחיות ב-Android Studio. כדי להגדיר כלל, מבצעים את השלבים הבאים:
כדי לפתוח את ההגדרות של Gemini, לוחצים על סמל הסטטוס של Gemini בתחתית ה-IDE ואז על Configure Gemini (הגדרת Gemini) > Prompt Library (ספריית ההנחיות). אפשרות נוספת היא לעבור אל File (קובץ) (Android Studio ב-macOS) >
Settings (הגדרות) > Tools (כלים) > Gemini > Prompt Library (ספריית הנחיות).
משתמשים בתפריט הנפתח Scope כדי לאחסן כללים ברמת ה-IDE או ברמת הפרויקט:
כללים ברמת ה-IDE הם פרטיים וניתן להשתמש בהם בכמה פרויקטים.
אפשר לשתף כללים ברמת הפרויקט בין חברי צוות שעובדים על אותו פרויקט. הם נשמרים בקובץ /.idea/project.prompts.xml עם הנחיות ברמת הפרויקט.
כדי להוסיף כלל, לוחצים על כללים ומוסיפים את הכללים בעורך. מוודאים שהכללים ספציפיים ומניבים תובנות מעשיות. הפריסה של הכללים לא קריטית, אבל כדי שיהיה לכם קל יותר לקרוא ולתחזק אותם, כדאי להוסיף כמה כללים לרשימת תבליטים.
לוחצים על החלה כדי לשמור את ההגדרות ולהישאר בתיבת הדו-שיח של ההגדרות. לוחצים על אישור כדי לשמור את ההגדרות ולצאת מתיבת הדו-שיח.
הנה כמה רעיונות לכללים שאפשר להוסיף:
מדריכי סגנון של חברות, למשל מוסכמות למתן שמות למשתנים או להוספת הערות לקוד
ספריות מומלצות לשימוש, לדוגמה: "מומלץ להשתמש בספרייה <X> במקום בספרייה <Y>"
העדפות לגבי שפת תכנות, למשל "תספק את כל דוגמאות הקוד ב-Kotlin"
ביטול הבחירה של כללים לשאילתה
הכללים חלים באופן אוטומטי על כל שאילתה ששולחים ל-Gemini. אם לא רוצים שהכללים יחולו על הנחיה ספציפית, אפשר לבטל את הבחירה בכללים לפני ששולחים את ההנחיה. לשם כך, לוחצים על הקשר ומבטלים את הסימון של כללים.
איך הכללים פועלים
הכללים מתווספים לתחילת כל הנחיה כהקדמה. כדאי להשתמש בכללים כדי לספק הקשר, לציין את הפלט והפורמט הרצויים ולעזור לעצב את ההתנהגות של Gemini כדי ליצור תשובות מדויקות ומועילות יותר. אם משתמשים בכללים ברמת ה-IDE וגם בכללים ברמת הפרויקט, שתי הקטגוריות של הכללים יחולו על כל הנחיה.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת 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."]]