スキル一覧に戻る
a-jay85

basketball-stats

by a-jay85

0🍴 1📅 2026年1月22日
GitHubで見るManusで実行

SKILL.md


name: basketball-stats description: Basketball statistics formatting using BasketballStats\StatsFormatter for percentages, averages, and totals. Use when displaying stats, calculating averages, or formatting basketball numbers.

Basketball Statistics Formatting

Use BasketballStats\StatsFormatter for ALL statistic formatting. Never use number_format() directly.

Available Methods

formatPercentage($made, $attempted)

Shooting percentages with 3 decimal places.

echo StatsFormatter::formatPercentage($fgm, $fga);  // "0.523"
echo StatsFormatter::formatPercentage($ftm, $fta);  // "0.875"
echo StatsFormatter::formatPercentage($tgm, $tga);  // "0.412"

formatPerGameAverage($total, $games)

Per-game stats with 1 decimal place.

echo StatsFormatter::formatPerGameAverage($points, $gamesPlayed);  // "25.3" PPG
echo StatsFormatter::formatPerGameAverage($assists, $gamesPlayed); // "7.2" APG
echo StatsFormatter::formatPerGameAverage($rebounds, $gamesPlayed); // "10.1" RPG

formatPer36Stat($total, $minutes)

Per-36-minute stats with 1 decimal place.

echo StatsFormatter::formatPer36Stat($points, $totalMinutes);  // "18.5"
echo StatsFormatter::formatPer36Stat($rebounds, $totalMinutes); // "8.3"

formatTotal($value)

Counting stats with comma separators.

echo StatsFormatter::formatTotal($careerPoints);   // "12,345"
echo StatsFormatter::formatTotal($careerRebounds); // "5,678"

formatAverage($value)

General averages with 2 decimal places.

echo StatsFormatter::formatAverage($playerRating); // "85.23"

calculatePoints($fgm, $ftm, $tgm)

Calculate point totals from shot makes.

$points = StatsFormatter::calculatePoints($fgm, $ftm, $tgm);
// Formula: (2 * FGM) + FTM + TGM

safeDivide($numerator, $denominator)

Division with zero-division handling.

$avg = StatsFormatter::safeDivide($total, $games); // Returns 0 if games=0

Usage Example

use BasketballStats\StatsFormatter;

// Player stat line
$fgPct = StatsFormatter::formatPercentage($player['fgm'], $player['fga']);
$ppg = StatsFormatter::formatPerGameAverage($player['pts'], $player['gp']);
$rpg = StatsFormatter::formatPerGameAverage($player['reb'], $player['gp']);

echo "FG%: $fgPct | PPG: $ppg | RPG: $rpg";
// Output: "FG%: 0.485 | PPG: 18.5 | RPG: 7.2"

Input Validation

Use BasketballStats\StatsSanitizer for input validation:

use BasketballStats\StatsSanitizer;

$playerId = StatsSanitizer::sanitizeInt($_GET['pid']);
$rating = StatsSanitizer::sanitizeFloat($_POST['rating']);
$name = StatsSanitizer::sanitizeString($_POST['name']);

Examples

See examples/ for more patterns:

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です