acc-create-bulkhead

Generates Bulkhead pattern for PHP 8.5. Creates resource isolation with semaphore-based concurrency limiting and thread pool isolation. Includes unit tests.

16 stars

Best use case

acc-create-bulkhead is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generates Bulkhead pattern for PHP 8.5. Creates resource isolation with semaphore-based concurrency limiting and thread pool isolation. Includes unit tests.

Teams using acc-create-bulkhead should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/acc-create-bulkhead-majiayu000/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/acc-create-bulkhead-majiayu000/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/acc-create-bulkhead-majiayu000/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How acc-create-bulkhead Compares

Feature / Agentacc-create-bulkheadStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generates Bulkhead pattern for PHP 8.5. Creates resource isolation with semaphore-based concurrency limiting and thread pool isolation. Includes unit tests.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Bulkhead Pattern Generator

Creates Bulkhead pattern infrastructure for resource isolation and fault containment.

## When to Use

| Scenario | Example |
|----------|---------|
| External API calls | Limit concurrent requests to payment gateway |
| Database connections | Pool size limiting |
| CPU-intensive work | Limit by CPU cores |
| Multi-instance | Redis-based coordination |

## Component Characteristics

### BulkheadInterface
- Common interface for all isolation strategies
- Acquire and release semantics
- Capacity monitoring

### Strategies
- **Semaphore Bulkhead**: Limits concurrent executions
- **Thread Pool Bulkhead**: Isolates execution with dedicated pool
- **Queue-based Bulkhead**: Limits with waiting queue

### BulkheadFullException
- Thrown when bulkhead capacity exhausted
- Contains bulkhead name and capacity info

---

## Generation Process

### Step 1: Generate Core Components

**Path:** `src/Infrastructure/Resilience/Bulkhead/`

1. `BulkheadInterface.php` — Common interface
2. `BulkheadConfig.php` — Configuration value object
3. `BulkheadFullException.php` — Exception with capacity info

### Step 2: Generate Bulkhead Implementation

Choose based on use case:

1. `SemaphoreBulkhead.php` — Local semaphore-based limiting
2. `DistributedSemaphoreBulkhead.php` — Redis-based for multi-instance

### Step 3: Generate Registry (Optional)

1. `BulkheadRegistry.php` — Manages multiple bulkheads

### Step 4: Generate Tests

1. `SemaphoreBulkheadTest.php` — Bulkhead behavior tests
2. `BulkheadConfigTest.php` — Configuration tests

---

## File Placement

| Component | Path |
|-----------|------|
| All Classes | `src/Infrastructure/Resilience/Bulkhead/` |
| Unit Tests | `tests/Unit/Infrastructure/Resilience/Bulkhead/` |

---

## Naming Conventions

| Component | Pattern | Example |
|-----------|---------|---------|
| Interface | `BulkheadInterface` | `BulkheadInterface` |
| Semaphore | `SemaphoreBulkhead` | `SemaphoreBulkhead` |
| Distributed | `DistributedSemaphoreBulkhead` | `DistributedSemaphoreBulkhead` |
| Config | `BulkheadConfig` | `BulkheadConfig` |
| Registry | `BulkheadRegistry` | `BulkheadRegistry` |
| Exception | `BulkheadFullException` | `BulkheadFullException` |
| Test | `{ClassName}Test` | `SemaphoreBulkheadTest` |

---

## Quick Template Reference

### BulkheadInterface

```php
interface BulkheadInterface
{
    public function execute(callable $operation): mixed;
    public function tryAcquire(): bool;
    public function release(): void;
    public function getAvailablePermits(): int;
    public function getActiveCount(): int;
    public function getName(): string;
}
```

### BulkheadConfig

```php
final readonly class BulkheadConfig
{
    public function __construct(
        public int $maxConcurrentCalls = 10,
        public int $maxWaitDuration = 0,
        public bool $fairness = true
    ) {}

    public static function default(): self;
    public static function forCpuBound(int $cpuCores): self;
    public static function forIoBound(int $cpuCores): self;
    public static function forExternalService(int $maxConnections): self;
}
```

---

## Usage Example

```php
// Create limiter
$bulkhead = new SemaphoreBulkhead(
    name: 'payment-gateway',
    config: BulkheadConfig::forExternalService(maxConnections: 20),
    logger: $logger
);

// Execute with isolation
try {
    $result = $bulkhead->execute(fn() => $client->charge($request));
} catch (BulkheadFullException $e) {
    return Result::serviceOverloaded();
}
```

---

## Use Case Selection

| Use Case | Bulkhead Type | Config |
|----------|---------------|--------|
| External API calls | Semaphore | Limited by API rate limits |
| Database connections | Semaphore | Limited by pool size |
| CPU-intensive work | Semaphore | Limited by CPU cores |
| Multi-instance | Distributed | Redis-based coordination |
| Mixed workloads | Registry | Per-service configuration |

---

## Anti-patterns to Avoid

| Anti-pattern | Problem | Solution |
|--------------|---------|----------|
| Global Bulkhead | Single point of contention | Per-service bulkheads |
| No Release | Permit leak | Always release in finally |
| Wrong Size | Too small = rejected, too large = no protection | Right-size per service |
| No Metrics | Can't monitor usage | Track acquired/rejected |
| Infinite Wait | Thread starvation | Set maxWaitDuration |
| No Fallback | Hard failure on full | Provide degraded response |

---

## References

For complete PHP templates and examples, see:
- `references/templates.md` — BulkheadInterface, Config, SemaphoreBulkhead, DistributedSemaphoreBulkhead, Registry
- `references/examples.md` — PaymentGatewayAdapter, ConnectionPool, OrderService examples and tests

Related Skills

acc-create-anti-corruption-layer

16
from diegosouzapw/awesome-omni-skill

Generates DDD Anti-Corruption Layer for PHP 8.5. Creates translation layer between bounded contexts or external systems. Includes adapters, translators, facades, and unit tests.

acc-create-action

16
from diegosouzapw/awesome-omni-skill

Generates ADR Action classes for PHP 8.5. Creates single-responsibility HTTP endpoint handlers with PSR-7 support. Includes unit tests.

ui-design-create-component

16
from diegosouzapw/awesome-omni-skill

Guided component creation with proper patterns Use when: the user asks to run the `create-component` workflow and the task requires multi-step orchestration. Do not use when: the task is small, single-step, and can be completed directly without orchestration overhead.

create-rule

16
from diegosouzapw/awesome-omni-skill

Create project rules for persistent AI guidance. Use when the user wants to create a rule, add coding standards, set up project conventions, configure file-specific patterns, create RULE.md files, or asks about the workspace rules directory or AGENTS.md.

create-design-system-rules

16
from diegosouzapw/awesome-omni-skill

Generates custom design system rules for the user's codebase. Use when user says "create design system rules", "generate rules for my project", "set up design rules", "customize design system guidelines", or wants to establish project-specific conventions for Figma-to-code workflows. Requires Figma MCP server connection.

typespec-m365-copilot-typespec-create-agent

16
from diegosouzapw/awesome-omni-skill

Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot Use when: the task directly matches typespec create agent responsibilities within plugin typespec-m365-copilot. Do not use when: a more specific framework or task-focused skill is clearly a better match.

typespec-create-agent

16
from diegosouzapw/awesome-omni-skill

Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot

mcp-create-declarative-agent

16
from diegosouzapw/awesome-omni-skill

Skill converted from mcp-create-declarative-agent.prompt.md

kitt-create-slash-commands

16
from diegosouzapw/awesome-omni-skill

Expert guidance for creating slash commands. Use when working with slash commands, creating custom commands, understanding command structure, or learning YAML configuration.

kitt-create-plans

16
from diegosouzapw/awesome-omni-skill

Create hierarchical project plans optimized for solo agentic development. Use when planning projects, phases, or tasks that the AI agent will execute. Produces agent-executable plans with verification criteria, not enterprise documentation. Handles briefs, roadmaps, phase plans, and context handoffs.

create-workflow

16
from diegosouzapw/awesome-omni-skill

Create Jazz workflow automation files (WORKFLOW.md). Use this for scheduling Jazz agents to run recurring tasks. For OS-level scripts/commands, use create-system-routine.

create-prompt

16
from diegosouzapw/awesome-omni-skill

Expert prompt engineering for creating effective prompts for Claude, GPT, and other LLMs. Use when writing system prompts, user prompts, few-shot examples, or optimizing existing prompts for better performance.