Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Component Patterns

ASecurity

Guidelines for organizing React components in Shadow Master. Use when creating new components, deciding between single-file vs subfolder structure, or adding character creation cards.

2 stars
0 votes
0 copies
0 views
Added 9/27/2026
developmenttypescriptgoreactapi

Works with

api

Security Analysis

A100/100

Scanned 9/27/2026

$npx -y skills add David-Li0406/meta-skill-evloving --skill component-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Component Patterns?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Component Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-component-patterns/badge)](https://www.skillsdirectory.com/skills/david-li0406-component-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: component-patterns
description: Guidelines for organizing React components in Shadow Master. Use when creating new components, deciding between single-file vs subfolder structure, or adding character creation cards.
allowed-tools: Read, Grep, Glob
---

# Component Organization Patterns

Guidelines for structuring React components in the Shadow Master codebase.

## Decision Flowchart

```
Does the component have modals?
├─ Yes → Create subfolder, extract modals
└─ No → Does it have reusable Row/ListItem components?
        ├─ Yes, used elsewhere → Create subfolder
        └─ No → Keep as single file with internal helpers
```

---

## When to Use a Subfolder

Create a subfolder with `index.ts` when:

- Component has one or more **modals** (selection dialogs, forms, etc.)
- Component has **reusable row/list item** components used in multiple places
- Component exceeds ~600 lines with clear separable concerns
- Component has distinct UI pieces that could be tested independently

**Subfolder structure:**

```
/components/creation/qualities/
├── QualitiesCard.tsx        # Main card component
├── QualityModal.tsx         # Selection/edit modal
├── QualityRow.tsx           # Optional: if row is complex/reusable
├── index.ts                 # Re-exports public components
```

**Index file pattern:**

```typescript
// index.ts - export only public API
export { QualitiesCard } from "./QualitiesCard";
export { QualityModal } from "./QualityModal"; // Only if used externally
```

---

## When to Keep as Single File

Keep as a single file when:

- Component is self-contained with only **internal helper components**
- Internal components are tightly coupled and only make sense within the parent
- Component is under ~400 lines with straightforward structure
- No modals or independently reusable pieces

---

## Creation Component Subfolders

Current organization (15 directories, 89 total components):

| Folder                 | Components | Pattern                                |
| ---------------------- | ---------- | -------------------------------------- |
| `/armor`               | 4          | Panel + Row + PurchaseModal + ModModal |
| `/augmentations`       | 4          | 4 specialized modals                   |
| `/contacts`            | 2          | Card + Modal + support files           |
| `/foci`                | 2          | Card + Modal                           |
| `/gear`                | 4          | Panel + Row + 2 Modals                 |
| `/identities`          | 6          | Card + 3 modal types                   |
| `/knowledge-languages` | 5          | Card + 2 Row types + 2 Modals          |
| `/magic-path`          | 2          | Card + Modal + utilities               |
| `/matrix-gear`         | 3          | Card + 2 specialized modals            |
| `/metatype`            | 2          | Card + Modal + support files           |
| `/qualities`           | 3          | Card + SelectionModal + DetailCard     |
| `/shared`              | 10         | Reusable utilities and hooks           |
| `/skills`              | 5          | 5 specialized modals                   |
| `/vehicles`            | 4          | 4 specialized modals                   |
| `/weapons`             | 4          | Row + 3 Modals                         |

---

## Adding a New Character Creation Card

1. **Determine if card needs subfolder** (see decision flowchart above)
   - Has modals? → Create subfolder with `index.ts`
   - Simple with internal helpers? → Single file is fine

2. **Create card component** in `/components/creation/` or `/components/creation/{feature}/`

3. **Follow the `CreationCard` wrapper pattern** from `/components/creation/shared/`

4. **Add to `SheetCreationLayout.tsx`** in the appropriate column

5. **Update `CreationState` type** in `/lib/types/creation.ts` if needed

6. **Export from `/components/creation/index.ts`**

---

## Adding a New API Endpoint

1. Create `/app/api/{path}/route.ts`
2. Export HTTP method handlers (GET, POST, PUT, DELETE)
3. Follow authentication pattern (getSession → validate user)
4. Call storage layer functions
5. Return JSON responses

---

## Adding a New Ruleset Module

1. Define module type in `/lib/types/edition.ts`
2. Add module to book payload in `/data/editions/{editionCode}/`
3. Update merge logic in `/lib/rules/merge.ts` if special handling needed
4. Create hook in `RulesetContext.tsx` for easy access

---

## Key Reference Files

- `components/creation/shared/CreationCard.tsx` - Card wrapper pattern
- `components/creation/SkillsCard.tsx` - Modal-based editing example
- `components/creation/AugmentationsCard.tsx` - Category tabs + list
- `app/characters/create/sheet/components/SheetCreationLayout.tsx` - Three-column layout

Attribution

David-Li0406David-Li0406
View sourceSee grades on GitHubMore from David-Li0406 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

286712 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Writing Plans

Use when you have a spec or requirements for a multi-step task, before touching code

2927051 votes
View all in development →