# Building a gem: your own reusable assistant
A Gem is a saved Gemini configuration: a name, a set of standing instructions, and optionally some reference files, that turns a repeated prompt into a one-click assistant. Instead of pasting the same 300-word "act as our brand editor" preamble every morning, you build it once and open it whenever you need it.
This lesson builds a real one: a "Brand Voice Rewriter" Gem. We will set it up, test it, then look at when a Gem genuinely beats a sharp one-off prompt and when it does not.
A Gem is a persistent system instruction plus optional knowledge attached to a chat surface in the Gemini app. When you open a Gem, those instructions are prepended to every turn in that conversation. The model still runs on the normal Pro or Flash tiers, still has the full context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète →, still does native multimodality. The Gem just guarantees the instructions and reference material show up every time without you re-typing them.
You create and manage Gems from the Gem manager in the Gemini app (the "Explore Gems" / "New Gem" area in the sidebar). Workspace admins can also publish shared Gems to a whole organization, which is the difference between a personal habit and a team standard.
Before touching the UI, decide the three things every Gem needs:
1. A name and one-line purpose. "Brand Voice Rewriter: turns any draft into our house voice."
2. The job it does, stated as behavior. What goes in, what comes out, what it should never do.
3. The knowledge it needs. Your actual style guide, example before/after pairs, banned words.
The most common Gem failure is vague instructions. "Make it sound on-brand" tells the model nothing. You have to encode the brand as rules and examples. The examples matter more than the adjectives.
Here is a complete instruction set for the Gem. Notice it is structured, specific, and shows examples rather than just describing them.
You are the Brand Voice Rewriter for Northwind, a B2B logistics company.
YOUR JOB
Take any draft text the user pastes and rewrite it in Northwind's voice.
Output only the rewritten text, then a one-line note on what you changed.
Never invent facts, prices, dates, or features that were not in the input.
OUR VOICE
- Direct and confident. Lead with the outcome, not the backstory.
- Plain words. Replace "utilize" with "use", "leverage" with "use".
- Short sentences. Max ~20 words. No semicolons.
- Warm but not cute. No exclamation marks, no emoji.
BANNED WORDS: synergy, seamless, world-class, revolutionary, game-changer.
EXAMPLE
Input: "We are excited to leverage our world-class network to seamlessly
deliver your freight in a timely manner!"
Output: "Your freight moves on our network and arrives on schedule."
IF the input is already on-voice, say so and make only minimal edits.
IF the input is ambiguous (e.g. a fragment), ask one clarifying question.That last block is the part people skip. Edge-case rules (what to do with on-voice text, what to do with fragments) are what make a Gem reliable across a team instead of just for you on a good day.
Instructions cover the rules. Knowledge files cover the detail you cannot fit inline. Attach your real style guide PDF, a glossary of approved product names, and a document of 10 to 15 before/after rewrite pairs. The Gem reads these as reference, so when someone pastes a sentence about your "FreightSync" product, it uses the correct capitalization and description.
A few attachment habits worth keeping:
The mechanics are quick:
1. Open Gemini, go to the Gems area, choose New Gem.
2. Paste the name and the instruction block above.
3. Upload your style guide and example-pair files as knowledge.
4. Use the live preview panel on the right to test before saving.
5. Save. It now lives in your sidebar.
The official walkthrough and current UI details are in Google's Gems help documentation, which is worth checking since the layout shifts as the product evolves.
Do not test with the example you already put in the instructions. Test with cases designed to break it:
Run these through the preview. When it fails, fix the instruction or add an example pair, then re-test. This loop, adversarial testing then patching, is the actual work of building a good Gem. The UI part takes five minutes; the testing makes it trustworthy.
If you want repeatable, automated testing across many inputs, that is a signal you have outgrown the app. The same instruction text becomes a system_instruction in the Gemini API via Google AI Studio, where you can script a test set:
from google import genai
client = genai.Client() # reads GEMINI_API_KEY from env
BRAND_VOICE = open("brand_voice_instructions.txt").read()
drafts = [
"We leverage our world-class network for seamless delivery!",
"Shipment 4471 departs Tuesday.",
"synergy",
]
for draft in drafts:
resp = client.models.generate_content(
model="gemini-2.5-flash",
config={"system_instruction": BRAND_VOICE},
contents=draft,
)
print(f"IN: {draft}\nOUT: {resp.text}\n")That is the same Gem behavior, now as code you can run in CI. The app Gem and the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → share the same idea: a system instruction is the spine of both.
Vérification des acquis
1. According to the lesson, what is a Gem at its core?
2. Why does the lesson warn against a bloated 2,000-word instruction set in a Gem?
3. In the Gemini app, who can publish a Gem so an entire organization can use it?
4. Select ALL correct answers about what makes a good candidate to build as a Gem, according to the lesson.
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers about how a Gem behaves under the hood in the Gemini app.
Sélectionnez toutes les réponses correctes.
This is the judgment call that separates people who collect Gems from people who use them.
A Gem wins when:
A one-off prompt wins when:
That last point is the most useful boundary. A Gem is a reusable *assistant you go to*. Gemini in Workspace is help that *comes to you* inside the file. The Brand Voice Rewriter as a Gem is great for bulk rewriting a batch of pasted drafts. For polishing one line as you write it, the Docs side panel is faster.
Gems are deliberately simple: instructions plus knowledge, no custom logic, no external tools. You have outgrown a Gem when you need any of these:
A Gem is the right tool at exactly one layer: a fixed behavior you trigger by hand. The moment it needs to *act on its own* or *be called by code*, you have crossed into agent and APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → territory, which the rest of this path covers.