05-template-processing

A template-processing system that replaces placeholders such as the project path, framework version, and selected stack with project-specific values.

In plain words
What is it for?
Use it to turn reusable files in a templates directory into project-specific documentation or rule files, including metadata added to MDC files.
Why use it?
It removes the need to copy and edit the same rule files manually for every project.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/tecnomanu/agent-rules-kit/05-template-processing
Clone the repo
git clone --depth 1 https://github.com/tecnomanu/agent-rules-kit

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 849 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00849
Opus 5 $0.00000 $0.00425
Sonnet 5 $0.00000 $0.00170
Haiku 4.5 $0.00000 $0.00085

Measured 2d ago against content hash 0013860e5845, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

05-template-processing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/05-template-processing.mdc · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Template Processing & Variables

This document explains how templates are processed and variables are substituted in Agent Rules Kit.

Template Variables

The following variables are available for use in template files:

Variable Description Example
{projectPath} Path to the project /path/to/project
{detectedVersion} Detected version of the framework 10
{versionRange} Compatible version range v10-11
{stack} Selected stack laravel

Processing Flow

  1. Read Template: Templates are read from templates/ directory
  2. Process Variables: All variables in {placeholder} format are replaced
  3. Add Front Matter: Metadata is added as front matter to MDC files
  4. Output Generation: Processed content is written to destination

Implementation

The main processing happens in cli/utils/file-helpers.js:

// Process template variables (simplified example)
const processTemplateVariables = (content, meta = {}) => {
  let processedContent = content;
  
  // Replace all template variables with their values
  const templateVariables = [
    { value: meta.detectedVersion, replace: 'detectedVersion' },
    { value: meta.versionRange, replace: 'versionRange' },
    { value: meta.projectPath, replace: 'projectPath' },
    { value: meta.stack, replace: 'stack' }
  ];
  
  templateVariables.forEach(({ value, replace }) => {
    if (value) {
      const regex = new RegExp(`\\{${replace}\\}`, 'g');
      processedContent = processedContent.replace(regex, value);
    }
  });
  
  return processedContent;
};

Example

Template file:

# {stack} Documentation

This project is using {stack} version {detectedVersion}.
It is located at {projectPath}.

After processing (if stack=laravel, detectedVersion=10, projectPath=/app):

# laravel Documentation

This project is using laravel version 10.
It is located at /app.

Template Structure Guidelines

Read the full file on GitHub · 125 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 125 lines · 0 tokens per session scan A 0013860e5845

Subscribe to this mod's changes

05-template-processing is a cursor rule published in the GitHub repository tecnomanu/agent-rules-kit (35 stars, last pushed 11mo ago), licensed ISC. It costs nothing until one of its globs matches a file; then it loads 849 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.