agentleFS
harnessharness/harness-skills/skills/fme/manage-segments/SKILL.md

manage-segments

Skill127 starsChanged 31 days agoApache-2.0View on GitHub

Create, inspect, and maintain Harness FME segments (STANDARD, LARGE, RULE_BASED). Manage metadata, select type-specific definition and membership workflows, and check referencing flags before every mutation. Use when asked to create a segment, add keys to a segment, list segments, update segment metadata, remove keys, replace keys, check segment usage, or delete segments. Do not use for making a flag USE a segment (update-flag-targeting), flag CRUD (create-feature-flag, manage-flag-lifecycle), or flag discovery (discover-feature-flags). Trigger phrases: create segment, add keys, list segments, segment membership, segment targeting, update segment, remove keys, replace segment keys, segment definition, check segment usage, delete segment.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Follow scope-establishment.md.

    line 60
  2. Distinctive:

    Ask only for what is missing:

    line 64
  3. Very specific:

    Create approved metadata, then provision each approved STANDARD definition or guide the RULE_BASED editor step.

    line 93
  4. Distinctive:

    Follow standard-membership.md for parsing, production-aware approval, ≤10,000-key append/removal batches and complete membership readback.

    line 98
  5. Distinctive:

    Follow Replace all keys: fully inventory the old set, preview removals, obtain destructive-write approval, replace in one call and verify …

    line 106
  6. Distinctive:

    Check if keys remain: List keys for one key.

    line 116
  7. Very specific:

    After any removal, rerun/revalidate the gate and verify the segment is empty.

    line 117
  8. Distinctive:

    STOP and wait for explicit confirmation.

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Manage Segments

Manage metadata for STANDARD, LARGE, and RULE_BASED segments, STANDARD membership, and approved RULE_BASED editor changes. Every mutation requires a complete reference-impact check and explicit approval. LARGE bulk membership operations are outside this skill's scope.

Tools

Works through Harness MCP or CLI with equivalent scope, confirmation and verification requirements. Discover exact CLI action syntax through command help; use tool-map.md for mappings. STANDARD in metadata examples stands for the selected type; definition/key rows apply only to STANDARD.

OperationMCPCLI
List traffic typesharness_list · fme_traffic_type · compact: falseharness list traffic_type --json
List environmentsharness_list · fme_environment · compact: falseharness list fme_environment --json
List flagsharness_list · fme_feature_flag · size: 50 · compact: falseharness list feature_flag --json --limit 50
List experimentsharness_list · fme_experiment · filters: { parent_type: "FEATURE_FLAG", parent_name, environment_id, status: ["ACTIVE", "PAUSED"], offset: 0, limit: 100 } · compact: falseharness list experiment --parent-type FEATURE_FLAG --parent-name <flag> --env <env-id> --status ACTIVE --json, then PAUSED; fully paginate both
List flag definitionsharness_list · fme_feature_flag_definition · params: { feature_flag_name } · filters: { offset: 0, limit: 100 } · compact: falseharness list feature_flag:definition <flag> --json
List segmentsharness_list · fme_segment · filters: { segment_type, status?, offset: 0, limit: 100 } · compact: falseharness list segment --segment-type STANDARD --json; safety gates list ACTIVE and ARCHIVED using declared status filters
Get segmentharness_get · fme_segment · params: { segment_name, segment_type }harness get segment <name> --segment-type STANDARD --json
Create segmentharness_create · fme_segment · body: { name, trafficType, segmentType, description?, tags?, owners? }harness create segment <name> --traffic-type user --segment-type STANDARD
Update segmentharness_update · fme_segment · params: { segment_name, segment_type } · body: { description?, tags?, owners? }harness update segment <name> --segment-type STANDARD --set description=foo
Delete segmentharness_delete · fme_segment · params: { segment_name, segment_type }harness delete segment <name> --segment-type STANDARD
List definitionsharness_list · fme_segment_definition · filters: { environment_id, status?, offset: 0, limit: 100 } · compact: falseharness list segment:definition --env <env-id> --json
Get definitionharness_get · fme_segment_definition · params: { segment_name, environment_id }harness get segment:definition <name> --env <env-id> --json
Create definitionharness_create · fme_segment_definition · params: { segment_name, environment_id } · body: { description? }?harness create segment:definition <name> --env <env-id>
Update definitionharness_update · fme_segment_definition · params: { segment_name, environment_id } · body: { description? }harness update segment:definition <name> --env <env-id> --set description=foo
Delete definitionharness_delete · fme_segment_definition · params: { segment_name, environment_id }harness delete segment:definition <name> --env <env-id>
List keysharness_execute · fme_segment_definition · action="list_keys" · params: { segment_name, environment_id, offset?, limit? }Discover the key-list action and pagination arguments through CLI help
Add keysharness_execute · fme_segment_definition · action="add_keys" · params: { segment_name, environment_id, replace? } · body: { keys, comment?, title? }Discover the key-add action and replacement argument through CLI help
Remove keysharness_execute · fme_segment_definition · action="remove_keys" · params: { segment_name, environment_id } · body: { keys, comment?, title? }Discover the key-remove action through CLI help

Instructions

Load references on demand:

  • concepts.md — segments section explains STANDARD vs LARGE vs RULE_BASED and how flags reference segments
  • write-safety.md — confirm-before-write protocol (production gates, verify before/after)

Phase 1: Establish scope

Follow scope-establishment.md. Ask for the org and project if missing. Restate: Working in org=..., project=...

Phase 2: Discover intent and segment context

Ask only for what is missing:

  1. Operation — list, create, change membership, edit rules/exclusions, update metadata, delete, check usage
  2. Segment name (case-sensitive; discover from list when ambiguous)
  3. Segment type (STANDARD, LARGE, or RULE_BASED; required for all segment metadata operations; choose during create)
  4. Target environments (one or more; List environments to resolve names to IDs and note isProduction)
  5. Traffic type (for create only; must match the flags that will use the segment; List traffic types to discover)

Phase 3: Execute operation

Resolve exact name and type, then choose the workflow below. Before every mutation, including metadata creation, definition provisioning and key additions, complete the usage check, present its impact with the plan, and obtain production-aware approval. Incomplete checks block writes; approval never waives coverage. Discover the selected operation's exact schema before execution and preserve native org/project scope.

TypeMembership modelWorkflow
STANDARDExplicit key setMetadata, environment definitions and key flows below
LARGELarge key setMetadata and reference-impact checks only
RULE_BASEDConditions, matchers and exclusionsMetadata and rule-editor workflow

Find / List

  • Without segment name: fully paginate all three metadata types and merge; report actual coverage, not a fixed call count.
  • With segment name: resolve type and get metadata. For STANDARD, inspect environment definitions and fully paginate keys. For RULE_BASED, inspect authoritative rule-editor configuration, not an observed sample of matching keys. For LARGE, report metadata and references only. Prefer counts or redacted samples over raw user keys.
  • For MCP segment metadata, STANDARD segment definitions and flag definitions, size is ignored: explicitly set filters.limit: 100, advance filters.offset, and continue until a short page. Their total is page length, not inventory size. Follow pagination for the other resources; failed/skipped pages cannot establish absence or no usage.

Create

  1. Explore naming conventions from existing segments. Recommend a pattern if clear.
  2. Confirm traffic type exists (List traffic types) and explain: "The traffic type must match the flags that will use this segment."
  3. Choose type (immutable), check exact-name/type uniqueness, and complete the usage gate even for a new name; existing rules can contain references to it.
  4. Plan metadata and environment steps separately. LARGE creation is metadata-only; RULE_BASED includes an explicitly agreed editor step. List each environment and apply the production-aware confirmation gate before writing.
  5. Create approved metadata, then provision each approved STANDARD definition or guide the RULE_BASED editor step. Revalidate the gate before dependent writes; stop on a conflict or changed state.
  6. Re-read changed metadata/definitions. Report metadata creation separately from membership or rules saved; never imply an unfinished step succeeded.

Add / Remove Keys (STANDARD)

Follow standard-membership.md for parsing, production-aware approval, ≤10,000-key append/removal batches and complete membership readback. A first-page check is not verification; report partial completion and never expose raw keys by default.

Usage check

Follow usage-check.md before every mutation. Scan all ACTIVE and ARCHIVED project flags and all environments, including rule matchers, treatment memberships and indirect RULE_BASED dependencies. Above 50 flags, obtain cost approval before definition reads; do not narrow a write's safety scan. Failed, skipped or unparsed coverage blocks the write. References require an explicit impact review; deletion is blocked until dependencies are separately resolved and the gate rerun.

Replace All Keys (STANDARD, Destructive)

Follow Replace all keys: fully inventory the old set, preview removals, obtain destructive-write approval, replace in one call and verify exact set equality. Stop above 10,000 keys—never chunk replacements or silently remove-then-add. Empty replacement requires an explicit clear request and confirmation.

Update Description / Tags

  • Update segment (metadata) or Update definition (per-env description).
  • Complete the usage gate, draft the before/after change, obtain explicit approval, then update and re-read. Distinguish metadata-only edits from changes affecting evaluation. MCP metadata uses merge patch; CLI uses declared field handlers, not guessed --set arrays. STANDARD per-environment descriptions use Update definition.

Delete STANDARD Definition (One Environment)

  1. Complete the usage gate. If any direct or indirect reference affects this environment, STOP; resolve it under separate approval with update-flag-targeting or the rule-editor workflow, then rerun the gate.
  2. Check if keys remain: List keys for one key. If keys exist, offer removal as a separate confirmed operation; fully inventory keys before constructing that removal.
  3. After any removal, rerun/revalidate the gate and verify the segment is empty. Do not bypass hasDependents.
  4. Present the deletion plan and obtain explicit production-aware approval.
  5. Delete definition, then verify exact get returns 404 (not an authorization/error response).

Delete Segment

  1. Run the usage gate. For STANDARD, inspect all environment definitions with STANDARD calls. For other types, use authoritative configuration evidence and the delete operation's dependency validation, never STANDARD definition calls. Before deletion, STOP for any known remaining direct/indirect references or active definitions; resolve them separately, then rerun the gate. On hasDependents, stop and report the dependency; never bypass it.
  2. Double confirmation: "This permanently deletes <segment> in all environments. This cannot be undone. Delete?"
  3. STOP and wait for explicit confirmation; revalidate state immediately before writing.
  4. Delete segment with the selected type; verify exact get returns 404, not an authorization/error response.

Rule-based workflow

  1. Confirm exact RULE_BASED metadata and environment. Ask the user to open the Harness rule editor and provide current ordered rules, matchers, exclusions and enabled state, with personal keys redacted. Preserve structural identifiers needed for dependency checks; do not infer rules from metadata or use STANDARD definition/key calls.
  2. Draft the exact before/after condition or exclusion change. Preserve rule order, combiners, negation and unrelated fields; verify referenced segment names/types and traffic types. For example, excluding STANDARD employees changes membership, not the flag's targeting rules.
  3. Complete the usage gate and present impacted flags/environments. Obtain explicit production-aware approval for the precise rule edit or enable/disable action.
  4. Have the user apply only the approved change in that environment's rule editor. Revalidate the gate and current configuration before saving; changed state requires a revised plan and approval. Respect any governance/approval requirement.
  5. Obtain fresh saved configuration and compare rules, exclusions and enabled state with the approved plan. Record user-confirmed evidence separately from direct readback. A draft or unsaved editor view is not completion; report verification pending until saved state is confirmed.

Phase 4: Output

Summarize per operation-summary.md: operation, exact name/type, environments, approved change, usage coverage and direct/indirect references, verification evidence (metadata, STANDARD membership, saved RULE_BASED configuration or confirmed deletion), and remaining work. Label incomplete checks as blocking and distinguish user-confirmed editor evidence from direct readback. Include a returned Harness UI link when available.

Examples

  • "Create a segment for beta users with traffic type user" — Create flow.
  • "Add 500 keys to the beta_users segment in staging" — Complete the usage gate, then approve and add keys.
  • "Replace all keys in early_access with the ones from this CSV" — Replace flow.
  • "Update the description of our LARGE segment" — Metadata change with a usage check.
  • "Change a RULE_BASED segment to exclude employees" — Draft, approve and verify a rule-editor change; preserve other rules.
  • "Check which flags use the beta_users segment" — Usage check.
  • "Delete the old_experiment segment" — Delete segment.

Performance Notes

  • One paginated metadata inventory per type; listing all types may take more than three calls.
  • STANDARD add/remove: batches ≤10,000; replacement: one call ≤10,000.
  • Usage check: one paginated definition inventory per project flag plus indirect-dependency evidence. Above 50 flags, obtain cost approval before definition reads. Never narrow a pre-write safety scan.

Troubleshooting

ErrorCauseFix
segment_type is required (400)Segment type is required on get/update/delete of a segmentSpecify segment type (STANDARD, LARGE, or RULE_BASED)
hasDependents on delete segmentDefinitions or references remainStop; resolve dependencies separately for the selected type, then rerun the usage gate; prefer leaving the segment intact
hasDependents on delete definitionKeys or dependencies remain in that environmentComplete the usage gate; resolve references separately, inventory and approve any key removal, then rerun the gate before retrying deletion
STANDARD keys not matching flagsTraffic type mismatch, wrong segment reference, or no STANDARD definition in that envVerify traffic types and flag rule; if needed, create the STANDARD definition through the confirmed usage-gated flow
keys must have at least 1 on remove keysThe key list is emptyRemove operations require at least one key
keys max 10000Request too largeBatch additive/removal operations only; stop oversized replacements
Usage coverage is incomplete or unparsedA page, rule shape or dependency chain is unresolvedStop the write; obtain the missing configuration/coverage and rerun the gate

Generic errors: see tool-map.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.