home / skills / laravel / boost / pennant-development
This skill helps you manage Laravel Pennant feature flags, enabling targeted rollouts, A/B testing, and conditional UI with ease.
npx playbooks add skill laravel/boost --skill pennant-developmentReview the files below or copy the command above to add this skill to your agents.
---
name: pennant-development
description: "Manages feature flags with Laravel Pennant. Activates when creating, checking, or toggling feature flags; showing or hiding features conditionally; implementing A/B testing; working with @feature directive; or when the user mentions feature flags, feature toggles, Pennant, conditional features, rollouts, or gradually enabling features."
license: MIT
metadata:
author: laravel
---
# Pennant Features
## When to Apply
Activate this skill when:
- Creating or checking feature flags
- Managing feature rollouts
- Implementing A/B testing
## Documentation
Use `search-docs` for detailed Pennant patterns and documentation.
## Basic Usage
### Defining Features
<!-- Defining Features -->
```php
use Laravel\Pennant\Feature;
Feature::define('new-dashboard', function (User $user) {
return $user->isAdmin();
});
```
### Checking Features
<!-- Checking Features -->
```php
if (Feature::active('new-dashboard')) {
// Feature is active
}
// With scope
if (Feature::for($user)->active('new-dashboard')) {
// Feature is active for this user
}
```
### Blade Directive
<!-- Blade Directive -->
```blade
@feature('new-dashboard')
<x-new-dashboard />
@else
<x-old-dashboard />
@endfeature
```
### Activating / Deactivating
<!-- Activating Features -->
```php
Feature::activate('new-dashboard');
Feature::for($user)->activate('new-dashboard');
```
## Verification
1. Check feature flag is defined
2. Test with different scopes/users
## Common Pitfalls
- Forgetting to scope features for specific users/entities
- Not following existing naming conventions
This skill manages feature flags using Laravel Pennant to help you create, check, toggle, and roll out features safely. It activates when you work with feature flags, the @feature Blade directive, A/B tests, conditional features, or gradual rollouts. It focuses on predictable, scoped feature control inside Laravel applications.
The skill inspects code and commands related to defining Feature::define(), Feature::active(), and Feature::for(...)->active()/activate()/deactivate(). It guides you through scoping flags to users or entities, using the @feature Blade directive, and implementing rollout and A/B testing patterns. It also verifies that flags are defined and recommends test scenarios for different scopes.
How do I test flagged behavior across users?
Define the flag and write tests that set different scopes with Feature::for($user)->activate() and assert both active and inactive outcomes.
What if I forget to scope a flag?
Unscoped flags apply globally. To avoid mistakes, prefer explicit scoping and include code reviews that check for Feature::for(...) when per-user behavior is required.