parent_skill

This skill helps you write cleaner C++ by applying Sean Parent's no raw loops philosophy, replacing loops with expressive algorithms for clarity and
  • Python

3

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill copyleftdev/sk1llz --skill parent

  • SKILL.md5.9 KB

Overview

This skill teaches writing C++ in the style of Sean Parent's "No Raw Loops" philosophy. It emphasizes expressing intent with named algorithms, composing small well-named operations, and treating code as mathematical reasoning. Use it to refactor loops into clearer, safer algorithmic code.

How this skill works

The skill inspects code for raw iteration patterns and suggests replacing them with standard algorithms, range-based pipelines, or small named algorithms when no standard one exists. It recommends specific replacements (e.g., std::transform, std::remove_if, std::partition) and shows how to compose primitives to preserve or improve performance and clarity. When necessary it guides writing a new utility algorithm and naming it to document intent.

When to use it

  • Refactoring legacy code that contains many for/while loops and mutation.
  • Writing new C++ where intent should be explicit and verifiable.
  • Reviewing code for readability, correctness, or hidden O(n^2) behavior.
  • Converting imperative loops to C++20 ranges or algorithm pipelines.
  • Designing library code where small named algorithms improve reuse.

Best practices

  • Ask what the operation is (search, transform, reorder, aggregate) before writing a loop.
  • Prefer standard algorithms and range views that express the semantic intent.
  • If no standard algorithm fits, implement a small, well-named algorithm rather than an ad-hoc loop.
  • Compose simple operations instead of nesting loops; name intermediate steps to document meaning.
  • Use erase-remove idiom or std::erase_if instead of manual element removal.

Example use cases

  • Replace a filtering-and-transform loop with a views::filter + views::transform pipeline to make intent explicit.
  • Convert a manual erase loop into vec.erase(std::remove_if(...), vec.end()) to fix O(n^2) bugs.
  • Implement a slide or gather utility to move ranges without nested index arithmetic.
  • Refactor nested loops that perform two sequential passes into composed algorithms for clarity and testability.

FAQ

Write a small, well-named algorithm that captures the intent and compose it with other primitives. Naming documents meaning and enables reuse and testing.

Does avoiding raw loops hurt performance?

No. Standard algorithms are often as fast or faster than manual loops and make complexity explicit. When performance-critical, profile and implement the algorithm with the same clear intent.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
parent skill by copyleftdev/sk1llz | VeilStrat