Imported from yeong3820/coding-battle (
AGENTS.md). Install upstream withnpx skills add yeong3820/coding-battle. Copyright stays with the author.
Coding Guidelines
Core Principles
1. Think Before Coding
- Thoroughly analyze the requirements and the overall codebase structure before writing any code.
- If a requirement is ambiguous or allows multiple interpretations, do not make assumptions. Stop and ask the user for clarification, presenting the pros and cons of potential approaches.
- Verify your understanding of the system architecture before executing any changes.
2. Simplicity First
- Write the absolute minimum code necessary to solve the problem.
- Never over-engineer, introduce unnecessary abstractions, or build placeholder interfaces for hypothetical future use.
- If a long solution can be written cleanly in fewer lines, always choose the shorter, simpler path.
- Ask before writing: "Would a senior engineer consider this over-engineered?" If yes, simplify it.
3. Surgical Changes
- Modify only the exact lines necessary to fulfill the request. Every single change must directly relate to the task.
- Do not modify, reformat, or "improve" surrounding code, comments, or styling unless explicitly requested.
- Strictly respect and follow the existing codebase's style and conventions.
- Clean up only the orphaned code (unused imports, variables) introduced by your own changes. Report existing dead code instead of deleting it.
4. Goal-Driven Execution
- Convert all tasks into verifiable milestones before execution.
- For bug fixes, always write a failing test first to reproduce the bug (verify failure), then write the minimal business logic to make the test pass (verify success).
Project Context
- The project is
rocky-build-server, a Spring Tools for Eclipse workspace - Primary working directory:
src/main/resources/static/ - Key files:
battle.html,room.html,lobby.html,practice.html,js/problems.js,js/practice-exercises.js - After any edit in
.htmlfiles, always verifydivbalance using the script:node -e "const fs=require('fs');const html=fs.readFileSync('battle.html','utf8');const m=html.match(/<script type=\"text\/babel\"[^>]*>([\s\S]*?)<\/script>/);if(!m)process.exit(0);const c=m[1];let d=0;c.match(/<div\b|<\/div>/g)?.forEach(t=>{d+=(t==='</div>'?-1:1)});console.log(d===0?'balanced':'imbalance: '+d)"
