Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

competitive-programming-problem-preparer

Skill pack for Cursor and Claude Code that takes an idea and an intended solution to a Polygon-ready problem package: OI vs ICPC format, subtask scoring, model + brute, stress, testlib validator/checker/generators, samples, and a small WA/TLE zoo. An HTML editorial and a Codeforces Polygon upload are optional steps that run only when you ask. This repository is also a Claude Code marketplace, and it installs from the command line, so it can be used in place or installed on another machine.

A fork of LLaammTTeerr/competitive-programming — that repo is a Claude Code plugin for contest solving and setting; this fork keeps the setting side and drops the solving/contest side. Differences are listed below.

Component Invoked as What it does
Skill creating-problems cp-problem-preparer:creating-problems Umbrella over the pipeline: drives an idea — finished or half-formed — to a Polygon-ready package end to end, gated phase by phase with machine-readable evidence from tools/package_status.py
Skill shaping-problems cp-problem-preparer:shaping-problems Turns the idea into numbers: originality check, intended difficulty, the N that separates the intended solution from the naive one, OI vs ICPC, and a subtask ladder with point weights
Skill solving-problems cp-problem-preparer:solving-problems C++ for the model solution and the brute-force oracle (plus a second correct algorithm when useful), with stress testing against the oracle
Skill preparing-tests cp-problem-preparer:preparing-tests Builds the test-data contract: checker, validator, generators (random / max-size / boundary / structured-adversarial / hand-written), and sample selection, driven by testlib and tools/gen_constraints_header.py / tools/drift_check.py
Skill validating-solutions cp-problem-preparer:validating-solutions Attacks the suite with a small zoo of deliberately-wrong solutions plus alternative accepted solutions; stress is against the brute, runs stay on local g++ — no sandbox, no isolate
Skill writing-statements cp-problem-preparer:writing-statements Authors and translates the statement for the vnolymp LaTeX template — the Vietnamese statement package for problems prepared on Polygon (two passes: body, then samples)
Skill writing-editorials cp-problem-preparer:writing-editorials Optional: a standalone HTML editorial for the problem (themes in references/themes/). Written only when asked
Skill reviewing-problems cp-problem-preparer:reviewing-problems Audits the finished package before it ships: mechanical checks (tools/review_checks.py) plus judgement checks run fresh from the statement
Skill uploading-to-polygon cp-problem-preparer:uploading-to-polygon Optional final step: upload a reviewed package to Codeforces Polygon through the external cf-polygon-mcp MCP server. Runs only when asked

Defaults live in preferences.yaml: test file count, OI default T, Σ-constraints, stress rounds, zoo composition, editorial theme. The pipeline reads it before asking anything already answered there.

What changes from upstream

Removedrunning-contests, the bundled Codeforces MCP server (mcp-server/), contest-submit loops, and the Linux-only isolate invocation matrix. This pack ships no .mcp.json and no MCP code.

Addeduploading-to-polygon (talks to an external server, never a bundled one), writing-editorials (opt-in HTML), and preferences.yaml (machine-readable defaults). docs/superpowers/ keeps upstream's design history for reference — it is not instructions.

Layout

competitive-programming-problem-preparer/
├── preferences.yaml          # defaults — read first, every run
├── .claude-plugin/
│   ├── plugin.json           # Claude Code plugin manifest ("skills": ["./skills"])
│   └── marketplace.json      # lets this repo install as a Claude Code marketplace
├── skills/
│   ├── creating-problems/SKILL.md     # the pipeline — start here
│   ├── shaping-problems/SKILL.md
│   ├── solving-problems/SKILL.md      (+ references/black-magic.md)
│   ├── preparing-tests/SKILL.md       (+ references: testlib.md, validator.md, test-generation.md)
│   ├── validating-solutions/SKILL.md  (+ references/)
│   ├── writing-statements/SKILL.md    (+ references/sample.md)
│   ├── writing-editorials/SKILL.md    (+ references/vi-glossary.md, themes/*.html)
│   ├── reviewing-problems/SKILL.md
│   └── uploading-to-polygon/SKILL.md
├── tools/                    # Python helpers the setting skills drive (see Checks)
│   ├── problem_meta.py  flags.py  gen_constraints_header.py  drift_check.py
│   ├── scan_solutions.py  review_checks.py  package_status.py
│   ├── bootstrap_testlib.py/.sh
│   └── tests/                # unittest suite — see Checks
├── install.sh  install.ps1   # command-line installers (see Installing)
└── docs/superpowers/         # upstream design history — not instructions

On-disk problem packages are Polygon-shaped, same as upstream:

<problem>/
  problem.json
  <name>.tex
  files/          validator.cpp, gen-*.cpp, constraints.h, optional check.cpp
  solutions/      sol-main.cpp, sol-brute.cpp, …
  tests/          g1/*.in, g2/*.in, …, samples/
  editorial/      editorial.html   (optional; only if asked)

problem.json sets io.input / io.output either to the sentinels "stdin" / "stdout" or to a pair of bare filenames (flight.inp / flight.out). File-IO and stdin/stdout are both supported; generators and validators are stdin/stdout testlib tools in both modes, and the checker always takes three file paths (checker <input> <output> <answer>).

Setup

Prerequisites: Python 3, g++, git for the tools; nothing else is required on the agent side.

testlib. Official Codeforces/Polygon MikeMirzayanov/testlib. Do not copy testlib.h into a problem folder. Bootstrap a cached checkout from this repo's root:

TESTLIB="$(python3 -m tools.bootstrap_testlib)"

Set CP_TESTLIB to an existing directory containing testlib.h to skip the clone. Details: skills/preparing-tests/references/testlib.md.

vnolymp for statements — the clone procedure lives in writing-statements (to be bundled later).

Optional — Polygon upload. The uploading-to-polygon step talks to gsh20040816/cf-polygon-mcp, a Codeforces Polygon API MCP server. It is configured outside this pack (in the user's .mcp.json / agent settings, with POLYGON_API_KEY and POLYGON_API_SECRET set) — the pack itself ships no .mcp.json, no MCP code, and no secret ever lives in this repo. Without the server, upload degrades to manual per-phase instructions.

Installing

Claude Code — same machine. Clone into ~/.claude/skills/. Anything there with a .claude-plugin/plugin.json auto-loads as <name>@skills-dir; no install step:

git clone https://github.com/nudetiger/competitive-programming-problem-preparer ~/.claude/skills/cp-problem-preparer
# then, in Claude Code:  /reload-plugins

Claude Code — elsewhere. Install it as a marketplace:

/plugin marketplace add https://github.com/nudetiger/competitive-programming-problem-preparer
/plugin install cp-problem-preparer@cp-problem-preparer

Cursor. Clone into your personal skills folder (available to every project) or into .agents/skills/ of one project:

git clone https://github.com/nudetiger/competitive-programming-problem-preparer ~/.cursor/skills/competitive-programming-problem-preparer     # personal
git clone https://github.com/nudetiger/competitive-programming-problem-preparer .agents/skills/competitive-programming-problem-preparer  # one project

Then reload or restart Cursor so the skills are picked up.

One line (any target). Targets: claude (default, ~/.claude/skills/cp-problem-preparer), cursor (~/.cursor/skills/…), project (./.agents/skills/…).

# macOS / Linux / git-bash
curl -fsSL https://raw.githubusercontent.com/nudetiger/competitive-programming-problem-preparer/main/install.sh | sh -s -- cursor

# Windows PowerShell (default target: claude)
irm https://raw.githubusercontent.com/nudetiger/competitive-programming-problem-preparer/main/install.ps1 | iex

An existing install updates itself with git pull — the installers detect an existing clone and pull instead of clobbering.

How skill discovery works here (read before adding skills)

Claude Code discovers personal skills at exactly ~/.claude/skills/<skill>/SKILL.md — one level. A bare subfolder is not scanned: a skill at ~/.claude/skills/<category>/<skill>/SKILL.md returns Unknown skill. Grouping works only because this folder is a plugin: .claude-plugin/plugin.json is what makes skills/* visible, and it is also what supplies the cp-problem-preparer: namespace. In Cursor the pack is a plain skills folder and each skills/<new-skill>/SKILL.md is discovered by the agent from its frontmatter.

To add a skill, create skills/<new-skill>/SKILL.md with frontmatter whose name: matches the directory. Do not nest deeper, and do not remove the manifest.

Checks

Each line names its own working directory. The tools suite imports tools.* and only resolves from the repository root.

cd <this repo>
claude plugin validate . --strict                   # manifests (Claude Code only)
claude plugin details cp-problem-preparer           # inventory: 9 skills, no bundled MCP

python3 -m unittest discover -s tools/tests -t . -v # tools suite (repo root)

The tools suite includes isolate-backed tests (the upstream run_matrix driver) that need a Linux box with ioi/isolate; set CP_ALLOW_SANDBOX_SKIP=1 to skip them — recommended on machines without isolate, this fork's normal validation path is plain local g++.

After editing a skill or .claude-plugin/, run /reload-plugins in Claude Code or restart the Cursor session.

Author

nudetiger — this fork: skill prose, pipeline, preferences.yaml, installers, README.

Upstream: LLaammTTeerr/competitive-programming — LamTer <lamtercqh@gmail.com>. Upstream's tools and design notes remain his work; they live on here in tools/ and docs/superpowers/.

About

Skill pack (Cursor & Claude Code) for setting one competitive-programming problem: idea + intended solution to a Polygon-ready package (OI/ICPC, subtask scoring, model + brute, stress, testlib tests, small WA/TLE zoo); optional HTML editorial and Polygon upload. Fork of LLaammTTeerr/competitive-programming.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages