Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Stupid Coder

    1

    Stupid Coder turns dense quant Python into code you can actually read, without making it slow or dumbed down.

    Free

    1 useSecurity scanned
    stupid-coder

    stupid-coder

    Example session with this skill installed

    Use stupid-coder on this. I wrote it for my thesis a few months ago and can't follow it anymore. p is a DataFrame of daily stock prices, b is the benchmark price Series.

    def f(p, b, w=60):
        r = p.pct_change().dropna()
        rb = b.pct_change().reindex(r.index)
        c = r.rolling(w).cov(rb)
        v = rb.rolling(w).var()
        beta = c.div(v, axis=0)
        a = r - beta.shift(1).mul(rb, axis=0)
        return beta, a
    
    • Read your context and instructions
    • Compiled the stupid-coder

    Summary: the function estimates a rolling 60-day beta of each stock against the benchmark and the daily alpha, i.e. the part of each stock's return not explained by the market. The rewrite keeps the behaviour identical (verified: both versions return the same DataFrames) and stays fully vectorised.

    import pandas as pd
     
    ROLLING_WINDOW_DAYS = 60  # ~3 trading months of daily returns per beta estimate
     
     
    # --- Rolling beta and daily alpha vs. a benchmark ---
    # Takes daily prices (DataFrame: dates x tickers) and benchmark prices (Series).
    # Returns two DataFrames (dates x tickers): rolling beta and daily alpha.
    def rolling_beta_and_alpha(stock_prices, benchmark_prices, window_days=ROLLING_WINDOW_DAYS):
        stock_returns = stock_prices.pct_change().dropna()  # drops a day if ANY stock lacks a price
        # Align benchmark to the stock dates so rows match one-to-one
        benchmark_returns = benchmark_prices.pct_change().reindex(stock_returns.index)
     
        # Beta = Cov(stock, market) / Var(market), over the last window_days
        rolling_covariance = stock_returns.rolling(window_days).cov(benchmark_returns)  # each column vs. the benchmark
        rolling_benchmark_variance = benchmark_returns.rolling(window_days).var()
        # axis=0 → divide each row by that date's variance, not match on column names
        rolling_beta = rolling_covariance.div(rolling_benchmark_variance, axis=0)
     
        # Use yesterday's beta: today's beta already contains today's return → look-ahead bias
        beta_known_yesterday = rolling_beta.shift(1)
        expected_return_from_market = beta_known_yesterday.mul(benchmark_returns, axis=0)
        daily_alpha = stock_returns - expected_return_from_market  # NaN for the first 60 days
     
        return rolling_beta, daily_alpha
    

    What changed

    • Renamed every variable (r, rb, c, v, a → stock_returns, benchmark_returns, rolling_covariance, rolling_benchmark_variance, daily_alpha) and moved the window into a named constant.
    • Split the alpha one-liner into named steps and added comments only where the logic is non-obvious: index alignment, axis=0, and why beta is lagged by one day.
    • Note: dropna() removes a date for all stocks if a single stock is missing a price. If your universe has stocks listing or delisting mid-sample, you may want to drop missing values per stock instead.
      Next steps
    • Run both versions on your data and check they match, e.g. with pd.testing.assert_frame_equal(old_beta, new_beta).
    • Want a chart of how your thesis functions connect? Paste the whole module and ask for the Mermaid call graph.

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

    About this skill

    Built for finance and economics students and graduates who know pandas, NumPy, OOP and some scikit-learn from a course or thesis, but haven't applied them much in real projects. They can read each line on its own, but a compact backtest or factor model still takes an hour to decode. Stupid Coder closes that gap.

    Two modes

    • Write: describe a task and get new code in this style.
    • Rewrite: paste existing code. Behaviour stays identical; only structure, names and comments change. Bugs are flagged, never silently "fixed". What you get
    • Descriptive names instead of r, w, df2, plus one step per line and small single-purpose functions.
    • Header comments before every function and class: what it does, inputs, outputs.
    • Precise, short inline comments only where they matter: look-ahead bias, index alignment, axis= arguments, return shapes, data leakage, the finance logic behind a step. No comments on print() or imports.
    • Performance kept: stays vectorised and idiomatic. No row-by-row loops for "simplicity", no over-engineering for tiny speed-ups.
    • Calibrates to you: if your own code is available, it comments less on what you already use well and more on what you avoid.
    • Optional Mermaid chart showing how the functions call each other; renders on GitHub, VS Code and Jupyter. Works well for: backtests, factor models, Monte Carlo simulations, risk metrics, ML pipelines, and thesis or homework code you need to understand or hand over.

    The assumed-knowledge list is editable, so you can adapt the skill to your own level.

    Focused on Python data stacks (pandas, NumPy). Skips basics for graduates but avoids advanced niche libraries like Numba or Cython. Optimized for finance and economics contexts.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 25 days ago

    • Free with an Agensi account

    Permissions

    Read Files
    Listed25 days ago

    What's inside

    Frequently Asked Questions

    This skill is designed for any platform that supports Python-based AI agents, specifically those integrated with the standard scientific stack like pandas and NumPy. It works seamlessly within your existing IDE or agent interface via the `/stupid-coder` command.

    Unlike generic prompts that explain basic syntax, this skill focuses on financial logic and data alignment. It identifies complex patterns like time-series shifts or vectorization and explains them in the context of quantitative research, ensuring a finance graduate understands the 'why' behind the code.

    No complex installation is required; once purchased, you can activate the skill by providing your script or using the dedicated command. The agent will automatically begin analyzing your code to determine the appropriate level of explanation needed for your team.

    The skill handles everything from core Python logic to specialized data libraries like scikit-learn and pandas. In addition to the refactored code, you will receive Mermaid.js flowcharts to visualize the script’s architecture and header documentation for every new function.

    This skill is highly optimized for data-centric and financial Python workflows but does not support low-level optimizations like Cython or Numba. It is also limited to Python and does not translate scripts into other programming languages.

    New in Prompt & Skill Engineering