/craftsman:agent-designfrom craftsman
Designs AI agents using the Perceive-Plan-Perform (3P) cognitive architecture with explicit tool boundaries and failure handling.
Ships in craftsman. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Design AI agents using the Perceive-Plan-Perform (3P) cognitive architecture.
┌─────────────────────────────────────────────────────────────────┐
│ AGENT COGNITIVE LOOP │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ PERCEIVE │─────▶│ PLAN │─────▶│ PERFORM │ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │ │ │
│ │ ┌──────────┐ │ │
│ └────────────│ REFLECT │◀───────────┘ │
│ └──────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Gather and interpret information from the environment.
class Perceiver:
"""Gathers context and interprets the environment."""
def perceive(self, input: str, context: Context) -> Perception:
return Perception(
user_intent=self.extract_intent(input),
entities=self.extract_entities(input),
context_summary=self.summarize_context(context),
constraints=self.identify_constraints(input),
ambiguities=self.detect_ambiguities(input),
)
def extract_intent(self, input: str) -> Intent:
"""Classify user intent: question, command, clarification, etc."""
pass
def detect_ambiguities(self, input: str) -> list[Ambiguity]:
"""Identify unclear aspects requiring clarification."""
pass
Devise a strategy to achieve the goal.
class Planner:
"""Creates action plans based on perception."""
def plan(self, perception: Perception, tools: list[Tool]) -> Plan:
# 1. Break down into subtasks
subtasks = self.decompose(perception.user_intent)
# 2. Select tools for each subtask
tool_assignments = self.assign_tools(subtasks, tools)
# 3. Order by dependencies
ordered_tasks = self.topological_sort(tool_assignments)
# 4. Identify risks
risks = self.assess_risks(ordered_tasks)
return Plan(
tasks=ordered_tasks,
risks=risks,
estimated_steps=len(ordered_tasks),
)
def decompose(self, intent: Intent) -> list[Subtask]:
"""Break complex goals into atomic subtasks."""
pass
Execute the plan using available tools.
class Performer:
"""Executes plan steps using tools."""
def perform(self, plan: Plan, tools: ToolRegistry) -> list[Result]:
results = []
for task in plan.tasks:
# Select tool
tool = tools.get(task.tool_name)
# Execute with error handling
try:
result = tool.execute(task.parameters)
results.append(Result(task=task, output=result, status="success"))
except ToolError as e:
# Attempt recovery
recovery = self.recover(task, e, tools)
results.append(recovery)
# Reflect after each step
self.reflect(task, results[-1])
return results
Learn from execution and adjust.
class Reflector:
"""Reflects on execution and adjusts strategy."""
def reflect(self, task: Task, result: Result) -> Reflection:
return Reflection(
success=result.status == "success",
lessons_learned=self.extract_lessons(result),
plan_adjustments=self.suggest_adjustments(result),
should_continue=self.evaluate_progress(result),
)
def extract_lessons(self, result: Result) -> list[str]:
"""What worked? What didn't?"""
pass
from abc import ABC, abstractmethod
from pydantic import BaseModel
class ToolInput(BaseModel):
"""Base class for tool inputs with validation."""
pass
class ToolOutput(BaseModel):
"""Base class for tool outputs."""
success: bool
data: Any
error: str | None = None
class Tool(ABC):
"""Base tool interface."""
@property
@abstractmethod
def name(self) -> str:
pass
@property
@abstractmethod
def description(self) -> str:
"""Used by LLM to decide when to use this tool."""
pass
@property
@abstractmethod
def parameters_schema(self) -> dict:
"""JSON schema for parameters."""
pass
@abstractmethod
def execute(self, params: ToolInput) -> ToolOutput:
pass
# Agent Design: [Agent Name]
## Purpose
[What problem does this agent solve?]
## Capabilities
- [ ] Capability 1
- [ ] Capability 2
## Tools Available
| Tool | Purpose | Risk Level |
|------|---------|------------|
| read_file | Read file contents | Low |
| write_file | Write file contents | Medium |
| execute_code | Run code | High |
## Workflow
### Perceive
- Inputs: [What the agent receives]
- Extraction: [What it identifies]
### Plan
- Decomposition strategy: [How it breaks down tasks]
- Tool selection criteria: [How it chooses tools]
### Perform
- Execution strategy: [Sequential, Parallel]
- Error handling: [Recovery strategies]
### Reflect
- Success criteria: [How it knows it succeeded]
- Learning: [What it remembers]
## Safety Constraints
- [ ] Confirmation required for: [destructive actions]
- [ ] Rate limits: [X calls per minute]
- [ ] Sandboxing: [isolated execution]
- [ ] Audit logging: [all actions logged]
## Example Interaction
User: [Example input]
PERCEIVE:
PLAN:
PERFORM:
REFLECT:
Response: [Final output to user]
| Anti-Pattern | Problem | Solution |
|---|---|---|
| No planning | Random tool calls | Always plan first |
| No reflection | Repeats mistakes | Reflect after each step |
| Overconfidence | Assumes success | Verify outputs |
| No error handling | Crashes on failure | Graceful recovery |
| No constraints | Dangerous actions | Safety boundaries |
What SKILL.md sets; muted values are Claude Code's defaults
opusxhighThree short reads, in order
npx claudepluginhub buldee/ai-craftsman-superpowers --plugin craftsman23 skills in this plugin
/challengeSenior architecture review and code challenge. Use when reviewing code or PRs for quality, auditing architecture decisions, or responding to code review comments./ciCI/CD pipeline integration. Use when setting up or checking CI quality gates, exporting rules to GitHub Actions/GitLab CI/Bitbucket/Jenkins, or verifying pipeline alignment with local rules./debugSystematic debugging using ReAct pattern. Use when encountering bugs, errors, unexpected behavior, test failures, or performance issues. Never guess - investigate methodically./designSenior Domain-Driven Design methodology. Use for creating entities, value objects, aggregates, or designing domain models. Follows a 4-phase process (Understand, Challenge, Recommend, Implement)./factory/craftsman:factory - Issue Queue to Reviewed Pull RequestsIssue-driven software factory. Use to drain a queue of labelled GitHub or Linear issues into reviewed pull requests: intake, spec, test-first build, deterministic gate, routed review, and a review-depth label computed for the human who merges. Never merges./gitSafe git workflow with destructive command protection. Use when committing changes, creating branches, managing git workflow, or handling merge conflicts.Other plugins' skills for the same job