# Code Quality

> Maintain high code quality through formatting, linting, static analysis, and clean code principles. Use for rustfmt, clippy, cargo audit, code reviews, refactoring, and quality gates.

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

## Install

```sh
agentstack add skill-d-o-hub-rust-self-learning-memory-code-quality
```

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

## About

# Code Quality

Unified skill for Rust code quality and clean code development.

## Quick Commands

```bash
./scripts/code-quality.sh fmt                    # Format check
./scripts/code-quality.sh clippy --workspace     # Lint with clippy
./scripts/code-quality.sh audit                  # Security audit
./scripts/code-quality.sh check                  # Run all quality gates
./scripts/quality-gates.sh                       # Full gates (coverage 90%)
```

## Quality Gates

| Check | Command | Target |
|-------|---------|--------|
| Format | `./scripts/code-quality.sh fmt` | 100% compliant |
| Lint | `./scripts/code-quality.sh clippy --workspace` | Zero warnings |
| Audit | `cargo audit` | No known vulnerabilities |
| Coverage | `cargo llvm-cov --html` | >=90% |
| Docs | `cargo doc --no-deps` | All public APIs |

## Rust Quality Dimensions

| Dimension | Focus |
|-----------|-------|
| Structure | Files , `?` operator (no unwrap) |
| Async | spawn_blocking for CPU work, no blocking in async |
| Testing | >=90% coverage, AAA pattern, cargo nextest + doctests |
| Security | Parameterized SQL, env vars, no hardcoded secrets |

## Clean Code Principles

**SOLID**: Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion

**DRY/KISS/YAGNI**: Extract common code, simple solutions, build what's needed now

## Anti-Patterns

| Bad | Fix |
|-----|-----|
| Excessive clone | Use borrowing or Arc |
| Unnecessary unwrap | Use `?` operator |
| Deep nesting | Extract methods |
| Large functions | Split (<50 LOC) |
| Deadlocks | Release locks before `.await` |
| `.py`/`.sh` in root | Move to `scripts/` or delete if one-off |

## Dependency Monitoring

```bash
cargo tree -d | grep -cE "^[a-z]"   # Count duplicates (target: <100)
cargo machete && cargo shear       # Find unused deps
```

## Code Review Output Format

```markdown
# Code Quality Report
Score: X/100 | Critical Issues: N | Warnings: M
- Structure: [Status] | Error Handling: [Status] | Testing: [Status]
1. [Issue] - File:line - Fix: [Recommendation]
```

## References

quality-dimensions.md, ADR-036 (Dependency Deduplication), ADR-032 (Disk Space)

## Source & license

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

- **Author:** [d-o-hub](https://github.com/d-o-hub)
- **Source:** [d-o-hub/rust-self-learning-memory](https://github.com/d-o-hub/rust-self-learning-memory)
- **License:** MIT
- **Homepage:** https://d-o-hub.github.io/rust-self-learning-memory/

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-o-hub-rust-self-learning-memory-code-quality
- Seller: https://agentstack.voostack.com/s/d-o-hub
- 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%.
