Generate project-specific skill files and custom commands based on extracted patterns.
Generates project-specific skill files and custom commands based on extracted patterns.
/plugin marketplace add twofoldtech-dakota/claude-marketplace/plugin install twofoldtech-dakota-xm-cloud-analyzer-plugins-xm-cloud-analyzer@twofoldtech-dakota/claude-marketplaceGenerate project-specific skill files and custom commands based on extracted patterns.
Name: skill-generator
Tools: Read, Write, Glob
Input: Pattern data from pattern-extractor agent
Output: Skill files in .claude/project-skills/
Output: .claude/project-skills/project-patterns/SKILL.md
Template:
---
name: project-patterns
description: Patterns specific to this {ProjectName} XM Cloud project
globs:
- "**/*.tsx"
- "**/*.ts"
- "**/*.graphql"
---
# {ProjectName} - Project Patterns
## Component Pattern
This project uses the following JSS component pattern:
### HOC Usage
{HOCPattern or "Direct component export"}
### Props Convention
{PropsConvention}
### Field Components
{FieldComponentsList}
### Example
```tsx
{SanitizedComponentExample}
{HookPatternDescription}
{CustomHooksList}
{DataHooksList}
{SanitizedHookExample}
{DataFetchingDescription}
{PrimaryApproach}
{RevalidationStrategy}
{GraphQLPatternDescription}
{QueryNamingConvention}
{FragmentStrategy}
{SanitizedQueryExample}
{StylingApproach}
### 2. Architecture Guide Skill
**Output**: `.claude/project-skills/architecture-guide/SKILL.md`
**Template**:
```markdown
---
name: architecture-guide
description: Architecture and structure guide for {ProjectName}
globs:
- "**/src/**/*"
- "**/pages/**/*"
- "**/app/**/*"
---
# {ProjectName} Architecture Guide
## Next.js Structure
This project uses {AppRouter | PagesRouter | Hybrid}.
### Directory Layout
{DirectoryStructure}
## Component Organization
### Location
{ComponentLocation}
### Naming Convention
{ComponentNaming}
### File Structure
{ComponentFileStructure}
## Adding New Components
### 1. Create Component File
```bash
# Create component in {ComponentPath}
touch src/components/{ComponentName}/{ComponentName}.tsx
Based on detected pattern:
{ComponentTemplate}
Add to component factory at {FactoryLocation}:
{FactoryRegistration}
{RenderingInstructions}
touch src/graphql/queries/{QueryName}.graphql
{QueryTemplate}
{TypeGenerationCommand}
{StaticPagePattern}
{DynamicPagePattern}
{ClientSidePattern}
{RequiredEnvVars}
{LocalDevSetup}
### 3. Project Vocabulary
**Output**: `.claude/project-skills/vocabulary.md`
**Template**:
```markdown
# {ProjectName} Vocabulary
## Domain Terms
| Term | Meaning | Usage |
|------|---------|-------|
{DomainTermsTable}
## JSS/XM Cloud Terms
| Term | Meaning | Context |
|------|---------|---------|
{JSSTermsTable}
## GraphQL Types
| Type | Purpose | Fields |
|------|---------|--------|
{GraphQLTypesTable}
## Component Names
| Component | Purpose | Location |
|-----------|---------|----------|
{ComponentsTable}
## Naming Conventions
### Components
{ComponentNamingConventions}
### Hooks
{HookNamingConventions}
### GraphQL
{GraphQLNamingConventions}
### Files
{FileNamingConventions}
Output: .claude/project-skills/commands/
# /project:build
Build the Next.js application.
## Command
```bash
{DetectedBuildCommand}
{BuildOptions}
#### /project:dev
```markdown
# /project:dev
Start development server.
## Command
```bash
{DevCommand}
{ConnectedModeInstructions}
{DisconnectedModeInstructions}
#### /project:new-component
```markdown
# /project:new-component [name]
Scaffold a new JSS component.
## Steps
1. Create component file at `src/components/{name}/{name}.tsx`
2. Create props interface
3. Add withDatasourceCheck wrapper
4. Register in component factory
5. Create Sitecore rendering item
## Generated Files
{GeneratedFilesList}
## Template Used
{ComponentTemplate}
def generate_skills(patterns, project_info):
# 1. Generate project-patterns SKILL
project_patterns = build_project_patterns_skill(
components=patterns.components,
hooks=patterns.hooks,
dataFetching=patterns.dataFetching,
graphql=patterns.graphql,
styling=patterns.styling
)
# 2. Generate architecture guide
architecture_guide = build_architecture_skill(
nextjs_version=project_info.nextVersion,
router_type=project_info.routerType,
component_structure=project_info.componentStructure,
graphql_setup=project_info.graphqlSetup
)
# 3. Generate vocabulary
vocabulary = build_vocabulary(
component_names=patterns.componentNames,
graphql_types=patterns.graphqlTypes,
domain_terms=extract_domain_terms(patterns)
)
# 4. Generate custom commands
commands = build_custom_commands(
package_json=project_info.packageJson,
deployment=project_info.deployment
)
return {
'project_patterns': project_patterns,
'architecture_guide': architecture_guide,
'vocabulary': vocabulary,
'commands': commands
}
Before writing files, validate:
{API_KEY}{ENDPOINT}Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences