Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    scaffold

    1

    Converts research papers into implementation roadmaps, pseudocode, and language-specific starter scaffolds.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    scaffold

    scaffold

    Example session with this skill installed

    [Attached: a research paper describing k-means++ initialization]

    /scaffold python

    Focus on the paper's initialization algorithm. Give me the protocol steps, dependencies, pseudocode, and a runnable starter implementation with a small example.

    • Read your context and instructions
    • Compiled the scaffold

    From Research Paper to Python Prototype

    The implementation target is

    k-means++ initialization: choose starting cluster centers that are spread across the dataset before running k-means.

    The first deliverable is a runnable Python implementation of the center-selection algorithm. The full clustering loop can be added afterward.

    1. Core Contribution

    Instead of choosing every initial center uniformly at random, k-means++ selects later centers using probabilities proportional to their squared distance from the nearest existing center.

    In code, this means maintaining a nearest-center distance for each point and using those distances as sampling weights.

    Implement first: the weighted center-selection routine with a reproducible random seed.

    2. Key Primitives

    PrimitivePurposeImplementation StrategyCommon Pitfall
    Squared Euclidean distanceMeasure separation from existing centersSum squared coordinate differencesMixing squared and unsquared distances
    Weighted random samplingFavor points far from selected centersSample using distance-derived weightsFailing when all weights are zero
    Nearest-center distanceAssign each point its sampling weightTake the minimum distance over selected centersUsing distance to only the newest center
    Seeded randomnessReproduce examples and testsUse a local random-number generatorDepending on shared global random state

    3. Dependency Map

    DependencyRequired?Role
    Python 3.10+YesRun the prototype
    random, mathYes; standard librarySampling and input validation
    NumPyOptionalSpeed up distance calculations later
    pytestOptionalExpand automated tests

    The starter implementation has no third-party dependencies.

    4. Protocol Steps

    1. Validate the dataset.
      Input: points and requested center count.
      Output: validated, consistent numeric vectors.
      Code hint: reject empty data, non-finite coordinates, and invalid k.

    2. Select the first center uniformly.
      Input: all points.
      Output: one starting center.
      Code hint: call rng.choice(points).

    3. Calculate each point's nearest-center squared distance.
      Input: points and selected centers.
      Output: one nonnegative weight per point.
      Code hint: use min(distance_squared(point, center) ...).

    4. Sample the next center using those weights.
      Input: points and distance weights.
      Output: an additional center.
      Code hint: use rng.choices(points, weights=weights, k=1).

    5. Repeat until k centers are selected.
      Output: the initialization centers.
      Code hint: loop while len(centers) < k.

    5. Pseudocode

    function initialize_centers(points, k, seed):
        validate(points, k)
        rng = seeded_random_generator(seed)
        centers = [uniform_random_point(points, rng)]
    
        while count(centers) < k:
            weights = []
            for point in points:
                weights.append(
                    minimum_squared_distance(point, centers)
                )
    
            if sum(weights) == 0:
                fail("Not enough distinct points")
    
            next_center = weighted_random_point(points, weights, rng)
            centers.append(next_center)
    
        return centers
    

    6. Starter Scaffold

    File Layout

    paper-prototype/
      initialize.py
      test_initialize.py
    

    initialize.py

    import math
    import random
    
    def distance_squared(a, b):
        return sum((x - y) ** 2 for x, y in zip(a, b))
    
    def initialize_centers(points, k, seed=42):
        points = [tuple(float(value) for value in point) for point in points]
    
        if not points or not points[0]:
            raise ValueError("Provide nonempty points.")
    
        dimensions = len(points[0])
        if any(len(point) != dimensions for point in points):
            raise ValueError("All points must have the same dimensions.")
    
        if any(not math.isfinite(value) for point in points for value in point):
            raise ValueError("Coordinates must be finite.")
    
        if isinstance(k, bool) or not isinstance(k, int) or k < 1:
            raise ValueError("k must be a positive integer.")
    
        if k > len(set(points)):
            raise ValueError("k cannot exceed the number of distinct points.")
    
        rng = random.Random(seed)
        centers = [rng.choice(points)]
    
        while len(centers) < k:
            weights = [
                min(distance_squared(point, center) for center in centers)
                for point in points
            ]
            total = sum(weights)
    
            if not math.isfinite(total):
                raise ValueError("Distances overflowed; rescale coordinates.")
    
            if total <= 0:
                raise ValueError("Distances collapsed; check coordinate scale.")
    
            centers.append(rng.choices(points, weights=weights, k=1)[0])
    
        return centers
    
    if __name__ == "__main__":
        dataset = [
            (0, 0), (0, 1), (1, 0),
            (10, 10), (10, 11), (11, 10),
            (20, 0), (20, 1), (21, 0),
        ]
        print("Initial centers:", initialize_centers(dataset, k=3))
    

    test_initialize.py

    import unittest
    
    from initialize import initialize_centers
    
    class InitializationTests(unittest.TestCase):
        def test_centers_are_distinct_input_points(self):
            points = [(0, 0), (1, 1), (10, 10), (11, 11)]
            centers = initialize_centers(points, 3)
            self.assertEqual(len(set(centers)), 3)
            self.assertTrue(all(center in points for center in centers))
    
        def test_same_seed_reproduces_result(self):
            points = [(0, 0), (1, 1), (10, 10)]
            self.assertEqual(
                initialize_centers(points, 2, seed=7),
                initialize_centers(points, 2, seed=7),
            )
    
        def test_rejects_too_many_centers(self):
            with self.assertRaises(ValueError):
                initialize_centers([(1, 1), (1, 1)], 2)
    
        def test_rejects_inconsistent_dimensions(self):
            with self.assertRaises(ValueError):
                initialize_centers([(1, 2), (3,)], 1)
    
    if __name__ == "__main__":
        unittest.main()
    

    Run

    python initialize.py
    python -m unittest -v
    

    7. Implementation Roadmap

    PhaseDeliverableExit Criteria
    BootstrappingCenter initialization and example datasetExample runs successfully
    Core clusteringAssignment and centroid-update loopIterations terminate with a defined convergence rule
    CorrectnessEdge cases and clustering invariantsTests cover duplicates, dimensions, and invalid input
    EvaluationCompare against random initializationReport clustering objective and runtime over multiple seeds

    8. Risks and Validation

    • This scaffold implements initialization, not the full k-means algorithm.
    • Feature scales affect Euclidean distance. Choose preprocessing deliberately.
    • Extreme coordinate magnitudes can overflow or underflow distance calculations.
    • A small example does not establish performance or reproduce the paper's experiments.

    Validate that centers come from the input dataset, remain distinct, and reproduce under the same seed. For the full clustering implementation, test convergence, empty-cluster handling, and objective behavior.

    9. Clarifying Assumptions

    AssumptionImpact
    Input consists of dense numeric vectorsMedium
    Squared Euclidean distance is the intended metricHigh
    Only initialization is in scope for this prototypeHigh
    Standard-library code is preferred for the first implementationLow

    Next steps: run the example, add the clustering loop, and compare experimental settings against the paper before claiming reproduction.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Research papers often present a massive gap between academic theory and a working prototype. This skill bridges that gap by translating complex papers into implementation-ready engineering roadmaps and starter code. It strips away academic fluff to focus on buildable primitives, protocol steps, and architectural scaffolds.

    What it does

    • Novelty extraction identifies the core contribution and translates it into developer-centric implementation priorities.
    • Primitive mapping lists required mathematical or cryptographic components alongside implementation strategies and common pitfalls.
    • Dependency management recommends mature libraries and environment tooling specific to your target language.
    • Protocol breakdown converts abstract algorithms into numbered steps with defined inputs, outputs, and code hints.
    • Scaffold generation produces a runnable skeleton with file layouts, interfaces, and placeholder logic for complex components.

    How it works

    1. Provide input by uploading a PDF, pasting paper text, or providing key excerpts from the research.
    2. Specify language and an optional focus like performance, security, or MVP speed to tailor the output.
    3. Review the roadmap which includes structured pseudocode, a phased execution plan, and a list of failure modes.

    Frameworks & tools

    The skill adapts to standard tooling for Python (pyproject.toml, pytest), TypeScript (Vitest/Jest), Rust (Cargo), Solidity (Hardhat/Foundry style), and Go.

    Why this beats prompting it yourself

    Generic prompts often return summaries or hallucinated equations. This skill enforces a strict engineering contract that prioritizes data structures, state transitions, and executable boilerplate over theory.

    Use cases

    • Convert a new cryptography paper into a Rust library scaffold.
    • Translate a distributed systems whitepaper into a Go service architecture.
    • Extract an ML paper's unique training loop into a PyTorch boilerplate.

    Known limitations

    Requires the user to provide the paper content or excerpts. It does not search external databases for PDFs. Logic for complex math components is provided as placeholders rather than generated code.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scanned

    Verified clean 7 days ago

    • Passed all security checks, Safe to install

    Listed7 days ago

    What's inside

    Frequently Asked Questions