feat: Add MLP surrogate with Turbo Mode for 100x faster optimization
Neural Acceleration (MLP Surrogate): - Add run_nn_optimization.py with hybrid FEA/NN workflow - MLP architecture: 4-layer (64->128->128->64) with BatchNorm/Dropout - Three workflow modes: - --all: Sequential export->train->optimize->validate - --hybrid-loop: Iterative Train->NN->Validate->Retrain cycle - --turbo: Aggressive single-best validation (RECOMMENDED) - Turbo mode: 5000 NN trials + 50 FEA validations in ~12 minutes - Separate nn_study.db to avoid overloading dashboard Performance Results (bracket_pareto_3obj study): - NN prediction errors: mass 1-5%, stress 1-4%, stiffness 5-15% - Found minimum mass designs at boundary (angle~30deg, thick~30mm) - 100x speedup vs pure FEA exploration Protocol Operating System: - Add .claude/skills/ with Bootstrap, Cheatsheet, Context Loader - Add docs/protocols/ with operations (OP_01-06) and system (SYS_10-14) - Update SYS_14_NEURAL_ACCELERATION.md with MLP Turbo Mode docs NX Automation: - Add optimization_engine/hooks/ for NX CAD/CAE automation - Add study_wizard.py for guided study creation - Fix FEM mesh update: load idealized part before UpdateFemodel() New Study: - bracket_pareto_3obj: 3-objective Pareto (mass, stress, stiffness) - 167 FEA trials + 5000 NN trials completed - Demonstrates full hybrid workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
331
docs/protocols/extensions/EXT_04_CREATE_SKILL.md
Normal file
331
docs/protocols/extensions/EXT_04_CREATE_SKILL.md
Normal file
@@ -0,0 +1,331 @@
|
||||
# EXT_04: Create New Skill
|
||||
|
||||
<!--
|
||||
PROTOCOL: Create New Skill or Module
|
||||
LAYER: Extensions
|
||||
VERSION: 1.0
|
||||
STATUS: Active
|
||||
LAST_UPDATED: 2025-12-05
|
||||
PRIVILEGE: admin
|
||||
LOAD_WITH: []
|
||||
-->
|
||||
|
||||
## Overview
|
||||
|
||||
This protocol guides you through creating new skills or skill modules for the LLM instruction system. Skills provide task-specific guidance to Claude sessions.
|
||||
|
||||
**Privilege Required**: admin
|
||||
|
||||
---
|
||||
|
||||
## When to Use
|
||||
|
||||
| Trigger | Action |
|
||||
|---------|--------|
|
||||
| Need new LLM capability | Follow this protocol |
|
||||
| "create skill", "new skill" | Follow this protocol |
|
||||
| Task pattern needs documentation | Follow this protocol |
|
||||
|
||||
---
|
||||
|
||||
## Skill Types
|
||||
|
||||
| Type | Location | Purpose | Example |
|
||||
|------|----------|---------|---------|
|
||||
| Bootstrap | `.claude/skills/0X_*.md` | LLM orientation | 00_BOOTSTRAP.md |
|
||||
| Core | `.claude/skills/core/` | Always-load skills | study-creation-core.md |
|
||||
| Module | `.claude/skills/modules/` | Optional, load-on-demand | extractors-catalog.md |
|
||||
| Dev | `.claude/skills/DEV_*.md` | Developer workflows | DEV_DOCUMENTATION.md |
|
||||
|
||||
---
|
||||
|
||||
## Step-by-Step Guide
|
||||
|
||||
### Step 1: Determine Skill Type
|
||||
|
||||
**Bootstrap (0X_)**: System-level LLM guidance
|
||||
- Task classification
|
||||
- Context loading rules
|
||||
- Execution patterns
|
||||
|
||||
**Core**: Essential task skills that are always loaded
|
||||
- Study creation
|
||||
- Run optimization (basic)
|
||||
|
||||
**Module**: Specialized skills loaded on demand
|
||||
- Specific extractors
|
||||
- Domain-specific (Zernike, neural)
|
||||
- Advanced features
|
||||
|
||||
**Dev (DEV_)**: Developer-facing workflows
|
||||
- Documentation maintenance
|
||||
- Testing procedures
|
||||
- Contribution guides
|
||||
|
||||
### Step 2: Create Skill File
|
||||
|
||||
#### For Core/Module Skills
|
||||
|
||||
```markdown
|
||||
# {Skill Name}
|
||||
|
||||
**Version**: 1.0
|
||||
**Purpose**: {One-line description}
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
{What this skill enables Claude to do}
|
||||
|
||||
---
|
||||
|
||||
## When to Load
|
||||
|
||||
This skill should be loaded when:
|
||||
- {Condition 1}
|
||||
- {Condition 2}
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference
|
||||
|
||||
{Tables with key patterns, commands}
|
||||
|
||||
---
|
||||
|
||||
## Detailed Instructions
|
||||
|
||||
### Pattern 1: {Name}
|
||||
|
||||
{Step-by-step instructions}
|
||||
|
||||
**Example**:
|
||||
\`\`\`python
|
||||
{code example}
|
||||
\`\`\`
|
||||
|
||||
### Pattern 2: {Name}
|
||||
|
||||
{Step-by-step instructions}
|
||||
|
||||
---
|
||||
|
||||
## Code Templates
|
||||
|
||||
### Template 1: {Name}
|
||||
|
||||
\`\`\`python
|
||||
{copy-paste ready code}
|
||||
\`\`\`
|
||||
|
||||
---
|
||||
|
||||
## Validation
|
||||
|
||||
Before completing:
|
||||
- [ ] {Check 1}
|
||||
- [ ] {Check 2}
|
||||
|
||||
---
|
||||
|
||||
## Related
|
||||
|
||||
- **Protocol**: [{related}]({path})
|
||||
- **Module**: [{related}]({path})
|
||||
```
|
||||
|
||||
### Step 3: Register Skill
|
||||
|
||||
#### For Bootstrap Skills
|
||||
|
||||
Add to `00_BOOTSTRAP.md` task classification tree.
|
||||
|
||||
#### For Core Skills
|
||||
|
||||
Add to `02_CONTEXT_LOADER.md`:
|
||||
```yaml
|
||||
{TASK_TYPE}:
|
||||
always_load:
|
||||
- core/{skill_name}.md
|
||||
```
|
||||
|
||||
#### For Modules
|
||||
|
||||
Add to `02_CONTEXT_LOADER.md`:
|
||||
```yaml
|
||||
{TASK_TYPE}:
|
||||
load_if:
|
||||
- modules/{skill_name}.md: "{condition}"
|
||||
```
|
||||
|
||||
### Step 4: Update Navigation
|
||||
|
||||
Add to `01_CHEATSHEET.md` if relevant to common tasks.
|
||||
|
||||
### Step 5: Test
|
||||
|
||||
Test with fresh Claude session:
|
||||
1. Start new conversation
|
||||
2. Describe task that should trigger skill
|
||||
3. Verify correct skill is loaded
|
||||
4. Verify skill instructions are followed
|
||||
|
||||
---
|
||||
|
||||
## Skill Design Guidelines
|
||||
|
||||
### Structure
|
||||
|
||||
- **Front-load**: Most important info first
|
||||
- **Tables**: Use for structured data
|
||||
- **Code blocks**: Complete, copy-paste ready
|
||||
- **Checklists**: For validation steps
|
||||
|
||||
### Content
|
||||
|
||||
- **Task-focused**: What should Claude DO?
|
||||
- **Prescriptive**: Clear instructions, not options
|
||||
- **Examples**: Show expected patterns
|
||||
- **Validation**: How to verify success
|
||||
|
||||
### Length Guidelines
|
||||
|
||||
| Skill Type | Target Lines | Rationale |
|
||||
|------------|--------------|-----------|
|
||||
| Bootstrap | 100-200 | Quick orientation |
|
||||
| Core | 500-1000 | Comprehensive task guide |
|
||||
| Module | 150-400 | Focused specialization |
|
||||
|
||||
### Avoid
|
||||
|
||||
- Duplicating protocol content (reference instead)
|
||||
- Vague instructions ("consider" → "do")
|
||||
- Missing examples
|
||||
- Untested code
|
||||
|
||||
---
|
||||
|
||||
## Module vs Protocol
|
||||
|
||||
**Skills** teach Claude HOW to interact:
|
||||
- Conversation patterns
|
||||
- Code templates
|
||||
- Validation steps
|
||||
- User interaction
|
||||
|
||||
**Protocols** document WHAT exists:
|
||||
- Technical specifications
|
||||
- Configuration options
|
||||
- Architecture details
|
||||
- Troubleshooting
|
||||
|
||||
Skills REFERENCE protocols, don't duplicate them.
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
### Example: Domain-Specific Module
|
||||
|
||||
`modules/thermal-optimization.md`:
|
||||
```markdown
|
||||
# Thermal Optimization Module
|
||||
|
||||
**Version**: 1.0
|
||||
**Purpose**: Specialized guidance for thermal FEA optimization
|
||||
|
||||
---
|
||||
|
||||
## When to Load
|
||||
|
||||
Load when:
|
||||
- "thermal", "temperature", "heat" in user request
|
||||
- Optimizing for thermal properties
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Physics | Extractor | Unit |
|
||||
|---------|-----------|------|
|
||||
| Max temp | E11 | K |
|
||||
| Gradient | E12 | K/mm |
|
||||
| Heat flux | E13 | W/m² |
|
||||
|
||||
---
|
||||
|
||||
## Objective Patterns
|
||||
|
||||
### Minimize Max Temperature
|
||||
|
||||
\`\`\`python
|
||||
from optimization_engine.extractors import extract_temperature
|
||||
|
||||
def objective(trial):
|
||||
# ... run simulation ...
|
||||
temp_result = extract_temperature(op2_file)
|
||||
return temp_result['max_temperature']
|
||||
\`\`\`
|
||||
|
||||
### Minimize Thermal Gradient
|
||||
|
||||
\`\`\`python
|
||||
from optimization_engine.extractors import extract_thermal_gradient
|
||||
|
||||
def objective(trial):
|
||||
# ... run simulation ...
|
||||
grad_result = extract_thermal_gradient(op2_file)
|
||||
return grad_result['max_gradient']
|
||||
\`\`\`
|
||||
|
||||
---
|
||||
|
||||
## Configuration Example
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"objectives": [
|
||||
{
|
||||
"name": "max_temperature",
|
||||
"type": "minimize",
|
||||
"unit": "K",
|
||||
"description": "Maximum temperature in component"
|
||||
}
|
||||
]
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
---
|
||||
|
||||
## Related
|
||||
|
||||
- **Extractors**: E11, E12, E13 in SYS_12
|
||||
- **Protocol**: See OP_01 for study creation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Issue | Cause | Solution |
|
||||
|-------|-------|----------|
|
||||
| Skill not loaded | Not in context loader | Add loading rule |
|
||||
| Wrong skill loaded | Ambiguous triggers | Refine conditions |
|
||||
| Instructions not followed | Too vague | Make prescriptive |
|
||||
|
||||
---
|
||||
|
||||
## Cross-References
|
||||
|
||||
- **Context Loader**: `.claude/skills/02_CONTEXT_LOADER.md`
|
||||
- **Bootstrap**: `.claude/skills/00_BOOTSTRAP.md`
|
||||
- **Related**: [EXT_03_CREATE_PROTOCOL](./EXT_03_CREATE_PROTOCOL.md)
|
||||
|
||||
---
|
||||
|
||||
## Version History
|
||||
|
||||
| Version | Date | Changes |
|
||||
|---------|------|---------|
|
||||
| 1.0 | 2025-12-05 | Initial release |
|
||||
Reference in New Issue
Block a user