Add Global Variable logo

Add Global Variable

Organization
microsoft
add-global-variable

Add a global variable to a Copilot Studio agent. Use when the user needs a variable that persists across topics in the same conversation and can optionally be visible to the AI orchestrator.

Overview

Publishermicrosoft
Repositoryskills-for-copilot-studio
Skill nameadd-global-variable
Stars
478
Forks
101
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by microsoft on GitHub. Read the source before you install it.

Installation

Install the Add Global Variable AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/microsoft/skills-for-copilot-studio/tree/main/skills/add-global-variable
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/microsoft/skills-for-copilot-studio.git /tmp/skills-for-copilot-studio
mkdir -p .claude/skills
cp -r /tmp/skills-for-copilot-studio/skills/add-global-variable .claude/skills/add-global-variable
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Add Global Variable in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Add Global Variable on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Add Global Variable is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Add Global Variable

Create a global variable that persists across all topics within a conversation.

Instructions

  1. Auto-discover the agent directory:

    Glob: **/agent.mcs.yml

    Use the top-level agent. NEVER hardcode an agent name.

  2. Read settings.mcs.yml to get the schemaName prefix:

    Read: <agent-dir>/settings.mcs.yml

    Extract the root-level schemaName value (e.g., copilots_header_cre3c_fullagent).

  3. Determine from the user:

    • Variable name (PascalCase, e.g., LastDiscussedCity)
    • Description of what it stores
    • Whether the AI orchestrator should be aware of it (aIVisibility)
    • Default value (if any)
    • DO NOT skip any of these properties. If the user doesn't provide them, ask follow-up questions to get the necessary information.
  4. Create the variable file at <agent-dir>/variables/<VariableName>.mcs.yml:

yaml
# Name: <Human-readable Name>
# <Description>
name: <VariableName>
aIVisibility: <UseInAIContext or HideFromAIContext>
scope: Conversation
description: <Description of what the variable stores>
schemaName: <prefix>.globalvariable.<VariableName>
kind: GlobalVariableComponent
defaultValue: <DEFAULT or specific value>
  1. Key fields explained:
    • name — PascalCase identifier. This is how topics reference the variable: Global.<name> (e.g., Global.LastDiscussedCity).
    • aIVisibility — Controls orchestrator awareness:
      • UseInAIContext — The orchestrator can read and reason about this variable. Use when the variable influences routing or response generation (e.g., user preferences, conversation state the AI should track).
      • HideFromAIContext — The variable exists but the orchestrator doesn't see it. Use for internal bookkeeping (e.g., counters, flags) that topics use but the AI doesn't need to reason about.
    • scope: Conversation — Always Conversation for global variables (persists for the session).
    • schemaName — Must follow the pattern <agent-schemaName>.globalvariable.<VariableName>. Read the prefix from settings.mcs.yml.
    • defaultValue — Initial value. Use DEFAULT if no specific initial value is needed.

How Topics Use Global Variables

Topics reference global variables with the Global. prefix:

yaml
# Reading a global variable in a condition
- kind: ConditionGroup
  id: conditionGroup_Xk9mPq
  conditions:
    - id: conditionItem_Lw3nRs
      condition: =!IsBlank(Global.LastDiscussedCity)
      actions:
        - kind: SendActivity
          id: sendMessage_Yt7vBw
          activity:
            text:
              - "Last time we discussed {Global.LastDiscussedCity}."

# Setting a global variable from a topic
- kind: SetTextVariable
  id: setTextVariable_Qp4kMn
  variable: Global.LastDiscussedCity
  value: =Topic.CityName

When to Use Global Variables

  • Cross-topic state: A value set in one topic needs to be read in another (e.g., user's preferred language, last search query)
  • AI-aware context: The orchestrator should know something about the conversation state to make better routing decisions (use UseInAIContext)
  • Conversation-wide defaults: A default value that multiple topics can read and optionally override
  • Dynamic knowledge sources: A global variable can hold a URL that a knowledge source references via =$"{Global.VarName}". This enables routing to different SharePoint folders or websites per user (e.g., by geolocation or department). See /copilot-studio:add-knowledge for the full pattern. Important: the variable value must be a clean, direct URL — not a SharePoint AllItems.aspx link with query parameters.

Frequently asked questions

What does the Add Global Variable AI skill do?

Add a global variable to a Copilot Studio agent. Use when the user needs a variable that persists across topics in the same conversation and can optionally be visible to the AI orchestrator.

Why use Add Global Variable on TypingMind?

Because you install it once and use it with any model. Add Global Variable is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Add Global Variable in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/microsoft/skills-for-copilot-studio/tree/main/skills/add-global-variable. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Add Global Variable?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Add Global Variable?

As many as you like. As long as a model supports skills, you can use Add Global Variable with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Add Global Variable AI skill free?

Yes. It is published on GitHub by microsoft under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇