> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenable.io/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Tools & New Features

> Automated governance checks ensure every AI-generated feature meets your standards

## Overview

Rapid AI-driven development introduces inconsistent patterns and technical debt. Zenable provides automated governance checks that ensure every AI-generated feature meets your standards, enabling 10x development speed without sacrificing code quality.

## Out-of-the-Box Quality Checks

Zenable automatically enforces these standards on AI-generated features:

<Card title="Standard Quality Enforcement">
  * **Security Best Practices** - Authentication, authorization, input validation
  * **Performance Patterns** - Efficient queries, caching, async operations
  * **Error Handling** - Proper exceptions, logging, recovery
  * **Code Organization** - SOLID principles, clean architecture
  * **API Consistency** - RESTful patterns, response formats
  * **Testing Requirements** - Unit tests, integration tests
</Card>

## Custom Feature Requirements

Enforce your organization's specific feature patterns:

> "All new features must use our feature flag system, include telemetry events, follow our domain-driven design patterns, and integrate with our custom analytics pipeline."

## In Action

When you use AI to build features, Zenable:

1. Validates against standard quality checks
2. Enforces your custom requirements
3. Provides instant feedback to the AI
4. Ensures consistent implementation

## Custom Feature Examples

### Example: Feature Flag Integration

**Your Policy:** "All new features must be wrapped in feature flags with gradual rollout"

```python theme={null}
# ❌ AI generates without feature flags
@app.post("/new-feature")
def new_feature(data: FeatureRequest):
    result = process_feature(data)
    return result

# ✅ Zenable enforces feature flag requirement
@app.post("/new-feature")
@feature_flag("new_feature_enabled", rollout_percentage=10)
def new_feature(data: FeatureRequest, user: User = Depends(get_current_user)):
    if not feature_flags.is_enabled("new_feature_enabled", user):
        return {"error": "Feature not available"}

    result = process_feature(data)
    analytics.track("new_feature_used", user.id, result)
    return result
```

### Example: Domain-Driven Design

**Your Policy:** "All business logic must be in domain services, not controllers"

```javascript expandable theme={null}
// ❌ AI puts logic in controller
app.post('/orders', async (req, res) => {
    const order = req.body;
    const total = order.items.reduce((sum, item) => sum + item.price, 0);
    const tax = total * 0.08;
    const finalAmount = total + tax;
    // Business logic mixed with controller
    db.save({...order, total: finalAmount});
    res.json({success: true});
});

// ✅ Zenable enforces DDD separation
app.post('/orders', async (req, res) => {
    const orderCommand = CreateOrderCommand.from(req.body);
    const result = await orderService.createOrder(orderCommand);
    res.json(OrderResponse.from(result));
});

// Business logic in domain service
class OrderService {
    async createOrder(command) {
        const order = Order.create(command);
        order.calculateTotals(this.taxService);
        await this.repository.save(order);
        await this.eventBus.publish(new OrderCreatedEvent(order));
        return order;
    }
}
```

### Example: Analytics Pipeline Integration

**Your Policy:** "All user actions must emit structured analytics events"

```python expandable theme={null}
# ❌ AI generates without analytics
def update_profile(user_id, profile_data):
    user = get_user(user_id)
    user.update(profile_data)
    save_user(user)
    return {"success": True}

# ✅ Zenable adds analytics requirements
def update_profile(user_id, profile_data, request_context):
    user = get_user(user_id)
    old_profile = user.profile.copy()

    # Track what changed
    changes = diff_profiles(old_profile, profile_data)

    user.update(profile_data)
    save_user(user)

    # Emit structured analytics event
    analytics.track({
        "event": "profile_updated",
        "user_id": user_id,
        "changes": changes,
        "source": request_context.source,
        "session_id": request_context.session_id,
        "timestamp": datetime.now()
    })

    return {"success": True}
```

## Benefits

* **10x Development Speed** - Build features faster without technical debt
* **Consistent Architecture** - Enforce your patterns across all AI-generated code
* **Reduced Review Cycles** - Catch issues before PR submission
* **Team Knowledge Scaling** - Embed best practices into the development process

## Related Use Cases

* [Preventing AI Mistakes](/use-cases/preventing-ai-mistakes) - Catch AI errors in real-time
* [Policy as Code](/use-cases/policy-as-code) - Define your feature requirements
* [Starting New Projects](/use-cases/starting-new-project) - Begin with best practices
