Agent Skill · ConfigDirector

configdirector-segments

Create a ConfigDirector segment or change one through the ConfigDirector MCP server or CLI, such as its condition groups, its name or key, or an environment override added or removed, after showing the current and resulting definition side by side with the configs that use the segment and, when the change reaches a live environment where a config uses it, getting an explicit yes. Use when the user asks to create a segment, change who is in one, rename it, give an environment its own definition or return it to the project definition, see which configs use a segment, or delete one, which is handed over.

Provider: ConfigDirector Path in repo: configdirector-segments/SKILL.md

Skill body

Create or change a segment

Work through the steps in order. The result is one segment, created or changed: its project definition, its name or key, or an environment override added, changed or removed, written once the user has seen the current and resulting definition side by side, with the configs that use the segment, and said yes. One segment per run; for several, work through the steps once per segment.

This skill changes segments only, never a config’s targeting rules: to use a segment in a config’s rules, use configdirector-roll-out. It never deletes a segment; step 6 hands a delete over to the user.

Creating a segment needs an API token with these permissions, as the ConfigDirector dashboard names them under API tokens: Projects: Read, Environments: Read, Segments: Read, Segments: Create. Changing one needs Segments: Update in place of Segments: Create.

1. Reach the account, find the project, check the permissions and find the environments

Use the ConfigDirector MCP tools when the ConfigDirector MCP server is connected, and the configdirector CLI otherwise; never both in one run. With the CLI, always pass --json and read the output, never the human text. Each step names the MCP tool first and the CLI command second.

List the projects: list_projects / configdirector projects list --json. When the current repository has configdirector.json, the project is the one whose slug is its project, and every CLI command, projects list included, runs from the directory that holds the file. Otherwise it is the only project listed, or the one the user picks when there are several: ask which one the segment belongs to. Then pass --project <slug> to every CLI command below.

Then read the token’s permissions, before proposing anything. On MCP, they are the ConfigDirector tools you can see by name, loaded or not, since the server offers only the tools the token allows; on the CLI, configdirector api-token get --json lists them in short form in permissions. The table gives each permission in the dashboard’s wording, its short form and the MCP tool that needs it:

Permission Short form MCP tool
Projects: Read projects:read list_projects
Environments: Read environments:read list_environments
Segments: Read segments:read list_segments
Segments: Create segments:create create_segment
Segments: Update segments:update update_segment

When Projects: Read, Environments: Read or Segments: Read is missing, or the one of Segments: Create and Segments: Update the request needs, stop and ask before proposing anything. A request that only asks which configs use a segment needs neither of those two.

List the environments: list_environments / configdirector environments list --json, for each environment’s id, which keys its override, its slug, which names it to the user, and live: a live environment serves real traffic, and step 4 asks for an explicit yes before a change reaches one where a config uses the segment.

When a step fails, tell the user why. The CLI sign-ins case runs the command again; every other case means nothing can be created or changed, so stop and ask, with the case’s fix as the first choice:

Stop and ask means: stop at once, before any other work, including work the user asked for outside this skill, such as the flags configdirector-migrate-from-launchdarkly creates after its segments. Tell the user what was not created or changed and why, with a missing permission in the dashboard’s wording, and ask how to go on:

  1. They fix it, as the case says, and you try again.
  2. They make the change in the dashboard, with the resulting definition you show them, and you go on.
  3. Only when the user’s task has work left that does not need the segment: you go on with that work without it, leaving the segment as it is, or uncreated. Run on its own, this skill offers the first two.

Wait for their answer. On choice 2 before the segment is composed, compose it and show it as steps 2 to 4 do, skipping any read that fails, and write nothing.

2. Read the segment and its format

Read all of this before composing anything. Never write a condition from memory.

  1. The segments: list_segments / configdirector segments list --json, each with its key, name and usages. For a new segment, make sure no segment has the key: when one does, say so and propose another. For an existing one, the segment is the one whose key or name the user gave; when none fits or several do, ask, listing the keys.
  2. An existing segment: get_segment / configdirector segments get <key> --json. Its groups are the project definition, its overrides map an environment’s id to that environment’s own groups, and its usages list each config whose targeting rules use the segment, by configKey, with the environmentIds where they do. When no segment has the key (on MCP, an error saying so; on the CLI, exit 2 with No segment in <project> has the key), return to item 1 and ask. When the user only asks which configs use the segment, show the usages, one line per config with its environments by slug, and stop.
  3. The targeting rules reference, once per run: get_targeting_rules_reference / configdirector targeting-rules reference --json. A segment’s conditions are attribute conditions in the shape the reference gives for a rule’s attribute conditions, { id, kind: "attribute", attribute, trait, operator, targetType, targetValues }: the attributes a condition can test, the operators of each target type and of the context kind attribute, and the notes on how values are written all come from it. A segment condition is never allowed inside a segment.

The limits are not in the reference: the descriptions of create_segment and update_segment state them, a project holds at most 200 segments, a project definition or an override at most 10 condition groups, and a condition group at most 20 conditions, and on the CLI the refusal step 5 reads names the one exceeded.

3. Compose the resulting segment

A context is in the segment when every condition of any one group matches: the conditions of a group are combined by AND, and the groups by OR. So “enterprise customers in Europe” is one condition group with two conditions, and “staff, or anyone on the beta plan” is two condition groups of one condition each. When the request leaves open which group a condition belongs to, or whether a change is to the project definition or to one environment’s override, ask; never guess.

Start from the current segment and change only what the user asked for:

Write each condition in the reference’s shape and each value in the operator’s target type, as the reference’s notes say. Every condition you keep keeps its id and its other fields. Give a new condition a new random UUID as its id on MCP, and no id on the CLI, which gives it one.

4. Show the change and confirm it

Show the current and the resulting definition side by side, one line per condition group in the sentences segments get writes in its text output, which you compose from the JSON: a condition reads as its trait without the leading /, or as context identifier, context kind, context name, app name or app version, then its operator and its target values separated by commas, and a condition group’s conditions are joined by and. Show one table for the project definition and one for each override the change touches, with a kept condition group on the same row in both columns. A new segment has an empty left column. For example:

Project definition, now Project definition, after the change
1. plan is one of enterprise 1. plan is one of enterprise and country is one of DE, FR, ES
  2. email ends with any of @example.com

Then say in words what changes and in which environments, by slug: a change to the project definition reaches every environment without an override; an override added, changed or removed reaches its environment only; a rename reaches none. Then list the configs that use the segment in those environments, from usages, such as “Used there by new-checkout in production and dark-mode in test, production”, or say that no config uses it there. Wait for the user’s yes before writing anything. When the user changes the request, compose it again and show both columns again.

When an environment the change reaches is live and a config uses the segment there, once the user says yes, tell them that environment is live and serving real traffic, name the configs that use the segment there, show both columns again, and ask for an explicit yes to this change. Anything other than a clear yes, such as a question or a change, is not one.

5. Write the segment

After the yes, write the segment once. Send overrides only when the change adds, changes or removes one, and then the whole map of the environments that stay overridden, keyed by environment id; left out, the overrides stay as they are, and {} removes them all.

When ConfigDirector refuses the segment, nothing changes: on MCP, a tool error listing the reasons; on the CLI, exit 2 with The Admin API rejected the request: and the reasons, such as a key another segment has or a limit from step 2. Show the reasons, fix the segment against the reference, and return to step 4 to show it and confirm again. Read any other failure, such as a missing permission, as step 1 does, and stop and ask.

6. Hand a delete over

When the user asks to delete a segment, never delete it. Read it as step 2 does and show the configs and environments whose targeting rules use it, from usages: ConfigDirector refuses the delete while any config’s rules use the segment, in any environment. Name configdirector-roll-out as the way to remove those segment conditions first, one environment at a time. Then give the user the command to run themselves, configdirector segments delete <key>, from the directory that holds configdirector.json or with --project <slug>, which needs Segments: Delete and asks for no confirmation, or the segment’s page in the dashboard, under Segments in the project’s sidebar, where Delete segment is at the bottom. Say that a deleted segment cannot be restored.

7. Hand over

In a few lines, tell the user:

Skill frontmatter

license: MIT metadata: {"author" => "ConfigDirector", "version" => "0.15.0"}

Work with this as data

Every skill here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for agent skills

4 MCP tools reach this
  • find_skillsBrowse and filter every skill in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This skill
curl "https://apis.io/api/v1/skills/configdirector-segments"
All agent skills
curl "https://apis.io/api/v1/skills?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.