name: codebaseanalyser
description: Performs comprehensive deep analysis of entire codebase and deployment pipeline to identify issues in production environment. Conducts systematic investigation across architecture, authentication, file connections, deployment, CI/CD, and stability.
Codebase Analyser
Perform comprehensive deep analysis of entire codebase and deployment pipeline to identify why functionality is not working correctly in production. Execute systematic investigation across all aspects of the application including architecture, authentication, file-level connections, deployment, CI/CD pipeline, and stability improvements.
When to Use This Skill
Use this skill when:
- Deployed application functionality is not working correctly in production
- Need comprehensive deep analysis of entire codebase
- Authentication system issues in production
- Deployment pipeline debugging is required
- CI/CD setup for auto-testing is needed
- Stability improvements and refactoring suggestions are required
- File-level and line-level connection audits are needed
How to Execute the Skill
Phase 1: Perform Full Codebase Architecture Analysis
- Analyze the complete project structure
- Identify:
- Frontend framework and architecture
- Backend framework and architecture
- Database type and connection method
- Authentication system implementation
- API communication pattern
- Environment configuration (.env usage)
- Deployment configuration
- Create a clear architecture map showing:
- How frontend communicates with backend
- How backend communicates with database
- How authentication flows through the system
Phase 2: Execute Authentication System Deep Trace
- Identify:
- Login route
- Registration route
- Token generation logic
- Token validation middleware
- Session or JWT handling
- Password hashing method
- Cookie handling (if any)
- Trace authentication flow step-by-step:
- User submits login form (frontend)
- Request sent to backend
- Backend processes credentials
- Token created
- Token returned to frontend
- Token stored (localStorage/cookies)
- Protected routes accessed
- Check for:
- CORS issues
- Missing credentials in fetch/axios
- Wrong base URLs
- Environment variable misconfiguration
- Production vs development differences
- Missing middleware
- Expired tokens
- Wrong secret keys
- API route mismatches
Phase 3: Execute File-Level and Line-Level Connection Audit
- Check every import/export
- Verify that:
- All API routes match frontend calls
- All controllers are properly connected
- All middleware is applied
- Database models are properly registered
- No circular dependencies exist
- Identify any dead code or unused functions
- Detect any runtime-only production errors
Provide a categorized issue list:
Phase 4: Execute Deployment & Production Debugging
Analyze:
- Build process
- Environment variables in hosting platform
- Backend server configuration
- Reverse proxy (if any)
- Port binding
- Production logs
- CORS production policy
- HTTPS issues
Explain why it might work locally but fail after deployment.
Phase 5: Implement CI/CD Pipeline Setup for Auto-Testing
Implement a CI/CD solution that:
- Automatically runs tests on:
- Every push
- Every pull request
- Tests:
- API endpoints
- Authentication flow
- Database connection
- Environment variable validation
- Frontend build success
- Fails deployment if tests fail
- Runs linting and type-checking
- Verifies that backend can start successfully
- Verifies that frontend can build without errors
Provide:
- Suggested GitHub Actions (or CI provider) config
- Example workflow YAML file
- Suggested test structure
- Suggested test libraries
Phase 6: Create Stability Improvement Plan
Create:
- Refactoring suggestions
- Security improvements
- Logging improvements
- Monitoring suggestions
- Error handling improvements
- Recommended production-grade best practices
Resources Available
- Run
scripts/codebase_analysis.py for automated codebase analysis
- Reference
references/production_debugging.md for common production issues and debugging patterns
- Use
assets/github-workflow.yml as a template for CI/CD workflow
Important Guidelines
- Do not give generic advice
- Analyze the actual code deeply
- Explain root causes clearly
- Provide fixes with code examples
- Be systematic and structured
- Focus on production-specific issues
- Prioritize critical issues that prevent functionality
- Identify environment-specific configurations
- Ensure comprehensive coverage of all system components