generate-problem

A command that runs the full workflow for generating a competitive-programming problem from its name, task description, intended approach, limits, and sample tests.

In plain words
What is it for?
Use it to generate a problem package containing items such as a statement, solutions, constraints, and tests from the supplied parameters.
Why use it?
It organises the required inputs and generation steps so a complete problem can be prepared consistently, including special handling for multiple test cases and interactive tasks.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/7oskaaa/polygon-problems-generator/generate-problem
Clone the repo
git clone --depth 1 https://github.com/7oSkaaa/polygon-problems-generator

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,822 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.04822
Opus 5 $0.00000 $0.02411
Sonnet 5 $0.00000 $0.00964
Haiku 4.5 $0.00000 $0.00482

Measured 2d ago against content hash 2507446961a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generate-problem 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 2d 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.

.claude/commands/generate-problem.md · 576 lines

How it starts

The opening of the file, as written. The whole thing — 576 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are running the full problem generation pipeline for a competitive programming problem.

Follow .claude/shared.md for roster, layout, pipeline, and critical rules. This command only adds the per-step prompts.

Expected parameters

Provide all of the following when invoking this command:

Parameter Required Default Description
name yes Snake_case identifier, e.g. carrot_sum
statement yes One or two sentences describing what to compute
solution yes The intended algorithmic idea / approach
constraints yes Full constraint block, e.g. 1 ≤ t ≤ 10^4, 1 ≤ n ≤ 10^5
multitest no yes Whether the problem has multiple test cases per file
interactive no no Whether the problem is interactive (requires an interactor)
sample tests yes At least one sample input/output pair (for interactive: show the interaction)

Arguments provided by the user:

$ARGUMENTS


Step 0 — Validate parameters

Parse the arguments above and extract:

  • name — snake_case problem identifier
  • statement — short problem description
  • solution — intended algorithm
  • constraints — constraint block
  • multitest — yes/no (default yes if not provided)
  • interactive — yes/no (default no if not provided)
  • sample tests — sample input and expected output (for interactive problems: full interaction example)

If name, statement, solution, constraints, or sample tests are missing, stop and ask the user to supply them before proceeding. Do not assume or invent values for these fields.

Once all required parameters are confirmed, derive the human-readable title from name:

  • Replace every _ with a space and capitalise each word.
  • e.g. carrot_sumCarrot Sum, two_sumTwo Sum

Also classify a tentative difficulty from the idea (Ace, Div2-ADiv2-G). Write it to problems/<name>/difficulty.txt as soon as the folder exists. Ace and Div2-A skip the originality block; harder problems must be original.

Read the full file on GitHub · 576 lines

Changes

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.

  1. 2d ago First seen · 576 lines · 0 tokens per session scan A 2507446961a3

Subscribe to this mod's changes

generate-problem is a command published in the GitHub repository 7oSkaaa/polygon-problems-generator (21 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,822 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-08-30.