### Install and Use Spatie's Ray for Debugging Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-laravel/SKILL.md Instructions for installing the spatie/laravel-ray package and examples of its usage for sending variables, coloring output, timing code execution, and displaying queries. ```bash composer require spatie/laravel-ray --dev ``` ```php ray($variable); ray($var1, $var2)->green(); ray()->measure(); ray()->pause(); ray()->showQueries(); ``` -------------------------------- ### GET and POST API Routes Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-nextjs/SKILL.md Example implementation of GET and POST request handlers for an API route. ```APIDOC ## GET /api/users ### Description Fetches user data based on an optional ID provided in the query parameters. ### Method GET ### Endpoint /api/users?id= ### Parameters #### Query Parameters - **id** (string) - Optional - The ID of the user to fetch. ### Request Example (No request body for GET) ### Response #### Success Response (200) - **data** (object) - The user data. #### Response Example ```json { "id": "user123", "name": "John Doe" } ``` ## POST /api/users ### Description Creates a new user with the data provided in the request body. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **field1** (type) - Required - Description of field1. - **field2** (type) - Required - Description of field2. ### Request Example ```json { "name": "Jane Doe", "email": "jane.doe@example.com" } ``` ### Response #### Success Response (201) - **id** (string) - The ID of the newly created user. - **message** (string) - Confirmation message. #### Response Example ```json { "id": "user456", "message": "User created successfully" } ``` #### Error Response (400) - **error** (string) - 'Invalid JSON' if the request body is not valid JSON. #### Error Response (500) - **error** (string) - 'Internal Server Error' for server-side issues. ``` -------------------------------- ### Flutter DevTools Installation and Execution Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flutter/SKILL.md Instructions for installing and running Flutter DevTools, a suite of performance and debugging tools for Flutter and Dart applications. ```bash # Install DevTools globally flutter pub global activate devtools # Run DevTools flutter pub global run devtools # Or use dart devtools dart devtools ``` -------------------------------- ### Install and Initialize Sentry SDK for Flask Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flask/SKILL.md Installs the Sentry SDK with Flask and SQLAlchemy integrations and initializes it with a DSN, sample rate, and environment configuration. This setup enables error tracking and performance monitoring for the Flask application. ```python import sentry_sdk from sentry_sdk.integrations.flask import FlaskIntegration from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration import os sentry_sdk.init( dsn="your-sentry-dsn", integrations=[ FlaskIntegration(), SqlalchemyIntegration(), ], traces_sample_rate=0.1, # 10% of transactions for performance monitoring environment=os.environ.get('FLASK_ENV', 'production'), ) ``` -------------------------------- ### Launch Flutter DevTools Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flutter/SKILL.md Instructions on how to install and launch Flutter DevTools, a comprehensive suite for debugging Flutter applications. ```bash # Launch DevTools flutter pub global activate devtools flutter pub global run devtools ``` -------------------------------- ### Install and Configure Laravel Telescope Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-laravel/SKILL.md Steps to install Laravel Telescope, a comprehensive debugging tool for Laravel. It includes composer installation, running the install command, migrating the database, and configuring access control via a Gate. ```bash composer require laravel/telescope --dev php artisan telescope:install php artisan migrate ``` ```php protected function gate() { Gate::define('viewTelescope', function ($user) { return in_array($user->email, [ 'admin@example.com', ]); }); } ``` -------------------------------- ### Using Tini as Entrypoint in Dockerfile (Option 1) Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-docker/SKILL.md Demonstrates how to use `tini` as the entrypoint in a Dockerfile for proper signal handling and zombie reaping. This example installs `tini` using `apt-get`. ```dockerfile # GOOD: Use tini for proper signal handling and zombie reaping FROM python:3.12-slim # Install tini RUN apt-get update && \ apt-get install -y --no-install-recommends tini && \ rm -rf /var/lib/apt/lists/* WORKDIR /app COPY . . ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["python", "app.py"] ``` -------------------------------- ### Install and Configure why-did-you-render Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-react/SKILL.md Installs the 'why-did-you-render' package via npm and configures it to track unnecessary re-renders in React development environments. It requires importing the library before React and enabling tracking for specific components. ```bash npm install @welldone-software/why-did-you-render ``` ```jsx // wdyr.js - import before React import React from 'react'; if (process.env.NODE_ENV === 'development') { const whyDidYouRender = require('@welldone-software/why-did-you-render'); whyDidYouRender(React, { trackAllPureComponents: true, }); } // Component to track function MyComponent() { ... } MyComponent.whyDidYouRender = true; ``` -------------------------------- ### Show Docker system-wide information Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-docker/SKILL.md Displays detailed information about the Docker installation, including version, storage driver, and operating system details. ```bash docker system info ``` -------------------------------- ### Environment and Configuration Checks (Python/Bash) Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-fastapi/SKILL.md Python and Bash commands for inspecting the environment and installed packages. Includes checking FastAPI and Pydantic versions, listing relevant installed packages, and retrieving environment variables. ```bash # Check Python environment python -c "import fastapi; print(fastapi.__version__)" python -c "import pydantic; print(pydantic.__version__)" # List installed packages pip list | grep -E "(fastapi|pydantic|uvicorn|starlette)" # Check environment variables python -c "import os; print(os.environ.get('DATABASE_URL'))" ``` -------------------------------- ### Minimal APIs for Lightweight Endpoints in C# Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-dotnet/SKILL.md Provides examples of using Minimal APIs in ASP.NET Core for creating simple and lightweight HTTP endpoints. It demonstrates mapping GET and POST requests with dependency injection. ```csharp app.MapGet("/orders/{id}", async (int id, IOrderService service) => await service.GetOrderAsync(id) is Order order ? Results.Ok(order) : Results.NotFound()); app.MapPost("/orders", async (CreateOrderRequest request, IOrderService service) => { var order = await service.CreateOrderAsync(request); return Results.Created($"/orders/{order.Id}", order); }); ``` -------------------------------- ### Install and Use ndb Debugger Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-express/SKILL.md Installs the ndb debugger globally and launches a Node.js application with it. ndb provides an enhanced debugging experience with a better UI and improved features for async stack traces. ```bash npm install -g ndb ndb node app.js ``` -------------------------------- ### Integrate Flask-DebugToolbar Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flask/SKILL.md Shows how to install and initialize the Flask-DebugToolbar extension. This toolbar provides valuable insights into requests, responses, templates, SQLAlchemy queries, and more directly within the browser. ```python # Install: pip install flask-debugtoolbar from flask import Flask from flask_debugtoolbar import DebugToolbarExtension app = Flask(__name__) app.config['SECRET_KEY'] = 'dev-secret-key' app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False toolbar = DebugToolbarExtension(app) ``` -------------------------------- ### Installing and Using django-extensions shell_plus Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-django/SKILL.md Explains how to install and configure `django-extensions` to use the enhanced `shell_plus` command. This provides an interactive Python shell with your Django models automatically imported, significantly speeding up development and debugging. ```bash pip install django-extensions # Add to INSTALLED_APPS INSTALLED_APPS = ['django_extensions', ...] # Use enhanced shell with auto-imports python manage.py shell_plus # With IPython python manage.py shell_plus --ipython # Print SQL queries python manage.py shell_plus --print-sql ``` -------------------------------- ### Install and Use Vue DevTools Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-nuxtjs/SKILL.md Instructions for using Vue DevTools, either as a browser extension for inspecting Vue components and state, or as a standalone application for more advanced debugging scenarios. ```bash # Install Vue DevTools browser extension # Or use standalone npx @vue/devtools ``` -------------------------------- ### ESLint Configuration for Node.js Projects Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-express/SKILL.md Sets up ESLint for a Node.js project to catch errors before runtime. Includes installing necessary packages and configuring rules for recommended practices and Node.js specific checks. ```bash npm install eslint eslint-plugin-node --save-dev npx eslint --init ``` -------------------------------- ### Graceful Startup with Error Handling in .NET Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-dotnet/SKILL.md Illustrates a robust pattern for application startup in .NET, using a try-catch-finally block to handle exceptions gracefully and ensure proper logging and flushing of log messages. This pattern helps diagnose and manage startup failures. ```csharp try { var builder = WebApplication.CreateBuilder(args); // Configure services var app = builder.Build(); // Configure pipeline await app.RunAsync(); } catch (Exception ex) { Log.Fatal(ex, "Application terminated unexpectedly"); } finally { Log.CloseAndFlush(); } ``` -------------------------------- ### Using Tini as Entrypoint in Dockerfile (Option 2) Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-docker/SKILL.md An alternative method for using `tini` as the entrypoint, this example downloads `tini` directly from GitHub and makes it executable. This can be useful in minimal base images. ```dockerfile # Alternative: Use tini from Docker Hub FROM python:3.12-slim ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini RUN chmod +x /tini ENTRYPOINT ["/tini", "--"] CMD ["python", "app.py"] ``` -------------------------------- ### Get React Native Version Information Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-react-native/SKILL.md Retrieves detailed information about your React Native setup, including versions of React Native, React, Node.js, and platform-specific build tools. ```bash npx react-native info ``` -------------------------------- ### Initial Kubernetes Status Overview Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-kubernetes/SKILL.md Begin the debugging process by gathering a broad overview of the current status of key Kubernetes resources within a namespace. This provides a baseline for identifying potential issues. ```bash # Quick status overview kubectl get pods,svc,deploy,rs -n ``` -------------------------------- ### Composable Usage in Nuxt.js Setup Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-nuxtjs/SKILL.md Highlights a common gotcha in Nuxt.js: composables must be called within the `setup` function or its scope. Calling composables directly in event handlers or other non-setup functions will result in errors. The example shows the correct way to access composables like `useRoute`. ```typescript // BAD function handleClick() { const route = useRoute() // Error! } // GOOD const route = useRoute() function handleClick() { console.log(route.path) } ``` -------------------------------- ### Testing Express Endpoints with cURL Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-express/SKILL.md Demonstrates how to test Express.js API endpoints using the cURL command-line tool. Includes examples for making GET and POST requests, sending JSON data, and including authorization headers. ```bash # Test endpoint directly curl -v http://localhost:3000/api/users curl -X POST -H "Content-Type: application/json" \ -d '{"name":"test"}' http://localhost:3000/api/users ``` -------------------------------- ### Build and Run ASP.NET Core Projects Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-dotnet/SKILL.md A collection of essential bash commands for building and running ASP.NET Core projects. Includes commands for standard build, release build, and running with hot reload. ```bash # Build project dotnet build # Build in Release mode dotnet build -c Release # Run with hot reload dotnet watch run ``` -------------------------------- ### Troubleshoot ASP.NET Core Middleware Pipeline Issues Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-dotnet/SKILL.md Addresses common problems within the ASP.NET Core middleware pipeline, including incorrect ordering, missing middleware, and issues arising from the response already being started. Provides code examples for debugging by adding diagnostic middleware and demonstrates the correct sequence for essential middleware components. ```csharp // Wrong middleware order app.UseAuthorization(); // Must come AFTER UseAuthentication! app.UseAuthentication(); // Missing middleware app.UseRouting(); // Missing UseAuthentication() and UseAuthorization() app.MapControllers(); // Response already started app.Use(async (context, next) => { await context.Response.WriteAsync("Hello"); // Response started await next(); // Next middleware tries to modify headers - ERROR }); ``` ```csharp app.Use(async (context, next) => { Console.WriteLine($"Request: {context.Request.Path}"); await next(); Console.WriteLine($"Response: {context.Response.StatusCode}"); }); ``` ```csharp app.UseExceptionHandler("/error"); app.UseHsts(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); app.UseAuthorization(); app.UseSession(); app.MapControllers(); ``` -------------------------------- ### Quick Reference: Environment and Build Commands (Bash) Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-react-native/SKILL.md A collection of frequently used bash commands for React Native development, including environment checks, starting the development server, running apps on specific platforms, and managing iOS/Android builds. ```bash # Environment check npx react-native doctor npx react-native info # Start with cache reset npx react-native start --reset-cache # Run on specific platform npx react-native run-ios npx react-native run-ios --simulator="iPhone 15 Pro" npx react-native run-android npx react-native run-android --deviceId= # iOS specific cd ios && pod install cd ios && pod update cd ios && pod deintegrate && pod install xcodebuild clean -workspace ios/YourApp.xcworkspace -scheme YourApp # Android specific cd android && ./gradlew clean cd android && ./gradlew assembleDebug --stacktrace cd android && ./gradlew assembleRelease # Generate release builds cd android && ./gradlew bundleRelease cd ios && xcodebuild -workspace YourApp.xcworkspace -scheme YourApp -configuration Release archive ``` -------------------------------- ### Install WSL2 on Windows Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-docker/SKILL.md Installs the Windows Subsystem for Linux version 2. This is often required for Docker Desktop on Windows to function correctly. Requires administrative privileges. ```powershell wsl --install ``` -------------------------------- ### Installing TensorFlow GPU and Verifying CUDA Compatibility Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-tensorflow/SKILL.md Shell commands for installing the correct TensorFlow GPU package and notes on CUDA/cuDNN version compatibility. This is crucial for ensuring TensorFlow can utilize the GPU. ```bash # Install correct TensorFlow GPU package pip install tensorflow[and-cuda] # TF 2.15+ # or pip install tensorflow-gpu # Older versions # Verify CUDA compatibility # TF 2.15: CUDA 12.x, cuDNN 8.9 # TF 2.14: CUDA 11.8, cuDNN 8.7 # TF 2.13: CUDA 11.8, cuDNN 8.6 # For Docker, use nvidia-docker docker run --gpus all -it tensorflow/tensorflow:latest-gpu ``` -------------------------------- ### Using Flask Shell for Interactive Debugging Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flask/SKILL.md Shows how to launch an interactive Flask shell session, which provides an application context for easier debugging. Examples include importing models, checking configuration, and inspecting application routes. ```bash # Start interactive shell with app context flask shell # In shell: >>> from app.models import User >>> User.query.all() >>> app.config['DEBUG'] >>> app.url_map # View all registered routes ``` -------------------------------- ### Install Laravel Debugbar Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-laravel/SKILL.md Command to install the Laravel Debugbar package, which provides quick inline debugging information for web pages, including query counts, route information, and rendering times. ```bash composer require barryvdh/laravel-debugbar --dev ``` -------------------------------- ### Vue Development and Build Commands Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-vue/SKILL.md Lists essential npm scripts for Vue.js development and build processes. Includes commands for starting the dev server with debugging, type checking, linting, running unit tests, building with source maps, analyzing bundle size, and previewing production builds. ```bash # Start dev server with debugging npm run dev -- --debug # Type check npm run type-check # or: npx vue-tsc --noEmit # Lint and fix npm run lint -- --fix # Run unit tests npm run test:unit # Run tests in watch mode npm run test:unit -- --watch # Build with source maps npm run build -- --sourcemap # Analyze bundle size npx vite-bundle-analyzer # Preview production build locally npm run preview ``` -------------------------------- ### Run Uvicorn Development Server (Bash) Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-fastapi/SKILL.md Provides bash commands for running the Uvicorn server, FastAPI's ASGI server. Demonstrates how to enable auto-reloading for development, set log levels, specify host and port, and enable access logs. ```bash # Development server with auto-reload on code changes uvicorn main:app --reload # Specify host and port uvicorn main:app --reload --host 0.0.0.0 --port 8000 # Set log level to debug for more verbose output uvicorn main:app --reload --log-level debug # Enable access logs to see incoming requests uvicorn main:app --reload --access-log # Combine options uvicorn main:app --reload --host 127.0.0.1 --port 8080 --log-level info --access-log ``` -------------------------------- ### Installing Django Debug Toolbar Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-django/SKILL.md Provides the command to install the Django Debug Toolbar package using pip. This tool offers invaluable insights into request/response cycles, SQL queries, template rendering, and more. ```bash pip install django-debug-toolbar ``` -------------------------------- ### Run .NET Application from Command Line Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-dotnet/SKILL.md Provides the command-line syntax for running a .NET application, specifying the DLL and the URLs it should listen on. This is useful for debugging hosting issues by running the application outside of its deployment environment. ```bash dotnet MyApp.dll --urls "http://localhost:5000" ``` -------------------------------- ### Set Up TensorBoard Logging and TensorFlow Profiler Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-tensorflow/SKILL.md This code illustrates how to integrate TensorBoard for logging model training metrics and visualizing them. It also shows how to start and stop the TensorFlow profiler to analyze performance bottlenecks and enable detailed debugging information for TensorBoard Debugger V2. ```python # TensorBoard logging tensorboard_callback = tf.keras.callbacks.TensorBoard( log_dir='./logs', histogram_freq=1 ) # Start profiler tf.profiler.experimental.start('/tmp/logdir') # ... code ... tf.profiler.experimental.stop() # Debug info for TensorBoard Debugger V2 tf.debugging.experimental.enable_dump_debug_info( '/tmp/tfdbg2', tensor_debug_mode='FULL_HEALTH' ) ``` -------------------------------- ### Start Node.js Debugging Session with Nodemon Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-express/SKILL.md Starts a Node.js application using nodemon with the inspector enabled for debugging. Nodemon automatically restarts the server on file changes, facilitating a smoother debugging workflow. ```bash DEBUG=express:* nodemon --inspect app.js ``` -------------------------------- ### Compare Django Settings with Defaults Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-django/SKILL.md Shows the difference between your project's settings and Django's default settings. Useful for identifying missing or overridden settings that might cause ImproperlyConfigured errors. ```bash python manage.py diffsettings ``` -------------------------------- ### kubectl get events command usage Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-kubernetes/SKILL.md Monitor cluster events using `kubectl get events`. This command helps identify warnings, errors, and other significant occurrences within the Kubernetes cluster that may indicate problems. ```bash kubectl get events -n kubectl get events -n --sort-by='.lastTimestamp' kubectl get events -n --field-selector type=Warning kubectl get events -n -w # watch for new events kubectl get events -A --sort-by='.lastTimestamp' | tail -20 # cluster-wide recent ``` -------------------------------- ### Nuxt Build, Generation, and Preview Commands Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-nuxtjs/SKILL.md Common commands for building, generating, and previewing Nuxt.js applications. Includes production builds, static site generation, previewing the production build, and analyzing bundle sizes. ```bash # Production build nuxi build # Generate static site nuxi generate # Preview production build nuxi preview # Analyze bundle size nuxi analyze # Type checking nuxi typecheck # Prepare Nuxt (generate types) nuxi prepare ``` -------------------------------- ### Get Docker image details Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-docker/SKILL.md Provides detailed information about a Docker image, including its configuration, layers, and metadata. ```bash docker inspect ``` -------------------------------- ### Quick Reference: ADB and Process Management (Bash) Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-react-native/SKILL.md Useful bash commands for interacting with Android devices via ADB, managing running processes (like Metro), and clearing various caches to resolve build or runtime issues. ```bash # Android specific ... adb logcat *:E adb reverse tcp:8081 tcp:8081 # Process management lsof -ti:8081 | xargs kill -9 # Kill Metro watchman watch-del-all watchman shutdown-server # Cache clearing rm -rf node_modules rm -rf $TMPDIR/react-* rm -rf $TMPDIR/metro-* rm -rf ios/Pods rm -rf android/.gradle rm -rf android/app/build ``` -------------------------------- ### Profile TensorFlow Performance Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-tensorflow/SKILL.md Starts and stops the TensorFlow profiler to capture performance metrics, which can be viewed using TensorBoard. Requires TensorFlow. ```python # Use tf.profiler # tf.profiler.experimental.start('/tmp/logdir') # model.fit(x, y, epochs=1) # tf.profiler.experimental.stop() ``` -------------------------------- ### Kustomize Production Overlay Configuration Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-kubernetes/SKILL.md An example of a Kustomize 'kustomization.yaml' for a production environment overlay. It includes resources from the base, applies a name prefix, sets the namespace, applies specific patches, and defines a ConfigMap generator. ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../../base namePrefix: prod- namespace: production patches: - path: patches/deployment-resources.yaml - path: patches/deployment-replicas.yaml configMapGenerator: - name: app-config behavior: merge literals: - LOG_LEVEL=info ``` -------------------------------- ### TensorBoard Debugger V2 Setup Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-tensorflow/SKILL.md Enables detailed debug information dumping for TensorFlow graphs to aid in debugging. Requires TensorFlow. ```python # Enable debug info dumping tf.debugging.experimental.enable_dump_debug_info( logdir='/tmp/tfdbg2_logdir', tensor_debug_mode='FULL_HEALTH', circular_buffer_size=1000 ) # Run training... # model.fit(x_train, y_train, epochs=5) # View in TensorBoard by running in terminal: # tensorboard --logdir /tmp/tfdbg2_logdir ``` -------------------------------- ### Externalizing Configuration with ConfigMaps and Secrets Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-kubernetes/SKILL.md Demonstrates how to externalize application configuration and secrets from container definitions. The 'BEFORE' example shows hardcoded values, while the 'AFTER' example uses 'envFrom' to reference ConfigMaps and Secrets, and 'valueFrom' for specific secret keys. This improves security and manageability. ```yaml # BEFORE: Hardcoded configuration containers: - name: api image: myapp:v1.2.3 env: - name: DATABASE_URL value: "postgres://user:password@db:5432/app" ``` ```yaml # AFTER: Externalized configuration containers: - name: api image: myapp:v1.2.3 envFrom: - configMapRef: name: api-config - secretRef: name: api-secrets env: - name: DATABASE_PASSWORD valueFrom: secretKeyRef: name: db-credentials key: password ``` -------------------------------- ### Using Artisan Tinker for Interactive Testing Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-laravel/SKILL.md Demonstrates how to use Artisan Tinker, an interactive REPL for Laravel, to test Eloquent queries, relationships, and service calls directly from the command line. ```bash php artisan tinker # Test Eloquent queries >>> User::where('active', true)->count() => 42 # Test relationships >>> $user = User::find(1) >>> $user->posts()->count() # Test services >>> app(UserService::class)->processUser($user) ``` -------------------------------- ### Kubernetes Resource Limits: Missing vs. Defined Limits Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-kubernetes/SKILL.md Demonstrates the anti-pattern of not defining resource requests and limits for containers, which can lead to resource starvation or noisy neighbor problems. The example shows the correct way to specify these constraints. ```yaml # BAD: No limits containers: - name: api image: myapp:v1 # GOOD: Proper constraints containers: - name: api image: myapp:v1 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 256Mi ``` -------------------------------- ### Enable NestJS Debug Mode with npm Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-nestjs/SKILL.md Starts the NestJS application in debug mode using the `nest start` command with the `--debug` and `--watch` flags. This allows for attaching debuggers to the running process. An alternative is to define a script in `package.json` for easier execution. ```bash # Start with debug flag nest start --debug --watch # Or add to package.json "start:debug": "nest start --debug --watch" ``` -------------------------------- ### Use Global Usings in C# Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-dotnet/SKILL.md Shows how to centralize common using statements in `GlobalUsings.cs`. This reduces the need to include the same `using` statements in multiple files. ```csharp global using System.Collections.Generic; global using Microsoft.Extensions.Logging; global using MyApp.Domain.Entities; ``` -------------------------------- ### Flutter Clean and Reset Commands Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flutter/SKILL.md Commands to clean build artifacts, get project dependencies, and reset platform-specific build files for iOS and Android. ```bash # Clean build artifacts flutter clean # Get dependencies flutter pub get # Reset iOS pods cd ios && pod deintegrate && pod install && cd .. # Reset Android cd android && ./gradlew clean && cd .. ``` -------------------------------- ### Kubernetes Pod Controllers: Naked Pod vs. Deployment Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-kubernetes/SKILL.md Illustrates the anti-pattern of deploying 'naked' pods directly and the best practice of using controllers like Deployments. Deployments provide features such as self-healing, rolling updates, and rollbacks. ```yaml # BAD: Pod without controller apiVersion: v1 kind: Pod # GOOD: Use Deployment apiVersion: apps/v1 kind: Deployment ``` -------------------------------- ### Flutter Minimal Reproduction and Assertions Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-flutter/SKILL.md Code examples for creating a minimal widget to reproduce an issue and using assertions to validate program state during debugging. ```dart // Create minimal reproduction class DebugWidget extends StatelessWidget { @override Widget build(BuildContext context) { // Isolate the problematic widget return Container( child: ProblematicWidget(), ); } } // Use assertions to validate state assert(data != null, 'Data should not be null at this point'); assert(index >= 0 && index < list.length, 'Index out of bounds: $index'); ``` -------------------------------- ### Implement Robust Plugin Initialization in Nuxt.js Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-nuxtjs/SKILL.md Details how to handle potential errors during Nuxt.js plugin initialization to prevent application failures. It shows how to use `defineNuxtPlugin` with `setup` for error handling, providing fallbacks, and how to create client-only plugins. ```typescript // plugins/my-plugin.ts // BAD: Plugin errors break the entire app export default defineNuxtPlugin(() => { const api = new ExternalAPI() // May throw }) // GOOD: Error handling in plugins export default defineNuxtPlugin({ name: 'my-plugin', enforce: 'pre', // or 'post' async setup(nuxtApp) { try { const api = new ExternalAPI() return { provide: { api } } } catch (error) { console.error('Plugin initialization failed:', error) // Provide fallback or skip } } }) // Client-only plugin export default defineNuxtPlugin({ name: 'client-only-plugin', setup() { // This only runs on client } }) // Name file: plugins/my-plugin.client.ts ``` -------------------------------- ### Override entrypoint for debugging Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-docker/SKILL.md Starts a container interactively, overriding the default entrypoint with a shell. This provides direct access to the container's environment for troubleshooting. ```bash docker run -it --entrypoint /bin/sh ``` -------------------------------- ### Enhance Pinia Debugging with Subscriptions and Devtools Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-vue/SKILL.md Details how to enable Pinia devtools and implement state and action subscriptions for better debugging. Includes code examples for setting up Pinia and logging mutations and actions. ```javascript // Enable Pinia devtools tracking import { createPinia } from 'pinia' const pinia = createPinia() // Subscribe to state changes store.$subscribe((mutation, state) => { console.log('Mutation:', mutation.type, mutation.storeId) console.log('New state:', state) }) // Subscribe to actions store.$onAction(({ name, args, after, onError }) => { console.log(`Action ${name} called with:`, args) after((result) => console.log(`${name} returned:`, result)) onError((error) => console.error(`${name} failed:`, error)) }) ``` -------------------------------- ### Managing Composer Dependencies for Laravel Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-laravel/SKILL.md Commands for managing Composer dependencies in a Laravel project, including checking installed packages, diagnosing conflicts, and updating the autoloader. ```bash # Check composer dependencies composer show # Check for package conflicts composer diagnose # Update autoloader composer dump-autoload ``` -------------------------------- ### Get full container details Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-docker/SKILL.md Provides comprehensive information about a container, including its configuration, network settings, and state. Useful for deep dives into container specifics. ```bash docker inspect ``` -------------------------------- ### Kubernetes Labels and Annotations Best Practices Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/refactor-kubernetes/SKILL.md Illustrates the recommended structure for Kubernetes metadata, including labels and annotations. It shows standard Kubernetes labels for resource identification and custom labels for selection, along with annotations for documentation and operational metadata like Prometheus scraping. ```yaml metadata: labels: # Recommended labels (Kubernetes standard) app.kubernetes.io/name: api app.kubernetes.io/instance: api-production app.kubernetes.io/version: "1.2.3" app.kubernetes.io/component: backend app.kubernetes.io/part-of: myapp app.kubernetes.io/managed-by: helm # Custom labels for selection environment: production team: platform annotations: # Documentation description: "Main API service" # Operational prometheus.io/scrape: "true" prometheus.io/port: "8080" ``` -------------------------------- ### Get Pod Restart Counts Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-kubernetes/SKILL.md Retrieves the restart count for containers within pods in a specific namespace. This is a key indicator for pods that are repeatedly crashing and restarting. ```bash kubectl get pods -n -o=custom-columns='NAME:.metadata.name,RESTARTS:.status.containerStatuses[0].restartCount' ``` -------------------------------- ### Android-Specific Troubleshooting Steps Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-react-native/SKILL.md Commands for troubleshooting Android builds, including setting the ANDROID_HOME path, cleaning Gradle, managing the Gradle wrapper, accepting SDK licenses, and resolving ADB issues. These steps help ensure the Android environment is correctly configured and functional. ```bash # Set Android SDK path export ANDROID_HOME=~/Library/Android/sdk # macOS export ANDROID_HOME=~/Android/Sdk # Linux # Add to PATH export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/platform-tools # Gradle clean and rebuild cd android ./gradlew clean ./gradlew assembleDebug --stacktrace cd .. # Fix Gradle wrapper issues cd android rm -rf .gradle ./gradlew wrapper --gradle-version=8.3 cd .. # Accept Android SDK licenses yes | sdkmanager --licenses # ADB issues adb kill-server adb start-server adb devices ``` -------------------------------- ### Create Minimal TensorFlow Reproduction Case Source: https://github.com/snakeo/claude-debug-and-refactor-skills-plugin/blob/master/plugins/debug-and-refactor/skills/debug-tensorflow/SKILL.md Provides a basic structure for creating a minimal, reproducible example of a TensorFlow model for debugging purposes. Requires TensorFlow. ```python # Minimal test case import tensorflow as tf # Smallest possible model model = tf.keras.Sequential([ tf.keras.layers.Dense(10, input_shape=(5,)) ]) # Synthetic data x = tf.random.normal((32, 5)) y = tf.random.normal((32, 10)) model.compile(optimizer='adam', loss='mse') model.fit(x, y, epochs=1) ```