一键导入
debugging
Use when debugging test failures, runtime errors, or unexpected behavior in the GAC project. Covers pytest debugging, logging, and common patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when debugging test failures, runtime errors, or unexpected behavior in the GAC project. Covers pytest debugging, logging, and common patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when adding a new AI provider to the GAC project (e.g. a new OpenAI-compatible inference service, Anthropic-compatible endpoint, or OAuth-based provider). Lists every file that must be created or edited and the exact registration steps required for the provider to appear in the registry, the `uvx gac init` flow, the README, and the test suite.
Use when formatting, linting, type checking, or reviewing code quality in the GAC project. Covers ruff, mypy, Makefile targets, and coding standards.
Use when navigating the GAC codebase, finding where code lives, or understanding the project structure. 106 source files, 151 test files.
Use when running, writing, or debugging tests in the GAC project. Covers test structure, pytest commands, provider testing patterns, and integration vs unit test practices.
基于 SOC 职业分类
| name | debugging |
| description | Use when debugging test failures, runtime errors, or unexpected behavior in the GAC project. Covers pytest debugging, logging, and common patterns. |
| tags | ["debugging","troubleshooting","logs"] |
uv run -- pytest tests/test_cli.py -v # Verbose
uv run -- pytest tests/test_cli.py -vv # Extra verbose
uv run -- pytest tests/test_cli.py -s # Show print statements
uv run -- pytest tests/test_cli.py -x # Stop on first failure
uv run -- pytest tests/test_cli.py --pdb # Debugger on failure
uv run -- pytest tests/test_cli.py --tb=long # Full traceback
uv run -- pytest tests/test_cli.py --showlocals # Local variables
# Run specific mocked test
uv run -- pytest tests/providers/test_openai.py::TestOpenAIProviderMocked::test_successful_api_call -vvv
# API key validation tests
uv run -- pytest tests/providers/test_openai.py -k "APIKey" -v
Note: The standard mocked test is test_successful_api_call (NOT test_successful_call).
# Dry run with verbose
gac --dry-run -v
# Message only (no commit)
gac --dry-run --message-only
# Show the prompt sent to LLM
gac --show-prompt --dry-run
# Enable debug logging
GAC_LOG_LEVEL=DEBUG uv run python -m gac.cli --dry-run -v
# Or via CLI flag
uv run python -m gac.cli --log-level DEBUG --dry-run
Note: There is NO GAC_DEBUG env var. Use GAC_LOG_LEVEL=DEBUG or --log-level DEBUG.
# Check which model/provider is configured
uv run python -c "import os; print({k:v for k,v in os.environ.items() if k.startswith('GAC_')})"
# Check stats file location
uv run python -c "from gac.stats.store import STATS_FILE; print(STATS_FILE)"
# Check OAuth token storage
uv run python -c "from gac.oauth.token_store import TOKEN_DIR; print(TOKEN_DIR)"
Always mock stats paths when debugging outside pytest:
from unittest.mock import patch
import tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as tmpdir:
with patch("gac.stats.store.STATS_FILE", Path(tmpdir) / "debug.json"):
from gac.stats import save_stats
save_stats({"model": "test"}) # safe — writes to temp
import pdb; pdb.set_trace() # Breakpoint
# Conditional
if data.get("error"):
import pdb; pdb.set_trace()
Remove debug breakpoints before committing.
Use logging, not print():
import logging
logger = logging.getLogger(__name__)
def parse_response(response: dict[str, Any]) -> str:
logger.debug("Received response keys: %s", list(response.keys()))
return response.get("message", {}).get("content", "")
Enable HTTP debugging for provider issues:
GAC_LOG_LEVEL=DEBUG uv run -- pytest tests/providers/test_openai.py -vv -s
[ ] Using -v / -s / --pdb for test debugging?
[ ] Using GAC_LOG_LEVEL=DEBUG (not GAC_DEBUG)?
[ ] Mocking stats paths outside pytest?
[ ] Removing debug code before committing?
[ ] Provider test name is test_successful_api_call?