Analyze naming conventions and structural patterns in Umbraco projects
Analyzes Umbraco projects for naming conventions, structural patterns, and code organization standards.
/plugin marketplace add twofoldtech-dakota/claude-marketplace/plugin install twofoldtech-dakota-umbraco-analyzer-plugins-umbraco-analyzer@twofoldtech-dakota/claude-marketplaceAnalyze document type naming, alias conventions, and code organization patterns.
Check document type names:
Good (PascalCase):
- BlogPost
- ProductPage
- HomePage
Bad:
- blog_post (snake_case)
- blogpost (no separation)
- Blog Post (spaces in alias)
Check property aliases:
Good (camelCase):
- pageTitle
- heroImage
- metaDescription
Bad:
- PageTitle (PascalCase)
- page_title (snake_case)
- page-title (kebab-case)
Check template organization:
Views/
├── HomePage.cshtml # Matches document type
├── BlogPost.cshtml
├── Partials/
│ ├── _Header.cshtml # Underscore prefix
│ └── _Footer.cshtml
└── MacroPartials/
└── RenderNavigation.cshtml
Check Composer class names:
// Good: Descriptive with Composer suffix
public class ServicesComposer : IComposer { }
public class NotificationHandlersComposer : IComposer { }
// Bad: Generic names
public class MyComposer : IComposer { }
public class Setup : IComposer { }
Check controller names:
// Good: Purpose-driven names
public class ContactFormController : SurfaceController { }
public class SearchApiController : UmbracoApiController { }
// Bad: Generic names
public class MyController : SurfaceController { }
Check plugin organization:
App_Plugins/
├── MyPackage/
│ ├── umbraco-package.json # Required manifest
│ ├── dist/
│ │ ├── my-editor.js
│ │ └── my-editor.css
│ └── lang/
│ ├── en.js
│ └── da.js
Check service layer naming:
// Good: Interface + Implementation pattern
public interface IProductService { }
public class ProductService : IProductService { }
public interface IProductRepository { }
public class ProductRepository : IProductRepository { }
// Bad: No interface or inconsistent naming
public class ProductHelper { } // Helper is vague
public class Products { } // Not descriptive
Check model classes:
// Good: Clear purpose
public class ContactFormModel { } // Form model
public class ProductViewModel { } // View model
public class ProductDto { } // Data transfer object
// Bad: Ambiguous
public class Product { } // Is it entity? DTO? ViewModel?
Check appsettings structure:
// Good: Organized by feature
{
"MyApp": {
"Email": {
"SmtpHost": "...",
"FromAddress": "..."
},
"Cache": {
"Duration": "00:05:00"
}
}
}
// Bad: Flat structure
{
"SmtpHost": "...",
"CacheDuration": "..."
}
| Code | Severity | Issue | Detection |
|---|---|---|---|
| CONV-001 | Warning | Document type not PascalCase | snake_case or spaces in alias |
| CONV-002 | Warning | Property alias not camelCase | PascalCase or snake_case |
| CONV-003 | Warning | Template name mismatch | Template doesn't match doc type |
| CONV-004 | Warning | Generic Composer name | Composer without descriptive name |
| CONV-005 | Info | Missing partial underscore | Partial view without _ prefix |
| CONV-006 | Info | Flat configuration | Settings not grouped |
| CONV-007 | Info | Ambiguous model name | Model without suffix |
If ModelsBuilder output exists:
Glob: **/Models/Generated/*.cs
Extract class names
Check PascalCase pattern
Or check content in database/API.
Glob: **/Views/**/*.cshtml
Verify naming matches document types
Check partial views have _ prefix
Glob: **/*Composer*.cs
Grep: : IComposer
Check class names are descriptive
Glob: **/Services/**/*.cs
Glob: **/Repositories/**/*.cs
Verify Interface + Implementation pattern
Glob: **/App_Plugins/*/
Check for umbraco-package.json
Verify folder structure
Read: appsettings.json
Analyze key structure
Check for nesting
## Conventions Analysis
### Summary
- **Document Types**: 15
- **Templates**: 18
- **Composers**: 5
- **Naming Score**: 82%
### Warnings
#### [CONV-001] Document Type Not PascalCase
**Document Types**:
- `blog_post` → should be `BlogPost`
- `product page` → should be `ProductPage`
**Impact**: Inconsistent API responses, confusing code
**Fix**: Update document type aliases in backoffice
#### [CONV-002] Property Alias Not camelCase
**Properties**:
- `PageTitle` → should be `pageTitle`
- `hero_image` → should be `heroImage`
**Locations**: HomePage, BlogPost document types
**Fix**: Update property aliases in backoffice
#### [CONV-004] Generic Composer Name
**File**: `src/Web/Composers/MyComposer.cs`
**Issue**: Name doesn't describe purpose
**Fix**: Rename to describe responsibility:
```csharp
public class EmailServicesComposer : IComposer { }
Files:
Views/Partials/Header.cshtml → _Header.cshtmlViews/Partials/Footer.cshtml → _Footer.cshtml
Fix: Add underscore prefix to partial views| Category | Compliant | Non-Compliant | % |
|---|---|---|---|
| Document Types | 13 | 2 | 87% |
| Property Aliases | 45 | 8 | 85% |
| Templates | 16 | 2 | 89% |
| Composers | 4 | 1 | 80% |
| Services | 8 | 2 | 80% |