
Algorithm Design
Paste publication-ready LaTeX algorithm blocks into papers or implementation plans when translating research ideas into documented pseudo-code.
Overview
Algorithm Design Templates is an agent skill for the Build phase that supplies LaTeX algorithm blocks for documenting ML and optimization procedures in research-grade papers and plans.
Install
npx skills add https://github.com/lingzhi227/agent-research-skills --skill algorithm-designWhat is this skill?
- Paper2Code- and AI-Researcher-style LaTeX `algorithm` + `algorithmic` scaffolds
- Basic training-loop template with Require/Ensure, mini-batches, and convergence break
- Main algorithm template that calls Encode/Decode subroutines with cross-references
- Iterative optimization template with while-loop and tolerance-based stopping
- Consistent numbering, labels, and Comment hooks for reproducible paper sections
- 3 core LaTeX algorithm template patterns (loop, subroutine call, iterative optimization)
Adoption & trust: 710 installs on skills.sh; 114 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You know the method logically but lack a consistent LaTeX algorithm skeleton that matches how reviewers expect training loops and subroutines to be presented.
Who is it for?
Indie researchers and ML builders drafting Paper2Code-style plans or conference write-ups who want standardized algorithmic LaTeX without consulting a style guide each time.
Skip if: Teams that only need executable code with no paper artifact, or projects that do not use LaTeX for documentation.
When should I use this skill?
You are writing or refactoring the methods section of a research paper, thesis, or agent research plan and need standard `algorithm` / `algorithmic` LaTeX scaffolds.
What do I get? / Deliverables
You get labeled, numbered `algorithm` environments ready to drop into a paper or spec so your agent or co-author can align implementation steps with published pseudo-code.
- Copy-ready LaTeX algorithm environments with captions, labels, and numbered steps
- Subroutine call patterns with cross-reference placeholders
Recommended Skills
Journey fit
Algorithm write-ups belong in the build phase when you are turning a method into shareable artifacts (papers, repos, agent plans) rather than during raw ideation. Docs is the canonical shelf because the skill outputs LaTeX `algorithm` environments and labeled pseudo-code, not runnable training code or infra.
How it compares
Use structured LaTeX pseudo-code templates instead of asking the model for one-off algorithm blocks that break numbering and package conventions.
Common Questions / FAQ
Who is algorithm-design for?
Solo builders and small research teams documenting ML, optimization, or agent planning algorithms in LaTeX for papers, theses, or formal implementation specs.
When should I use algorithm-design?
During Build/docs when you are writing a methods section, a Paper2Code plan, or an AI-Researcher-style agent plan and need loop, subroutine, or convergence templates filled with your notation.
Is algorithm-design safe to install?
It is documentation-only LaTeX patterns with no shell or network behavior implied by the skill itself; still review the Security Audits panel on this Prism page before installing from any source.
SKILL.md
READMESKILL.md - Algorithm Design
# Algorithm Design Templates Extracted from Paper2Code (planning stage) and AI-Researcher (plan_agent). ## LaTeX Algorithm Templates ### Basic Algorithm with Loop ```latex \begin{algorithm}[t] \caption{Algorithm Name} \label{alg:name} \begin{algorithmic}[1] \Require Input data $\mathcal{D} = \{(x_i, y_i)\}_{i=1}^N$, learning rate $\eta$, epochs $T$ \Ensure Trained model parameters $\theta^*$ \State Initialize $\theta \sim \mathcal{N}(0, \sigma^2)$ \For{$t = 1$ to $T$} \For{each mini-batch $\mathcal{B} \subset \mathcal{D}$} \State $\mathcal{L} \gets \frac{1}{|\mathcal{B}|} \sum_{(x,y) \in \mathcal{B}} \ell(f_\theta(x), y)$ \State $\theta \gets \theta - \eta \nabla_\theta \mathcal{L}$ \EndFor \If{convergence criterion met} \State \textbf{break} \EndIf \EndFor \State \Return $\theta^* \gets \theta$ \end{algorithmic} \end{algorithm} ``` ### Algorithm with Subroutine Call ```latex \begin{algorithm}[t] \caption{Main Algorithm} \label{alg:main} \begin{algorithmic}[1] \Require Input $x$, model $f_\theta$ \Ensure Prediction $\hat{y}$ \State $z \gets \textsc{Encode}(x)$ \Comment{See Algorithm~\ref{alg:encode}} \State $\hat{y} \gets \textsc{Decode}(z)$ \State \Return $\hat{y}$ \end{algorithmic} \end{algorithm} ``` ### Algorithm with While Loop and Convergence ```latex \begin{algorithm}[t] \caption{Iterative Optimization} \label{alg:optimize} \begin{algorithmic}[1] \Require Initial solution $x_0$, tolerance $\epsilon$ \Ensure Optimal solution $x^*$ \State $k \gets 0$ \While{$\|x_{k+1} - x_k\| > \epsilon$} \State $g_k \gets \nabla f(x_k)$ \State $\alpha_k \gets \textsc{LineSearch}(x_k, g_k)$ \State $x_{k+1} \gets x_k - \alpha_k g_k$ \State $k \gets k + 1$ \EndWhile \State \Return $x^* \gets x_k$ \end{algorithmic} \end{algorithm} ``` ## Mermaid UML Templates ### Class Diagram (from Paper2Code) ```mermaid classDiagram class Main { +__init__() +run_experiment() } class DatasetLoader { +__init__(config: dict) +load_data() -> Any +preprocess(data: Any) -> Tensor } class Model { +__init__(params: dict) +forward(x: Tensor) -> Tensor +compute_loss(pred: Tensor, target: Tensor) -> float } class Trainer { +__init__(model: Model, data: Any) +train() -> None +validate() -> dict } class Evaluation { +__init__(model: Model, data: Any) +evaluate() -> dict +compute_metrics(pred: Tensor, target: Tensor) -> dict } Main --> DatasetLoader Main --> Trainer Main --> Evaluation Trainer --> Model Evaluation --> Model ``` ### Sequence Diagram (from Paper2Code) ```mermaid sequenceDiagram participant M as Main participant DL as DatasetLoader participant MD as Model participant TR as Trainer participant EV as Evaluation M->>DL: load_data() DL-->>M: return dataset M->>MD: initialize model() M->>TR: train(model, dataset) TR->>MD: forward(x) MD-->>TR: predictions TR-->>M: training complete M->>EV: evaluate(model, dataset) EV->>MD: forward(x) MD-->>EV: predictions EV-->>M: metrics ``` ### Flowchart for Method Pipeline ```mermaid flowchart TD A[Input Data] --> B[Preprocessing] B --> C{Train/Test Split} C -->|Train| D[Model Training] C -->|Test| E[Model Evaluation] D --> F[Checkpoint Best Model] F --> E E --> G[Results & Metrics] G --> H[Generate Figures] G --> I[Generate Tables] ``` ## Complexity Analysis Template ```latex \begin{proposition}[Computational Complexity] \label{prop:complexity} Algorithm~\ref{alg:name} has time complexity $O(NTd)$ and space complexity $O(Nd)$, where $N$ is the number of samples, $T$ is the number of epochs, and $d$ is the feature dimension. \end{proposition} \begin{proof} The outer loop runs $T$ iterations. In each iteration, we process all $N$ samples. For each sample, the forward pass requires $O(d)$ opera