rainboyOJ/problems / .agents/skills/add-roj-problem
add-roj-problem
VerifiedImport programming problems into this repository's roj/ corpus from local problem directories, local contest roots, or an explicitly supplied OJ problem URL. Use this skill whenever the user asks to add, import, migrate, register, copy, or prepare a problem for roj, especially when they mention a local path, statement.md, 题面.md, down/下发文件, data/, std.cpp, or finding an unused roj problem ID. This skill governs the complete review-first workflow and must be used even when the user asks for only one part of the import.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 13.7 KB |
| scripts/find-empty-roj-id.pyexecutable | script | 2.3 KB |
| scripts/generate-data-manifest.pyexecutable | script | 7.6 KB |
scripts/find-empty-roj-id.py
View on GitHub#!/usr/bin/env python3
"""Find an unused numeric problem ID under a ROJ directory.
The default mode returns the first gap at or above --start. Append mode returns the
next ID after the largest existing numeric directory. The script never mutates the
filesystem and writes only the selected integer to stdout on success.
"""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Find an unused numeric ID in a ROJ directory."
)
parser.add_argument(
"--root",
type=Path,
default=Path("roj"),
help="ROJ directory to scan (default: ./roj)",
)
parser.add_argument(
"--start",
type=int,
default=1000,
help="Smallest candidate ID (default: 1000)",
)
parser.add_argument(
"--mode",
choices=("gap", "append"),
default="gap",
help="gap: first missing ID; append: ID after the current maximum",
)
return parser.parse_args()
def numeric_directories(root: Path) -> set[int]:
if not root.exists():
raise ValueError(f"ROJ directory does not exist: {root}")
if not root.is_dir():
raise ValueError(f"ROJ path is not a directory: {root}")
ids: set[int] = set()
for entry in root.iterdir():
if (
not entry.is_dir()
or entry.is_symlink()
or not entry.name
or any(char < "0" or char > "9" for char in entry.name)
):
continue
ids.add(int(entry.name))
return ids
def find_id(ids: set[int], start: int, mode: str) -> int:
if start < 0:
raise ValueError("--start must be non-negative")
if mode == "append":
return max(max(ids, default=start - 1) + 1, start)
candidate = start
while candidate in ids:
candidate += 1
return candidate
def main() -> int:
args = parse_args()
try:
ids = numeric_directories(args.root)
selected = find_id(ids, args.start, args.mode)
except (OSError, ValueError) as error:
print(f"find-empty-roj-id: {error}", file=sys.stderr)
return 2
print(selected)
return 0
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |