Skip to content

Instantly share code, notes, and snippets.

@kamkom
kamkom / snake-spec
Created June 21, 2026 10:43
snake-spec
# Specification: Browser-Based Snake Game
## 1. Overview
The application is a simple browser-based Snake game. The player controls a snake that moves around the game area, collects food, and gains points. The game ends when the player reaches **10 points**, collides with the wall, or collides with the snake’s own body.
## 2. Game Objective
The objective is to collect food items to increase the score. Each collected food item gives the player **1 point**. When the player reaches **10 points**, the game ends successfully.
---
name: comment-code
description: Write clear, useful in-code comments and documentation that capture what the code cannot say for itself. Use this skill whenever writing or revising comments, docstrings, interface/API documentation, function or class headers, or inline explanations — and whenever reviewing code for comment quality or being asked to "document," "add comments," "explain in comments," or improve existing comments. Apply it even when the request only mentions writing the code, since fresh code is the moment to document it well.
---
# Writing Good Code Comments
Comments exist to capture information that was in the writer's mind but cannot be expressed in the code itself. Code states *what happens* mechanically; comments supply intent, contracts, rationale, units, invariants, and the higher-level picture. Good comments make a system understandable to someone reading it for the first time and let abstractions hide complexity. The cost is small — typically a fraction of development time — and it