# Self Fix Loop

> >

- **Type:** Skill
- **Install:** `agentstack add skill-d-oit-rust-2026-template-self-fix-loop`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [d-oit](https://agentstack.voostack.com/s/d-oit)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [d-oit](https://github.com/d-oit)
- **Source:** https://github.com/d-oit/rust-2026-template/tree/main/.agents/skills/self-fix-loop
- **Website:** https://d-oit.github.io/rust-2026-template/

## Install

```sh
agentstack add skill-d-oit-rust-2026-template-self-fix-loop
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Self-Fix Loop Skill

## When to Use

- User asks for this skill's functionality

Automated self-learning cycle: **commit → push → monitor → analyze failures → fix → retry** until all CI checks pass.

**Self-Fix Threshold**: If 2+ similar errors occur during the loop, pause and diagnose the root cause before attempting another fix.

## Overview

Continuous improvement loop that:
1. Commits all changes atomically
2. Pushes to feature branch
3. Creates/updates PR/MR
4. Monitors CI (GitHub Actions or GitLab CI)
5. On failure: diagnoses and fixes
6. Repeats until ALL checks pass

## Platform Detection

Auto-detect from git remote:

```bash
REMOTE=$(git remote get-url origin)
if echo "$REMOTE" | grep -qi "github"; then
  PLATFORM="github"; CLI="gh"
elif echo "$REMOTE" | grep -qi "gitlab"; then
  PLATFORM="gitlab"; CLI="glab"
fi
```

## CLI Command Mapping

| Action | GitHub (`gh`) | GitLab (`glab`) |
|--------|---------------|-----------------|
| Check CI | `gh pr checks` | `glab ci status` |
| Create PR/MR | `gh pr create` | `glab mr create` |
| View logs | `gh run view --log-failed` | `glab ci view` |

## Arguments

| Argument | Description | Default |
|----------|-------------|---------|
| `--max-retries N` | Maximum fix iterations | 5 |
| `--platform github\|gitlab` | Force platform | auto-detect |
| `--auto-research` | Use web research on failures | true |
| `--fix-issues` | Attempt automatic fixes | true |
| `--strict-validation` | ALL checks must pass | true |
| `--timeout SECONDS` | Per-iteration timeout | 1800 |
| `--dry-run` | Simulate without pushing | false |

## Loop Phases

```
[Start]
   ↓
Phase 1: COMMIT & PUSH
   - Stage all changes
   - Run quality gate
   - Atomic commit
   - Push to feature branch
   ↓
Phase 2: CREATE/UPDATE PR/MR
   - Create new PR/MR or update existing
   ↓
Phase 3: MONITOR CI
   - Poll GitHub Actions / GitLab CI
   - Wait for all checks complete
   ↓
Phase 4: ANALYZE FAILURES
   - Identify failed checks
   - Extract error messages
   - Categorize failure type
   ↓
Phase 5: FIX (if failures)
   - Diagnose root cause
   - Apply fixes
   - Commit fix
   ↓
Phase 6: RETRY LOOP
   - If retries remaining → Phase 1
   - If max retries → FAIL
   - If all pass → SUCCESS
```

## Rust Failure Types

| Failure Type | Action |
|--------------|--------|
| `cargo fmt` | Run `cargo fmt --all` |
| `cargo clippy` | Fix warnings, respect `-D warnings` |
| `cargo test` | Debug test failures, fix or skip flaky |
| `cargo audit` | Update vulnerable dependency |
| `cargo deny` | Fix license or advisory violations |
| `cargo machete` | Remove unused dependencies |
| Linker errors | Check `build-essential`, `pkg-config` |

## Rationalizations

| Rationalization | Reality |
|-----------------|---------|
| "The loop is stuck, I'll just force merge" | Force merging defeats the purpose of CI and introduces regressions. |
| "One more retry should fix it" | Repeated identical failures indicate a root cause, not a flaky test. |
| "I'll disable strict validation to pass faster" | Strict validation catches issues early; disabling it pushes bugs to production. |

## Red Flags

- [ ] Exceeding max retries without diagnosing root cause
- [ ] Disabling strict validation to bypass failing checks
- [ ] Force merging when the self-fix loop reports failure

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [d-oit](https://github.com/d-oit)
- **Source:** [d-oit/rust-2026-template](https://github.com/d-oit/rust-2026-template)
- **License:** MIT
- **Homepage:** https://d-oit.github.io/rust-2026-template/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-d-oit-rust-2026-template-self-fix-loop
- Seller: https://agentstack.voostack.com/s/d-oit
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
