Borrowing it
Nothing to install: this file belongs to rinerebox1/deno-gemini-grounding-mcp-server. 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/rinerebox1/deno-gemini-grounding-mcp-server/main/.gemini/commands/safe-refactor.mdgit clone --depth 1 https://github.com/rinerebox1/deno-gemini-grounding-mcp-serverWrote 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/commands/rinerebox1/deno-gemini-grounding-mcp-server/safe-refactor)<a href="https://agentmods.dev/commands/rinerebox1/deno-gemini-grounding-mcp-server/safe-refactor"><img src="https://agentmods.dev/badge/commands/rinerebox1/deno-gemini-grounding-mcp-server/safe-refactor/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/commands/rinerebox1/deno-gemini-grounding-mcp-server/safe-refactor"><img src="https://agentmods.dev/badge/commands/rinerebox1/deno-gemini-grounding-mcp-server/safe-refactor.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.01258 |
| Opus 5 | $0.00000 | $0.00629 |
| Sonnet 5 | $0.00000 | $0.00252 |
| Haiku 4.5 | $0.00000 | $0.00126 |
Grade A, and why
safe-refactor scanned grade A with 0 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 9d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.
安全なリファクタリング
テストカバレッジを維持しながら、コードを安全にリファクタリングします。template/ディレクトリの実装パターンを参考にして、コードの品質と保守性を向上させます。
基本原則
- テストが通ることを確認 - リファクタリング前後でテストが通ることを保証
- 小さなステップで進める - 一度に大きな変更を加えない
- パターンの参照 - template/ディレクトリの実装例を参考にする
- コミットの頻度 - 各リファクタリングステップでコミット
リファクタリングの種類と手順
1. 型安全性の向上
参考: @template/src/template_package/types.py
# Before: 辞書をそのまま使用
def process_item(item: dict) -> dict:
return {"id": item["id"], "processed": True}
# After: TypedDictを使用
from typing import TypedDict
class ItemDict(TypedDict):
id: int
name: str
value: int
class ProcessedItemDict(ItemDict):
processed: bool
def process_item(item: ItemDict) -> ProcessedItemDict:
return {**item, "processed": True}
2. エラーハンドリングの改善
参考: @template/src/template_package/core/example.py
# Before: 単純なエラー
if not data:
raise ValueError("Invalid data")
# After: 具体的で実用的なエラー
if not data:
raise ValueError(
f"Data cannot be empty when validation is enabled. "
f"Either provide valid data or set validate=False."
)
3. ロギングの追加
参考: @template/src/template_package/utils/logging_config.py
from project_name.utils.logging_config import get_logger
logger = get_logger(__name__)
def process_data(data: list) -> list:
logger.debug(f"Processing {len(data)} items")
try:
result = [transform(item) for item in data]
logger.info(f"Successfully processed {len(result)} items")
return result
except Exception as e:
logger.error(f"Failed to process data: {e}", exc_info=True)
raise
4. テストの追加・改善
参考: @template/tests/
- 単体テスト: 正常系・異常系・エッジケース
- プロパティベーステスト: Hypothesisを使用した自動テスト
- 統合テスト: コンポーネント間の連携
5. パフォーマンスの最適化
参考: @template/src/template_package/utils/profiling.py
from project_name.utils.profiling import profile, timeit
@timeit
def optimized_function(data: list) -> list:
# リスト内包表記を使用
return [item * 2 for item in data if item > 0]
@profile
def heavy_computation():
# プロファイリング対象の処理
pass
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.
- 9d ago First seen · 141 lines · 0 tokens per session scan A 93d2d3297573
safe-refactor is a command published in the GitHub repository rinerebox1/deno-gemini-grounding-mcp-server (0 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,258 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.
Other commands, from other repositories
sdd-init
Initialize SDD context — detects project stack and bootstraps persistence backend.
review-branch
Review the current branch's diff against base by dispatching atomic-reviewer. No orchestration loop, no spec required — pre-flight before /commit pr or /commit merge.
init
Install the formatters this repository needs, with every command visible before it runs.
merge-conflict-analysis
You are analyzing merge conflicts for PR #${{ pr-number }}.
repo-audit
Audit a codebase (local or remote GitHub/GitLab) against architecture principles and requirements, surfacing drift, risk, and missing decisions.
argos
A command for checking whether an implementation matches its design deliverables. Its Korean description compares the work to the design as part of a completion inspection.