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.
npx agentmods add rules/usamaijazmughal/code-diagram/cursorrulesgit clone --depth 1 https://github.com/usamaijazmughal/code-diagramWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.03268 | $0.03268 |
| Opus 5 | $0.01634 | $0.01634 |
| Sonnet 5 | $0.00654 | $0.00654 |
| Haiku 4.5 | $0.00327 | $0.00327 |
Grade A, and why
cursorrules 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.
How it starts
The opening of the file, as written. The whole thing — 241 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Code Diagram Generator v1.2.0
When the user asks you to generate diagrams, analyze code structure, or visualize architecture, follow this analysis pipeline. Use terminal commands (rg, find, cat) for all file operations.
Input modes
Extract from the user's message and detect which mode applies (check in order):
| Mode | When | Example |
|---|---|---|
| Multi-path | User mentions multiple files/directories | "Analyze lib/auth and lib/payments together" |
| Line range | User specifies line numbers | "Diagram lines 10-50 of bloc.dart" |
| Single file | User points at one file | "Analyze auth_bloc.dart" |
| Directory | User points at a directory | "Analyze lib/features/payments" |
| Pasted code | User pastes raw code | "Diagram this: class Foo { ... }" |
Also extract flags (can appear in any order in the user's request):
DIAGRAM_TYPE—class,sequence,component,arch, orall(default:all)FLOW_MODE—fullorsplit(default:full)DETAIL_LEVEL— if user says "rich" or "with details" or "show endpoints" →rich. Otherwise →method-names(default, secure)EFFORT_LEVEL—low,medium(default),max, oreffort=VALUE(explicit form)low: 10 reads, 5-hop tracemedium: 20 reads, 12-hop trace (default)max: no read cap, unlimited trace, no auto-decompose split- Abstract resolution + mixin tracking are ALWAYS active at all levels
File type validation
If the target is a single file, check its extension: .dart, .ts, .tsx, .js, .jsx, .py, .kt, .java, .go, .swift, .rs, .svelte. If unsupported, tell the user: "Unsupported file type. Please point at a source code file or directory."
Multi-path mode
When multiple targets are provided, budget per target is from EFFORT_LEVEL: low=10, medium=20, max=unlimited.
Process each target independently, then check for cross-path imports to draw connections between subgraphs.
Line range mode
When user specifies lines (e.g., "lines 10-50 of file.dart"), read only that range. Note in output that entities outside the range are not shown.
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.
- 2d ago First seen · 241 lines · 3,268 tokens per session scan A acf8e190bbe5
cursorrules is a cursor rule published in the GitHub repository usamaijazmughal/code-diagram (2 stars, last pushed 4mo ago), licensed MIT. It adds 3,268 tokens to every session, about $0.0163 per session on Opus 5. 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-31.
Other cursor rules, from other repositories
cursorrules
You are working with a React Native (Expo) architecture reference project. Read the skill files before generating any code.
archgate-governance
Archgate ADR governance — enforces architecture decision records.
code-convention
Code convention analysis and enforcement — ESLint integration, naming conventions, type safety checks, and quality scoring with remediation steps. Applied when analysing code style and conventions.
devops-practices
DevOps practices — CI/CD pipeline design, Docker containerisation, Kubernetes orchestration, Infrastructure as Code, monitoring, logging, and security. Applied when working with deployment and infrastructure files.
performance
Performance optimisation guidelines — bundle optimisation, memory management, rendering, network, Electron-specific, and monitoring strategies. Applied when working on performance-sensitive code.
ai-skills
Operate the AI-SKILLS library autonomously, selecting the right skill or prompt for each task.