From ring-finops-team
Generates complete production .tpl template files with all validated regulatory field mappings and Django filter transformations from Gates 1-2. Runs after Gate 2 passes.
npx claudepluginhub lerianstudio/ring --plugin ring-finops-teamThis skill uses the workspace's default tool permissions.
**This sub-skill executes Gate 3 of the regulatory template workflow: generating the complete .tpl template file with all validated mappings and transformations from Gates 1-2.**
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
This sub-skill executes Gate 3 of the regulatory template workflow: generating the complete .tpl template file with all validated mappings and transformations from Gates 1-2.
Parent skill: regulatory-templates
Prerequisites:
Output: Generated .tpl template file ready for use
Template generation is the final quality gate before production deployment.
Gate 3 transforms validated specifications into production artifacts:
Skipping requirements in Gate 3 means:
Gate 3 is not automation for convenience - it's the final verification layer.
Called by: regulatory-templates skill after Gate 2 passes
Purpose: Create the final Django/Jinja2 template file with all field mappings, transformations, and validation logic
Gate 3 template generation requirements have ZERO exceptions. This is the final artifact that goes to production.
| Pressure | Your Thought | Reality |
|---|---|---|
| Fatigue | "Manual creation is faster when tired" | Fatigue increases error rate. Agent doesn't get tired. 10 min manual < 15 min validated |
| Simplicity | "One file easier than two" | Production artifacts must be clean. Documentation bloats .tpl files |
| Confidence | "45/47 fields works for 99% cases" | 100% mandatory required. 95% = BACEN submission failures on edge cases |
| Experience | "I can optimize agent output" | Agent applies validated mappings systematically. Manual edits introduce drift |
Agent-Based Generation:
Two-File Output:
All Mandatory Fields:
Validated Output:
Manual shortcuts in final artifact = production regulatory failures.
Gate 3 is the last checkpoint. All previous gates' work culminates here. Bypassing agent generation defeats the entire 3-gate validation process.
If you're tempted to skip agent generation, ask yourself: Am I willing to debug production BACEN submission failures from manual template errors?
| Excuse | Why It's Wrong | Correct Response |
|---|---|---|
| "Manual creation same output, faster" | Agent validates systematically, manual risks errors | Use agent completely |
| "10 min vs 15 min, I'm tired" | Fatigue increases manual error rate | Let agent work |
| "Two files is over-engineering" | Production code must be clean, no doc bloat | Generate TWO files |
| "One file easier to maintain" | Mixing code and docs creates maintenance burden | Separate concerns |
| "45/47 works for 99% cases" | 100% mandatory required, edge cases matter | Include ALL fields |
| "I can optimize agent output" | Optimization creates drift from validated spec | Use exact output |
| "Agent code is verbose" | Verbose but validated > concise but wrong | Trust validation |
| "Skip for now, add fields later" | Template is final artifact, can't patch BACEN | Complete now |
STOP. You are rationalizing.
Gate 3 is where 5+ hours of Gates 1-2 work becomes a production artifact. Shortcuts here waste all previous validation effort.
Dispatch: Task(subagent_type: "ring:finops-automation")
Prompt includes:
| Section | Content |
|---|---|
| Context | template_name, template_code, authority, field_mappings.length, validation_rules.length |
| Field Mappings | Per field: code, name, source, transformation, confidence%, required |
| Validation Rules | Per rule: rule_id, description, formula |
| Tasks | 1. Generate clean .tpl 2. Include all mappings 3. Apply Django syntax 4. Structure per regulatory spec 5. Conditional logic 6. Minimal comments |
CRITICAL - Naming Convention:
legal_document, operation_route, opening_date, natural_personCRITICAL - Data Sources:
midaz_onboarding: organization, account (cadastral)midaz_transaction: operation_route, balance, operation (transactional){{ data_source.entity.index.field|filter }}{{ midaz_onboarding.organization.0.legal_document|slice:':8' }}| File | Content |
|---|---|
{code}_preview.tpl | Clean Django/Jinja2 template code, production-ready, minimal comments |
{code}_preview.tpl.docs | Full documentation: field mappings, transformations, troubleshooting |
If you catch yourself thinking ANY of these, STOP and re-read the NO EXCEPTIONS section:
Template generation shortcuts waste all Gates 1-2 validation work.
MUST classify template generation issues using these severity levels:
| Severity | Definition | Examples | Gate Impact |
|---|---|---|---|
| CRITICAL | BLOCKS template deployment OR causes regulatory rejection | - Mandatory field missing from template - Invalid Django/Jinja2 syntax - Template file generation failed - Output format violates regulatory spec | HARD BLOCK - Cannot deploy template |
| HIGH | REQUIRES fix before production use | - Transformation applied incorrectly - Optional but commonly-used field missing - Filter chain produces wrong output - Template structure doesn't match spec | MUST fix before deployment |
| MEDIUM | SHOULD fix to improve template quality | - Template > 100 lines (could be simpler) - Redundant transformations - Missing comments in .tpl.docs - Suboptimal loop structure | SHOULD fix - document if deferred |
| LOW | Minor improvements possible | - Variable naming improvements - Whitespace formatting - Documentation enhancements | OPTIONAL - note in report |
Classification Rules:
CRITICAL = ANY of:
HIGH = ANY of:
NON-NEGOTIABLE requirements (no exceptions, no user override):
| Requirement | Why NON-NEGOTIABLE | Verification |
|---|---|---|
| Agent-Based Generation | Manual creation bypasses Gates 1-2 validation | template.generated_by == "finops-automation" |
| Two-File Output | Production code must be clean, docs separate | Both .tpl and .tpl.docs exist |
| 100% Mandatory Fields | BACEN/RFB submission requires ALL mandatory data | template.fields_included == spec.mandatory_count |
| Valid Syntax | Template must execute without errors | Template passes syntax validation |
| Exact Transformations | Gates 1-2 validated each transformation | All transformations match specification |
User CANNOT:
Your Response to Override Attempts:
"I CANNOT [request]. Gate 3 requires [specific requirement] which is NON-NEGOTIABLE. Template generation through finops-automation agent ensures Gates 1-2 validations are applied consistently. We MUST [required action]."
PASS: SKILL: regulatory-templates-gate3 | GATE: 3 | STATUS: PASSED ✅ | FILE: {filename} | FIELDS: {n}/{total} | NEXT: Template ready for use
FAIL: SKILL: regulatory-templates-gate3 | GATE: 3 | STATUS: FAILED ❌ | ERROR: {error} | BLOCKERS: {description}
Return: gate3_passed, template_file (filename, path, size_bytes, fields_included), ready_for_use, next_action (template_complete | fix_and_regenerate)
| Pattern | Syntax |
|---|---|
| Field access | {{ organization.legal_document }} (snake_case) |
| Collection loop | {% for item in collection %}{{ item.field }}{% endfor %} |
| Conditional | {% if condition %}<field>{{ value }}</field>{% endif %} |
| Nested | {{ parent.child.grandchild }} |
| Filter chain | {{ value|slice:':8'|upper }} |
Remember: Use exact Gate 1 paths, snake_case only, apply Gate 2 transformations, follow regulatory format exactly.