.claude/skills/architecture-reference/SKILL.md
Deep-dive reference for Shadow Master subsystems including Combat, Matrix, Rigging, Inventory, Contacts, Sync, and Security. Use when working on specific game mechanics or need detailed file locations for a subsystem.
npx skillsauth add Jasrags/ShadowMaster architecture-referenceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Detailed documentation for Shadow Master's core subsystems. For high-level architecture overview, see CLAUDE.md.
Full combat tracking with initiative, actions, and damage resolution.
Key Concepts:
Critical Files:
/lib/combat/CombatSessionContext.tsx - Combat state management/lib/rules/action-resolution/ - Action execution framework
action-executor.ts - Core execution logicaction-validator.ts - Action validationdice-engine.ts - Dice rolling enginepool-builder.ts - Dice pool constructionedge-actions.ts - Edge spending actionscombat/ - Combat-specific handlers (damage, weapons)/app/api/combat/ - Combat session API endpoints/components/combat/ - Combat UI (tracker, dice pools, quick reference)Full matrix hacking with overwatch, marks, and program management.
Key Concepts:
Critical Files:
/lib/rules/matrix/ - Matrix operations
cyberdeck-validator.ts - Hardware validationprogram-validator.ts - Program allocationoverwatch-calculator.ts - OS calculationoverwatch-tracker.ts - Session trackingmark-tracker.ts - Mark managementaction-validator.ts - Matrix action validationdice-pool-calculator.ts - Matrix dice poolsVehicle and drone control for riggers.
Key Concepts:
Critical Files:
/lib/rules/rigging/ - Rigging mechanics
vcr-validator.ts - VCR validationrcc-validator.ts - RCC validation and slavingdrone-network.ts - Network managementdrone-condition.ts - Drone damage trackingjumped-in-manager.ts - Jump-in modebiofeedback-handler.ts - Biofeedback damagenoise-calculator.ts - Signal noise calculationsaction-validator.ts - Rigging action validationdice-pool-calculator.ts - Vehicle/drone dice poolsEquipment state management for gear, weapons, and devices.
Key Concepts:
Critical Files:
/lib/rules/inventory/state-manager.ts - Equipment state management/lib/rules/gear/validation.ts - Gear availability validation/lib/rules/gear/weapon-customization.ts - Weapon modificationsRuntime calculations for combat and tests.
Key Concepts:
Critical Files:
/lib/rules/gameplay.ts - Core gameplay calculations/lib/rules/constraint-validation.ts - Creation constraint validationPre-built NPC templates for GMs with professional rating tiers.
Key Concepts:
Critical Files:
/lib/rules/grunts.ts - Grunt mechanics and validation/lib/storage/grunt-templates.ts - Template persistence/data/editions/{editionCode}/grunt-templates/ - PR0-PR6 template files/app/campaigns/[id]/grunt-teams/ - Team management UI/app/api/campaigns/[id]/grunt-teams/ - Grunt team APIContact relationships and favor economy for social gameplay.
Key Concepts:
Critical Files:
/lib/rules/contact-network.ts - Contact relationship logic/lib/rules/favors.ts - Favor economy system/lib/rules/social-actions.ts - Social interaction mechanics/lib/storage/contacts.ts - Contact persistence/lib/storage/favor-ledger.ts - Favor tracking/app/api/characters/[characterId]/contacts/ - Contact APICharacter-ruleset drift detection and migration.
Key Concepts:
Critical Files:
/lib/rules/sync/ - Synchronization system
drift-analyzer.ts - Change detectionlegality-validator.ts - Rule compliance checkingmigration-engine.ts - Migration planning and executionsync-audit.ts - Audit trailhooks.ts - React hooks for client-side syncCampaign-level rule customization.
Key Concepts:
Critical Files:
/lib/rules/optional-rules.ts - Optional rule managementAuthentication State (/lib/auth/AuthProvider.tsx):
useAuth() hook for componentsRuleset State (/lib/rules/RulesetContext.tsx):
useRuleset(), useMetatypes(), useSkills(), etc./api/rulesets/[editionCode]Sidebar State (/lib/contexts/SidebarContext.tsx):
useSidebar() hook with: isOpen, isCollapsed, toggle, close, toggleCollapseshadow-master-sidebar-collapsed-global)AuthenticatedLayoutLocal Storage:
Design: JSON files on disk with atomic writes (temp file + rename pattern)
Storage Layer (/lib/storage/):
Core modules:
base.ts - Core utilities: readJsonFile(), writeJsonFile(), ensureDirectory()users.ts - User CRUD operationscharacters.ts - Character CRUD + specialized operations (damage, karma, etc.)campaigns.ts - Campaign CRUD operationseditions.ts - Edition and ruleset loadingExtended modules:
contacts.ts, favor-ledger.ts - Contact system persistencecombat.ts, action-history.ts - Combat session storagegrunt-templates.ts, grunts.ts - NPC system storagenotifications.ts, activity.ts - User activity trackingaudit.ts, user-audit.ts - Audit trail loggingruleset-snapshots.ts, snapshot-cache.ts - Ruleset versioninglocations.ts, locations_connections.ts - Campaign location storagesocial-capital.ts - Social capital trackingviolation-record.ts - Rule violation trackingStorage Structure:
/data
├── /users/{userId}.json
├── /characters/{userId}/{characterId}.json
├── /campaigns/{campaignId}.json
└── /editions/{editionCode}/
├── edition.json
├── core-rulebook.json
├── {sourcebook}.json
└── /grunt-templates/
└── pr{0-6}-{name}.json
Important: This is NOT production-scalable. File I/O happens on every request. Future migration to a database is planned.
Rate Limiting (/lib/security/rate-limit.ts):
Audit Logging (/lib/security/audit-logger.ts):
/lib/storage/audit.tsCharacter Authorization (/lib/auth/character-authorization.ts):
Additional Auth Modules (/lib/auth/):
validation.ts - Auth validation logicmiddleware.ts - Auth middlewarecampaign.ts - Campaign-specific authorizationemail-verification.ts - Email verification token handlingAdmin User Management (/app/api/users/[id]/):
lockout/route.ts - DELETE to clear login lockoutsresend-verification/route.ts - POST to resend verification emails (rate limited)verify-email/route.ts - POST to manually verify user emailsuspend/route.ts - POST/DELETE to suspend/reactivate accountsAdmin UI (/app/users/):
UserTable.tsx - User list with lockout/verification badges and menu actionsUserEditModal.tsx - User details with lockout info and verification controlsUserAuditModal.tsx - User audit trail viewerAll API routes follow this pattern:
getSession()getUserById()Example:
// /app/api/characters/route.ts
export async function GET(request: NextRequest) {
const session = await getSession();
if (!session?.userId) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
const user = getUserById(session.userId);
if (!user) {
return NextResponse.json({ error: "User not found" }, { status: 404 });
}
const characters = getUserCharacters(session.userId);
return NextResponse.json({ characters });
}
testing
# Verify Reference Data Run the hybrid verification pipeline to compare extracted reference material against edition data files. ## Usage ``` /verify-reference # Run all mapping configs /verify-reference street-gear-weapons-armor # Run specific mapping by name /verify-reference --fix # Run and attempt semantic fixes ``` ## Phase 1 — Structural Verification (Script) Run `pnpm verify-reference` to execute structural checks: ```bash # All mappings p
testing
Test infrastructure reference for Shadow Master. Use when writing tests, finding existing test files, or running test suites. Covers Vitest unit tests, Playwright E2E tests, and testing patterns.
development
# Ship Current Work 1. Run `npm run typecheck` and fix any TypeScript errors 2. Run `npm test` and fix any test failures 3. Run `git status` to review changes 4. Create a descriptive commit with conventional commit format (feat:, fix:, etc.) 5. Push to the current feature branch 6. Create a PR using `gh pr create` with a descriptive title and body referencing the GitHub issue 7. Report the PR URL Never commit to main. If on main, ask the user for a branch name first.
content-media
Redesigns character sheet display components to match the character creation card aesthetic. Use when updating any component in /components/character/sheet/ to use grouped sections, value pills, and the established dark-mode-first color system.