JSDoc Best Practices for the Euchre Project
description: When working with complex files.
trigger: always_on description: When working with complex files.
JSDoc Best Practices for the Euchre Project
This ruleset outlines the mandatory JSDoc techniques for documenting the Euchre project. Proper documentation is critical for maintaining Layer 1 purity, enabling test-driven development with node:test, and ensuring clarity across the layered architecture. Consistent and detailed JSDoc provides a structured format that is easily understood by both developers and AI assistants, aligning with the project's development standards.
Table of Contents
- Basic Function Documentation (
@param,@returns) - Defining Complex Objects with In-Place
@typedef - Documenting Dependency Injection for Tests
- Creating Types from Constants (
@typedef,keyof typeof) - Mandatory Reference Tracking with
@see
1. Basic Function Documentation (@param, @returns)
This is the foundational technique for describing a function's contract. For this project, it's essential for documenting pure Layer 1 functions that operate on game state.
The Technique:
Use @param {type} name - Description for each parameter and @returns {type} - Description for the return value. All Layer 1 functions that transform state must document their inputs and outputs.
Example (Based on constants-import-usage-guide.md):
import {
GAME_PHASES,
PLAYER_POSITIONS,
CARD_VALUES,
CARD_SUITS,
TEAMS,
} from "@/config/constants";
/**
* @typedef {import('./jsdoc.md').GamePhase} GamePhase
* @typedef {import('./jsdoc.md').PlayerRole} PlayerRole
* @typedef {import('./jsdoc.md').Card} Card
* @typedef {import('./jsdoc.md').SuitConstant} SuitConstant
*/
/**
* Creates the initial state object for a new game. This is a pure function.
*
* @param {{ team: string }} player - The player object, containing their team.
* @returns {{phase: GamePhase, dealer: PlayerRole, cards: Card[], trump: SuitConstant}} A new state fragment.
*/
function setupInitialState(player) {
// Access the prefixed property from the imported `TEAMS` object.
if (player.team === TEAMS.TEAM_NS) {
// ... team logic
}
// Prefixed constants are explicit and unambiguous.
return {
phase: GAME_PHASES.GAME_PHASE_LOBBY,
dealer: PLAYER_POSITIONS.PLAYER_SOUTH,
cards: CARD_VALUES,
trump: CARD_SUITS.CARD_SUIT_HEARTS,
};
}
Related Documents
Design Document: BharatSeva AI
BharatSeva AI is a multi-agent orchestration system built on AWS using Amazon Bedrock Agents with Claude 3.5 Sonnet as the foundation model. The system deploys 10 AI agents (1 Master Orchestrator + 9 Specialist Agents) to assist India's informal sector workers in navigating government schemes across three domains: PM Vishwakarma (artisan credit), PMFBY (crop insurance), and BOCW (construction worker welfare).
OpenClaw Enterprise Transformation Plan
Transform OpenClaw from a single-user personal AI assistant into a **dual-mode platform** that is simultaneously:
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Daniel Sandner, for article on https://sandner.art/
Qwen3-TTS — Model Reference
Models: `Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice` and `Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice`