Debug Menu logo

Debug Menu

Community
rshankras
debug-menu

Generates a developer debug menu with feature flag toggles, environment switching, network log viewer, cache clearing, crash trigger, and diagnostic info export. Only included in DEBUG builds. Use when user wants a debug panel, dev tools menu, or shake-to-debug functionality.

Overview

Publisherrshankras
Repositoryclaude-code-apple-skills
Skill namedebug-menu
Stars
744
Forks
70
Bundled files
1
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.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

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

Installation

Install the Debug Menu 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.
  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/rshankras/claude-code-apple-skills.git /tmp/claude-code-apple-skills
mkdir -p .claude/skills
cp -r /tmp/claude-code-apple-skills/skills/generators/debug-menu .claude/skills/debug-menu
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Debug Menu 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 Debug Menu 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 Debug Menu 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.

Debug Menu Generator

Generate a comprehensive developer debug menu accessible via shake gesture or hidden tap. Includes feature flag toggles, environment switching, network log viewer, cache clearing, crash trigger, and diagnostic info export. All code is wrapped in #if DEBUG so it never ships to production.

When This Skill Activates

Use this skill when the user:

  • Asks for a "debug menu" or "developer menu"
  • Wants "dev tools" or a "debug panel"
  • Mentions "shake to debug" or "diagnostic menu"
  • Wants to "toggle feature flags" from the app
  • Asks about "environment switching" (dev/staging/production)
  • Wants a "network log viewer" in the app

Pre-Generation Checks

1. Project Context Detection

  • Check deployment target (iOS 17+ / macOS 14+ required for @Observable)
  • Check Swift version (requires Swift 5.9+)
  • Identify source file locations and project structure

2. Conflict Detection

Search for existing debug/dev menu code:

Glob: **/*Debug*Menu*.swift, **/*DevMenu*.swift, **/*DevTools*.swift, **/*DebugPanel*.swift
Grep: "DebugMenu" or "DevMenu" or "motionEnded" or "shake" in *.swift

If existing debug menu found:

  • Ask if user wants to replace or extend it
  • If extending, integrate new sections into existing structure

3. Feature Flags Detection

Search for existing feature flag setup:

Glob: **/*FeatureFlag*.swift, **/*Feature*Toggle*.swift
Grep: "FeatureFlag" or "featureFlag" or "isFeatureEnabled"

If found, integrate debug menu toggles with existing feature flag system rather than creating a new one.

Configuration Questions

Ask user via AskUserQuestion:

  1. Access method?

    • Shake gesture (shake device to open)
    • Hidden tap (5-tap on a hidden area)
    • Both (shake + hidden tap) -- recommended
  2. Sections to include? (multi-select)

    • Feature flags (toggle flags on/off at runtime)
    • Environment switcher (dev / staging / production)
    • Network logs (recent requests with status codes and timing)
    • Cache tools (clear image cache, HTTP cache, all caches)
    • Crash trigger (force crash for Crashlytics testing)
    • Diagnostics (device info, memory, disk, app version)
  3. Include push notification testing?

    • Yes (simulate local push notifications for testing)
    • No
  4. Include export diagnostics?

    • Yes (share sheet with full diagnostic report)
    • No

Generation Process

Step 1: Read Templates

Read templates.md for production Swift code wrapped in #if DEBUG.

Step 2: Create Core Files

Generate these files (all wrapped in #if DEBUG):

  1. DebugMenuView.swift -- Main NavigationStack with all sections
  2. DebugSection.swift -- Enum defining available debug sections

Step 3: Create Section Files

Based on configuration: 3. DebugEnvironmentSwitcher.swift -- If environment switcher selected 4. DebugNetworkLogger.swift -- If network logs selected 5. DiagnosticInfo.swift -- If diagnostics or export selected

Step 4: Create Trigger Files

  1. DebugMenuTrigger.swift -- ShakeDetector + hidden tap gesture + ViewModifier

Step 5: Create Action Files

  1. DebugActions.swift -- Collection of debug utility actions

Step 6: Determine File Location

Check project structure:

  • If Sources/ exists -> Sources/DebugMenu/
  • If App/ exists -> App/DebugMenu/
  • Otherwise -> DebugMenu/

Entire folder is #if DEBUG and should be excluded from release builds.

Output Format

After generation, provide:

Files Created

DebugMenu/
├── DebugMenuView.swift            # Main NavigationStack with all sections
├── DebugSection.swift             # Enum of available sections
├── DebugEnvironmentSwitcher.swift # Environment switching (optional)
├── DebugNetworkLogger.swift       # Network request logger (optional)
├── DiagnosticInfo.swift           # Device and app diagnostics (optional)
├── DebugMenuTrigger.swift         # Shake gesture + hidden tap trigger
└── DebugActions.swift             # Utility actions (reset, clear, crash)

Integration Steps

Add the debug trigger to your root view:

swift
#if DEBUG
import SwiftUI

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .debugMenuTrigger()  // Adds shake + tap to open debug menu
        }
    }
}
#endif

Or add only to specific views:

swift
struct SettingsView: View {
    var body: some View {
        Form {
            // ... your settings
        }
        #if DEBUG
        .debugMenuTrigger(method: .hiddenTap)
        #endif
    }
}

Hook up the network logger to your API client:

swift
#if DEBUG
func performRequest(_ request: URLRequest) async throws -> (Data, URLResponse) {
    let start = Date()
    let (data, response) = try await session.data(for: request)
    DebugNetworkLogger.shared.log(request: request, response: response, data: data, duration: Date().timeIntervalSince(start))
    return (data, response)
}
#endif

Register your feature flags:

swift
#if DEBUG
extension DebugMenuView {
    static let featureFlags: [FeatureFlag] = [
        FeatureFlag(key: "new_onboarding", title: "New Onboarding Flow", defaultValue: false),
        FeatureFlag(key: "dark_mode_v2", title: "Dark Mode V2", defaultValue: false),
        FeatureFlag(key: "premium_paywall", title: "Premium Paywall", defaultValue: true),
    ]
}
#endif

Testing

swift
#if DEBUG
@Test
func debugMenuSectionsRender() {
    let view = DebugMenuView()
    // Verify all sections are present
    #expect(DebugSection.allCases.count > 0)
}

@Test
func environmentSwitcherChangesBaseURL() {
    let switcher = DebugEnvironmentSwitcher()
    switcher.current = .staging
    #expect(switcher.baseURL.absoluteString.contains("staging"))

    switcher.current = .production
    #expect(switcher.baseURL.absoluteString.contains("api."))
}

@Test
func networkLoggerRecordsRequests() async {
    let logger = DebugNetworkLogger.shared
    await logger.clear()

    let request = URLRequest(url: URL(string: "https://api.example.com/users")!)
    let response = HTTPURLResponse(url: request.url!, statusCode: 200, httpVersion: nil, headerFields: nil)!
    await logger.log(request: request, response: response, data: Data(), duration: 0.25)

    let entries = await logger.entries
    #expect(entries.count == 1)
    #expect(entries.first?.statusCode == 200)
}

@Test
func diagnosticInfoCollectsDeviceData() {
    let info = DiagnosticInfo.collect()
    #expect(!info.appVersion.isEmpty)
    #expect(!info.osVersion.isEmpty)
    #expect(!info.deviceModel.isEmpty)
    #expect(info.memoryUsageMB > 0)
}
#endif

Common Patterns

Shake Gesture Trigger

swift
#if DEBUG
// In your app's UIWindow subclass or scene delegate:
ContentView()
    .debugMenuTrigger(method: .shakeGesture)
#endif

Toggle a Feature Flag at Runtime

swift
#if DEBUG
// In DebugMenuView, toggle persists to UserDefaults:
Toggle(flag.title, isOn: binding(for: flag))
    .onChange(of: flag.isEnabled) {
        NotificationCenter.default.post(name: .featureFlagChanged, object: flag.key)
    }
#endif

Switch API Environment

swift
#if DEBUG
DebugEnvironmentSwitcher.shared.current = .staging
// All subsequent API calls use staging base URL
// App restarts recommended for full effect
#endif

Clear All Caches

swift
#if DEBUG
Button("Clear All Caches", role: .destructive) {
    DebugActions.clearAllCaches()
}
#endif

Gotchas

  • MUST be #if DEBUG only -- every file, every type, every extension must be wrapped. Never let debug menu code ship to production.
  • Never ship debug menu to production -- verify your release scheme does not define the DEBUG flag. Check Build Settings > Swift Compiler > Active Compilation Conditions.
  • Shake gesture conflicts -- UIKit's motionEnded may conflict with other shake handlers (e.g., "shake to undo"). Disable the system shake-to-undo if using shake for debug: UIApplication.shared.applicationSupportsShakeToEdit = false.
  • Sensitive data in logs -- Network logger captures request/response bodies. Strip authorization headers and redact sensitive fields before logging.
  • UserDefaults pollution -- Feature flag overrides stored in UserDefaults persist across launches. Prefix all debug keys (e.g., debug_flag_) and provide a "Reset All" button.
  • Environment switching requires restart -- Some services cache their base URL at init. Show an alert recommending app restart after environment change.
  • Thread safety -- Use actors or @MainActor for shared debug state. The network logger must be an actor since it is written to from URLSession callbacks.

References

  • templates.md -- All production Swift templates for debug menu components
  • Related: generators/feature-flags -- Full feature flag system with remote config
  • Related: generators/logging-setup -- Structured logging infrastructure

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Debug Menu AI skill do?

Generates a developer debug menu with feature flag toggles, environment switching, network log viewer, cache clearing, crash trigger, and diagnostic info export. Only included in DEBUG builds. Use when user wants a debug panel, dev tools menu, or shake-to-debug functionality.

Why use Debug Menu on TypingMind?

Because you install it once and use it with any model. Debug Menu 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 Debug Menu in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/rshankras/claude-code-apple-skills/tree/main/skills/generators/debug-menu. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Debug Menu?

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 Debug Menu?

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

Is the Debug Menu AI skill free?

Yes. It is published on GitHub by rshankras 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 👇