# Optimize a skill using best practices

The [previous section](https://docs.tessl.io/evaluate/evaluating-skills) discussed how skill reviews are scored and presented. In this section, let us learn how to auto-generate improvements for those agent skills based on best practices!

## TL;DR

The [Review](https://docs.tessl.io/evaluate/evaluating-skills) capability of Tessl also can suggest fixes and implement them if you accept them. See [example](#example) below.

## Prerequisites

* Tessl [installed](https://docs.tessl.io/introduction-to-tessl/installation)
* Either one of:
  * `tessl whoami` reports being logged in via `tessl login`
  * `TESSL_TOKEN` api key set in the environment
* `SKILL.md` file(s) available locally

## Usage

Perform a review and automatically generate improvements for your skill:

```bash
tessl skill review --optimize ./<path to SKILL.md folder>
```

* Runs `tessl skill review` to score your skill
* The option `--optimize` automatically makes the suggested changes and re-runs the review
  * Runs in a loop until the skill scores 100% or a set number of iterations has passed
  * Prompts the user to accept automated edits to `SKILL.md`, unless overridden.

### Additional flags

* Use the `--max-iterations` flag to configure the max number of improvement loops - this defaults to 3 and can be set to a maximum of 10.
* Use the `--yes` (or `-y`) flag to skip the confirmation prompt and auto-apply the suggested changes:

```bash
tessl skill review --optimize --yes ./<path to SKILL.md folder>
```

*This is useful for CI pipelines or batch workflows where you want to apply improvements without manual confirmation.*

### **Example**

```
$ tessl skill review --optimize ./arduinoskill
: Reviewing and improving skill (this can take up to 1 minute)...
```

A summary of changes will be provided, alongside the improvement score, such as:

{% code overflow="wrap" %}

```
+## Best Practices
+
+- **Use meaningful variable names**: 'ledPin' instead of 'p1'
+- **Add comments**: Explain non-obvious logic for future reference +- **Avoid blocking code**: Don't use long 'delay()'
calls in loops; use millis() instead
+- **Test incrementally**: Upload and verify each feature before adding the next +-**Check library documentation**: Many sensors have example code in their Arduino libraries

Summary of Changes

Removed the introductory sentence "This skill helps you create functional Arduino sketches..." to start directly with the workflow, improving conciseness. Trimmed inline code comments that explain obvious Arduino concepts (e.g., "// Initialize serial communication" after Serial.begin()). Retained the Board Reference table and Best Practices section inline to preserve actionability and reference value, as they are concise and frequently needed during sketch development. These changes address the verbosity feedback while maintaining the skill's high actionability and workflow clarity scores.

Score: 33% → 96% (+63%) after 3 iterations
```

{% endcode %}

You will be prompted to accept the changes, unless you have used the additional option to automatically do so.

## How to integrate it into your workflow

1. Search for a skill or create your own.
2. Download the skill locally.
3. Use the Tessl CLI to review and optionally ask it to fix it via the **--optimize** option.
4. Convert to a Tessl tile by [importing](https://docs.tessl.io/distribute/promote-or-claim-a-skill-you-have-created#create-a-tile.json) it, if it is not already in a Tessl tile.
5. Optionally, consider running [scenario based evaluations](https://docs.tessl.io/evaluate/evaluate-skill-quality-using-scenarios).
6. Publish to your [workspace](https://docs.tessl.io/reference/workspaces) to share the skill tile. Create a workspace if it does not exist yet.
