com um clique
code-quality-excellence
// Enforces code quality standards for Black Trigram — maintainable, type-safe TypeScript with low complexity, organized imports, explicit error handling, and search-before-create discipline
// Enforces code quality standards for Black Trigram — maintainable, type-safe TypeScript with low complexity, organized imports, explicit error handling, and search-before-create discipline
Enforces systematic threat modeling for Black Trigram using STRIDE, MITRE ATT&CK, and attack trees — maintains THREAT_MODEL.md and FUTURE_THREAT_MODEL.md aligned with Hack23 Threat Modeling Policy and Secure Development Policy §3.2
Enforces C4 Architecture Model documentation standards for Black Trigram. Ensures ARCHITECTURE.md, DATA_MODEL.md, FLOWCHART.md, STATEDIAGRAM.md, MINDMAP.md, SWOT.md and their FUTURE_* variants are maintained with strategic, rule-based principles.
Enforces WCAG 2.1 Level AA accessibility for Black Trigram — semantic HTML, ARIA, keyboard navigation, 4.5:1/3:1 contrast, screen reader support, and prefers-reduced-motion for inclusive Korean martial arts gameplay
Enforces AI governance for Black Trigram — transparent and accountable AI-assisted development aligned with Hack23 AI Governance Policy, EU AI Act, NIST AI RMF, and Information Security Policy
Enforces data protection at every stage of its lifecycle for Black Trigram — classification, HTTPS/TLS 1.2+, CSP, SRI, minimal retention, aligned with Hack23 Data Classification Policy and GDPR Articles 5, 25, 32
Enforces consistent documentation standards for Black Trigram — JSDoc/TSDoc completeness, architecture currency, bilingual Korean-English content, and security documentation updates
| name | code-quality-excellence |
| description | Enforces code quality standards for Black Trigram — maintainable, type-safe TypeScript with low complexity, organized imports, explicit error handling, and search-before-create discipline |
| license | MIT |
Strategic Principle: High-quality code is reusable, type-safe, maintainable, and testable by design.
Enforce code quality standards for Black Trigram, ensuring every line of code contributes to a maintainable, secure, and efficient codebase following Hack23 AB standards.
Reference: Hack23 ISMS Secure Development Policy
IF (creating new code)
THEN (search existing src/types/, src/utils/, src/components/ first)
ELSE (reject duplicate code - extend existing implementations)
IF (any TypeScript code)
THEN (no 'any' types, no type assertions without justification, readonly properties for interfaces)
ELSE (reject - type safety is non-negotiable)
IF (function cyclomatic complexity > 10 OR lines > 50)
THEN (refactor into smaller, focused functions)
ELSE (maintain single responsibility principle)
IF (import statements in file)
THEN (organize: 1) React/Three.js 2) External libs 3) Internal modules 4) Types 5) Constants)
ELSE (maintain consistent import ordering)
IF (operation can fail: async, DOM access, external data)
THEN (handle errors explicitly with try/catch or null coalescing)
ELSE (unhandled errors crash the game)
src/types/ → Type definitions (constants.ts, common.ts)
src/utils/ → Utility functions
src/components/ui/ → Reusable UI components
src/systems/ → Game systems (combat, audio)
src/hooks/ → Custom React hooks
// ✅ GOOD: Strict types with readonly
export interface CombatResult {
readonly damage: number;
readonly stanceBonus: number;
readonly vitalPointHit: boolean;
readonly effects: readonly StatusEffect[];
}
// ❌ BAD: Loose types
interface CombatResult {
damage: any;
stanceBonus: number;
vitalPointHit: boolean;
effects: StatusEffect[];
}
// ✅ GOOD: Null coalescing
const playerName = player?.name ?? 'Unknown';
const damage = calculateDamage(attack) ?? 0;
// ❌ BAD: Truthy check (misses 0, '')
const damage = calculateDamage(attack) || 0;
// ✅ GOOD: Small, focused, typed
export function calculateEffectiveDamage(
baseDamage: number,
stanceMultiplier: number,
archetypeBonus: number,
): number {
return Math.round(baseDamage * stanceMultiplier * (1 + archetypeBonus));
}
// ❌ BAD: Large function doing too many things
export function combat(attacker: any, defender: any) {
// 100+ lines of mixed concerns
}
as any type assertionsvalue!) without justificationconsole.log in production code (use proper logging)| Metric | Target | Tool |
|---|---|---|
| TypeScript errors | 0 | npm run check |
| ESLint warnings | 0 | npm run lint |
| Test coverage | >90% | npm run coverage |
| Unused code | 0 | npm run find:unused |
| License compliance | 100% | npm run test:licenses |
흑괘의 품질 - Quality of the Black Trigram