frontend-maintenance

Diagnose and fix Ant Design deprecations and API failures in React projects.

57|13|Updated Jul 12, 2025
One-click install
npx skills add https://github.com/heidsoft/itsm --skill frontend-maintenance-heidsoft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-maintenance
Source: https://github.com/heidsoft/itsm/tree/main/itsm-frontend/.trae/skills/frontend-maintenance
Command: npx skills add https://github.com/heidsoft/itsm --skill frontend-maintenance-heidsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Diagnoses and fixes common frontend issues including Ant Design deprecations and API failures. Invoke when user reports console warnings, UI crashes, or requests project maintenance.

Core Features & Use Cases

1. Ant Design Deprecation Fixes

Detects and repairs deprecated component props to ensure compatibility with Ant Design v5/v6.

Common Replacements:

  • Statistic: valueStyle -> styles={{ content: { ... } }}
    • Caution: When batch replacing, ensure closing brackets are balanced: }} -> }}}.
  • Collapse: children (nested Panels) -> items (prop with array of objects).
  • Alert: message -> description (when used for detailed content).
    • Note: Use message only for the title, and description for the main content.
  • Static Methods: message/notification/modal cannot consume Context (Theme/I18n).
    • Fix: Use App.useApp() hook: const { message } = App.useApp();.
  • Space: direction -> orientation
  • Button: iconPosition -> iconPlacement
  • Card: bordered={false} -> variant="borderless", bordered={true} -> variant="outlined"
    • Note: Requires handling type definitions (e.g., Omit<CardProps, 'variant'>) if extending props.
  • Drawer: width -> size (Use size="large" or style={{ width: ... }} for custom widths).
  • Dependencies: Remove @ant-design/v5-patch-for-react-19 if on Antd v6+.

2. API Resilience & Fallback

Ensures the application remains usable even when backend services fail.

Pattern:

  • Wrap API calls in try-catch blocks.
  • Never let a 500 error crash the page.
  • Fallback Strategy:
    1. Return a structured "empty" or "safe" object matches the expected type.
    2. Log the error to console/monitoring with a clear prefix.
    3. Optionally use cached or mock data if critical for UX.
    4. Auth Loop Prevention: Check window.location.pathname before redirecting to /login on 401.

Example Implementation:

async getData() {
  try {
    return await api.fetchData();
  } catch (error) {
    console.error('API Failed, using fallback:', error);
    return { 
      items: [], 
      total: 0, 
      status: 'fallback' 
    }; // Returns safe default matching interface
  }
}

3. Diagnostic Toolkit (Grep Patterns)

Use these commands to quickly identify issues:

  • Find Static Method Misuse:

    grep -r "import {.*message.*} from 'antd'" src/
    grep -r "import {.*Modal.*} from 'antd'" src/
    
  • Find Deprecated Statistic Styles:

    grep -r "valueStyle" src/
    
  • Find Deprecated Alert Props:

    grep -r "Alert" src/ | grep "message="
    

4. Workflow

  1. Audit: Check browser console for Red (Errors) and Yellow (Warnings) logs.
  2. Port Check: If net::ERR_CONNECTION_REFUSED, check ports: lsof -i :3000 and kill zombies.
  3. Search: Use Diagnostic Toolkit to locate affected files.
  4. Fix: Apply code changes (prop renaming, try-catch wrappers, useApp hook).
  5. Verify: Restart dev server (npm run dev) and check console again.

Menu & Route Configuration

Adding New Menu Items

The ITSM system uses dynamic menus from database with a static fallback.

Database Menu (Production)

  • Provide SQL seeds and examples as in the original content.

Route Mismatch (404 Fix)

Provide guidance for ensuring route paths match actual pages.

When to Apply

  • When console shows deprecated prop warnings in Ant Design.
  • When API endpoints are unstable causing UI disruptions.
  • When UI maintenance requests are frequent.
  • During frontline code quality audits.

Quick Start

Invoke the frontend-maintenance skill on your project to scan for Ant Design deprecations and API failures and apply safe fixes.

Frequently Asked Questions about frontend-maintenance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix Ant Design deprecation warnings for components like Statistic and Collapse?

Resolve Ant Design static method context issues by replacing direct imports of `message` or `Modal` from 'antd' with the `App.useApp()` hook, allowing static methods to correctly consume Context for Theme and I18n configurations.

What is the best way to handle API failures in React without crashing the UI?

The best way to handle API failures in React is to wrap API calls in `try-catch` blocks, log the error, and return a structured 'empty' or 'safe' object matching the expected type to prevent 500 errors from crashing the page interface.

How do I prevent an authentication redirect loop on 401 API errors?

Prevent an authentication redirect loop on 401 errors by checking `window.location.pathname` before redirecting to `/login`, ensuring the application does not repeatedly redirect users already on the login page.

How do I find deprecated Ant Design props across my React project?

Find deprecated Ant Design props across a React project by using grep patterns in the terminal, such as searching for `valueStyle` to locate outdated Statistic styles or `import {.*message.*} from 'antd'` to identify static method misuse.