
cs-algorithms
Algorithms: sorting, searching, BFS/DFS/A, dynamic programming, greedy, backtracking, Big-O
- Installs
- 59
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/alphaonedev/openclaw-graph --skill cs-algorithms- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads cs-algorithms automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
cs-algorithms
Purpose
This skill equips OpenClaw with tools for implementing and analyzing computer science algorithms, focusing on sorting, searching, graph traversals, dynamic programming, greedy approaches, backtracking, and Big-O complexity analysis. Use it to generate code snippets, optimize algorithms, or explain concepts in responses.
When to Use
Apply this skill when handling algorithmic problems in coding tasks, such as optimizing search in large datasets, solving graph problems in networks, or analyzing time complexity in performance-critical applications. Use it for educational responses, code reviews, or when users ask about specific algorithms like BFS for pathfinding.
Key Capabilities
- Sorting: Implement quicksort, mergesort, or bubblesort with configurable pivots or stability checks.
- Searching: Binary search, linear search, with options for recursive or iterative variants.
- Graph Traversals: BFS, DFS, and A* for pathfinding, including handling weighted graphs.
- Dynamic Programming: Memoization and tabulation for problems like knapsack or longest common subsequence.
- Greedy and Backtracking: Solve scheduling or subset sum problems with backtracking constraints.
- Big-O Analysis: Compute and explain time/space complexity, e.g., O(n log n) for mergesort.
- Additional: Handle edge cases like sorted arrays or disconnected graphs.
Usage Patterns
To use this skill, invoke it via OpenClaw's API or CLI by specifying the algorithm type and inputs. Always pass required parameters like data arrays or graph structures. For example, chain it with other skills by outputting results to variables. Prefix calls with authentication via $OPENCLAW_API_KEY in environment variables. In code, import the skill and call methods directly; in CLI, use subcommands for quick execution.
Common Commands/API
Use the OpenClaw CLI for direct runs or the Python API for integration. Authentication requires setting $OPENCLAW_API_KEY as an environment variable.
-
CLI Example:
openclaw run cs-algorithms --algorithm sort --input "[1,3,2]" --method quickThis sorts the array using quicksort. -
API Example:
import openclaw openclaw.set_api_key(os.environ['OPENCLAW_API_KEY']) sorted_array = openclaw.algorithms.sort([1,3,2], method='quick') -
Common Flags:
--algorithm [sort|search|bfs|...]: Specifies the algorithm to run.--input [JSON string]: Provides input data, e.g., arrays or graphs as JSON.--config { "method": "quick", "depth": 5 }: JSON config for parameters like recursion depth.
-
API Endpoints:
openclaw.algorithms.sort(array, method='quick'): Returns sorted array.openclaw.algorithms.bfs(graph, start_node): Returns traversed nodes.- For dynamic programming:
openclaw.algorithms.dp_solve(problem='knapsack', items=[...], capacity=10).
Config formats are JSON-based; for graphs, use adjacency lists like {"A": ["B", "C"]}.
Integration Notes
Integrate by adding OpenClaw as a dependency in your project (e.g., pip install openclaw). Set up authentication in your environment with export OPENCLAW_API_KEY=your_key. For asynchronous use, wrap API calls in async functions, e.g., await openclaw.algorithms.bfs_async(graph). Ensure inputs are validated (e.g., arrays must be lists), and handle outputs as JSON. If combining with other skills, use OpenClaw's output piping, like openclaw run cs-algorithms --output var1 | openclaw run another-skill --input var1.
Error Handling
Common errors include invalid inputs (e.g., non-array for sort) or authentication failures. Check for InvalidInputError by wrapping calls in try-except blocks. For CLI, errors return non-zero exit codes with messages like "Error: Array must be a list". In API, catch exceptions:
try:
result = openclaw.algorithms.sort([1, 'a'], method='quick') # Type mismatch error
except openclaw.errors.InvalidInputError as e:
print(f"Handle error: {e} - Ensure all elements are numbers")
Always validate inputs before calling, e.g., use isinstance(array, list). For Big-O analysis, handle cases where complexity can't be computed (e.g., infinite loops) by setting timeouts.
Concrete Usage Examples
-
Sorting an Array: To sort a user-provided list, use:
openclaw run cs-algorithms --algorithm sort --input "[5,2,9,1]" --method mergesort". This outputs[1,2,5,9]. In code:import openclaw openclaw.set_api_key(os.environ['OPENCLAW_API_KEY']) sorted_list = openclaw.algorithms.sort([5,2,9,1], method='mergesort') print(sorted_list) # [1, 2, 5, 9]Analyze complexity: Add
--analyze-complexityflag for "O(n log n) time". -
BFS on a Graph: For graph traversal, run:
openclaw run cs-algorithms --algorithm bfs --input '{"A": ["B"], "B": ["C"]}' --start "A". Output:["A", "B", "C"]. In API:graph = {"A": ["B"], "B": ["C"]} traversal = openclaw.algorithms.bfs(graph, "A") print(traversal) # ['A', 'B', 'C']Use for pathfinding in AI responses.
Graph Relationships
- Related Clusters: computer-science (parent cluster for algorithmic topics).
- Related Skills: data-structures (for array/graph implementations), machine-learning (for A* in optimization).
- Tags Connections: "algorithms" links to optimization skills; "sorting" and "searching" connect to efficiency-focused tools; "complexity" relates to performance-analysis skills.
FAQ
What does the cs-algorithms skill do?
Algorithms: sorting, searching, BFS/DFS/A, dynamic programming, greedy, backtracking, Big-O
How do I install cs-algorithms?
Run npx skills add https://github.com/alphaonedev/openclaw-graph --skill cs-algorithms in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/cs-algorithms/ (personal) or .claude/skills/cs-algorithms/ (project).
Which AI agents can use cs-algorithms?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is cs-algorithms safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains cs-algorithms?
It is published by alphaonedev in alphaonedev/openclaw-graph. It has 59 recorded installs.
More from alphaonedev/openclaw-graph
playwright-scraper
alphaonedev/openclaw-graph
Playwright web scraping: dynamic content, auth flows, pagination, data extraction, screenshots
humanize-ai-text
alphaonedev/openclaw-graph
AI text humanization: reduce AI-detection patterns, natural phrasing, tone adjustment
gcp-iam
alphaonedev/openclaw-graph
Manages identity and access control for Google Cloud resources using IAM policies and roles.
macos-automation
alphaonedev/openclaw-graph
AppleScript, JXA, Shortcuts, Automator, osascript, System Events, accessibility API
food-order
alphaonedev/openclaw-graph
Food delivery: DoorDash/UberEats/Grubhub ordering, restaurant search, order status tracking
tavily-web-search
alphaonedev/openclaw-graph
Open the skill to read its SKILL.md instructions.
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.