This comprehensive guide documents how to maintain, update, and test the strapi-plugin-custom-api-builder using Claude Code, based on the successful Strapi v4 β v5 migration completed in 2025.
This plugin was successfully migrated from Strapi v4 to v5 using Claude Code, demonstrating advanced AI-assisted development capabilities including:
- Complex API migrations
- Dependency resolution
- End-to-end testing with Playwright
- Multi-step debugging and troubleshooting
# Install Claude Code CLI
npm install -g @anthropics/claude-code
# Verify installation
claude --version# Clone the repository
git clone https://github.com/vivmagarwal/strapi-plugin-custom-api-builder.git
cd strapi-plugin-custom-api-builder
# Install dependencies
npm installThe CLAUDE.md file serves as the master documentation for Claude Code operations:
# Key Sections in CLAUDE.md:
- Project Overview & Status
- Migration History & Achievements
- Installation Requirements
- Technical Implementation Details
- Testing Procedures
- Troubleshooting GuideAlways update CLAUDE.md when:
- Completing major changes
- Discovering new requirements
- Fixing critical bugs
- Adding new features
- Updating documentation
# Start Claude Code session
claude code
# In Claude Code, always begin with:
"Read the CLAUDE.md file to understand current status and requirements"Best Practices:
- Review existing todos and status
- Understand dependency requirements
- Check compatibility requirements
- Plan systematic approach
// Always use TodoWrite to track progress
TodoWrite({
todos: [
{
content: "Update API endpoints for new Strapi version",
status: "pending",
activeForm: "Updating API endpoints"
},
{
content: "Test plugin loading in admin interface",
status: "in_progress",
activeForm: "Testing plugin loading"
}
]
})- Read files first: Always use Read tool before editing
- Multiple file edits: Use MultiEdit for complex changes
- Systematic approach: Update related files together
- Commit frequently: Small, focused commits with detailed messages
π Key Plugin Files:
βββ package.json # Dependencies & version
βββ strapi-admin.js # Admin entry point
βββ strapi-server.js # Server entry point
βββ admin/src/index.jsx # Admin plugin config
βββ admin/src/pages/App/index.jsx # Main app component
βββ server/controllers/ # API controllers
βββ server/services/ # Business logic
βββ CLAUDE.md # Documentation
# Set up test Strapi environment
npx create-strapi-app@latest test-strapi --quickstart
# Install plugin locally
cd test-strapi
npm install ../strapi-plugin-custom-api-builder
# Install required dependencies
npm install @strapi/design-system @strapi/icons// Use Playwright MCP for end-to-end testing
mcp__playwright__browser_navigate({url: "http://localhost:1337/admin"})
mcp__playwright__browser_click({element: "Custom API link"})
mcp__playwright__browser_snapshot() // Verify UI stateTesting Checklist:
- Plugin loads in admin navigation
- No console errors on page load
- All dependencies resolve correctly
- Custom API creation works
- Content type selection functions
- Field mapping operates correctly
- API generation produces valid endpoints
- Check for Strapi core updates
- Review dependency security alerts
- Test plugin functionality
- Update documentation if needed
- Review and update dependencies
- Run comprehensive test suite
- Check compatibility with latest Strapi version
- Update CLAUDE.md with any changes
- Create backup branch
- Document current working state
- Plan migration strategy using Claude Code
- Set up testing environment
- Use TodoWrite to track all tasks
{
"peerDependencies": {
"@strapi/strapi": "^5.0.0"
},
"dependencies": {
"lodash": "^4.17.21"
},
"userMustInstall": [
"lodash",
"@strapi/design-system@2.0.0-rc.29",
"@strapi/icons"
]
}- Check compatibility: Research breaking changes
- Update systematically: One dependency at a time
- Test thoroughly: Verify functionality after each update
- Document changes: Update CLAUDE.md with requirements
# Start development environment
npm run develop
# In parallel terminal, start test Strapi instance
cd test-strapi && npm run develop# Run Playwright tests
npx playwright test
# Test specific functionality
npx playwright test --grep "custom-api"- Plugin Installation Test
- Admin Interface Test
- API Generation Test
- Content Type Integration Test
- Relationship Mapping Test
- Generated API Functionality Test
// Essential testing commands in Claude Code
Read({file_path: "/path/to/test-results"})
Bash({command: "npm test", description: "Run test suite"})
BashOutput({bash_id: "test-server"}) // Monitor background processes
Playwright__browser_snapshot() // Visual verification// Debug steps in Claude Code:
1. Bash({command: "npm ls", description: "Check dependencies"})
2. Read({file_path: "package.json"}) // Verify peer dependencies
3. BashOutput({bash_id: "strapi-server"}) // Check server logs
4. Grep({pattern: "custom-api", path: "."}) // Find references// Check module compatibility:
1. Read({file_path: "strapi-admin.js"}) // Verify export format
2. Grep({pattern: "import.*custom-api"}) // Find import statements
3. Edit() // Fix ES6/CommonJS compatibility// Resolve missing dependencies:
1. Bash({command: "npm list --depth=0"}) // Check installed packages
2. Edit({file_path: "package.json"}) // Add missing dependencies
3. Bash({command: "npm install"}) // Install dependencies- Identify the issue: Use logs and error messages
- Isolate the problem: Test individual components
- Research solutions: Use available MCP tools for research
- Implement fixes: Make targeted changes
- Verify resolution: Test thoroughly
- Document findings: Update CLAUDE.md
# 1. Update version in package.json
npm version patch|minor|major
# 2. Update CLAUDE.md with changes
# 3. Commit all changes
git add -A
git commit -m "Release v2.x.x: Description of changes"
# 4. Push to repository
git push origin main
# 5. Publish to NPM
npm publish- All tests passing
- Documentation updated
- CLAUDE.md reflects current status
- Version number incremented
- Changelog updated
- Dependencies verified
- Installation guide current
// First command in any Claude Code session:
Read({file_path: "/path/to/CLAUDE.md"})- Track all tasks, even small ones
- Mark tasks completed immediately after finishing
- Keep only one task "in_progress" at a time
- Use clear, actionable task descriptions
// Preferred workflow:
1. Read({file_path: "target-file"}) // Understand current state
2. MultiEdit() // Make multiple related changes
3. Bash({command: "npm run lint"}) // Verify code quality
4. Test functionality
5. Commit changes- Test after every significant change
- Use both automated and manual testing
- Verify functionality in clean environment
- Document any new requirements discovered
- Write detailed commit messages
- Update documentation continuously
- Use descriptive task names in TodoWrite
- Explain complex changes in CLAUDE.md
- Check server logs:
BashOutput({bash_id: "server"}) - Verify dependencies:
Bash({command: "npm ls"}) - Test in clean environment: Create fresh Strapi instance
- Check recent changes:
git log --oneline -10
- Isolate the issue: Test individual components
- Research the problem: Use MCP tools for investigation
- Implement targeted fix: Make minimal necessary changes
- Verify resolution: Test thoroughly
- Document the solution: Update CLAUDE.md
- Always test before releasing
- Keep detailed change logs
- Maintain clean git history
- Document all requirements
- Check CLAUDE.md: Most issues documented
- Review git history: Look for similar fixes
- Test in isolation: Verify issue reproduction
- Create detailed issue: Include logs and steps
- Document solutions: Add to CLAUDE.md
- Share findings: Update community resources
- Improve processes: Refine this guide
- Test thoroughly: Ensure quality contributions
This guide provides a comprehensive framework for maintaining the Strapi Plugin Custom API Builder using Claude Code. The key to success is:
- Systematic approach: Use TodoWrite and follow established patterns
- Thorough testing: Verify functionality at every step
- Clear documentation: Keep CLAUDE.md current and detailed
- Community focus: Share knowledge and improvements
Following this guide will ensure the plugin remains stable, compatible, and well-maintained for the community.
Last Updated: 2025-09-07
Plugin Version: 2.0.0
Strapi Compatibility: v5.x
Status: β
Production Ready