ln-751-command-templates
L3 Worker - Generates individual .claude/commands files from templates
Worker Workflow
stateDiagram-v2
[*] --> Receive: From ln-750
state Receive {
[*] --> ParseInput
ParseInput --> ValidateVars
ValidateVars --> [*]
ParseInput: Template name + Variables
ValidateVars: Check required variables
}
Receive --> Generate: Input Valid
state Generate {
[*] --> LoadTemplate
LoadTemplate --> Substitute
Substitute --> WriteFile
WriteFile --> [*]
LoadTemplate: Read references/*.md
Substitute: Replace {{VAR}}
WriteFile: .claude/commands/*.md
}
Generate --> Report: Success
Generate --> Error: Failed
Report --> [*]: Return to Coordinator
Error --> [*]: Return Error
Template Processing
flowchart LR
subgraph Input["Input from ln-750"]
TN[Template Name]
Vars[Variables Map]
end
subgraph Process["Template Processing"]
Load[Load Template]
Parse["Find {{VAR}}"]
Replace[Substitute Values]
end
subgraph Output["Output"]
File[".claude/commands/*.md"]
end
TN --> Load
Load --> Parse
Vars --> Replace
Parse --> Replace
Replace --> File
classDef input fill:#FFD700
classDef process fill:#90EE90
classDef output fill:#E6E6FA
class TN,Vars input
class Load,Parse,Replace process
class File output
Available Templates
flowchart TD
subgraph Core["Core Templates (Always Generated)"]
T1[refresh_context_template.md]
T2[refresh_infrastructure_template.md]
T3[build_and_test_template.md]
end
subgraph Optional["Optional Templates (Conditional)"]
T4[ui_testing_template.md]
T5[deploy_template.md]
T6[database_ops_template.md]
end
T1 --> O1[refresh_context.md]
T2 --> O2[refresh_infrastructure.md]
T3 --> O3[build-and-test.md]
T4 --> O4[ui-testing.md]
T5 --> O5[deploy.md]
T6 --> O6[database-ops.md]
classDef core fill:#90EE90
classDef optional fill:#E6E6FA
classDef output fill:#FFF8DC
class T1,T2,T3 core
class T4,T5,T6 optional
class O1,O2,O3,O4,O5,O6 output
Variable Substitution
flowchart TD
Template["Template Content"] --> Scanner["Scan for {{...}}"]
Scanner --> Found{Found Variables?}
Found -->|Yes| Lookup["Lookup in Variables Map"]
Found -->|No| Done["Output = Input"]
Lookup --> Exists{Variable Exists?}
Exists -->|Yes| Replace["Replace with Value"]
Exists -->|No| Default["Use Default or Error"]
Replace --> More{More Variables?}
Default --> More
More -->|Yes| Scanner
More -->|No| Done
Done --> Write["Write to .claude/commands/"]
classDef decision fill:#FFB6C1
classDef action fill:#90EE90
class Found,Exists,More decision
class Scanner,Lookup,Replace,Default,Write action