ape-write-pseudocode

Solid

Guidelines for writing pseudocode for functions and algorithms. Use this skill whenever the user asks to write pseudocode, sketch out an algorithm, or describe the logic of a function at a high level. Trigger on phrases like "write pseudocode", "sketch this algorithm", "pseudocode for this function", or "describe the logic".

Code & Development 40 stars 3 forks Updated today MIT

Install

View on GitHub

Quality Score: 83/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Pseudocode Style Guide ## Structure of a Function Every pseudocode function has exactly three parts: input, output, and body. Use Python-like syntax: `def` for the function signature, a docstring-style comment block for input and output, and indented body lines. ``` def function_name(param1, param2, ...): # input: <what each param represents> # output: <what the function returns or produces> <body> ``` ## Body Rules The body is the core of the pseudocode. Each line is a pythonic, non-functional call that names the operation and its operands -- not English prose. Invent clear, intuitive method or function names. The goal is code that reads like intent, not implementation. - One call per logical step. - Use `object.verb(args)` or `verb(args)` style -- never English sentences. - No type annotations, no real data-structure internals, no language-specific APIs. - Intermediate variable names are fine when they connect two steps. - Never more than one idea per line. ## Control Flow Use `if`, `elif`, `else`, and loops sparingly and only when the branching or iteration is the point of the logic. Conditions are also written as code-like expressions, not prose. ``` if condition_call(args): ... else: ... for item in collection: ... while not done(): ... ``` ## What to Write on Each Line Each line should look like a call you would recognise but cannot actually run. Good patterns: - `nodes.filter_reachable_from(source)` - `entries.sort_by(time...

Details

Author
arpitbbhayani
Repository
arpitbbhayani/ape-skills
Created
3 months ago
Last Updated
today
Language
CSS
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category