ترغیب موثر
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
اثربخشی طرح برنامه شما و کیفیت کد تولید شده به وضوح و جزئیات درخواست شما بستگی دارد. هنگام استفاده از App Prototyping agent ، دستورالعملهای زیر را برای درخواست مؤثر هنگام تولید و اشکالزدایی برنامهها در نظر بگیرید:
- مشخص باشید: ویژگی ها، تعاملات کاربر و نیازهای داده برنامه خود را به وضوح تعریف کنید. در صورت امکان، فناوری های خاصی را بخواهید. برای مثال، اگر میخواهید یک برنامه وب با عناصر سه بعدی ایجاد کنید، ممکن است بخواهید از Gemini بخواهید از
three.js
استفاده کند. - درباره کارهای اضافی برای راهاندازی سرویسها بپرسید: Gemini میتواند برای برنامه شما کد بنویسد، اما در واقع نمیتواند سرویسها را راهاندازی کند، APIها را فعال کند یا منابع ارائه کند (مانند سطل Cloud Storage یا حساب Stripe). حتماً به Gemini بگویید که اگر برای سرویسهای خاصی کد مینویسد، باید نحوه راهاندازی آن سرویسها را نیز به شما بگوید.
- درخواست یک پروژه Firebase: اگر از App Prototyping agent بخواهید به شما در راهاندازی خدمات Firebase کمک کند، پروژه Firebase از طرف شما ارائه میکند. برای مثال، میتوانید از «Help me add Firestore» یا «Connect my app to Firebase» بپرسید.
- از Gemini برای اصلاح درخواست خود استفاده کنید: از Gemini برای Google استفاده کنید، با Gemini در Firebase در نمای Code یا سایر سطوح Gemini گپ بزنید تا درخواست خود را اصلاح و بهینه کنید.
- زمینه را ارائه دهید: اطلاعات پسزمینهای در مورد هدف برنامه، مخاطبان هدف و تجربه کاربری مورد نظر خود درج کنید.
- از مثالها استفاده کنید: در صورت امکان، مثالهایی از نحوه تعامل کاربران با برنامه یا دادههایی که باید نمایش داده شوند، ارائه دهید.
- تکرار و اصلاح: به طور تکراری به توسعه خود نزدیک شوید. در نظر بگیرید که با یک درخواست اولیه شروع کنید، سپس یک ویژگی را اضافه کنید، آن را آزمایش کنید، آن را اصلاح کنید، سپس ویژگی دیگری اضافه کنید.
با پیروی از این دستورالعملها، میتوانید کیفیت و ارتباط طرحهای برنامه تولید شده توسط Firebase Studio و موفقیت آن را در هنگام اشکالزدایی برنامه خود به طور قابل توجهی بهبود بخشید.
از دستورات اضافی برای اصلاح پاسخ ها استفاده کنید
اگر نتایج اولیه آن چیزی نیست که انتظار دارید، میتوانید با اضافه کردن جزئیات بیشتر یا ارائه دستورالعملهای خاص، درخواستهای خود را اصلاح کنید:
- افزودن محدودیت ها: محدودیت هایی را در رابط کاربری، مدل داده یا ویژگی ها مشخص کنید.
- مثالهایی ارائه کنید: مثالهایی از نحوه تعامل کاربران با برنامه و اینکه چه دادههایی باید ظاهر شوند را ارائه دهید.
- استفاده از کلمات کلیدی: از کلمات کلیدی برای توصیف ویژگی ها یا قابلیت های مورد نظر خود استفاده کنید که ممکن است LLM با کلاس خروجی مورد نظر شما مرتبط باشد. برای مثال، ممکن است از Material Design در درخواستی استفاده کنید که در آن نشان میدهید که میخواهید برنامه شما به استانداردهای طراحی Google پایبند باشد.
- تغییرات خاص را بخواهید: تغییرات خاصی را در کد یا طرح اولیه ایجاد شده بخواهید. هر درخواست ویژگی را در یک درخواست جداگانه اضافه کنید.
- از مدل بخواهید استدلال کند: اگر برای رسیدن به نتایج دلخواه مشکل دارید، سعی کنید از مدل بخواهید تا از طریق درخواست استدلال کند. به عنوان مثال، می توانید بگویید "گام به گام فکر کنید. من می خواهم یک کادر ورودی برای برنامه وظیفه خود ایجاد کنم. باید حاوی یک دکمه "افزودن کار" و یک دکمه "لغو" باشد.
با استفاده از این تکنیک ها، می توانید به طور مکرر دستورات خود را اصلاح کنید تا به نتایجی که می خواهید برسید.
نمونه هایی از اعلان های موثر برای نقشه های برنامه
در اینجا چند نمونه از دستورات موثر برای انواع مختلف برنامه ها آورده شده است:
ردیاب کار ساده:
Create a simple web app that displays a list of to-do items.
Users should be able to add new items to the list and mark items as complete.
Provide a way to delete items and export the list as a text file.
Use a clean and modern UI using Google Material Design principles.
برنامه بودجه بندی:
A budgeting and expense tracking app with spending categories, charts, and
budget goals. Include a clean dashboard with key insights. It should include
spending categories, charts, and budget goals. The app should allow users to
manually add expenses or upload csv files. The app should also allow users to
upload receipts, then use AI to convert the receipt into an expense entry that
users can edit. Data should be stored in browser cache, with download and
delete options.
درخواست برنامه بازی با کمک Gemini (Markdown):
Generate a delightful sliding number puzzle game (15-puzzle) with Javascript,
HTML, and CSS.
- **Setup:** Create a 4x4 grid with numbers 1-15 and one empty space. Use a
**solvable shuffling algorithm** to randomize the start.
- **Gameplay:** Allow clicking tiles **adjacent to the empty space** to slide
them. Count and display the number of moves.
- **Timer:** Include a **countdown timer** starting at **120 seconds**
(2 minutes).
- **End Conditions:**
- If solved (numbers 1-15 in order): Alert with an encouraging winning
statement generated by AI.
- If timer reaches 0: Alert with a funny retort generated by AI.
نکاتی برای رفع اشکال
می توانید از Gemini در Firebase استفاده کنید تا به شما کمک کند کد خود را با چت در فضای کاری Code یا App Prototyping agent اشکال زدایی کنید.
در حالی که Gemini می تواند برای شما کد بنویسد، ممکن است گاهی اوقات خطا نیز ایجاد کند. وقتی خطایی را تشخیص داد، سعی می کند آن را برطرف کند. اگر متوجه شدید که با توجه به پیام خطا نمی تواند مشکل را حل کند، می توانید برخی از تکنیک های زیر را امتحان کنید:
مشکل را شرح دهید: در رابط چت، مشکلی را که با آن روبرو می شوید تا حد امکان واضح و مختصر شرح دهید. در حالی که Gemini ممکن است به زمینه هایی مانند پیام های خطا و گزارش ها دسترسی داشته باشد، ممکن است متن کامل را درک نکند. توصیف رفتار همراه با پیام خطا می تواند به Gemini کمک کند تا خطاها را سریعتر برطرف کند.
سوالات خاص بپرسید: از پرسیدن سوالات مستقیم Gemini در مورد کد خود نترسید. به عنوان مثال، "چه چیزی می تواند باعث استثنای اشاره گر تهی در این تابع شود؟" یا "چگونه می توانم از این شرایط مسابقه جلوگیری کنم؟"
مشکلات پیچیده را تجزیه کنید: اگر با یک مسئله پیچیده سر و کار دارید، آن را به بخش های کوچکتر و قابل مدیریت تقسیم کنید. از Gemini بخواهید که به شما کمک کند تا هر قسمت را به طور جداگانه اشکال زدایی کنید و گام به گام به مشکلات فکر کنید.
از حصارهای کد استفاده کنید: هنگام به اشتراک گذاری قطعات کد، از حصارهای کد استفاده کنید تا مطمئن شوید که کد به درستی قالب بندی شده است. این امر خواندن و درک کد شما را برای Gemini آسان تر می کند.
تکرار و اصلاح: جمینی ممکن است همیشه در اولین تلاش راه حل عالی ارائه نکند. پاسخها را مرور کنید، سؤالات روشنکننده بپرسید و در صورت نیاز اطلاعات بیشتری ارائه دهید.
از حلقه های درخواستی خودداری کنید: اگر Gemini در یک حلقه گیر کرد یا قادر به پاسخگویی به سؤال شما نیست، سعی کنید درخواست خود را دوباره بیان کنید یا زمینه اضافی را ارائه دهید. گاهی اوقات، فقط بازنویسی سؤال خود می تواند به جوزا کمک کند تا بفهمد چه می پرسید.
اگر بازنویسی درخواست شما حلقه را حل نمی کند، تکنیک های زیر را امتحان کنید:
شروع یک چت جدید: اگر از Gemini در چت Firebase در فضای کاری Code خود استفاده می کنید، یک جلسه گپ جدید را برای بازنشانی زمینه Gemini شروع کنید. این می تواند به رهایی از هرگونه تصور اشتباه یا فرضی که جوزا ممکن است در گفتگوی قبلی داشته باشد کمک کند.
مثالهای متقابل ارائه کنید: اگر جمینی مفروضات نادرستی میکند، مثالهای متقابل ارائه کنید تا به او در درک رفتار صحیح کمک کنید.
مراحل بعدی
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[],[],null,["The effectiveness of your app blueprint and the quality of the generated code\ndepend on the clarity and detail of your prompts. When using\nthe App Prototyping agent, consider the following guidelines for effective\nprompting when generating and debugging apps:\n\n- **Be specific:** Clearly define the features, user interactions, and data requirements of your app. Ask for specific technologies, where possible. For example, if trying to create a web app with 3D elements, you may want to ask Gemini to use `three.js`.\n- **Ask about additional tasks to set up services:** Gemini can write code for your app, but it cannot actually set up services, enable APIs, or provision resources (like a Cloud Storage bucket or a Stripe account). Make sure to tell Gemini that if it writes code for specific services that it should also tell you how to set up those services.\n- **Request a Firebase project:** If you ask the App Prototyping agent to help you set up Firebase services, it will provision a Firebase project on your behalf. For example, you can ask \"Help me add Firestore,\" or \"Connect my app to Firebase.\"\n- **Use Gemini to refine your prompt:** Use [Gemini for\n Google](https://gemini.google.com), [chat with\n Gemini in Firebase](/docs/studio/try-gemini) in Code view, or other Gemini surfaces to refine and optimize your prompt.\n- **Provide context:** Include background information about your app's purpose, target audience, and the user experience you want.\n- **Use examples:** If possible, provide examples of how users should interact with the app or what data should be displayed.\n- **Iterate and refine:** Approach your development *iteratively*. Consider starting with a basic request, then add a feature, test it, refine it, then add another feature.\n\nBy following these guidelines, you can significantly improve the quality and\nrelevance of the app blueprints generated by Firebase Studio and its\nsuccess when debugging your app.\n\nUse additional prompts to refine responses\n\nIf the initial results aren't what you expect, you can refine your prompts by\nadding more detail or providing specific instructions:\n\n- **Add constraints:** Specify constraints on the UI, data model, or features.\n- **Provide examples:** Provide examples of how users should interact with the app and what data should appear.\n- **Use keywords:** Use keywords to describe the features or capabilities you want that the LLM might associate with the class of output you want. For example, you might use *Material Design* in a prompt where you indicate that you want your app to adhere to Google design standards.\n- **Ask for specific changes:** Ask for specific changes to the generated code or blueprint. Add each feature request in a separate request.\n- **Ask the model to reason:** If you're having trouble getting the results you want, try asking the model to reason through the prompt. For example, you could say \"Think step by step. I want to create an input box for my task app. It should contain an 'Add task' button and a 'Cancel' button.\"\n\nBy using these techniques, you can iteratively refine your prompts to get the\nresults you want.\n\nExamples of effective prompts for app blueprints\n\nHere are some examples of effective prompts for different types of apps:\n\n**Simple task tracker:** \n\n Create a simple web app that displays a list of to-do items.\n Users should be able to add new items to the list and mark items as complete.\n Provide a way to delete items and export the list as a text file.\n Use a clean and modern UI using Google Material Design principles.\n\n**Budgeting app:** \n\n A budgeting and expense tracking app with spending categories, charts, and\n budget goals. Include a clean dashboard with key insights. It should include\n spending categories, charts, and budget goals. The app should allow users to\n manually add expenses or upload csv files. The app should also allow users to\n upload receipts, then use AI to convert the receipt into an expense entry that\n users can edit. Data should be stored in browser cache, with download and\n delete options.\n\n**Game app prompt with assistance from Gemini (Markdown):** \n\n Generate a delightful sliding number puzzle game (15-puzzle) with Javascript,\n HTML, and CSS.\n\n - **Setup:** Create a 4x4 grid with numbers 1-15 and one empty space. Use a\n **solvable shuffling algorithm** to randomize the start.\n - **Gameplay:** Allow clicking tiles **adjacent to the empty space** to slide\n them. Count and display the number of moves.\n - **Timer:** Include a **countdown timer** starting at **120 seconds**\n (2 minutes).\n - **End Conditions:**\n - If solved (numbers 1-15 in order): Alert with an encouraging winning\n statement generated by AI.\n - If timer reaches 0: Alert with a funny retort generated by AI.\n\nTips for debugging\n\nYou can use Gemini in Firebase to help you debug your code with\nchat in your **Code** workspace\nor the App Prototyping agent.\n\nWhile Gemini can write code for you, it might sometimes also\nproduce errors. When it detects an error, it will attempt\nto fix it. If you find that it isn't able to resolve the issue given\nthe error message, you can try some of the following techniques:\n\n- **Describe the issue:** In the chat interface, describe the\n problem you're encountering as clearly and concisely as possible.\n While Gemini might have access to context like error messages\n and logs, it might not understand the full context. Describing the behavior\n along with the error message can help Gemini fix errors\n faster.\n\n- **Ask specific questions:** Don't be afraid to ask Gemini\n direct questions about your code. For example, \"What could be causing a\n null pointer exception in this function?\" or \"How can I prevent\n this race condition?\"\n\n- **Break down complex problems:** If you're dealing with a complex\n issue, break it down into smaller, more manageable parts. Ask\n Gemini to help you debug each part separately and think\n through problems step-by-step.\n\n- **Use code fences:** When sharing code snippets, use code fences\n to ensure that the code is properly formatted. This makes it easier\n for Gemini to read and understand your code.\n\n- **Iterate and refine:** Gemini may not always provide the perfect\n solution on the first try. Review the responses, ask clarifying\n questions, and provide additional information as needed.\n\n- **Avoid prompting loops:** If Gemini gets stuck in a loop or is\n unable to answer your question, try rephrasing your prompt or\n providing additional context. Sometimes, just rewording your\n question can help Gemini understand what you're asking.\n\n If rephrasing your prompt doesn't resolve the loop, try\n the following techniques:\n - **Start a new chat:** If you're using Gemini in Firebase\n chat in your Code\n workspace, start a new chat session to reset\n Gemini's context. This can help break free from any\n misconceptions or assumptions that Gemini may have made\n in the previous conversation.\n\n - **Provide counter-examples:** If Gemini is making incorrect\n assumptions, provide counter-examples to help it understand\n the correct behavior.\n\nNext steps\n\n- [Get started with the App Prototyping agent](/docs/studio/get-started-ai).\n- [Develop, publish, and monitor an app following a guided tour of the App Prototyping agent](/docs/studio/solution-build-with-ai).\n- [Develop applications in a\n Firebase Studio workspace](/docs/studio/get-started-workspace)."]]