documentation
Use when shipping features with public interfaces that lack docs, generating documentation, updating README files, writing API docs, creating architecture…
Use after implementing features, before claiming a phase is complete, when reviewing AI-generated code, or when code feels overly complex. Also use when you notice repeated patterns across files, a function exceeds 40 lines, nesting exceeds 3 levels, or an abstraction has only
$ npx -y skills add lgbarn/shipyard --skill code-simplification --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/code-simplificationContext preview
The summary Claude sees to decide when to auto-load this skill.
Use after implementing features, before claiming a phase is complete, when reviewing AI-generated code, or when code feels overly complex. Also use when you notice repeated patterns across files, a function exceeds 40 lines, nesting exceeds 3 levels, or an abstraction has only
name: code-simplification description: Use after implementing features, before claiming a phase is complete, when reviewing AI-generated code, or when code feels overly complex. Also use when you notice repeated patterns across files, a function exceeds 40 lines, nesting exceeds 3 levels, or an abstraction has only one implementation. Covers duplication, dead code, over-engineering, and AI-specific bloat patterns like verbose error handling and redundant type checks.
<!-- TOKEN BUDGET: 400 lines / ~1200 tokens -->
<activation>
**The simplifier agent references this skill for systematic cross-task analysis.**
</activation>
AI-generated code accumulates complexity. Each task is implemented in isolation by a fresh agent that can't see the full picture. After multiple tasks, duplication creeps in, abstractions multiply, and dead code lingers.
**Core principle:** The simplest code that works correctly is the best code. Complexity is a cost, not a feature.
**This skill applies after implementation, not during.** Don't prematurely optimize -- but don't ship bloat either.
<instructions>
When reviewing code for simplification:
1. **Identify scope:** What files changed in this phase? (Use git diff) 2. **Scan for duplication:** Look for similar patterns across files 3. **Check complexity:** Flag functions exceeding thresholds 4. **Find dead code:** Look for unused definitions 5. **Spot over-engineering:** Look for abstractions with single implementations 6. **Check AI patterns:** Apply the AI anti-pattern checklist 7. **Prioritize findings:**
**Exact duplicates:** Identical code blocks in different files or functions.
# RED FLAG: Same logic in two places
def validate_user_email(email):
if not email or "@" not in email:
raise ValueError("Invalid email")
def validate_contact_email(email):
if not email or "@" not in email:
raise ValueError("Invalid email")**Near duplicates:** Same structure, different details.
# RED FLAG: Parallel structure, only names differ
def create_user(data):
validate(data)
user = User(**data)
db.add(user)
db.commit()
return user
def create_project(data):
validate(data)
project = Project(**data)
db.add(project)
db.commit()
return project**Parallel hierarchies:** When adding a new type requires changes in multiple places.
**Copy-paste config:** Same configuration blocks repeated in Docker, Terraform, or CI files.
**Extract method:** When a function does too many things.
# BEFORE: One function doing everything
def process_order(order):
# validate (10 lines)
# calculate totals (15 lines)
# apply discounts (12 lines)
# save to database (8 lines)
# send notification (6 lines)
# AFTER: Clear responsibilities
def process_order(order):
validate_order(order)
totals = calculate_totals(order)
totals = apply_discounts(totals, order.customer)
save_order(order, totals)
notify_order_placed(order)**Early returns / guard clauses:** Eliminate deep nesting.
# BEFORE: Nested conditionals
def get_discount(user):
if user:
if user.is_premium:
if user.years > 5:
return 0.20
else:
return 0.10
else:
return 0.0
else:
return 0.0
# AFTER: Guard clauses
def get_discount(user):
if not user or not user.is_premium:
return 0.0
if user.years > 5:
return 0.20
return 0.10**Replace conditionals with polymorphism:** When type-checking drives behavior.
**Simplify boolean expressions:** Collapse nested boolean logic.
| Metric | Acceptable | Review | Refactor | |--------|-----------|--------|----------| | Function length | < 20 lines | 20-40 lines | > 40 lines | | Nesting depth | <= 2 levels | 3 levels | > 3 levels | | Parameters | <= 3 | 4-5 | > 5 | | Cyclomatic complexity | <= 5 | 6-10 | > 10 |
# OVER-ENGINEERED: Abstract factory for one implementation
class NotificationFactory:
@staticmethod
def create(type):
if type == "email":
return EmailNotifier()
raise ValueError(f"Unknown: {type}")
# SIMPLE: Just use the thing directly
notifier = EmailNotifier()**Rule:** If there's on
A Claude Code plugin for structured project execution. Plan work in phases, build with parallel agents and TDD, review with security audits and quality gates, and ship with confidence.
Repo: lgbarn/shipyard
Use when shipping features with public interfaces that lack docs, generating documentation, updating README files, writing API docs, creating architecture…
Use when starting feature work that needs a branch, creating worktrees for isolation, making atomic commits during development, or completing a development…
Import a handwritten spec document into Shipyard, replacing brainstorming. Use when a freeform spec, requirements, or design document exists.
Import a spec-kit feature spec into Shipyard, replacing brainstorming. Use when a spec-kit feature directory exists with spec.md.
Use when working with Terraform (.tf, .tfvars), Ansible (playbooks, roles, inventory), Docker (Dockerfile, docker-compose.yml), Kubernetes (manifests, Helm…
Use when a phase or milestone is complete and you need to extract reusable knowledge, before shipping, or when reflecting on completed work. Also use when the…