frontend-maintenance
Skill15 starsChanged 3 months agoMITView on GitHub
Frontend codebase maintenance - dead code detection, linting, dependency updates, and cleanup for TypeScript/React code.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- backend/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- frontend/CLAUDE.mdCLAUDE.md
- add-session-cardSkill
- backend-maintenanceSkill
- bugfixSkill
- cut-releaseSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 15 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use TodoWrite to create a checklist and track progress
- Distinctive: line 13
Run commands from project root using full paths
- Distinctive: line 14
Use the Grep tool instead of bash grep for searching
- Distinctive: line 39
Unused files: Delete immediately (truly dead code)
- Distinctive: line 40
Unused exports: Remove export keyword or delete if truly unused
- Distinctive: line 41
Unused dependencies: Verify before removing (@types/* packages may be implicit)
- Distinctive: line 42
If knip reports issues, fix them before continuing with other maintenance tasks
- Distinctive: line 44
Do NOT ask for permission - just fix and report what was cleaned up.
- Distinctive: line 84
Use Grep to find these patterns:
- Distinctive: line 112
Look at the largest files first - they often contain logic that could be extracted
- Distinctive: line 113
Use Grep to find repeated patterns: similar function signatures, identical JSX structures, duplicated state management
- Distinctive: line 115
Check for inline logic that already exists as a utility function elsewhere
- Distinctive: line 143
After fixing issues in Phases 1-2, run the code-simplifier agent to simplify and refine any modified frontend code:
- Distinctive: line 155
Create a summary with:
- Distinctive: line 183
Remove dead code flagged by knip
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Frontend Maintenance
Periodic evaluation and cleanup for the frontend codebase.
Instructions for Claude
- Use TodoWrite to create a checklist and track progress
- Run commands from project root using full paths
- Use the Grep tool instead of bash grep for searching
- Collect all findings, then triage and summarize at the end
Phase 1: Automated Checks
Track with TodoWrite:
- Dead code detection (knip)
- Linting warnings (ESLint)
- Outdated dependencies
- Security audit
- TODO/FIXME audit
- Test coverage
Dead Code Detection
# Knip: finds unused files, exports, and dependencies
cd frontend && npm run knip
# ESLint for general linting
cd frontend && npm run lintIMPORTANT: The knip report should be clean (no output = no issues).
- Unused files: Delete immediately (truly dead code)
- Unused exports: Remove export keyword or delete if truly unused
- Unused dependencies: Verify before removing (@types/* packages may be implicit)
- If knip reports issues, fix them before continuing with other maintenance tasks
Do NOT ask for permission - just fix and report what was cleaned up.
Dependency Audit
cd frontend && npm outdated
cd frontend && npm auditUpdate strategy:
- Patch versions: Update immediately
- Minor versions: Update if low-risk
- Major versions: Note for review, don't auto-update
Test Coverage
# Use --run to avoid watch mode
cd frontend && npm test -- --coverage --runPhase 2: Manual Code Review
Track with TodoWrite:
- Security review
- Code smell detection
- DRY / code deduplication review
- Logic simplification review
- Bundle size check
Security Review Checklist
- XSS prevention:
dangerouslySetInnerHTMLuses DOMPurify - User input sanitized before display
- No secrets in client-side code
- API errors handled gracefully
Code Smell Patterns to Search
Use Grep to find these patterns:
# Empty catch blocks
Pattern: "catch.*\{\s*\}"
# Console.log left in code
Pattern: "console\.log"
# Any type usage
Pattern: ": any"
# Disabled ESLint rules
Pattern: "eslint-disable"DRY / Code Deduplication Review
Actively search for opportunities to reduce duplication and simplify logic:
Duplicated patterns to look for:
- Similar UI components that could share a common base (e.g., pages with tables, modal dialogs, form patterns)
- Repeated fetch/state/error handling logic across hooks or components
- Identical or near-identical CSS patterns across module files
- Copy-pasted utility logic (formatting, validation, data transforms)
- Similar conditional rendering blocks across components
How to search:
- Look at the largest files first - they often contain logic that could be extracted
- Use Grep to find repeated patterns: similar function signatures, identical JSX structures, duplicated state management
- Compare hooks that do similar things (e.g., multiple hooks that fetch + poll + handle errors)
- Check for inline logic that already exists as a utility function elsewhere
Logic simplification to look for:
- Overly nested conditionals that could be flattened (early returns, guard clauses)
- Complex expressions that could be extracted into well-named variables or functions
- State that could be derived from other state instead of tracked independently
- Effects that could be replaced with event handlers or useMemo
- Verbose patterns that have simpler idiomatic equivalents
Action: Report findings with specific file locations and a brief description of the simplification. For low-risk improvements (extracting a shared component, simplifying a conditional), fix directly. For larger refactors, note in the findings table.
Bundle Size Check
cd frontend && npm run buildWatch for chunks exceeding 500 KB - consider code-splitting.
Files to Prioritize for Review
Largest/most complex:
schemas/claudeTranscript.ts(~545 lines) - Validationpages/ShareLinksPage.tsx(~347 lines) - Complex UIpages/APIKeysPage.tsx(~316 lines) - Complex UI
Phase 3: Code Simplification
After fixing issues in Phases 1-2, run the code-simplifier agent to simplify and refine any modified frontend code:
Use the Task tool with subagent_type="code-simplifier" and prompt:
"Simplify and refine recently modified TypeScript/React code in the frontend/src/ directory.
Focus on clarity, consistency, and maintainability while preserving all functionality."This catches additional simplification opportunities (verbose patterns, unnecessary complexity, inconsistent style) that automated tools miss.
Phase 4: Triage and Report
Create a summary with:
Findings Table
| Category | Severity | Issue | Location | Action |
| Security | High/Med/Low | Description | file:line | Fix/Ticket/Ignore |
| Dead Code | ... | ... | ... | ... |
| Duplication | ... | ... | ... | ... |
| Simplification | ... | ... | ... | ... |
| Code Smell | ... | ... | ... | ... |
| Bundle | ... | ... | ... | ... |
Severity Guidelines
- High: Security vulnerabilities, crashes
- Medium: Bugs that affect functionality, significant code smells
- Low: Minor issues, style inconsistencies, small improvements
Action Guidelines
- Fix now: Low-risk, high-value improvements (dead code, patch updates)
- Create ticket: Larger refactors needing planning
- Ignore: Acceptable tradeoffs, false positives
Risk Categories
Low-Risk (Do Immediately)
- Remove dead code flagged by knip
- Fix linting warnings
- Update patch-level dependencies
Higher-Risk (Plan Carefully)
- Major dependency updates
- Restructuring components
- Shared type modifications
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
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.

