Get expert-level code analysis for any file in seconds. Whether you're trying to understand legacy code, spot potential issues, or get a second opinion on your work, this function gives you insights that would normally take hours of manual review.
Quick Start
Here are the quickest ways to analyse your code - just copy, paste, and watch the magic happen:
Please analyse this file: C:/project/src/UserAuth.tsx
Analyse this code for potential issues:
function processUser(user) {
return users.map(u => u.name);
}
Give me a comprehensive analysis of this React component: C:/src/Dashboard.jsx
Instant Insights
You'll get results in under 10 seconds for most files. The analysis includes code quality scores, security warnings, performance tips, and specific improvement suggestions - all without burning through your Claude API budget.
What You'll Get Back
This isn't just a basic code check - you're getting the kind of thorough review that usually takes a senior developer an hour or more:
Quality Assessment
Get a clear quality score with specific areas for improvement. No vague feedback - just actionable insights you can implement immediately.
Security Vulnerability Detection
Spot potential security issues before they become problems. Covers common vulnerabilities like XSS, SQL injection, and unsafe data handling.
Performance Optimisation Suggestions
Identify bottlenecks and inefficiencies with estimated impact. Get specific recommendations for making your code run faster.
Framework-Specific Best Practices
Whether it's React, Vue, Node.js, or WordPress - get advice tailored to your technology stack and current patterns.
Refactoring Opportunities
Clear suggestions for improving code structure, readability, and maintainability - with risk assessment for each recommendation.
Confidence Scoring
Every suggestion comes with a confidence level, so you know which recommendations to prioritise and which to investigate further.
Parameters
Here's what you can customise to get exactly the analysis you need:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
filePath |
string | Yes* | - |
Path to the file you want analysed Example:
"C:/project/src/UserAuth.tsx" |
code |
string | Yes* | - |
Code content directly (alternative to filePath) Perfect for pasting snippets you want reviewed
|
analysisDepth |
string | No | "detailed" |
How thorough should the analysis be?
• basic - Quick overview (30 seconds)
• detailed - Thorough review (1-2 minutes) • comprehensive - Deep dive analysis (2-3 minutes) |
analysisType |
string | No | "comprehensive" |
Focus area for the analysis
• structure - Code organisation and patterns
• quality - Readability and maintainability • security - Vulnerability detection • performance - Speed and efficiency • comprehensive - All of the above |
context |
object | No | {} |
Framework and project context for better insights
Example:
{"framework": "React", "typescript": true}
|
*Either filePath or code is required - choose whichever suits your workflow
Real-World Examples
Here's how to get the most value from different types of analysis:
React Component Analysis
Please analyse this React component with comprehensive depth:
filePath: C:/src/components/UserProfile.jsx
context: {"framework": "React", "typescript": false, "hooks": true}
Perfect for: Reviewing components before code reviews, identifying performance issues, checking hook usage patterns.
Security-Focused Analysis
Security analysis for this authentication file:
filePath: C:/api/auth/login.js
analysisType: security
context: {"framework": "Express", "database": "MongoDB"}
Perfect for: Pre-deployment security checks, reviewing authentication logic, validating input sanitisation.
Legacy Code Understanding
Help me understand this legacy code:
filePath: C:/legacy/user-handler.php
analysisDepth: comprehensive
context: {"age": "legacy", "framework": "vanilla_php"}
Perfect for: Onboarding to new codebases, planning refactoring projects, understanding complex business logic.
Code Snippet Review
Review this code snippet for issues:
function calculateTotal(items) {
let total = 0;
for(let i = 0; i < items.length; i++) {
total += items[i].price * items[i].quantity;
if(items[i].discount) {
total -= items[i].price * items[i].discount / 100;
}
}
return total;
}
Perfect for: Quick reviews of small functions, validating logic before implementation, learning opportunities.
Perfect For
Here are the situations where this function really shines:
Code Reviews
Get a thorough analysis before your team reviews. Catch obvious issues early and focus human reviewers on architecture and business logic rather than basic quality checks.
Understanding Complex Code
Joining a new team? Inherited legacy code? Get up to speed quickly by understanding what each file does, how it works, and where the potential issues might be.
Security Assessment
Before deploying to production, get a security-focused analysis of your critical files. Identify potential vulnerabilities before they become problems.
Quality Assessment
Wondering if your code meets professional standards? Get an objective quality assessment with specific suggestions for improvement.
Performance Optimization
Identify performance bottlenecks and inefficiencies before they impact users. Get specific recommendations for making your code faster.
Learning and Improvement
Every analysis is a learning opportunity. See how your code could be better and understand the reasoning behind each suggestion.
Best Practices
Get the most value from your analysis with these pro tips:
Be Specific About Context
Include framework information, TypeScript usage, and any specific patterns your team follows. The more context you provide, the more relevant the analysis becomes.
{"framework": "React", "typescript": true, "state": "redux"}
Basic:
{}
Match Depth to Purpose
Use 'basic' for quick checks, 'detailed' for regular reviews, and 'comprehensive' when you need deep insights or are dealing with critical code.
Analyse Early and Often
Don't wait until the end of development. Run analysis during coding to catch issues early when they're easier and cheaper to fix.
Consider the Confidence Scores
High-confidence suggestions are usually safe to implement immediately. Lower-confidence suggestions are worth investigating but may need your judgement.
Remember: You're The Expert
This analysis is designed to augment your expertise, not replace it. Use the insights as a starting point for your own investigation and decision-making. Context that the analysis can't see - like business requirements, team conventions, or performance constraints - should always inform your final choices.
Troubleshooting
Having issues? Here are solutions to the most common problems:
Analysis seems generic or unhelpful
This usually happens when the analysis lacks context about your specific setup.
- Add specific context:
{"framework": "React", "typescript": true}
- Try increasing analysisDepth to "comprehensive"
- Mention specific areas you're concerned about in your prompt
- Include information about your team's coding standards or constraints
File path not found or access denied
The system can only access files in your configured allowed directories.
- Use absolute paths:
C:/project/src/file.js
not./src/file.js
- Check your LM Studio MCP configuration includes the directory
- As a workaround, paste the code directly using the 'code' parameter instead
- Ensure the file exists and you have read permissions
Analysis is taking too long or seems stuck
Large files or deep analysis can take time, but shouldn't hang indefinitely.
- Try reducing analysisDepth to "basic" for very large files
- Check that your LM Studio model is fully loaded and responding
- For files over 1000 lines, consider analysing key functions separately
- Restart LM Studio if the model seems unresponsive
Getting analysis for wrong language or framework
The analysis tries to detect your language and framework, but explicit context helps.
- Always specify framework in context:
{"framework": "Vue", "language": "TypeScript"}
- Include file extensions in filePath to help with detection
- Mention specific patterns or libraries you're using
- For mixed-language files, specify the primary language
Model giving poor quality analysis
Analysis quality depends heavily on your local model's capabilities.
- Use a model with at least 13B parameters for best results
- Ensure your model is fully loaded (check LM Studio status)
- Try restarting LM Studio and reloading your model
- Consider upgrading to a larger, more capable model