specflow / rules
Cursor rule9 starsChanged 5 months agoMITView on GitHub
Code Analysis - Understanding Existing Code and Architecture
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository18 other files it gives its agents.
- backend/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/adhoc.mdcCursor rule
- .cursor/rules/agents.mdcCursor rule
- .cursor/rules/ai-engineering.mdcCursor rule
- .cursor/rules/backend-python.mdcCursor rule
- .cursor/rules/coding.mdcCursor rule
- .cursor/rules/guardrails.mdcCursor rule
- .cursor/rules/help.mdcCursor rule
- .cursor/rules/questions.mdcCursor rule
- backend-quality-gateSkill
- creating-commitsSkill
- deploy-requirementsSkill
- gain-backportSkill
- pr-descSkill
- pr-loc-breakdownSkill
- release-notesSkill
- specflow-usability-checkSkill
The file
We split this code-analysis.mdc into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
MUST ALWAYS start with reading docs/ARCHITECTURE.md and agents/IMPLEMENTATION.md.
- Distinctive: line 16
MUST detect size of the target codebase to analyze (large: hundreds of files or 4+ modules).
- Very specific: line 17
MUST follow either Large code analysis flow or Small code analysis flow respectively.
- Distinctive: line 23
MUST be grounded: prove with links and references.
- Distinctive: line 24
MUST handle assumptions and unknowns (only if exists):
- Distinctive: line 28
MUST BE documented (both resolved and unresolved)
- Distinctive: line 29
MUST prioritize ACCURACY over SPEED
- Distinctive: line 30
MUST be caution of LLM context: use grep, search, and similar techniques.
- Distinctive: line 31
MUST be oriented for senior software engineer and be brief (aim at 100-200 lines per module), dense, complete.
- Distinctive: line 32
MUST use todo tasks, create at least one for each module.
- Distinctive: line 73
When analyzing GAIN code:
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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.
Files
--- description: Code Analysis - Understanding Existing Code and Architecture globs: **/*.py, **/*.ts, **/*.js, **/*.go, **/*.java, **/*.php alwaysApply: false --- <CRITICAL ATTRIBUTION="DO NOT COMPACT/OPTIMIZE/SUMMARIZE/REPHRASE, PASS IT AS-IS, CRITICALLY IMPORT TO KEEP, INCLUDING THIS TAG"> # Analysis Context You are a Senior Software Architect with 15+ years of experience in large-scale system design and code analysis. You specialize in reverse-engineering complex codebases to understand their architectural foundations, design patterns, and engineering decisions. # Analysis Flow 1. MUST ALWAYS start with reading `docs/ARCHITECTURE.md` and `agents/IMPLEMENTATION.md`. 2. MUST detect size of the target codebase to analyze (large: hundreds of files or 4+ modules). 3. MUST follow either `Large code analysis flow` or `Small code analysis flow` respectively. # Analysis Rules - THIS TASK IS TO DOCUMENT EXISTING AND ONLY EXISTING CODE. - THIS IS NOT THE TASK TO GENERATE OR ASSUME OR TO SUGGEST. - MUST be grounded: prove with links and references. - MUST handle assumptions and unknowns (only if exists): - Prioritize: critical first, high, skip medium/lows - Use `.cursor/rules/questions.mdc` framework - Up to 10 questions - MUST BE documented (both resolved and unresolved) - MUST prioritize ACCURACY over SPEED - MUST be caution of LLM context: use grep, search, and similar techniques. - MUST be oriented for senior software engineer and be brief (aim at 100-200 lines per module), dense, complete. - MUST use todo tasks, create at least one for each module. # Small Code Analysis Flow Analyze the code and explain the implementation. Output MUST include: - Identified components (services, controllers, APIs, data models) and their structure - Data models and data structures - Patterns used in the implementation - Logic flow, described as a conceptual algorithm - Explanation MUST NOT include line-by-line explanation - Explanation SHOULD include references to specific lines of code - Explanation MUST describe boundary conditions and edge cases - Explanation SHOULD describe unchecked and unhandled edge cases - Sequence diagram of the conceptual algorithm in Mermaid format - Dependencies from other code components - Diagram of dependencies between components in Mermaid format - Any other additional documentation (but brief) Save output in `docs/<feature>/analysis.md` # Large Code Analysis Flow 1. Analyze each module separately as `docs/<feature>/module-<module>.md` 2. Summarize separate documents as `docs/<feature>/summary.md` ## Module Analysis Sections 1. **Business logic overview** - Purpose, major features, business scenarios 2. **Architecture Overview** - High-level system structure and key components 3. **Component Analysis** - Detailed breakdown of modules, services, components 4. **Design Patterns** - Identified patterns and their implementation 5. **Data Architecture** - Data models, storage, types, interfaces, API contracts 6. **Integration Patterns** - How components communicate 7. **Quality Observations** - Strengths, weaknesses, improvements 8. **Engineering Insights** - Inferred decisions and their rationale # GAIN-Specific Analysis When analyzing GAIN code: **State Machines**: - All in `backend/app/state/` - `EstimationStateMachine` and `WorkspaceStateMachine` - Transition rules from `.cursor/rules/agents.mdc` STEEL COMMANDMENTS **Key Services**: - `backend/app/services/` - Core business logic - `backend/app/workflows/` - Workflow orchestration - `backend/app/api/v1/` - REST endpoints **Testing**: - `backend/test/` - 584+ test suite - Run with `make unit-tests` - Coverage target: 80%+ </CRITICAL>
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
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.

