Party TPH Catalog

VerifiedSafe

TPH-based pattern for small catalog dimensions like Gender, BlogTag, etc. Uses single Party table with discriminator, inherited DTOs, and base service.

Sby Skills Guide Bot
DevelopmentIntermediate
7/24/2026
Claude CodeCursorWindsurfCopilotCodex
#party-pattern#tph#ef-core#discriminator#catalog-lookup

Recommended for

Automated summary

This skill guides adding a small catalog dimension (tag, status, gender) by inheriting the TPH Party model instead of scaffolding a full entity.

Strengths

  • Walks through the whole chain: Party entity, discriminator registration, inherited DTOs, BasePartyService-derived service, and endpoints
  • Flags concrete gotchas (int key, extra columns must be nullable, missing discriminator registration yields empty type-scoped queries)
  • Provides a clear decision table for when to apply the pattern versus using a full scaffold
  • Covers party-to-party links through PartyRelation without inventing extra join tables

Limitations

  • Highly specific to a .NET/EF Core codebase where Party, BasePartyService and ResourceIdentifiers already exist
  • Assumes familiarity with TPH, policy-based caching and the project's endpoint conventions
  • Of little use outside that foundation, since the class and API names are not generic
When to use it

Use it when adding a shared-shape lookup dimension (id + description + state) that should live in the Parties table rather than its own entity.

When not to use it

Don't use it for an entity with a rich schema, its own relations or a non-integer key, which needs a full scaffold.

Security analysis

Safe
Quality score84/100

The skill is pure architectural documentation for an internal C# EF Core TPH pattern. It declares only Read, Grep and Glob — no bash, network, write, or execution capability — and contains no install scripts, curl|sh pipelines, credential handling, obfuscated payloads, or instructions to disable safety. All code blocks are illustrative C# class/registration snippets for a known in-house codebase, so there is no meaningful execution risk.

No concerns found

How this analysis is made

Examples

Add a BlogTag catalog type
Add a BlogTag catalog dimension using the Party TPH pattern: inherit Party with a Slug property, register the discriminator, create the inherited DTOs and a service derived from BasePartyService.
Add a status lookup
I need a new BlogPostStatus lookup (id + description + state). Should I use the party catalog pattern or scaffold a full entity? Walk me through the steps if it fits.
Debug empty type-scoped queries
My SearchByCriteriaByPartyTypeAsync<Gender> returns nothing even though rows exist. Check whether the Party discriminator is registered and SetPolicies is called.

name: "party-tph-catalog" description: "Use when adding a small polymorphic catalog dimension (Gender, BlogTag, BlogPostStatus, statuses, types, categories-as-lookup) instead of scaffolding a full entity. Covers the Party base (TPH, int key, PartyType discriminator), PartyRelation for party-to-party links, DTO inheritance from Info/Create/UpdatePartyDto, BasePartyService with SetPolicies and SearchByCriteriaByPartyTypeAsync, and discriminator registration. Domain: Persistence, Domain Modeling. Level: Intermediate. Tags: party, tph, discriminator, catalog, lookup." allowed-tools: [Read, Grep, Glob]

Activation

ACTIVATION:
  triggers:
    - "party pattern"
    - "catalog dimension"
    - "lookup table"
    - "TPH"
    - "new tag/status/type entity"
  context: decision-point | implementation
  anti-triggers:
    - "Entities with their own rich schema — use scaffold-template-entity"
    - "Anything needing its own table or non-int key"

Detail

Party (TPH) Catalog Pattern

Problem

Small catalog dimensions (Gender, BlogTag, BlogPostStatus, BlogPostVisibility…) each need audit fields, state, soft delete, permissions and CRUD — but giving each its own table + migration + full scaffold is overkill for rows that are basically (id, description).

Solution

All catalog dimensions share one table (Parties) via TPH with a PartyType string discriminator.

  1. Inherit Party (which already implements IEntity<int>, IAuditableEntity, IStateEntity; Description serves as the display name). New properties must be nullable/defaulted so they don't interfere with sibling types:
public class BlogTag : Party
{
    public string Slug { get; set; } = string.Empty;
    public string TagName => Description ?? string.Empty;   // computed alias for clarity
}
public class Gender : Party { }
  1. Register the discriminator in PartyConfiguration (.HasValue<Gender>(ResourceIdentifiers.Gender)), add DbSet<Gender> Genders to AppDbSetter, and the ResourceIdentifiers constant. No new table/migration for the type itself (only if you added columns).
  2. DTOs inherit the Party DTOs in one file: InfoGenderDto : InfoPartyDto, CreateGenderDto : CreatePartyDto, UpdateGenderDto : UpdatePartyDto (reuse DeletePartyDto).
  3. Service inherits BasePartyService<TParty, TInfo, TCreate, TUpdate, TDelete> (int key, extends PayloadService<>): call SetPolicies(_cachePolicies) in the constructor; CreateAsync stamps createDto.PartyType = typeof(TParty).Name automatically; type-scoped reads via SearchByCriteriaByPartyTypeAsync<TDerived>(model) / ExportByPartyTypeAsync<TDerived>(...) which filter by discriminator through _repository.AsQueryableOfType<TDerived>(false).
  4. Party-to-party links use the PartyRelation table (PartyId, RelatedPartyId, RelationshipType, StartDate/EndDate, notes; auditable) — don't invent join tables between dimensions.
  5. Endpoints/permissions follow the standard recipe (GenderEndpoints : IEndpointDefinition, attribute triad).

Applicability

| Condition | Apply? | |---|---| | Small lookup shared-shape dimension (id + description + state) | ✅ Yes | | Dimension with 1-3 extra nullable columns | ✅ Yes | | Entity with rich schema, relations, own lifecycle | ❌ No — full scaffold | | Read-only projection | ❌ No — QueryPayloadService<> |

Gotchas

  1. Key is int (Party owns it) — not the Guid default of full entities.
  2. New properties on a derived type live on the shared table — keep them nullable or defaulted, or sibling inserts break.
  3. Forgetting the discriminator registration makes EF treat rows as base Party — type-scoped queries return empty.
  4. SearchByCriteriaByPartyTypeAsync caches under the first policy (falls back to CacheRoutes.Parties) — call SetPolicies or you share the generic Parties cache.
  5. Root SKILL.md declares this pattern as its anti-trigger — one entry point per flow: full entity → root skill, catalog dimension → this one.

Related Skills

  • scaffold-template-entity, permission-model, cache-policy-eviction

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/party-tph-catalog-mryiqfv1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/party-tph-catalog-mryiqfv1/download' --output '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md.part' && mv '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md.part' '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md' && test -s '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/party-tph-catalog' && cp -R '.skill-downloads/party-tph-catalog-mryiqfv1' '.claude/skills/party-tph-catalog'

Cursor
test -f '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md' && test -s '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/party-tph-catalog' && cp -R '.skill-downloads/party-tph-catalog-mryiqfv1' '.cursor/skills/party-tph-catalog'

Codex
test -f '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md' && test -s '.skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/party-tph-catalog' && cp -R '.skill-downloads/party-tph-catalog-mryiqfv1' '.agents/skills/party-tph-catalog'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/party-tph-catalog-mryiqfv1'

openskills read 'party-tph-catalog-mryiqfv1'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/party-tph-catalog-mryiqfv1/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills