agentleFS
udaydeep1992udaydeep1992/pinescript-agents-antigravity/skills/pine-auditor/SKILL.md

pine-auditor

Skill0 starsChanged 41 days agoMITView on GitHub

Proactively audits Pine Script indicators and strategies for repainting, lookahead leakage, unconfirmed bar dependencies, backtest realism (commission, slippage, fill assumptions), code quality, and adherence to user specification. Use when asked to audit, review, verify, validate, or inspect Pine Script code.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use of legacy v4/v5 functions (security(), study(), iff()).

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Pine Script Auditor

The Pine Auditor is a dedicated auditing layer that thoroughly inspects Pine Script code for repainting vulnerabilities, backtest distortion, code quality defects, and deviations from specifications.

Audit Dimensions

graph TD
    A[Pine Script Code] --> B[1. Repainting & Lookahead Audit]
    A --> C[2. Backtest Validity Audit]
    A --> D[3. Code Quality & Syntax Audit]
    A --> E[4. Specification Compliance Audit]
    B --> F[Audit Report]
    C --> F
    D --> F
    E --> F

1. Repainting & Future Leakage Check

Inspect for:

  1. request.security() Lookahead:
    • ⚠️ Flags any request.security() missing lookahead=barmerge.lookahead_off.
    • ⚠️ Flags lookahead=barmerge.lookahead_on on historical bars unless explicitly intended for session reference (e.g. daily open).
    • ⚠️ Flags higher-timeframe data accessed without bar offset (e.g. request.security(syminfo.tickerid, "D", close) accesses the daily close before the day ends on intraday historical bars).
  2. Realtime Bar Instability:
    • Flags signals dependent on close, high, low on unconfirmed bars where signals can appear and disappear on every tick.
    • Verifies whether barstate.isconfirmed or close[1] is required.
  3. Pivots and Swings:
    • Verifies that ta.pivothigh() and ta.pivotlow() have their inherent right-side bar delay acknowledged (e.g. ta.pivothigh(5, 5) only evaluates true 5 bars after the peak).
  4. Drawing Coordinate Degradation:
    • Flags usage of xloc.bar_index on historical lookback beyond 5,000 bars.

2. Backtest Validity & Realism Check

Inspect for:

  1. Commission & Slippage Assumptions:
    • Flags strategies with 0% commission or 0 slippage. High-frequency or low-timeframe strategies with zero commission produce severely distorted equity curves.
  2. Order Execution Realism:
    • calc_on_order_fills=true / calc_on_every_tick=true: Check if intrabar fills assume fills at the close or intrabar extremes.
    • Limit and stop orders: Check whether realistic bid/ask spread and price gaps are accounted for.
  3. Position Sizing & Margin:
    • Checks default_qty_type and default_qty_value.
    • Flags 100% equity compounding without risk caps.
    • Flags unintended pyramiding (pyramiding > 0 allowing duplicate entries on every bar).

3. Code Quality & Pine Script v6 Standards Check

Inspect for:

  1. Deprecated Syntax:
    • Missing //@version=6.
    • Use of legacy v4/v5 functions (security(), study(), iff()).
  2. Syntax Trap Detection:
    • Split ternary operators (? :) across multiple lines outside parentheses.
    • Incorrect continuation indentation (multiples of 4).
    • plot() called inside local scopes (if, for).
  3. Loop Boundary Vulnerabilities:
    • Traditional for i = 0 to array.size(arr) without boundary caching (March 2025 breaking change).
  4. Missing Strategy Alert Annotations:
    • Verifies //@strategy_alert_message {{strategy.order.alert_message}} is present and placed after strategy().
  5. State Management & Persistence:
    • Incorrect use of var / varip vs series re-initialization.
    • Missing na() handling on historical offset series (series[1]).

4. Audit Report Structure

Generate the audit findings in this clear format:

# Pine Script Audit Report: [Script Name]

## 1. Repainting & Future Leakage
- **Status**: [PASSED / WARNING / CRITICAL]
- **Findings**:
  - `Line XX`: [Explanation and risk assessment]

## 2. Backtest Validity & Execution Realism
- **Status**: [PASSED / REALISTIC / DISTORTED]
- **Findings**:
  - Commission: [Configured or missing]
  - Slippage: [Configured or missing]
  - Intrabar assumptions: [Evaluation]

## 3. Code Quality & Syntax Compliance
- **Status**: [CLEAN / WARNINGS / ERRORS]
- **Findings**:
  - Pine Version: [v6 confirmed / outdated]
  - Loop safety: [Verified / vulnerable]
  - Line formatting: [Valid / invalid]

## 4. Specification Adherence
- Matches requested rules: [Yes / Partial / Discrepancy]
- Discrepancies noted: [None or bullet points]

## 5. Recommended Fixes (Surgical)
```pinescript
// Specific corrected code snippet

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.