Skip to content
moai-core-proactive-suggestions logo

Proactive Suggestions Expert

moai-core-proactive-suggestions

Proactive suggestions for code quality, security, and best practices

SKILL.md

Full skill instructions

Proactive Suggestions Expert

Intelligent Code Improvement Recommendations

Focus: Code Quality, Security, Performance, Best Practices
Approach: Analyze → Suggest → Prioritize


Overview

Automatically detect improvement opportunities and provide actionable suggestions.

Suggestion Categories

  1. Code Quality: Readability, maintainability
  2. Security: Vulnerabilities, best practices
  3. Performance: Bottlenecks, optimization opportunities
  4. Architecture: Design patterns, structure

Suggestion Patterns

1. Code Quality Suggestions

Pattern: Overly Complex Function

# Detected Issue
def process_data(data):
    if len(data) > 0:
        for item in data:
            if item['status'] == 'active':
                if item['type'] == 'user':
                    # 20+ more lines...

# Suggestion
✅ **Simplify Logic**:
- Extract nested loops into separate functions
- Use early returns to reduce nesting
- Current complexity: 15 → Target: <10

# Improved
def process_data(data):
    active_users = filter_active_users(data)
    return [process_user(user) for user in active_users]

2. Security Suggestions

Pattern: Hardcoded Secrets

# Detected Issue
API_KEY = "sk-1234567890abcdef"

# Suggestion
❌ **Security Risk: Hardcoded Secret**
- Move to environment variable
- Use secrets management (e.g., .env, AWS Secrets Manager)
- Add .env to .gitignore

# Fixed
import os
API_KEY = os.getenv("API_KEY")

3. Performance Suggestions

Pattern: N+1 Query

# Detected Issue
users = User.query.all()
for user in users:
    posts = Post.query.filter_by(user_id=user.id).all()

# Suggestion
⚡ **Performance: N+1 Query Detected**
- Use eager loading (joinedload)
- Reduces queries from N+1 to 1

# Optimized
users = User.query.options(joinedload(User.posts)).all()

4. Best Practice Suggestions

Pattern: Missing Type Hints

# Detected Issue
def calculate_total(items):
    return sum(item.price for item in items)

# Suggestion
📝 **Best Practice: Add Type Hints**
- Improves IDE autocomplete
- Catches type errors early
- Self-documenting code

# Improved
from typing import List

def calculate_total(items: List[Item]) -> float:
    return sum(item.price for item in items)

Suggestion Priority Levels

Critical (🔴 Fix Immediately)

  • Security vulnerabilities
  • Data loss risks
  • Production bugs

High (🟡 Fix Soon)

  • Performance bottlenecks (>2x improvement possible)
  • Code smells affecting maintainability
  • Missing error handling

Medium (🟢 Consider)

  • Code style inconsistencies
  • Missing documentation
  • Potential refactoring

Low (ℹ️ Optional)

  • Minor optimizations
  • Cosmetic improvements

Suggestion Workflow

  1. Analyze: Scan code for patterns
  2. Detect: Identify improvement opportunities
  3. Prioritize: Rank by impact and effort
  4. Suggest: Provide actionable recommendations
  5. Track: Monitor adoption rate

Example Suggestions

Missing Error Handling

# Current
def fetch_data(url):
    response = requests.get(url)
    return response.json()

# Suggestion
🛡️ **Add Error Handling**
- Network failures not handled
- Invalid JSON not handled

# Improved
def fetch_data(url):
    try:
        response = requests.get(url, timeout=5)
        response.raise_for_status()
        return response.json()
    except requests.Timeout:
        logger.error(f"Timeout fetching {url}")
        raise
    except requests.HTTPError as e:
        logger.error(f"HTTP error: {e}")
        raise

Validation Checklist

  • Actionable: Suggestions include concrete fixes?
  • Prioritized: Critical issues flagged first?
  • Justified: Explanation provided for each suggestion?
  • Measurable: Impact quantified (e.g., "2x faster")?

Related Skills

  • moai-essentials-review: Code review
  • moai-essentials-refactor: Refactoring patterns
  • moai-security-devsecops: Security scanning

Last Updated: 2025-11-20

More Security skills

supabase logo
Security

supabase

Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...

2.7K 308.9K
View

Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.

98 216.2K
View

Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.

462 163.8K
View

A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.

462 127.7K
View

Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.

462 125.1K
View

Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.

222 118.2K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View
cloudflare logo
Security

cloudflare

Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.

3K 110.7K
View

Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.

253 103K
View
gws-gmail logo
Security

gws-gmail

Send, read, and manage Gmail messages, drafts, labels, and account settings.

31.2K 78.9K
View

Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.

94 72.3K
View
gws-shared logo
Security

gws-shared

Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.

31.2K 63.4K
View

Security AI tools

StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
GeoSpy logo
Security

GeoSpy

GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams

Free
View

Detect AI-generated voices to protect against audio fraud.

Paid
View

Ensure Your Content's Originality with AI Plagiarism Checker

Freemium
View
Img Upscaler logo
Security

Img Upscaler

Upscale images by 400% without quality loss

Freemium
View
AICheatCheck logo
Security

AICheatCheck

Accurately Detect AI-Generated Content with TheChecker.AI

Free
View
D
Security

Detect GPT

Chrome extension that detects and flags AI-generated content

Free
View