lvt-analyze

star 0

Analyze LiveTemplate app structure - examine schema, resources, relationships, complexity, and provide insights

livetemplate By livetemplate schedule Updated 12/19/2025

name: lvt-analyze description: Analyze LiveTemplate app structure - examine schema, resources, relationships, complexity, and provide insights category: maintenance version: 1.0.0 keywords: ["lvt", "livetemplate", "lt"]

lvt:analyze

Comprehensive analysis of LiveTemplate application structure. Examines database schema, resources, relationships, code organization, and provides actionable insights.

๐ŸŽฏ ACTIVATION RULES

Context Detection

This skill typically runs in existing LiveTemplate projects (.lvtrc exists).

โœ… Context Established By:

  1. Project context - .lvtrc exists (most common scenario)
  2. Agent context - User is working with lvt-assistant agent
  3. Keyword context - User mentions "lvt", "livetemplate", or "lt"

Keyword matching (case-insensitive): lvt, livetemplate, lt

Trigger Patterns

With Context: โœ… Generic prompts related to this skill's purpose

Without Context (needs keywords): โœ… Must mention "lvt", "livetemplate", or "lt" โŒ Generic requests without keywords


User Prompts

When to use:

  • "Analyze my app"
  • "Show me my app structure"
  • "What's in my application?"
  • "Review my schema"
  • "Tell me about my app's architecture"

Examples:

  • "Analyze my blog app"
  • "Show me the structure of my application"
  • "Review my database schema"
  • "What resources do I have?"

Analysis Components

1. Schema Analysis

Use lvt:resource-inspect to examine:

  • All tables and their purposes
  • Field counts and complexity
  • Data types used
  • Relationships (foreign keys)
  • Indexes

Output format:

=== Schema Analysis ===

Resources: 5 tables found

Core Resources:
- users (7 fields) - User accounts and profiles
- posts (6 fields) - Blog posts with content
- comments (5 fields) - User comments on posts

Supporting Tables:
- sessions (4 fields) - User session management
- categories (3 fields) - Post categorization

Complexity: Medium (5 tables, 25 total fields)

2. Relationship Analysis

Detect and document:

  • One-to-many relationships
  • Many-to-many relationships
  • Self-referencing relationships
  • Missing relationships (potential gaps)

Output format:

=== Relationships ===

One-to-Many:
- posts โ†’ comments (via post_id)
- users โ†’ posts (via user_id)
- users โ†’ sessions (via user_id)

Many-to-Many:
- (none detected)

Potential Missing Relationships:
- posts could relate to categories
- comments could relate to users

Foreign Key Analysis:
โœ… All foreign keys use CASCADE delete
โœ… Relationships properly indexed

3. Resource Complexity

Analyze each resource:

  • Field count (simple: <5, medium: 5-10, complex: >10)
  • Field types (diversity)
  • Business logic hints
  • UI complexity

Output format:

=== Resource Complexity ===

Simple Resources:
- categories (3 fields) - Basic lookup table
- sessions (4 fields) - Session tracking

Medium Resources:
- comments (5 fields) - Standard CRUD
- posts (6 fields) - Content management

Complex Resources:
- users (7 fields) - Auth + profile data

Average Complexity: 5 fields per resource

4. Code Organization

Check file structure:

=== Code Organization ===

App Structure:
โœ… app/ - Handler organization
โœ… database/ - Database layer
โœ… shared/ - Shared utilities

Resources with Full Stack:
- posts (handler, template, tests)
- comments (handler, template, tests)
- users (auth system)

Views:
- home (landing page)
- about (static page)

Missing:
โš ๏ธ  No E2E tests for posts
โš ๏ธ  No custom middleware

5. Database Health

Analyze database structure:

  • Migration count and history
  • Index coverage
  • Potential performance issues
  • Schema consistency

Output format:

=== Database Health ===

Migrations: 5 applied
Latest: 20251104_create_comments.sql

Index Coverage:
โœ… Primary keys on all tables
โœ… Foreign keys indexed
โš ๏ธ  High-volume table 'posts' missing index on created_at

Performance Recommendations:
- Add index on posts(created_at) for date sorting
- Add index on comments(post_id, created_at) for pagination

Schema Consistency:
โœ… All timestamps use DATETIME
โœ… Consistent naming (snake_case)
โœ… ID fields use INTEGER PRIMARY KEY

6. Feature Detection

Identify features in use:

  • Authentication (password, magic link, email confirm)
  • Authorization (middleware, protected routes)
  • CRUD operations
  • Search/filter
  • Pagination
  • Sorting

Output format:

=== Features Detected ===

Authentication:
โœ… Password authentication
โœ… Magic link authentication
โœ… Email confirmation
โœ… Session management
โœ… CSRF protection

CRUD Operations:
โœ… posts - Full CRUD
โœ… comments - Full CRUD
โœ… categories - Full CRUD

Advanced Features:
โœ… Pagination (infinite scroll)
โš ๏ธ  No search functionality
โš ๏ธ  No sorting controls
โš ๏ธ  No filters

Checklist

  • Run lvt resource list to get all tables
  • For each resource, run lvt resource describe
  • Analyze relationships and foreign keys
  • Calculate complexity metrics
  • Check code organization
  • Review database migrations
  • Detect features in use
  • Identify missing indexes
  • Suggest improvements
  • Generate comprehensive report

Analysis Report Template

# Application Analysis Report

## Overview
- **App Name:** [name]
- **Resources:** [count] tables
- **Complexity:** [simple/medium/complex]
- **Features:** [auth, CRUD, pagination, etc.]

## Schema Summary
[List all resources with field counts]

## Relationships
[Document all foreign keys and relationships]

## Complexity Analysis
[Breakdown by resource]

## Database Health
- **Migrations:** [count]
- **Index Coverage:** [percentage]
- **Performance:** [issues/recommendations]

## Feature Coverage
[Which features are implemented]

## Recommendations
[Ordered list of suggestions]

## Next Steps
[Actionable items for improvement]

Example Analysis

Small Blog App

=== App Analysis ===

Overview:
- 3 core resources (posts, comments, users)
- Medium complexity (18 total fields)
- Basic CRUD + Auth

Strengths:
โœ… Clean schema with proper relationships
โœ… Full authentication system
โœ… Consistent naming conventions

Opportunities:
โš ๏ธ  Add categories for better organization
โš ๏ธ  Add indexes for better performance
โš ๏ธ  Add search functionality

Recommendation: Add categories and post_categories junction table

E-commerce App

=== App Analysis ===

Overview:
- 6 core resources (products, orders, customers, etc.)
- Complex (45 total fields)
- Full e-commerce features

Strengths:
โœ… Complete order workflow
โœ… Customer management
โœ… Product catalog

Opportunities:
โš ๏ธ  Missing inventory tracking
โš ๏ธ  No product reviews
โš ๏ธ  Cart abandonment not tracked

Recommendation: Add reviews resource and inventory fields

Metrics to Calculate

Schema Metrics

  • Total tables
  • Total fields
  • Average fields per table
  • Relationship count
  • Index count

Code Metrics

  • Handlers with tests
  • Template coverage
  • Middleware count
  • Shared utilities

Feature Metrics

  • Auth completeness (0-100%)
  • CRUD coverage (0-100%)
  • Advanced features (search, sort, filter)

Common Insights

Well-Structured App

  • Consistent naming
  • Proper relationships
  • Good index coverage
  • Comprehensive tests
  • Clear separation of concerns

Needs Improvement

  • Missing relationships
  • No indexes on high-volume queries
  • Inconsistent naming
  • Missing tests
  • Monolithic handlers

Success Criteria

Analysis is complete when:

  1. โœ… All resources documented
  2. โœ… Relationships mapped
  3. โœ… Complexity calculated
  4. โœ… Code organization reviewed
  5. โœ… Database health checked
  6. โœ… Features detected
  7. โœ… Recommendations provided

Notes

  • Purely informational (no modifications)
  • Helps users understand their app
  • Identifies improvement opportunities
  • Great for onboarding new developers
  • Useful before refactoring
  • Can inform testing priorities
  • Combines data from multiple inspection tools
Install via CLI
npx skills add https://github.com/livetemplate/lvt --skill lvt-analyze
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator
livetemplate
livetemplate Explore all skills →