Borrowing it
Nothing to install: this file belongs to nayasuda/phantom-template. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/nayasuda/phantom-template/main/.gemini/skills/coding-best-practices/SKILL.mdgit clone --depth 1 https://github.com/nayasuda/phantom-templateWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/nayasuda/phantom-template/coding-best-practices)<a href="https://agentmods.dev/skills/nayasuda/phantom-template/coding-best-practices"><img src="https://agentmods.dev/badge/skills/nayasuda/phantom-template/coding-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/nayasuda/phantom-template/coding-best-practices"><img src="https://agentmods.dev/badge/skills/nayasuda/phantom-template/coding-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.03150 |
| Opus 5.5 | $0.00000 | $0.01260 |
| Sonnet 5.5 | $0.00000 | $0.00630 |
| Haiku 4.5 | $0.00000 | $0.00315 |
Grade A, and why
coding-best-practices scanned grade A with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
response = requests.get(url) Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
result = subprocess.run( How it starts
The opening of the file, as written. The whole thing — 453 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Coding Best Practices Skill
Overview
このスキルは、Project Phantom での高品質なコード実装のためのベストプラクティスを提供します。Python を中心に、エラーハンドリング、API 呼び出し、ログ戦略、テスト手法をカバーします。
When to Use
- 新しいスクリプトや API を実装する時
- 既存コードのリファクタリング時
- コードレビューで品質を確認する時
- エラーハンドリングの改善が必要な時
Core Principles
1. Fail Fast, Fail Loudly
# ❌ Bad: Silent failure
def get_token():
token = os.environ.get("API_TOKEN")
return token # None if not set
# ✅ Good: Explicit error
def get_token():
token = os.environ.get("API_TOKEN")
if not token:
raise ValueError("API_TOKEN environment variable is not set")
return token
2. Always Use Timeouts
# ❌ Bad: No timeout (can hang forever)
response = requests.get(url)
# ✅ Good: With timeout
response = requests.get(url, timeout=30)
3. Log Important Events
import logging
logger = logging.getLogger(__name__)
# Log at appropriate levels
logger.debug("Detailed debug information")
logger.info("High-level progress update")
logger.warning("Something unexpected but recoverable")
logger.error("Error occurred", exc_info=True)
Error Handling Patterns
HTTP API Calls
import requests
from typing import Optional, Dict, Any
def call_api(
url: str,
method: str = "GET",
data: Optional[Dict[str, Any]] = None,
headers: Optional[Dict[str, str]] = None
) -> Optional[Dict[str, Any]]:
"""
Robust API call with comprehensive error handling.
Args:
url: The API endpoint
method: HTTP method (GET, POST, etc.)
data: Request payload
headers: HTTP headers
Returns:
Response JSON or None on error
"""
try:
response = requests.request(
method=method,
url=url,
json=data,
headers=headers,
timeout=30
)
# Check status code
if response.status_code == 200:
return response.json()
elif response.status_code == 201:
logger.info(f"Resource created: {url}")
return response.json()
elif response.status_code == 401:
logger.error("Authentication failed. Check your token.")
return None
elif response.status_code == 403:
logger.error("Permission denied. Check token scopes.")
return None
elif response.status_code == 404:
logger.error(f"Resource not found: {url}")
return None
elif response.status_code == 422:
logger.error(f"Validation error: {response.json()}")
return None
elif response.status_code >= 500:
logger.error(f"Server error ({response.status_code}): {response.text}")
return None
else:
logger.warning(f"Unexpected status {response.status_code}: {response.text}")
return None
except requests.exceptions.Timeout:
logger.error(f"Request timeout: {url}")
return None
except requests.exceptions.ConnectionError:
logger.error(f"Connection error: {url}")
return None
except requests.exceptions.RequestException as e:
logger.error(f"Request failed: {e}", exc_info=True)
return None
except Exception as e:
logger.error(f"Unexpected error: {e}", exc_info=True)
return None
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 453 lines · 0 tokens per session scan A b9e99859ef53
coding-best-practices is a skill published in the GitHub repository nayasuda/phantom-template (7 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,150 tokens. A static security scan graded it A with 2 findings (makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
sparc-methodology
SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) comprehensive development methodology with multi-agent orchestration.
agent-harness-fault-injection
Use when an agent workflow needs deterministic recovery evidence for sandbox, MCP/tool, worker, checkpoint, memory, or orchestration failures.
foundry-hosted-agent-validation
Step-by-step process for validating a Python Foundry hosted agent sample (under python/samples/04-hosting/foundry-hosted-agents/) end to end — running it locally (native runtime and azd ai agent run) and after deploying it to an Azure AI Foundry project with azd. Use this when asked to validate a hosted agent sample.
build-and-test
How to build and test .NET projects in the Agent Framework repository. Use this when verifying or testing changes.
verify-dotnet-samples
How to build, run and verify the .NET sample projects in the Agent Framework repository. Use this when a user wants to verify that the samples still function as expected.
oma-qa
Review changes for correctness, security, accessibility, and performance. Use for scoped quality reviews or verification plans; bug fixes use oma-debug.