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.
Gate exemptions only allowed for config/tables. Nesting, complexity, and callback depth limits are absolute. Requires existing repo conventions for Full SDD mode.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account
Permissions
No special permissions declared or detected