feature-toggle-developer
Guides systematic removal of feature toggles from the codebase with automated cleanup detection. Use when removing feature flags, enabling toggles permanently, or cleaning up unused code after toggle removal.
Install
mkdir -p .claude/skills/feature-toggle-developer && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4309" && unzip -o skill.zip -d .claude/skills/feature-toggle-developer && rm skill.zipInstalls to .claude/skills/feature-toggle-developer
About this skill
Feature Toggle Developer
Status: Active
Auto-activates on: Feature flag/toggle removal, cleanup after refactoring toggles
Related Skills: code-generation-developer, ios-dev-guidelines, code-review-developer
Purpose
Guides the systematic removal of feature toggles (feature flags) from the codebase with automated cleanup detection. Ensures no orphaned code, unused components, or forgotten files remain after toggle removal.
When This Skill Activates
- User mentions: "remove toggle", "delete feature flag", "enable feature toggle permanently"
- User edits:
FeatureDescription+Flags.swift - After completing toggle removal: helps identify cleanup opportunities
Feature Toggle Removal Workflow
Phase 1: Pre-Removal Analysis
Before removing any toggle, gather complete information:
-
Find the toggle definition:
# Location: Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift rg "static let toggleName" --type swift -
Check the defaultValue to determine which branch to keep:
defaultValue: true→ Keep the TRUE branch, remove FALSE branchdefaultValue: false→ Keep the FALSE branch, remove TRUE branch
-
Search for ALL usages:
rg "toggleName" --type swift -
Identify usage patterns:
- Direct:
if FeatureFlags.toggleName { ... } - Inverted:
if !FeatureFlags.toggleName { ... }orguard !FeatureFlags.toggleName - Compound:
if FeatureFlags.toggleName && otherCondition { ... } - Assignment:
let value = FeatureFlags.toggleName ? a : b - State:
@State private var toggle = FeatureFlags.toggleName
- Direct:
-
List affected files and present to user for review
Phase 2: Toggle Removal
Systematic removal process:
-
Remove conditional checks and simplify:
Example 1 - Simple conditional (defaultValue: true):
// BEFORE if FeatureFlags.toggleName { // feature code } // AFTER (keep true branch) // feature codeExample 2 - Ternary operator (defaultValue: true):
// BEFORE VStack(spacing: FeatureFlags.toggleName ? 8 : 0) // AFTER VStack(spacing: 8)Example 3 - Inverted logic (defaultValue: true):
// BEFORE guard !FeatureFlags.toggleName else { return } oldCode() // AFTER (flag is true, so guard fails, remove entire block) // [entire block deleted]Example 4 - State variable (defaultValue: true):
// BEFORE @State private var toggle = FeatureFlags.toggleName if toggle { newUI() } else { oldUI() } // AFTER newUI() // Note: @State variable removed in cleanup phase -
Remove feature flag definition:
// Delete from: Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift static let toggleName = FeatureDescription(...) -
Run code generation:
make generateThis updates
FeatureFlags+Flags.swiftautomatically. -
Verify removal:
rg "toggleName" --type swift # Should return no results
Phase 3: Automated Cleanup Detection ⭐
CRITICAL: After toggle removal, systematically check for orphaned code:
3.1 Unused State Variables
Search for @State variables that were only used for the toggle:
# Look for patterns like: @State private var someToggle = FeatureFlags.toggleName
rg "@State.*=.*FeatureFlags" --type swift
Action: Remove the entire @State variable declaration if it's no longer used.
3.2 Unused View Components
When a toggle controlled which UI component to show, one component may now be unused:
Detection Pattern:
- Toggle switched between ComponentA and ComponentB
- After removal, only one is used
- Search for the unused component's name across codebase
Example from vaultBackToRoots:
// BEFORE
if !vaultBackToRootsToggle {
SpaceCardLabel(...) // This became unused
} else {
NewSpaceCardLabel(...)
}
// AFTER
NewSpaceCardLabel(...)
// CLEANUP: SpaceCardLabel is now unused
rg "SpaceCardLabel" --type swift # Check if used anywhere else
# If only in its own file → DELETE the file
Action:
- Search for unused component name:
rg "UnusedComponentName" --type swift - If only found in its definition file and comments → DELETE the file
- Update references in comments
3.3 Unused ViewModels / Service Classes
Toggle removal may leave entire classes unused:
Detection:
# For each major component that was conditionally used:
rg "UnusedViewModel" --type swift
rg "class UnusedViewModel" --type swift
Action: Delete unused ViewModels, their files, and DI registrations.
3.4 Unused Imports
After simplification, import AnytypeCore may only have been needed for FeatureFlags:
Detection:
- File imports
AnytypeCore - Only usage was
FeatureFlags.toggleName - After removal, no other
AnytypeCoreusage
Action: Remove unused import.
3.5 Orphaned Parameters / Properties
Toggle-gated functionality may have parameters that are no longer needed:
Example:
// BEFORE
func configure(showFeature: Bool) {
if showFeature && FeatureFlags.toggle { ... }
}
// AFTER toggle removal
func configure(showFeature: Bool) {
if showFeature { ... }
}
// POTENTIAL CLEANUP: Is showFeature still needed?
Action: Review function signatures and remove unnecessary parameters.
3.6 Test Cleanup
Toggle removal affects tests:
Check:
- Mock objects with toggle-related properties
- Test cases specifically for toggle behavior
- Test setup code with toggle configurations
Files to check:
rg "toggleName" AnyTypeTests/ --type swift
rg "toggleName" "Anytype/Sources/PreviewMocks/" --type swift
Action: Update or remove tests for deleted code paths.
Phase 4: Final Verification
Before committing:
-
Grep verification:
rg "toggleName" --type swift # Should be empty -
Compilation check:
- Remind user to verify compilation in Xcode
- Claude cannot verify this due to caching
-
Generate updated commit message:
IOS-XXXX Removed [toggleName] toggle -
Review cleanup summary:
- List all files modified
- List all files deleted
- Note any remaining manual checks needed
Cleanup Checklist Template
Use this checklist after every toggle removal:
## Cleanup Verification for [toggleName]
- [ ] Toggle definition removed from FeatureDescription+Flags.swift
- [ ] `make generate` run successfully
- [ ] All conditional usage removed
- [ ] No grep results for toggle name
- [ ] Unused @State variables removed
- [ ] Unused view components identified and deleted
- [ ] Unused ViewModels/services deleted
- [ ] Unused imports removed (especially AnytypeCore)
- [ ] Orphaned function parameters removed
- [ ] Tests updated (check AnyTypeTests/ and PreviewMocks/)
- [ ] Comments referencing old component updated
- [ ] Xcode compilation verified (by user)
Common Patterns & Pitfalls
Inverted Logic
Watch out for !FeatureFlags.toggle:
// If defaultValue: true
if !FeatureFlags.toggle {
oldCode() // This branch NEVER runs, delete it
}
Compound Conditions
Simplify conditions properly:
// BEFORE (defaultValue: true)
if FeatureFlags.toggle && userHasPermission {
showFeature()
}
// AFTER
if userHasPermission {
showFeature()
}
Guard Statements
Be careful with guards:
// BEFORE (defaultValue: true)
guard !FeatureFlags.toggle else { return }
performOldBehavior()
// AFTER (toggle is true, guard returns, entire block is dead code)
// DELETE ENTIRE BLOCK
Integration with Other Skills
- code-generation-developer: References for
make generatecommand and troubleshooting - ios-dev-guidelines: Swift refactoring patterns, import management
- code-review-developer: Cleanup standards, ensuring no orphaned code in PRs
More by anyproto
View all skills by anyproto →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversStructured Workflow guides disciplined software engineering via refactoring, feature creation, and test driven developme
Unlock AI-ready web data with Firecrawl: scrape any website, handle dynamic content, and automate web scraping for resea
Serena is a free AI code generator toolkit providing robust code editing and retrieval, turning LLMs into powerful artif
Uno Platform — Documentation and prompts for building cross-platform .NET apps with a single codebase. Get guides, sampl
Effortlessly create 25+ chart types with MCP Server Chart. Visualize complex datasets using TypeScript and AntV for powe
Interactive MCP server for collecting user feedback and executing commands during AI-assisted development. Features a we
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.