Extract project-specific patterns from Sitecore 10.x codebases to generate AI-enhancing skills.
Extracts project-specific coding patterns from Sitecore 10.x codebases to generate AI-enhancing skills.
/plugin marketplace add twofoldtech-dakota/claude-marketplace/plugin install twofoldtech-dakota-sitecore-classic-analyzer-plugins-sitecore-classic-analyzer@twofoldtech-dakota/claude-marketplaceExtract project-specific patterns from Sitecore 10.x codebases to generate AI-enhancing skills.
Name: pattern-extractor
Tools: Read, Glob, Grep
Purpose: Detect and document coding patterns specific to this project
Detection Strategy:
1. Find all classes ending in "Service"
2. Identify base classes and interfaces
3. Detect constructor injection patterns
4. Analyze method signatures and return types
5. Check for caching decorators
Files to Scan:
**/Services/**/*.cs**/Foundation/**/code/**/*Service.cs**/Feature/**/code/**/*Service.csPatterns to Extract:
| Pattern | Detection | Example |
|---|---|---|
| Base service class | class.*Service.*:.*ServiceBase | NavigationService : ServiceBase<INavigationService> |
| Interface convention | I{Name}Service paired with {Name}Service | ISearchService / SearchService |
| Constructor injection | Constructor with ILogger, IConfiguration, etc. | DI pattern usage |
| Async patterns | Methods returning Task<T> | Async service methods |
Output Format:
servicePatterns:
baseClass: "ServiceBase<T>"
interfaceConvention: "I{Name}Service"
registration: "Scoped"
commonDependencies:
- ILogger<T>
- ISitecoreContext
- IContentSearchService
examples:
- name: NavigationService
file: src/Feature/Navigation/code/Services/NavigationService.cs
Detection Strategy:
1. Find classes with "Repository" in name
2. Identify generic repository patterns
3. Detect caching strategies
4. Analyze query patterns (Content Search vs direct)
Files to Scan:
**/Repositories/**/*.cs**/*Repository.csPatterns to Extract:
| Pattern | Detection | Example |
|---|---|---|
| Generic repository | IRepository<T> | IRepository<Article> |
| Caching decorator | Cached*Repository | CachedArticleRepository |
| Content Search usage | ContentSearchManager.GetIndex | Search-based queries |
| Glass Mapper integration | ISitecoreContext, IGlassHtml | ORM patterns |
Detection Strategy:
1. Find classes inheriting from Controller
2. Identify rendering controller base classes
3. Analyze action method patterns
4. Detect model binding conventions
Files to Scan:
**/Controllers/**/*.cs**/*Controller.csPatterns to Extract:
| Pattern | Detection | Example |
|---|---|---|
| Base controller | Custom base class inheritance | RenderingController |
| Action naming | Method naming conventions | Index, Get{Resource} |
| Model binding | [FromRoute], [FromQuery] usage | Parameter binding |
| Error handling | Try/catch patterns in actions | Exception handling |
Detection Strategy:
1. Find classes inheriting from processor base classes
2. Identify pipeline registration patterns
3. Detect processor ordering
Files to Scan:
**/Pipelines/**/*.cs**/*Processor.csPatterns to Extract:
| Pattern | Detection | Example |
|---|---|---|
| HTTP pipeline | : HttpRequestProcessor | Request processors |
| Item pipeline | : ItemProcessor | Item event processors |
| Custom pipeline | Custom pipeline definitions | Domain-specific pipelines |
Detection Strategy:
1. Analyze App_Config/Include structure
2. Identify naming conventions for patch files
3. Detect environment-specific configurations
4. Find role-based configurations
Files to Scan:
**/App_Config/Include/**/*.config**/*.module.jsonPatterns to Extract:
| Pattern | Detection | Example |
|---|---|---|
| Patch naming | File naming convention | Feature.Navigation.config |
| Layer organization | Folder structure | /Foundation/, /Feature/, /Project/ |
| Environment configs | env:require attributes | Production-specific settings |
| Role configs | role:require attributes | CM/CD specific settings |
Detection Strategy:
1. Find IServicesConfigurator implementations
2. Analyze service registration patterns
3. Detect lifetime choices (Transient, Scoped, Singleton)
Files to Scan:
**/*Configurator.cs**/DependencyInjection/**/*.cs**/RegisterDependencies.csOutput Format:
diPatterns:
configuratorBase: "IServicesConfigurator"
registrationFile: "RegisterDependencies.cs"
lifetimeDefaults:
services: "Scoped"
repositories: "Scoped"
factories: "Transient"
conventions:
- "services.AddTransient<I{Name}, {Name}>();"
# The agent executes these steps:
1. Glob for pattern-specific files
2. Read and analyze file contents
3. Extract pattern metadata
4. Build pattern documentation
5. Return structured pattern data
{
"patterns": {
"services": [...],
"repositories": [...],
"controllers": [...],
"pipelines": [...],
"configuration": [...],
"dependencyInjection": [...]
},
"statistics": {
"totalPatternsFound": 45,
"servicesAnalyzed": 12,
"controllersAnalyzed": 15,
"configFilesAnalyzed": 28
},
"examples": [
{
"pattern": "ServiceBase<T>",
"file": "src/Feature/Navigation/code/Services/NavigationService.cs",
"snippet": "..." // Sanitized
}
]
}
.claudeignore