
create-derpcode-problem
This skill allows the agent to create new coding problems for the DerpCode platform. This skill shou
Skill Instructions
Context:
You are creating a new coding problem for a leetcode style platform called DerpCode. The .txt files you create along with the base driver code will all be injected into the docker containers at runtime for on demand remote code execution. The drivers, answers, and ui templates you write will not be buildable or testable as they depend on the docker run scripts and run time injection.
-
Review the base drivers in the base drivers folder to understand how each problem will start with. All problem drivers must inherit from a base driver. They are all intentinally txt files. The drivers for the respective languages are located:
-
Review the example problem here to understand how problems are constructed. Review every file in the folder. Every single one is important and required (pay close attention to the sections in the problem description and explanation).
2.1. (Optional) You can review more problems in the DerpCode.API/Data/SeedData/Problems folder.
2.2. (Optional) If you want to know how the code gets injected into the containers at runtime, see the language folders in Docker/{language}/ for each language.
-
Determine the id for the new problem. Ids are positive integers. Determine the new id by looking at the existing problems in the
DerpCode.API/Data/SeedData/Problemsfolder. Each folder in that folder is a problem and is named{Id}-{ProblemName}. Find the problem with the highest Id and add 1 to that id. This will be the new Id. -
Create a new folder in
DerpCode.API/Data/SeedData/Problemsand name id{NewProblemIdFromStep3}-{NewProblemName} -
Create the
Description.mdfile, theExplanation.mdfile, and theProblem.jsonin the folder created in step 4 file following the conventions you discovered in step 2 when reviewing the example problem. Do not provide hints in the problem description. -
Create a
Driversfolder in the folder created in step 4. -
For each language (CSharp, Java, JavaScript, Python, TypeScript, and Rust), create a new folder in the
Driversfolder created in step 6. -
For each language (CSharp, Java, JavaScript, Python, TypeScript, and Rust), create an
Answer.txt, aDriverCode.txt, and anUITemplate.txtfile in the respective language folder created in step 7 (there will be 3 files per language). It is IMPORTANT that the file extensions are.txt. Follow the conventions from the example problem when creating these files. All problem drivers MUST inherit from the base drivers from step 1. Drivers should not use any 3rd party libraries (like lodash) unless absolutely necessary. -
Validate the problem and its drivers against the example problem for consistency. Ensure the new problem has working driver for each language (CSharp, Java, JavaScript, Python, TypeScript, and Rust). Validate each driver has an
Answer.txt, aDriverCode.txt, and anUITemplate.txtfile.
Notes:
- User submitted data and problem drivers are in seperate files when run in the container (see Docker/ folder for docker files). Meaning don't assume that user code is injected into the same file as the driver when you are making new drivers. Don't forget import statemenst for user files (like import { add } form 'solution.js' for javasctipt)
- TypeScript drivers import from
./solution(the injectedsolution.ts). Ensure theUITemplate.txt(and the seededAnswer.txt) exports the function/class the driver imports, e.g.export function climbStairs(...). Otherwisets-nodefails with TS2306 (solution.ts"is not a module"). - The DerpCode UI supports math rendering (KaTeX) in markdown. In
Explanation.md, feel free to use$...$for inline math and$$...$$for block math (for example:$GF(2)$,$O(N \cdot W)$,$O(\log N \cdot W)$). - For JavaScript code, always use class syntax over 'function ClassName ()' syntax. Never use var for javascript. Prefer function foo() syntax over const foo = () syntax
- The problem name in the json file needs to match the folder name (trimmed of whitespace). So problem 1 with name Add Two Numbers will be in the 1-AddTwoNumbers folder.