Skip to content
Back to skills

Collection

ASecurity

Codify reusable pygame patterns for entities, projectiles, movement, and sprite handling. Use when implementing pygame entities or systems that need frame-independent physics, collision detection, or sprite management. References verified patterns from project implementation.

  • 24 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 8, 2026
testingpythonbashtestingapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-081ab6f0/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-081ab6f0)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pygame-patterns
description: Codify reusable pygame patterns for entities, projectiles, movement, and sprite handling. Use when implementing pygame entities or systems that need frame-independent physics, collision detection, or sprite management. References verified patterns from project implementation.
allowed-tools: Read, Grep, Glob
---

# Pygame Patterns Skill

Provides tested, verified pygame patterns from this project. Use when implementing new entities or systems to ensure consistency and correctness.

## Core Principles

1. **Frame-Independent Movement**: All movement uses delta_time for consistent speed regardless of framerate
2. **Verified Patterns Only**: All patterns come from working code in this project
3. **Config-Driven**: Use centralized config.py dataclasses, never hardcode values
4. **Angle Conventions**: 0° = right, 90° = up, 180° = left, 270° = down (pygame Y-axis is inverted)

## Available Patterns

### Projectiles
See [patterns/projectiles.md](patterns/projectiles.md) for:
- Spawning projectiles at entity position with direction
- Frame-independent projectile movement (velocity vectors)
- Circle collision detection
- Lifetime management and despawning
- Converting angles to velocity vectors (accounting for pygame Y-axis)

## Instructions

### Step 1: Identify the Pattern Needed

Determine which pattern matches your implementation:
- **Projectile system**: spawning, movement, collision → Use projectiles.md
- **Entity movement**: WASD, smooth rotation → See player.py:129-155
- **Sprite loading**: error handling, fallbacks → See utils.py:10-27
- **Collision detection**: circle-based → See game.py collision logic

### Step 2: Reference the Pattern

Read the pattern documentation:
```bash
Read .claude/skills/pygame-patterns/patterns/<pattern>.md
```

Or examine the existing implementation:
```bash
Read src/entities/<entity>.py
```

### Step 3: Verify with Documentation

**CRITICAL**: Before implementing, verify pygame APIs with ref.tools:
- Check pyproject.toml for pygame version
- Use ref_search_documentation for API verification
- Confirm function signatures and parameters

### Step 4: Apply the Pattern

Follow the pattern structure:
1. Add config dataclass to src/config.py (no hardcoded values)
2. Import necessary pygame modules
3. Use delta_time for frame-independent calculations
4. Add logging for entity lifecycle events
5. Follow angle conventions (0° = right, pygame Y-inverted)

## Pattern Verification Checklist

Before using a pattern:
- [ ] Read the pattern documentation
- [ ] Verify pygame APIs with ref.tools if using new functions
- [ ] Check that config values are in config.py
- [ ] Understand coordinate system (pygame Y-axis inverted)
- [ ] Test frame-independence (should work at any FPS)

## Example Usage

When implementing a projectile entity:

1. **Read the pattern**:
   ```
   Read .claude/skills/pygame-patterns/patterns/projectiles.md
   ```

2. **Follow the structure**:
   - Create ProjectileConfig in config.py
   - Spawn at entity position with angle
   - Convert angle → velocity (cos/sin, negative Y)
   - Update position with delta_time
   - Check lifetime and collisions

3. **Verify angle math**:
   ```python
   # 0° = right, 90° = up (pygame Y is inverted)
   angle_rad = math.radians(angle)
   velocity_x = math.cos(angle_rad) * speed
   velocity_y = -math.sin(angle_rad) * speed  # negative for pygame
   ```

## Integration with Other Skills

- **python-testing**: Use to generate tests for entity movement and collision
- **entity-builder**: Use this skill to inform entity generation patterns
- **game-artist**: Use patterns for sprite loading and rotation

## Current Project Patterns

Verified patterns from implemented code:
- **Player rotation**: src/entities/player.py:129-155 (smooth rotation, angle wrap)
- **Sprite loading**: src/utils.py:10-27 (error handling, fallbacks)
- **Collision detection**: Circle-based (used in player-zombie and player-powerup)
- **Frame-independent movement**: All entities use delta_time * speed

## Quality Standards

All patterns must:
- Be frame-independent (use delta_time)
- Use centralized config (no magic numbers)
- Include logging for entity events
- Handle pygame Y-axis inversion correctly
- Be verified from working code

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.