// Name: PhD Math Exercises & Biology Explainer // Description: Generate PhD-level math exercises with solutions or detailed biology explanations using AI. // Author: Nko00 // GitHub: Nko00 import "@johnlindquist/kit" const mode = await arg("What would you like to generate?", [ { name: "PhD-level Math Exercises", description: "Create rigorous, original graduate/PhD-level exercises with full solutions", value: "math", }, { name: "Explain a Biology Topic", description: "Produce a deep, structured explanation with mechanisms, experiments, and references", value: "bio", }, ]) if (mode === "math") { const topic = await arg("Enter a math topic (e.g., algebraic topology, PDE, category theory)") const countStr = await arg({ placeholder: "How many exercises? (1–10, default 5)", strict: false, }) const n = Math.max(1, Math.min(10, Number(countStr || 5))) const mathGenerator = ai( [ "You are a rigorous mathematics educator at the PhD level.", "Given a topic and a desired count, generate that many graduate/PhD-level exercises with full, detailed solutions.", "Requirements:", "- Problems must be original, well-posed, and progressively increase in difficulty.", "- Emphasize precision, proof techniques, and deep conceptual understanding.", "- Include formal statements, definitions, and relevant theorems where appropriate.", "- Where helpful, include a short 'Hint' section before the solution.", "- Provide complete, carefully justified solutions (not just outlines).", "- Use LaTeX math delimiters $...$ and $$...$$ for inline and display equations.", "- Use Markdown with the following structure:", " # {Topic}", " ## Exercise k", " ### Problem", " ### Hint (optional)", " ### Solution", "- If there are any standard references, mention them briefly at the end.", "Avoid any preamble or meta commentary—start directly with the content.", ].join("\n") ) const prompt = `Topic: ${topic}\nCount: ${n}\nGenerate now.` const output = await mathGenerator(prompt) await editor({ value: output, language: "markdown", scrollTo: "top", shortcuts: [ { name: "Copy", key: `${cmd}+c`, bar: "right", onPress: async (input: string) => { await copy(input) await toast("Copied to clipboard") }, }, ], }) } else if (mode === "bio") { const topic = await arg("Enter a biology topic (e.g., CRISPR, oxidative phosphorylation, developmental signaling)") const bioExplainer = ai( [ "You are an expert biology lecturer writing for advanced graduate/PhD students.", "Given a topic, produce a thorough, structured explanation with clear headings.", "Include:", "- Concise overview", "- Core mechanisms and pathways (with key molecules/structures)", "- Pivotal experiments and historical context", "- Current debates, open questions, and cutting-edge findings", "- Quantitative/biophysical aspects when relevant (include equations only if justified)", "- Common misconceptions and how to resolve them", "- At least 3 advanced exercises or thought questions", "- A short bibliography with references and links (where possible)", "Formatting:", "- Use Markdown headings and lists.", "- Use clear, precise language suitable for advanced students.", "- Avoid fluff; focus on mechanisms, evidence, and reasoning.", "Begin directly with the content, no preamble.", ].join("\n") ) const output = await bioExplainer(`Topic: ${topic}\nGenerate now.`) await editor({ value: output, language: "markdown", scrollTo: "top", shortcuts: [ { name: "Copy", key: `${cmd}+c`, bar: "right", onPress: async (input: string) => { await copy(input) await toast("Copied to clipboard") }, }, ], }) } else { notify("No mode selected") }