

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345678# Coding Standards910## Python Style Guidelines1112This document outlines the coding standards for the mtg-utils project. Following these guidelines ensures consistent, maintainable code across the project.1314---1516## Style Requirements1718### Code Style1920- **PEP 8 compliance** is required for all Python code21- **Line length**: Maximum 120 characters (configured in `ruff`)22- **Indentation**: 4 spaces per indentation level23- **String quotes**: Use double quotes `"` for consistency2425### Naming Conventions2627| Type | Convention | Example |28|------|-----------|---------|29| Functions/Methods | snake_case | `check_missing_cards` |30| Classes | PascalCase | `CardLibrary` |31| Variables | snake_case | `deck_list` |32| Constants | UPPER_SNAKE_CASE | `MAX_DECK_SIZE` |33| Modules | snake_case | `moxfield_api.py` |3435### Imports3637Imports should be organized in the following order:38391. Standard library imports402. Third-party imports (e.g., click, rich, requests)413. Local project imports4243```python44# Standard library45import os46import json4748# Third-party49import click50from rich.console import Console5152# Local project53from mtg_utils.utils.console import console54```5556---5758## Type Hints5960Type hints are **required** for all function signatures:6162```python63# ✅ GOOD64def check_missing_cards(deck_file: str, binder_cards: list[str]) -> list[str]:65 pass6667# ❌ BAD68def check_missing_cards(deck_file, binder_cards):69 pass70```7172### Type Hint Rules7374- Always specify parameter types75- Always specify return type (use `-> None` for functions that don't return)76- Use `list[str]`, `dict[str, Any]`, etc. for generic types77- Use `Optional[T]` for nullable types7879---8081## Docstrings8283All public functions, classes, and modules should have docstrings:8485```python86def check_missing_cards(deck_file: str, binder_cards: list[str]) -> list[str]:87 """88 Check which cards are missing from the binder collection.8990 Args:91 deck_file: Path to the decklist file92 binder_cards: List of cards in the binder collection9394 Returns:95 List of card names that are missing96 """97 pass98```99100---101102## Error Handling103104- Use specific exception types when possible105- Provide meaningful error messages106- Handle file I/O errors gracefully107108```python109# ✅ GOOD110def read_deck_list(path: str) -> list[str]:111 try:112 with open(path, 'r') as f:113 return [line.strip() for line in f if line.strip()]114 except FileNotFoundError:115 console.print(f"[bold red]Error:[/bold red] Deck file not found: {path}")116 raise117118# ❌ BAD119def read_deck_list(path: str) -> list[str]:120 with open(path, 'r') as f:121 return f.readlines()122```123124---125126## Console Output127128Use the `rich` library for formatted console output:129130```python131from rich.console import Console132from rich.table import Table133from mtg_utils.utils.console import console134135# Use console.print() instead of print()136console.print("[bold green]Success![/bold green]")137138# Use rich formatting for tables and panels139table = Table(title="Deck Comparison")140table.add_column("Card", style="cyan")141table.add_column("Count", style="magenta")142```143144---145146## Configuration147148Configuration is loaded from `config.json` using Pydantic models:149150```python151from mtg_utils.utils.config import Config, DeckConfig152153# Load configuration154config = Config.from_file("config.json")155156# Access configuration157for name, deck in config.decks.items():158 console.print(f"Deck: {name}")159```160161---162163## File I/O164165- Use `with open()` for all file operations166- Prefer text mode for card files167- Handle encoding explicitly (UTF-8)168169```python170# ✅ GOOD171def write_card_list(path: str, cards: list[str]) -> None:172 with open(path, 'w', encoding='utf-8') as f:173 f.write('\n'.join(sorted(cards)))174175# ❌ BAD176open('file.txt', 'w').write(cards)177178```
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| gasbasd/mtg-utils.clinerules/05-cli-workflows.md · 0 | Cline rules | setuparch | 54/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/01-project-overview.md · 0 | Cline rules | setuptestlint-formatarch | 89/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/03-testing-standards.md · 0 | Cline rules | testarchtypestesting-strategy+1 | 66/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/04-security-practices.md · 0 | Cline rules | setupstylesecuritydo-not | 61/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/06-version-control.md · 0 | Cline rules | testlint-formatstyletypes+4 | 62/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/memory-bank.md · 0 | Cline rules | archperformancedocs | 58/100 | 8 days ago | |
| gasbasd/mtg-utils.github/copilot-instructions.md · 0 | Copilot instructions | setupbuildtestlint-format+3 | 89/100 | 8 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| enuno/unifi-mcp-server.clinerules · 226 | Cline rules | setuptestlint-formatstyle+10 | 96/100 | today | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| u9401066/pubmed-search-mcp.clinerules/50-pubmed-project.md · 25 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| ryok/python-boilerplate.clinerules/common-commands.md · 0 | Cline rules | setupbuildtestlint-format+3 | 90/100 | 13 days ago | |
| gasbasd/mtg-utils.clinerules/01-project-overview.md · 0 | Cline rules | setuptestlint-formatarch | 89/100 | 8 days ago | |
| u9401066/pubmed-search-mcp.clinerules/60-pubmed-python.md · 25 | Cline rules | setuptestlint-formatstyle+2 | 86/100 | 14 days ago | |
| u9401066/pubmed-search-mcp.clinerules/00-project.md · 25 | Cline rules | testlint-formatstylearch+1 | 86/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/gasbasd-mtg-utils-clinerules-02-coding-standards)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.