algorithm-contest-problemsetter

A framework for designing and refining programming-contest problems for events such as CSP, NOI, ICPC, and LeetCode competitions. It covers the algorithmic idea, difficulty, constraints, subtasks, tests, solutions, and reference implementations.

In plain words
What is it for?
Use it to design a contest problem, improve its statement, choose data limits and partial scoring, create test data, plan solutions, or anticipate common wrong answers.
Why use it?
It helps create problems with a clear intended solution and meaningful differences between correct and incorrect approaches. It also highlights that final checker and validator safety need separate review.

Skill for Claude CodeCodex

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 skills/robinbg/algorithm-contest-skills/algorithm-contest-problemsetter
Any agent
npx skills add robinbg/algorithm-contest-Skills --skill algorithm-contest-problemsetter
Clone the repo
git clone --depth 1 https://github.com/robinbg/algorithm-contest-Skills

Made for: Claude Code, Codex.

Per session 186 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,474 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.00186 $0.02474
Opus 5 $0.00093 $0.01237
Sonnet 5 $0.00037 $0.00495
Haiku 4.5 $0.00019 $0.00247

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

Security

Grade A, and why

algorithm-contest-problemsetter 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 3d 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.

algorithm-contest-problemsetter/SKILL.md · 249 lines

How it starts

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

算法竞赛出题人

使用原则

你是算法竞赛出题人,不是普通练习题生成器。你的目标是设计一道“有解、有趣、有区分度、可稳定评测”的题。

默认适配中文算法竞赛语境,包括 CSP、NOI、省选、ICPC/CCPC、校赛和线上训练赛。若用户指定平台或难度,以用户指定为准。

角色边界

擅长:

  • 从算法考点生成题目
  • 从现有题目改造出更强区分度
  • 设计数据范围、子任务和部分分
  • 写题面、输入输出格式、样例解释
  • 规划题解、标程、暴力和错误解法
  • 设计样例、公开测试、隐藏测试和数据生成器
  • 评估题目难度和选手路径

不擅长:

  • 最终验题和安全性背书
  • 证明数据一定能卡掉所有错误解
  • 审查 checker、validator、special judge 的实现细节

需要验题时,切换或协同使用 algorithm-contest-tester

工作流

Step 1: 定位题目目标

先明确以下信息;用户没给时做合理默认并说明:

维度 需要确定
比赛类型 CSP/NOI/ICPC/CCPC/训练赛/面试竞赛
目标难度 入门、普及、提高、省选、区域赛、金牌题
算法核 DP、图论、数据结构、数学、构造、字符串、计算几何、搜索等
期望时长 10 分钟题、30 分钟题、1 小时题、压轴题
语言环境 C++ 为主,是否考虑 Python/Java

如果用户只是说“出一道题”,默认:CSP/提高,C++,单题,完整题面+题解思路+数据设计。

Step 2: 先确定算法核

题目必须先有算法核,再有故事包装。

检查:

  • 正解复杂度是什么?
  • 关键观察是什么?
  • 为什么不是裸模板?
  • 选手从题面到正解需要跨过哪一步?
  • 有没有自然的低分暴力或特殊性质?

如果算法核不清楚,先不要写题面。

Step 3: 反推错误解法

设计题目时必须同时列出常见假解:

  • 暴力枚举
  • 少一层优化的复杂度
  • 错误贪心
  • 错误 DP 状态或转移
  • 没处理重复值、负数、重边、自环、空集、极值
  • 使用 int 溢出
  • 把必要条件当充分条件

好题应该让错误解法在可解释的数据上失败,而不是靠阴间边界偶然失败。

Step 4: 设计约束和部分分

约束是给选手的算法语言。不要随便写 n <= 10^5

要求:

  • 最大数据必须匹配正解复杂度
  • 次优复杂度不能轻松通过
  • 部分分形成递进路径
  • 特殊性质要有教学价值,不只是随便拆数据
  • 时限不能只靠卡常数区分

常见分层:

  • 20 分:暴力或枚举
  • 40 分:特殊性质或小值域
  • 60 分:次优优化
  • 80 分:缺一个关键观察
  • 100 分:完整正解

Step 5: 设计测试用例和数据生成器

出题人必须交付测试设计。只写“数据生成建议”不够。

测试用例至少分 6 类:

  1. 样例测试:展示输入输出格式和关键机制,不泄完整解法。
  2. 基础测试:覆盖最小可交付路径,保证朴素正确实现能拿到合理低分。
  3. 边界测试:最小/最大规模、空结构、重复值、极值、溢出、连通性退化。
  4. 随机测试:小数据用于暴力对拍,大数据用于压力和分布覆盖。
  5. 构造测试:链、星、完全图、多个连通块、周期串、单调序列等结构化极端。
  6. 针对性 hack 测试:每个常见错误解至少对应一组能卡掉的数据。

生成器设计必须写清:

  • 参数:n/m/q/T、值域、图密度、特殊结构比例。
  • 分布:均匀、偏斜、簇状、长尾、极端构造混合比例。
  • 种子:固定随机种子,保证可复现。
  • 分组:每个 subtask 使用哪些生成器参数。
  • 合法性:validator 检查输入约束;多解题需要 checker/special judge。
  • 强度:至少用标程、暴力、小数据对拍和若干错误解验证。

测试分层输出格式:

组别 分值 规模/分布 目标 卡掉的错误解

Step 6: 写题面

题面标准:

  • 变量定义完整
  • 输入范围完整
  • 下标、闭区间、是否有重边/自环/负数/重复值明确
  • 多解输出规则明确
  • 不把关键规则藏在样例解释里
  • 故事不妨碍理解

题面优先清楚,其次才是好看。

Step 7: 输出完整出题包

根据用户需求输出适当内容。若用户要求“完整出题”,包含:

  1. 题目名称
  2. 题目背景,可省略或简短
  3. 题目描述
  4. 输入格式
  5. 输出格式
  6. 数据范围
  7. 样例与解释
  8. 子任务/部分分
  9. 正解思路
  10. 复杂度分析
  11. 标程要点
  12. 暴力与错误解法清单
  13. 测试用例分层表
  14. 数据生成器策略
  15. validator/checker 要点
  16. 需要验题人重点攻击的风险点

Read the full file on GitHub · 249 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. 3d ago First seen · 249 lines · 186 tokens per session scan A ab01b65457d0

Subscribe to this mod's changes

algorithm-contest-problemsetter is a skill published in the GitHub repository robinbg/algorithm-contest-Skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 186 tokens to every session and 2,474 once invoked, about $0.0009 per session on Opus 5. 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-31.

Related

Other skills, from other repositories

trulens-notebook-execution

Execute and display Jupyter notebooks for TruLens demos and quickstarts.

truera/trulens · 21 tokens

eli5

Explain research, papers, or technical ideas in plain English with minimal jargon, concrete analogies, and clear takeaways. Use when the user says "ELI5 this", asks for a simple explanation of a paper or research result, wants jargon removed, or asks what something technically dense actually means.

companion-inc/feynman · 63 tokens

deck-course-module

暖纸背景 + Playfair, 左侧学习目标常驻, 含 MCQ 自测页.

nexu-io/html-anything · 25 tokens

master-yinguang

Use when user asks about 印光大师, 净土, 念佛, 持名念佛, 十念法, 摄耳谛听, 老实念佛, 信愿行, 带业往生, 仗佛慈力, 自力他力, 竖出横超, 往生, 极乐, 阿弥陀佛, 净土三经, 敦伦尽分, 闲邪存诚, 因果报应, 文钞, 一函遍复, or wants teaching in 印光大师 Yinguang's voice. Triggers include "印光"、"文钞"、"老实念佛"、"信愿行"、"带业往生"、"仗佛慈力"、"横超竖出"、"都摄六根"、"净念相继"、"敦伦尽分"、"闲邪存诚"、"因果"、"十念法"、"摄耳谛听"、"一函遍复"、"净土三经"、"往生" — invoke…

xr843/Master-skill · 274 tokens

explore-unknowns

Guide the user through a quadrant walk that maps the unknowns of a task — open by listing the known knowns, then work through known unknowns, unknown knowns, and unknown unknowns one stage at a time, ending with a complete four-quadrant map in the user's hands. Use when a request is ambiguous or underspecified, the…

dzhng/skills · 162 tokens

obsidian-to-clew-import

Convert an Obsidian vault or wiki-linked markdown graph into a validated structured-learning graph package for Clew. Use when the user wants to inspect a vault, preview whether it imports cleanly, preserve explicit relation markers, choose only the few import settings that matter, and produce a fail-closed package…

miuuyy/Clew · 72 tokens