cs
Root CS: theoretical foundations, problem classification, complexity theory
What this skill does
## Purpose
This skill enables OpenClaw to handle core computer science theory, focusing on theoretical foundations (e.g., Turing machines, automata), problem classification (e.g., P vs NP), and complexity theory (e.g., Big O analysis). It provides precise tools for reasoning about algorithms and computational limits.
## When to Use
Use this skill when tackling theoretical CS problems, such as verifying algorithm efficiency, classifying problem types (e.g., decidable vs undecidable), or optimizing code based on complexity metrics. Apply it during algorithm design, code reviews, or when debugging performance issues in theoretical contexts.
## Key Capabilities
- Analyze time and space complexity of code snippets using Big O notation.
- Classify problems as P, NP, NP-complete, or undecidable based on input descriptions.
- Generate explanations of CS fundamentals, like finite state machines or halting problems.
- Compare algorithm complexities, e.g., via asymptotic analysis.
- Handle edge cases in theory, such as reduction proofs for problem classification.
## Usage Patterns
To use this skill, invoke it via OpenClaw's CLI or API. Always provide inputs like code snippets or problem descriptions. For CLI, prefix commands with `openclaw cs`. For API, use HTTP requests to endpoints like `/api/cs/analyze`. Set the environment variable `$OPENCLAW_API_KEY` for authentication before any operation. Example pattern: Load the skill in your script, then call functions with required parameters, handling responses synchronously.
To analyze complexity:
1. Prepare a code snippet as a string.
2. Call the function with flags for output format (e.g., JSON).
3. Parse the response for Big O results.
For problem classification:
1. Describe the problem in a JSON object.
2. Use the classify command with relevant flags.
3. Validate the output against expected categories.
## Common Commands/API
- CLI Command: `openclaw cs analyze-complexity --code "def func(arr): for i in arr: print(i)" --output json`
- Flags: `--code` for input code (required), `--output` for format (e.g., json, text).
- Output: JSON like `{"big_o": "O(n)", "description": "Linear time complexity"}`.
- CLI Command: `openclaw cs classify-problem --description "Determine if a graph has a Hamiltonian path" --detail full`
- Flags: `--description` for problem text, `--detail` for output depth (e.g., full for proofs).
- Output: String like "NP-complete, reducible from TSP".
- API Endpoint: POST to `/api/cs/analyze` with body `{"code": "def func(...)", "type": "complexity"}`
- Headers: Include `Authorization: Bearer $OPENCLAW_API_KEY`.
- Response: JSON object, e.g., `{"status": "success", "big_o": "O(n^2)"}`.
- API Endpoint: GET `/api/cs/classify?query=traveling+salesman`
- Query Params: `query` for problem description.
- Config Format: Use JSON in request body, e.g., `{"query": "string", "options": {"depth": 1}}`.
Code Snippet Example 1 (Python):
```python
import openclaw
openclaw.set_api_key(os.environ['OPENCLAW_API_KEY'])
result = openclaw.cs.analyze_complexity(code="def sum_list(lst): return sum(lst)")
print(result['big_o']) # Outputs: O(n)
```
Code Snippet Example 2 (Python):
```python
import openclaw
response = openclaw.cs.classify_problem(description="Shortest path in weighted graph")
print(response['classification']) # Outputs: e.g., "P, solvable via Dijkstra"
```
## Integration Notes
Integrate this skill by importing the OpenClaw library in your code and calling CS-specific modules. For multi-skill workflows, chain outputs (e.g., use classification results in an algorithms skill). Configuration: Store settings in a `.openclawrc` file with format like `{"cs": {"default_output": "json", "api_endpoint": "/api/cs"}}`. Ensure `$OPENCLAW_API_KEY` is set in your environment. For asynchronous use, wrap API calls in try-except blocks and handle retries for rate limits.
## Error Handling
Check for errors like invalid inputs (e.g., malformed code) by parsing response codes: HTTP 400 for bad requests, 401 for auth failures. Use OpenClaw's error objects, e.g., in Python: `try: result = openclaw.cs.analyze_complexity(...) except openclaw.errors.InvalidInputError as e: print(e.message) # e.g., "Code snippet must be a string"`. For CLI, errors return as stderr with codes (e.g., exit code 1 for failures). Always validate inputs before calling, and retry on transient errors like network issues with exponential backoff.
## Graph Relationships
- Related to: algorithms (for practical implementations), data-structures (for complexity interactions).
- Clusters with: computer-science (as root node), theory (for shared fundamentals).
- Dependencies: Requires core OpenClaw runtime; links to advanced topics like machine-learning for theoretical extensions.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.