Agent Skill · ConfigDirector

configdirector-clean-up-flag

Remove a settled temporary ConfigDirector feature flag from the code, keeping the branch it serves, after reading its lifecycle state, its recent evaluations and every code reference through the ConfigDirector MCP server or CLI and configdirector scan, and archive the config only once the user confirms the removal is deployed. Use when the user asks to remove, retire or clean up a flag, or to hardcode its value.

Provider: ConfigDirector Path in repo: configdirector-clean-up-flag/SKILL.md

Skill body

Remove a settled flag from the code

Work through the steps in order. The result is the code without the flag: the branch the flag serves stays, the other branch, the evaluation and their tests go, and the config is archived only once the user confirms the removal is deployed everywhere that read it. Confirm with the user before editing anything and before archiving.

This skill removes one temporary feature flag per run. A kill switch or a permanent config stops at step 2, and why a flag is still read is not answered here.

Cleaning up a flag needs an API token with these permissions, as the ConfigDirector dashboard names them under API tokens: Projects: Read, Environments: Read, Configs: Read, Configs: Archive.

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

Use the ConfigDirector MCP tools when the ConfigDirector MCP server is connected, and the configdirector CLI otherwise; never both in one run, except scan in step 3, which exists only on the CLI. 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 flag 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
Configs: Read configs:read get_config
Configs: Archive configs:archive archive_config

When Projects: Read, Environments: Read or Configs: Read is missing, stop and ask before proposing anything. When Configs: Archive is missing, tell the user that archiving the config at the end needs it, and go on; step 6 stops and asks before the archive.

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. 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 archive the config from the dashboard’s Configs page, and you go on.
  3. They archive it later, as step 6 says, and you go on without archiving.

Wait for their answer. Choices 2 and 3 apply at step 6 only: before it, the run needs the facts of step 2 to decide whether the flag can go, so the first is the only choice.

2. Read the facts and decide from the lifecycle state

Read all three before deciding anything:

  1. The config: get_config / configdirector configs get <key> --json. Note its current key, which the user may have named by an old one, its old keys in deprecatedKeys[].key, its role, lifetime and state, and its targets, one entry per environment with targets[].environment.slug and targets[].environment.live, its rules and its defaultValue, the default targeting rule value. Write each environment’s rules in one line per rule, as configs get writes them, with the default targeting rule value last, for example production (live): 1. plan is one of pro, team: true; default targeting rule: true. When no config has the key (on MCP, an error saying so; on the CLI, exit 2 with No config in <project> has the key), list the configs with list_configs / configdirector configs list --json and ask which one the user means.
  2. The recent evaluations: get_config_activity / configdirector configs activity <key> --json. Each entry of latestEvaluations is the most recent evaluation from one environment, SDK key kind (source), SDK name and SDK version, with its time. An SDK listed here can belong to another application than the repository you are in.
  3. The environments: list_environments / configdirector environments list --json, for which ones are live. A live environment serves real traffic, and only live environments decide what the flag serves.

Then decide from the config, in this order, and stop where a line says so:

3. Find every reference

Run configdirector scan --json from the directory that holds configdirector.json, or with --project <slug> when the repository has none. The scan has no MCP form: when the CLI is not installed, send the user to the Install section of https://docs.configdirector.com/integrations/cli, and when it reports No API token found or No CLI sign-in is for the organization, have them sign in to the repository’s organization with configdirector login in their own terminal, never by pasting the token into the chat. The CLI signs in on its own, apart from the MCP server, and scan needs Projects: Read and Configs: Read, so a token with the permissions of step 1 serves it as well.

Collect every entry of references whose key is the config’s current key or one of its old keys:

Either kind has test true when it is a test client call or sits in a test file.

The scan covers this repository only. When dynamicReferences is not empty, stop: list each one with its file, line, call and argument, and tell the user that an SDK call whose key the scan cannot know may read this flag, so it has to pass its key as a string or a constant before the cleanup can be trusted. When no reference to the key is listed, the code no longer reads it: say so and go to step 6.

4. Decide which branch stays

For a settled flag, the branch that stays is the single value the live environments serve, read from the rules of each live environment’s targets entry: its defaultValue when it has no rules, otherwise the value that every rule and the defaultValue serve. A percentage rule serves every value it splits over. ConfigDirector also reports the value as settledValue; when the two differ, or the live environments disagree, show the rules and ask. For an archive-ready flag, read it the same way, and when the live environments do not serve one value, the user picks. For a stale flag, the user picks. When the project has no live environment, read every environment.

Show each environment’s rules in the sentences of step 2, then propose the branch, such as “Keep the true branch: production and staging both serve true”, and wait for the user’s yes.

5. Show the change, then edit

Before editing, list every reference from step 3 and what happens to it:

Wait for the user’s yes. Then make the edits, run the project’s build, typecheck and tests, and fix anything the change broke. Run configdirector scan --json again and confirm that no reference to the key or its old keys is listed.

6. The archive gate

Ask whether the removal is deployed everywhere that read the flag; the SDKs and environments of step 2 say where that is. Advise waiting a day or two after that deploy before archiving, in case an application is rolled back to the version that still reads the key: that version would get its in-code default value instead of the value the flag served, which can be the other branch.

On a yes, when Configs: Archive is missing, stop and ask as step 1 says. Otherwise show the archive before doing it: the config’s current key and project, that SDKs stop receiving the config and an application that still reads it gets its in-code default value and raises a Config not found alert, and that the dashboard restores it for 30 days with its targeting rules intact. Wait for the user’s yes, then archive it by its current key: archive_config / configdirector configs archive <key> --json. On the CLI, exit 2 with No config in <project> has the key means the config is already archived or belongs to another project; on MCP, an error saying no config has the key means the same. Read any other failure, such as a missing permission, as step 1 does, and stop and ask.

On a no, or when the user wants to wait, end without archiving and tell them how to archive later: run this skill again, which finds no reference and goes straight to this step, or run configdirector configs archive <key>, call archive_config, or archive it from the dashboard’s Configs page.

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-clean-up-flag"
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.