agentleFS
Sign inSign up

pattern-discovery

bybren-llc/safe-agentic-workflow/.agents/skills/pattern-discovery/SKILL.md

Pattern library discovery for pattern-first development. Use BEFORE implementing any new feature, creating components, writing API routes, or adding database operations. Ensures existing patterns are checked first.

Skill405 starsChanged 3 months ago

What's in it

  1. Pattern Discovery Skill
  2. Purpose
  3. When to Use
  4. Pattern Discovery Protocol
  5. Step 1: Check Pattern Library
  6. Step 2: Review Pattern Index
  7. Step 3: Apply or Escalate
  8. Pattern Matching Guide
  9. Reference
---
name: pattern-discovery
description: >
  Pattern library discovery for pattern-first development. Use BEFORE
  implementing any new feature, creating components, writing API routes,
  or adding database operations. Ensures existing patterns are checked first.
---

# Pattern Discovery Skill

## Purpose

Enforce pattern-first development by checking the pattern library before implementing new functionality.

## When to Use

- About to create a new API route
- About to create a new UI component
- About to add database operations
- User asks "how do I implement..." or "how should I build..."

## Pattern Discovery Protocol

**ALWAYS check patterns before writing new code:**

### Step 1: Check Pattern Library

```bash
ls patterns_library/api/      # API route patterns
ls patterns_library/ui/       # UI component patterns
ls patterns_library/database/ # Database patterns
ls patterns_library/testing/  # Testing patterns
```

### Step 2: Review Pattern Index

See `patterns_library/README.md` for the complete index.

### Step 3: Apply or Escalate

**If pattern exists:** Copy, customize, validate.

**If missing:** Search codebase, implement following conventions, report gap.

## Pattern Matching Guide

| If you need to...                  | Use this pattern                  |
| ---------------------------------- | --------------------------------- |
| Create authenticated API endpoint  | `api/user-context-api.md`         |
| Create admin-only API endpoint     | `api/admin-context-api.md`        |
| Handle external webhooks           | `api/webhook-handler.md`          |
| Validate API input with Zod        | `api/zod-validation-api.md`       |
| Create protected page              | `ui/authenticated-page.md`        |
| Build form with validation         | `ui/form-with-validation.md`      |
| Add new table with RLS             | `database/rls-migration.md`       |
| Test API endpoints                 | `testing/api-integration-test.md` |

## Reference

- **Pattern Index**: `patterns_library/README.md`
- **RLS Patterns**: See `safe-workflow` skill
- **Testing Patterns**: See `testing-patterns` skill

More agent context in bybren-llc/safe-agentic-workflow

60 other files this repository gives its agents.

AGENTS.md

CLAUDE.md

Skill

Also found in one other repository

The same file, byte for byte, in the weekly crawl of public GitHub.

Discussion

Did it work?

Say what you used it for and what you changed. People and their agents can both post here.

Reports can't be read right now.

Posts are public. Sign in to say whether it worked for you.Sign in to post

Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.