Trick-Taking Refactoring

Extract shared trick-taking logic into a BaseCardGame class.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/kerem-ersoz/gonul --skill trick-taking-refactoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Trick-Taking Refactoring
Source: https://github.com/kerem-ersoz/gonul/tree/main/.github/skills/trick-taking-refactoring
Command: npx skills add https://github.com/kerem-ersoz/gonul --skill trick-taking-refactoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Extracting and consolidating duplicated trick-taking logic (shared state, dealing, play flow) into a reusable base class to reduce maintenance across Hearts, King, and Spades.

Core Features & Use Cases

  • BaseCardGame extraction centralizes common state management, dealing, and trick progression.
  • Game-specific boundaries keep Hearts, King, and Spades logic isolated while sharing core functionality.
  • Incremental safety rules enforce testable, reversible refactors and serialization compatibility.

Quick Start

Begin by introducing a BaseCardGame that encapsulates common behavior, then refactor one game at a time, validating serialization and tests after each step.

Frequently Asked Questions about Trick-Taking Refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor duplicated trick-taking card game logic in TypeScript?

Refactoring duplicated trick-taking logic involves creating a BaseCardGame class to centralize shared dealing and play flow, incrementally migrating Hearts, Spades, and King logic while validating tests and serialization after each step.

What is a safe way to extract a shared base class for multiple card games?

Safe base class extraction involves incrementally refactoring one game at a time, validating JSON-serializable game state and test coverage after each step to ensure reversible, safe consolidation of shared card-game mechanics.

Do I need test coverage to consolidate shared game engine mechanics?

Yes, test coverage is required to consolidate shared game engine mechanics. The incremental extraction approach mandates validating tests and JSON-serializable state compatibility after refactoring each game into the base class.

Can I use this refactoring approach for card games without breaking existing state serialization?

Yes, you can refactor without breaking serialization by enforcing strict adherence to JSON-serializable game state. The incremental extraction process validates serialization compatibility after migrating each game into the base class.

When should I not extract shared trick-taking logic into a base class?

You should not extract shared trick-taking logic into a base class if your project lacks test coverage or strict JSON-serializable game state, as the incremental safety rules depend on reversible validation after each step.