Works with the AI Agents you already use
craft
A quality-gated coding workflow that enforces SOLID principles, complexity limits, and formal review protocols.
Free
craft
Example session with this skill installed
Refactor the processOrder function in orders.ts to reduce complexity and extract the database logic.
- Read your context and instructions
- Compiled the craft
I have refactored processOrder in orders.ts. The implementation was moved to a Craft-only mode (Mode C) to address high cyclomatic complexity and IO coupling. The database logic is now extracted into a repository pattern, and the domain logic is pure.
Refactor Audit & Gate Verdict
| Function | Lines (Gate: 25) | Nesting (Gate: 3) | Complexity (Gate: 7) | Status |
|---|---|---|---|---|
processOrder | 12 | 1 | 3 | APPROVED |
validateInventory | 8 | 1 | 2 | APPROVED |
calculateTax | 5 | 1 | 1 | APPROVED |
saveOrderRecord | 6 | 0 | 1 | APPROVED |
// src/orders.ts
/**
* Trigger: Requirement to decouple domain logic from IO and reduce nesting.
* Pattern: Repository Pattern for DB isolation.
*/
export async function processOrder(order: Order, repo: OrderRepository): Promise<void> {
const validatedOrder = validateInventory(order);
const total = calculateTax(validatedOrder);
const finalOrder = { ...validatedOrder, total, status: 'processed' };
await repo.save(finalOrder);
}
function validateInventory(order: Order): Order {
if (order.items.length === 0) throw new Error("Empty order");
// Logic here...
return order;
}
function calculateTax(order: Order): number {
const BASE_RATE = 0.07;
return order.subtotal * (1 + BASE_RATE);
}
Next steps
- Run
npm testto verify the extractedcalculateTaxlogic against edge cases. - Update the
OrderRepositoryinterface to include the newsavesignature. - Review the
follow-upslist for implementing a retry mechanism on the DB write.
Connects securely to your tools. The creator never sees your data.
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
- 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).
- Spec Scaffolding for new features, the agent creates or updates specifications and design docs before writing a single line of implementation.
- Implementation Loop code is written in small, testable slices using guard clauses, early returns, and named functions to stay within gate limits.
- Gate Measurement every changed function is measured against complexity metrics; failing functions are automatically refactored.
- 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
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean 7 days ago
- Free to download with an account