# Generate Cursor Context

> Generates or regenerates the .cursor/rules/context.mdc file for a GoConnection repository. Use this skill whenever you need to initialise Cursor rules for a repo, update the rules after significant changes to the codebase or docs, or when context.mdc is missing, stale, or incorrect. Triggers on phrases like "generate cursor context", "update cursor rules", "initialise repo rules", "create context.mdc", or "cursor rules are out of date". Always use this skill rather than writing context.mdc manually.

- Skill: `miguelpecegueiro/generate-cursor-context` (Agent Skill)
- Install (CLI): `npx skillmds@latest add miguelpecegueiro/generate-cursor-context`
- Raw SKILL.md: https://api.skillmd.com/api/skills/miguelpecegueiro/generate-cursor-context/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: MiguelPecegueiro (https://skillmd.com/u/miguelpecegueiro)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/miguelpecegueiro/generate-cursor-context

---


# Generate Cursor Context

Produce or update `.cursor/rules/context.mdc` for the current repository by reading
the repo's own documentation and codebase. The output is a short, dense rules file
that gives Cursor the minimum context it needs to work correctly in this repo without
having to re-infer it every session.

## GoConnection context

- All apps are part of the GoConnection call center platform (ISO 9001, ISO 27001)
- Stack: .NET 8/10 (ASP.NET Core, Razor Pages, Worker Services), Python Flask (GC_Tools only), SQL Server, Azure Key Vault, IIS on SRVGOB, GitHub Actions CI/CD
- Every app has an IT-SA reference code (e.g. IT-SA-17) and a Confluence page
- Clients include: EDP, Endesa, UNICEF, MSF, Cofidis, CUF, Manutan/Salvador, Iberdrola, Allianz, Medicare, Amnistia, Renault, IGS
- Multi-tenant risk: GC_OneAgentScripts and GC_OneAgentPortal serve all clients — changes there have maximum blast radius

---

## Before starting

1. Check if `docs/` exists. If it does not exist, stop and tell the user — the skill requires repo documentation to work. Do not invent content.
2. List every file in `docs/` so you know what is available before reading anything.
3. Check if `.cursor/rules/context.mdc` already exists. If it does, read it — you are updating, not starting from scratch. Note what has changed.
4. Read all files in `docs/` in full. This is the primary source. Do not skim.
5. If `CLAUDE.md` exists at the repo root, read it too.
6. Read the entry point file (Program.cs, app.py, Startup.cs) to confirm the stack matches what docs describe.

---

## Output format

Write the output to `.cursor/rules/context.mdc`. Create `.cursor/rules/` if it does not exist.

The file must use this exact structure:

```markdown
---
description: Auto-generated repo context for Cursor. Do not edit manually — regenerate with generate-cursor-context skill.
alwaysApply: true
---

# [App name] — Cursor Context

## Identity
- **IT-SA reference:** [e.g. IT-SA-17, or N/A]
- **Type:** [e.g. ASP.NET Core Razor Pages, Worker Service, Web API, Python Flask]
- **Framework:** [e.g. .NET 10, .NET 8, Python 3.11]
- **Purpose:** [One sentence — what this app does]
- **Deploy target:** [e.g. IIS on SRVGOB, Windows Service on SRVGOB, Azure VM]

## Blast radius
[Who and what is affected by changes to this repo. Be specific — name clients,
downstream systems, external delivery targets, other apps that depend on this one.
This is the most important section. Vague warnings are ignored; specific ones are not.]

Examples of what belongs here:
- "All active Endesa campaigns — changes to the FF mapper affect live SFTP delivery to CGI SafeTransfer"
- "GC_OneAgentPortal depends on this API — breaking changes to endpoints affect all agents in session"
- "EDP receives daily XLSX reports via Microsoft Graph — any change to the report generation schedule or format is client-visible"

## Stack and patterns
- [Key pattern 1 — e.g. "Razor Pages with PageModel per feature, no MVC controllers"]
- [Key pattern 2 — e.g. "All secrets via Azure Key Vault — never appsettings.json"]
- [Key pattern 3 — e.g. "Serilog structured logging to Elasticsearch — always include context properties"]
- [Add as many as needed — only include patterns that are actually enforced in this repo]

## Database
- **Server:** [GoConnectionSRV / Azure SQL OCGoConnection / both]
- **Schemas used:** [e.g. Clientes.edp.*, Clientes.endesa.*, GoConnection.dbo.*]
- **Linked server:** [Yes/No — if yes, four-part naming: OCGoConnection.OCGoConnection.dbo.TableName]
- [Any repo-specific DB conventions worth noting]

## Known constraints
[Repo-specific constraints that are NOT in the global rules. Do not repeat global rules here.]

Examples:
- "This repo targets .NET Framework 4.7.2 — do not use .NET 8+ APIs"
- "Blue-green deploy: A/B app pools on SRVGOB — deploy script handles flip, do not touch IIS manually"
- "Python Flask — MSAL auth via GC_Tools pattern, not .NET MSAL"
- "Worker Service — deploy with dotnet publish -c Release -r win-x64 --self-contained true or DefaultAzureCredential fails"

## Docs index
[List every file in docs/ with a one-line description of what it covers.
This section is auto-maintained — regenerate the context whenever docs change.]

- `docs/filename.md` — [what it covers]
- `docs/filename.md` — [what it covers]
```

---

## Rules for writing the output

- **Dense, not verbose.** Every line should carry information. No filler.
- **Blast radius is the most important section.** Spend the most effort here. Name specific clients, systems, and downstream dependencies. Generic warnings are useless.
- **Known constraints is repo-specific only.** Do not repeat things already in global Cursor rules (agent discipline, security rules, .NET code quality). Only add what is unique to this repo.
- **Do not invent.** Every claim in the output must come from what you read in `docs/` or the codebase. If you are unsure, omit it.
- **Docs index must be complete.** List every file in `docs/` — even files you did not read in full. The index is navigation, not a summary.
- **Keep it short.** The context file is loaded on every Cursor request. Every unnecessary token costs. Target under 150 lines for the output.

---

## After writing

Tell the user:
- The file was written to `.cursor/rules/context.mdc`
- How many docs files were read
- Whether an existing context.mdc was updated or a new one was created
- Any docs that were missing or seemed outdated based on what you read in the codebase

Do not commit the file — that is the user's responsibility.

