home / skills / athola / claude-night-market / shared-patterns

This skill provides reusable validation, error handling, testing, and workflow templates to ensure consistency across skills and hooks.

npx playbooks add skill athola/claude-night-market --skill shared-patterns

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
2.1 KB
---
name: shared-patterns
description: 'Reference these patterns to validate consistency across the ecosystem.
  Use when creating new skills or hooks that need consistent patterns, implementing
  validation logic, setting up error handling, creating test scaffolding, referencing
  standard workflow structures. Do not use when pattern is specific to one skill only.
  DO NOT use when: pattern is still evolving - wait for stability. DO NOT use when:
  pattern is context-dependent requiring variations.'
category: meta-infrastructure
tags:
- patterns
- templates
- shared
- validation
- reusable
dependencies: []
estimated_tokens: 400
---

# Shared Patterns

Reusable patterns and templates for skill and hook development.

## Purpose

This skill provides shared patterns that are referenced by other skills in the abstract plugin. It follows DRY principles by centralizing common patterns.

## Pattern Categories

### Validation Patterns

See [modules/validation-patterns.md](modules/validation-patterns.md) for:
- Input validation templates
- Schema validation patterns
- Error reporting formats

### Error Handling

See [modules/error-handling.md](modules/error-handling.md) for:
- Exception hierarchies
- Error message formatting
- Recovery strategies

### Testing Templates

See [modules/testing-templates.md](modules/testing-templates.md) for:
- Unit test scaffolding
- Integration test patterns
- Mock fixtures

### Workflow Patterns

See [modules/workflow-patterns.md](modules/workflow-patterns.md) for:
- Checklist templates
- Feedback loop patterns
- Progressive disclosure structures

## Usage

Reference these patterns from other skills:

```markdown
For validation patterns, see the `shared-patterns` skill's
[validation-patterns](../shared-patterns/modules/validation-patterns.md) module.
```
**Verification:** Run the command with `--help` flag to verify availability.
## Troubleshooting

### Common Issues

**Command not found**
Ensure all dependencies are installed and in PATH

**Permission errors**
Check file permissions and run with appropriate privileges

**Unexpected behavior**
Enable verbose logging with `--verbose` flag

Overview

This skill provides a centralized library of reusable patterns for building Claude Code skills and hooks. It enforces consistent validation, error handling, testing, and workflow structures so teams can follow the same conventions across the ecosystem. Use it as a reference to speed development and reduce duplication.

How this skill works

The skill groups patterns into modules for validation, error handling, testing, and workflows. Each module presents templates and example structures—schemas for input validation, exception hierarchies and recovery strategies, test scaffolding with mocks, and step-by-step workflow checklists. Consumers import or reference the relevant pattern and adapt parameters rather than recreating core logic.

When to use it

  • Creating a new skill or hook that must follow ecosystem-wide conventions
  • Implementing input validation and schema checks for public-facing commands
  • Designing error handling that maps to standardized messages and recovery paths
  • Setting up unit and integration test scaffolding with shared fixtures
  • Defining workflow steps, checklists, or feedback loops for consistent UX

Best practices

  • Reference patterns instead of copying them to stay DRY and keep updates centralized
  • Only adopt patterns that are stable; avoid using evolving patterns until they are finalized
  • Adapt templates by parameters rather than changing structure to preserve compatibility
  • Use the validation and error formats to produce machine-readable diagnostics
  • Write tests against the testing templates to ensure consistent CI behavior

Example use cases

  • Add standardized schema validation to a new CLI skill to ensure consistent error messages
  • Implement an exception class that maps to documented recovery strategies across plugins
  • Bootstrap unit and integration tests for a new hook using the testing templates and mock fixtures
  • Build a stepwise onboarding workflow for a feature using the progressive disclosure pattern
  • Reference checklist templates during code review to ensure every plugin meets baseline requirements

FAQ

Can I modify patterns for a single-skill use case?

Prefer adapting via parameters; if a pattern requires a one-off change, document the deviation and evaluate whether the pattern should evolve.

When should I avoid using these patterns?

Do not use them for patterns that are still evolving or for context-specific variations that would break ecosystem consistency.