Module 46

AI Optimization Tricks

Last updated 2026-06-02

Key points

Lesson 1: What is AI Optimization Tricks and why it matters

AI optimization tricks are practical techniques to make AI models faster, cheaper, and more reliable while improving their output. One key trick is the PIV loop (Plan, Implement, Validate cycle). You plan what you want, delegate implementation to the AI, then validate the results. Each loop makes your AI smarter and your code better, turning AI coding from a gamble into a predictable system.

Another essential optimization is separating decisions from execution. Instead of rewriting instructions daily, you compose reusable skills and commands into repeatable workflows. Think of it as a recipe (the fixed instructions) plus a chef (the AI that follows them). This shift, often expressed in structured YAML (a human-readable data format), stops you from reinventing the process every time.

The harness (a framework of repeatable steps) combines deterministic precision steps with creative AI steps and loops that iterate until tests pass. This systematic approach matters because AI-generated code frequently contains security vulnerabilities—reports show 48% of such code has flaws. You must treat AI output like code from a junior developer: review it carefully, test thoroughly, and never assume correctness.

Finally, the bubble metaphor illustrates why optimization matters: as AI improves, the bubble of reliable tasks expands, but the boundary where humans must operate also grows. Optimization keeps you working at that boundary effectively, identifying bottlenecks and validating results rather than blindly accepting AI output.

Sources

Lesson 2: How to use AI Optimization Tricks: step-by-step

To use AI optimization tricks effectively, start with the PIV loop (Plan, Implement, Validate). You handle planning and validation; let the AI handle implementation. Each cycle improves your code and workflow. For example, clearly state your goal and tools, then let the AI build it, and check the results.

Next, treat your instructions as code. Write them in markdown (a plain text formatting syntax). Andrej Karpathy advises treating these markdown files as tunable code, not static documentation. You iterate on them: run different versions, see which performs better, and let the AI improve its own instructions. This separates decisions from execution, like a recipe (the markdown YAML) and a chef (the AI model).

For teams, one person can create an AI agent skill and turn it into a skill (an automation that runs scripts or calls APIs). That skill becomes a standard operating procedure your whole team can reuse. Share what you build casually with teammates, document time saved, and show the benefits. Pick one workflow nobody has touched yet, build the AI version, and demonstrate it. This plants seeds for broader adoption.

To save time, set up autonomous workflows. Remove yourself as a bottleneck by arranging agents to run independently; you only occasionally input a few tokens. For complex tasks, consider using agent teams or fast mode. The key is developing a rhythm for assigning work and reviewing outputs, recognizing when to parallelize or sequence tasks.

Sources

Lesson 3: Best practices and pitfalls

The biggest mistake beginners make is treating AI like a magic one-shot machine. Instead, use the PIV loop (Plan, Implement, Validate). You own planning and validation; delegate implementation to the AI. For every task, ask yourself how AI could do at least 30% of it. Even 50% or 75% is a huge productivity gain.

A common pitfall is repeating instructions because you don't trust first-pass accuracy. Stop doing that. Instead, tell the AI not to move to the next to-do until it's 95% confident the current one is good. This forces it to one-shot closer to the mark rather than producing mediocre work.

When saving work, do not save your plan alongside your execution in the same conversation. Clear your history, start fresh, and reference your plan as a separate file. Your plan should include goals, success criteria, documentation references, a task list, a validation strategy, and desired code structure. The more explicit you are, the fewer mistakes the AI makes.

For teams, treat agent instructions as tunable code. Your markdown files are not static documentation — they are code that controls behavior. Optimize them like software. Also, avoid being the bottleneck. Arrange workflows so agents run autonomously, only stepping in occasionally with very few tokens while huge amounts of work happen on your behalf. Share what you build casually with your team by saying, "Hey, look what I built this weekend." Plant those seeds before the company mandates an AI strategy.

Sources