trainer-train-code

Orchestrates optimization loops for Python code targets using Microsoft Trace and test-based feedback.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Tyler-R-Kendrick/copilot-auto-training --skill trainer-train-code-tyler-r-kendrick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trainer-train-code
Source: https://github.com/Tyler-R-Kendrick/copilot-auto-training/tree/main/skills/trainer-train-code
Command: npx skills add https://github.com/Tyler-R-Kendrick/copilot-auto-training --skill trainer-train-code-tyler-r-kendrick

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires trace-opt, and includes references (resource) and assets (resource) components.

What problem does it solve? Optimizing Python code with Microsoft Trace requires a disciplined loop: identifying the right trainable surface, securing a deterministic feedback signal, running optimization passes, and validating candidates before write-back. This Skill provides the orchestration contract for that entire loop so code targets are improved through repeatable, test-based feedback rather than ad-hoc edits. ## Core Features & Use Cases - Trainable Surface Selection: Guides the choice between trace.node, @trace.bundle, and @trace.model so only the smallest meaningful code boundary is optimized. - Feedback Signal Discipline: Enforces deterministic, rerunnable feedback (pytest suites, benchmarks, evaluators) and treats missing signals as hard blockers. - Workspace & Write-Back Governance: Initializes .trainer-workspace/ state, requires an engineering review checkpoint, and gates write-back on test pass, import hygiene, and a decision summary. - Use Case: You want to improve scripts/optimize_support.py with Trace. The skill derives the workspace, confirms pytest as the feedback signal, marks a formatting function as a @trace.bundle(trainable=True) candidate, runs optimization, and writes back only after the suite passes. ## Quick Start Ask the agent to set up the trainer loop for your Python file, naming the repository root and the test command used as the feedback signal.

Frequently Asked Questions about trainer-train-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a Python function with Microsoft Trace?

Identify the smallest trainable surface, then apply `@trace.bundle(trainable=True)` for a callable optimized as a unit or `trace.node(trainable=True)` for mutable values like prompts and thresholds. Provide a deterministic feedback command such as pytest so the optimizer receives repeatable signals.

When should I use trace.node vs @trace.bundle vs @trace.model?

Use `trace.node(trainable=True)` for mutable values like prompts, thresholds, and templates. Use `@trace.bundle(trainable=True)` for callables optimized as a unit, such as formatters or classifiers. Use `@trace.model` when several trainable nodes and bundles belong to one coherent object.

What judge mode should code optimization targets use?

Code targets default to `custom` scoring because executable feedback like test pass/fail is authoritative. An explicit row-level `scoring` declaration overrides this default, and `llm_judge` is only a secondary signal when tests show what failed but not how to improve.

What happens if my code target has no test suite or benchmark?

The loop treats a missing feedback signal as a blocker and stops optimization. Microsoft Trace requires deterministic, rerunnable feedback, so you must first create a test suite, benchmark script, or deterministic evaluator before the loop can proceed.

What validation is required before writing back an optimized candidate?

Write-back requires the test suite to pass, Trace imports to remain explicit and local to the trainable surface, no hidden dependencies added, the feedback signal still deterministically rerunnable, and a written decision summary at the workspace root.

Can this skill optimize prompts, skill files, or agent contracts?

No. This skill is scoped to Python code targets only. For prompt-only targets, skill files, or agent contracts, the parent trainer skill's target-routing reference identifies the appropriate specialist loop instead.