/economist-agents:python-qualityfrom economist-agents
Python coding standards for the economist-agents multi-agent pipeline. Use when writing new Python code, when reviewing PRs for code quality, when configuring linting and type checking.
Ships in economist-agents. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Coding standards for the economist-agents content pipeline. Type hints mandatory, docstrings required, orjson not json, logger not print(). All code must pass ruff, mypy, and pytest before commit.
quality-gatestestingmcp-developmentdict[str, Any] for JSON, T | None for nullable. Run mypy.orjson for JSON serialization, never json.logger for output, never print(). Use logging.getLogger(__name__).except:. Catch APIError, JSONDecodeError, etc.with open(...).def f(items: list | None = None), never def f(items=[])..env + os.getenv() only.# Standard library
import logging
from pathlib import Path
from typing import Any
# Third-party
import orjson
from anthropic import Anthropic
# Local
from scripts.validation import validate_agent_output
logger = logging.getLogger(__name__)
AGENT_PROMPT = """You are a research agent..."""
def run_agent(client: Anthropic, topic: dict[str, Any]) -> dict[str, Any]:
"""Run agent with structured output.
Args:
client: Anthropic API client.
topic: Topic dictionary with title and description.
Returns:
Agent output with content and usage keys.
Raises:
APIError: If API call fails after retries.
"""
try:
response = client.messages.create(...)
return {"content": response.content, "usage": response.usage}
except APIError as e:
logger.error("Agent API call failed: %s", e)
raise
def save_output(data: dict[str, Any], path: Path) -> None:
"""Save agent output to JSON."""
with open(path, "wb") as f:
f.write(orjson.dumps(data, option=orjson.OPT_INDENT_2))
ruff format . # Format
ruff check . # Lint
mypy scripts/ # Type check
pytest tests/ -v --cov=scripts --cov-report=term-missing # Test
| Rationalization | Reality |
|---|---|
"json is in the stdlib, why add a dependency?" | orjson is 10x faster and handles bytes natively — agent pipelines serialize constantly |
"print() is fine for debugging" | print() in production code bypasses log levels, can't be filtered, and breaks structured logging |
"Any type is easier" | Any defeats the purpose of type checking — use specific types for agent inputs/outputs |
| "Docstrings are overhead for internal functions" | Internal functions become public when agents compose them — docstrings are the API contract |
| "We'll add type hints later" | Type hints later means mypy debt later; adding them at write time costs 5% more, removing debt costs 50% more |
import json instead of import orjsonprint() used for error reporting or loggingexcept: clausedef f(items=[]))from module import *)pandas used instead of polars for data framesbreakpoint() statementsmypy scripts/ passes with zero errorsdef without preceding docstringorjson used for JSON — evidence: grep -r "import json" scripts/ returns empty (excluding tests)logger used, not print() — evidence: grep -rn "print(" scripts/ returns only non-error outputgrep -rn "except:" scripts/ returns emptyruff format --check . && ruff check . exits 0pytest --cov outputWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
4 skills in this plugin
/adr-governanceRules for writing, numbering, and superseding Architectural Decision Records. Use when creating a new ADR, when changing an ADR's status, when consolidating or auditing the ADR tree./economist-writingDefine the writing standard for every article in the content pipeline. Use when configuring the Writer Agent, when reviewing article prose quality, when tuning the deterministic polish stage./using-agent-skillsDiscovers and invokes agent skills. Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.Claude Code refuses to install this plugin
.claude-plugin/plugin.json: author: Invalid input: expected object, received string, commands: Invalid input, agents: Invalid string: must start with "./", agents: Invalid string: must end with ".md", skills: Invalid string: must start with "./"
.claude-plugin/plugin.json: author: Invalid input: expected object, received string, commands: Invalid input, agents: Invalid string: must start with "./", agents: Invalid string: must end with ".md", skills: Invalid string: must start with "./"
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.