# craft

> A quality-gated coding workflow that enforces SOLID principles, complexity limits, and formal review protocols.

craft is a free AI agent skill on Agensi by Yamil Lanz, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Yamil Lanz](https://www.agensi.io/creators/yamil-lanz)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-12
- Security: scan passed (2026-10-12); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/craft
- Tags: code-review, prompt-engineering, typescript, refactoring, solid-principles, clean-code

## About this skill

Stop shipping "valid but tangled" code. Most AI coding assistants generate large, monolithic functions that pass tests but fail long-term maintenance. This skill enforces a rigorous, quality-gated workflow that rejects any code exceeding strict complexity thresholds or violating SOLID principles.

### What it does
- **Enforces Hard Gates** measures function length, nesting depth, cyclomatic complexity, and callback nesting before marking a task as done.
- **Drives Pattern Pressure** prevents speculative generality by requiring a specific trigger and justification for every design pattern used.
- **Automates Protocol-Based Reviews** runs a formal verdict protocol on every changed file to identify blockers, majors, and minors.
- **Decouples Domain Logic** ensures core business logic remains isolated from IO, side effects, and concrete implementations.
- **Standardizes Documentation** generates specs, design documents, and task lists based on the project's existing conventions.

### How it works
1. **Mode Selection** the agent detects if the task is a greenfield app (Full SDD), an informal requirement (Spec-lite), or a surgical fix (Craft-only).
2. **Spec Scaffolding** for new features, the agent creates or updates specifications and design docs before writing a single line of implementation.
3. **Implementation Loop** code is written in small, testable slices using guard clauses, early returns, and named functions to stay within gate limits.
4. **Gate Measurement** every changed function is measured against complexity metrics; failing functions are automatically refactored.
5. **Final Verdict** a formal report is generated showing gate numbers, applied patterns, and any deferred follow-up items.

### Frameworks & tools
Works with any language or framework. It automatically detects and runs existing repository tooling such as `npm test`, `pytest`, `eslint`, or `tsc` based on project lockfiles and configurations.

### Why this beats prompting it yourself
Generic prompts often result in the LLM taking the path of least resistance, leading to technical debt. This skill forces the agent into a hostile reviewer mindset, measuring exact metrics like cyclomatic complexity and nesting depth that manual prompts typically ignore.

### Use cases
- Refactoring legacy methods into clean, decoupled, and testable units.
- Scaffolding greenfield features with full SDD documentation and SOLID architecture.
- Enforcing strict coding standards across a team of AI agents or human collaborators.
- Ensuring domain logic is pure and free from side-effect contamination.

### Known limitations
Line-count gate exemptions are only permitted for declarative config or tables via specific comments. Nesting and complexity gates have no exemptions.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the craft skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Which programming languages and frameworks is this skill compatible with?

'Craft' works with any programming language or framework; it detects your project’s environment (like npm or pytest) and automatically applies complexity gates and SOLID enforcement regardless of the stack.

### How does this differ from just asking a standard AI agent to 'write clean code'?

Unlike standard prompts, this skill acts as a 'hostile reviewer' that measures specific metrics like cyclomatic complexity and nesting depth, refusing to complete tasks until the code meets hard quality gates.

### Can I use this skill to refactor existing legacy code, or is it only for new projects?

Yes, the skill is designed to analyze existing repositories to identify 'tangled' code and refactor legacy methods into decoupled, testable units that follow modern architectural patterns.

### What exactly is included in the purchase of the 'craft' skill?

You receive the 'craft' skill package containing the logic for the implementation loop, automated gate measurement protocols, and the formal verdict reporting system.

### What happens if my project requires a large function that exceeds the default complexity limits?

The skill allows for line-count gate exemptions in declarative files (like configs) via specific comments, but it strictly maintains nesting and complexity limits to ensure long-term maintainability.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
