agentleFS
griddynamicsgriddynamics/specflow/.cursor/rules/coding.mdc

specflow / rules

Cursor rule9 starsChanged 5 months agoMITView on GitHub

Coding Workflow - Implementation, Testing, Validation

The file

Show its rules and text

We split this coding.mdc into the rules it gives an agent

38 rules. About 0 are common, 30 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈30

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    ALWAYS start with reading docs/ARCHITECTURE.md and agents/IMPLEMENTATION.md.

    line 22
  2. Very specific:

    ALWAYS perform discovery and provide tech specs and plan in agents/plans/<FEATURE>/<FEATURE>-SPECS.md and …

    line 23
  3. Distinctive:

    Follow KISS, SOLID, DRY principles, and senior engineer best practices.

    line 29
  4. Distinctive:

    Prefer minimal changes, apply only what was requested, simpler is better.

    line 31
  5. Distinctive:

    No cheating. No "pre-existing" condition.

    line 32
  6. Very specific:

    Always ask questions when original intent is not possible to achieve, when plan changes, in doubt, assumptions highly affect result, or …

    line 33
  7. Distinctive:

    NEVER EVER DELETE DATA FROM ACTUAL SERVERS.

    line 36
  8. Distinctive:

    DO NOT USE ACTUAL SERVERS IN UNIT TESTING EVER.

    line 37
  9. Distinctive:

    MUST maintain single source of truth, each file has its own single purpose AND must not include DUPLICATE or SIMILAR content of OTHER files.

    line 38
  10. Distinctive:

    Use all available MCPs: Context7, Fetch, sequential-thinking, Playwright, etc.

    line 39
  11. Distinctive:

    Create and update document that you were EXPLICITLY instructed to do by rules or user.

    line 41
  12. Very specific:

    ALWAYS run make unit-tests before marking coding tasks complete

    line 47
  13. Distinctive:

    Never commit failing tests

    line 49
  14. Very specific:

    Run make check for static checks (ruff, mypy, vulture)

    line 50
  15. Very specific:

    All status/checkpoint writes ONLY in backend/app/state/

    line 53
  16. Very specific:

    Use EstimationStateMachine and WorkspaceStateMachine

    line 54
  17. Distinctive:

    NO direct Firestore writes outside state machines

    line 55
  18. Distinctive:

    Follow STEEL COMMANDMENTS in CLAUDE.md

    line 56
  19. Distinctive:

    Avoid duplication of code, search and check existing code

    line 66
  20. Distinctive:

    Write code aware of environments, never mock data for dev or prod.

    line 67
  21. Distinctive:

    When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing …

    line 68
  22. Very specific:

    Keep all temporary scripts in SCRIPTS folder in the workspace root.

    line 69
  23. Distinctive:

    Keep the codebase very clean and organized

    line 70
  24. Distinctive:

    Avoid having files over 300 lines of code.

    line 71
  25. Distinctive:

    Never add stubbing or fake data patterns to code that affects the dev or prod environments.

    line 72
  26. Distinctive:

    Always look for existing code to iterate on instead of creating new code.

    line 73
  27. Distinctive:

    Do not drastically change the patterns before trying to iterate on existing patterns.

    line 74
  28. Distinctive:

    Always think about what other methods and areas of code might be affected by code changes.

    line 75
  29. Distinctive:

    Always verify current folder when you use relative folder paths, especially in scripts or commands.

    line 76
  30. Distinctive:

    If issue is hard to fix OR code is highly concurrent: create a sequence diagram of what happens, temporary enable tracing in code and logs, …

    line 80
  31. Distinctive:

    Write thorough tests for all major functionality, the minimal coverage is 80%, all tests must succeed, all tests are isolated and …

    line 84
  32. Distinctive:

    MUST use scenario testing (explain step-by-step scenario, setup and expectations in the comment in the beginning of the test) for high …

    line 85
  33. Distinctive:

    MUST always mock all EXTERNAL calls (Http, Any Client, SQL, etc.) and ONLY in unit tests.

    line 86
  34. Distinctive:

    MUST ensure 1 sec test timeouts via attributes or configuration on EACH test to early detect external calls.

    line 87
  35. Distinctive:

    Always kill all existing servers that may have been started previously.

    line 88
  36. Distinctive:

    MUST create sequence diagram with all parties involved for each complex or scenario test to clearly show responsibilities.

    line 89
  37. Distinctive:

    Use Playwright MCP for testing as the first step.

    line 90
  38. Distinctive:

    ALWAYS update those after EACH task with very brief key points.

    line 102

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
coding.mdc
---
description: Coding Workflow - Implementation, Testing, Validation
globs: backend/app/**/*.py, **/*.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">

# Main Coding Flow (MUST FOLLOW ALWAYS)

1. Discovery
2. Tech plan
3. User review with explicit approval
4. Implementation, build (tests excluded)
5. Implementation Validation (local integration / E2E)
6. User review with explicit approval
7. Tests
8. Final Validation

# Core Principles

- ALWAYS start with reading `docs/ARCHITECTURE.md` and `agents/IMPLEMENTATION.md`.
- ALWAYS perform discovery and provide tech specs and plan in `agents/plans/<FEATURE>/<FEATURE>-SPECS.md` and `agents/plans/<FEATURE>/<FEATURE>-PLAN.md`:
  1. READ `.cursor/rules/techspecs.mdc`
  2. READ `.cursor/rules/planning.mdc`
  3. Execute both and apply guardrails rules.
- YOU MUST provide specs and plan to the user before continuing with implementation. User must approve explicitly with either "Yes, I reviewed the plan" or "Approve, the plan and specs were reviewed". Do not assume user has approved. If user messages anything else, he is reviewing the provided documents!
- Analyze existing code and dependencies before editing.
- Follow KISS, SOLID, DRY principles, and senior engineer best practices.
- Applications must be configurable and will run in multiple environments (local, dev, test, production).
- Prefer minimal changes, apply only what was requested, simpler is better.
- No cheating. No "pre-existing" condition. No warnings. No Errors. All tests must succeed, all code must compile (including any pre-existing), all requirements must be fulfilled, unless explicitly asked.
- Always ask questions when original intent is not possible to achieve, when plan changes, in doubt, assumptions highly affect result, or something is unknown/unclear/gap.
- Operating System: **Darwin (macOS)** on **arm64**
- Shell: **zsh**
- NEVER EVER DELETE DATA FROM ACTUAL SERVERS.
- DO NOT USE ACTUAL SERVERS IN UNIT TESTING EVER.
- MUST maintain single source of truth, each file has its own single purpose AND must not include DUPLICATE or SIMILAR content of OTHER files.
- Use all available MCPs: Context7, Fetch, sequential-thinking, Playwright, etc.
- Validation means in-depth analysis of what was done vs what was planned, checking git changes, re-read tech plan, gaps, anything missing, factual checking with MCPs.
- Create and update document that you were EXPLICITLY instructed to do by rules or user. **MUST NOT** create ANY other documents: summaries, change lists, validations, implementations, etc.
- YOU MUST ALWAYS systematically perform Implementation Validation (databases with queries but extremely careful to only delete your own data you just created, APIs with curl, Web Apps with Chrome DevTools/Playwright MCPs, checking logs, cleaning up afterwards, ALWAYS CONSIDERING CONSEQUENCES).

# GAIN-Specific Rules

**Testing Before Commits**:
- ALWAYS run `make unit-tests` before marking coding tasks complete
- Current baseline: **584+ passing tests**
- Never commit failing tests
- Run `make check` for static checks (ruff, mypy, vulture)

**State Management**:
- All status/checkpoint writes ONLY in `backend/app/state/`
- Use `EstimationStateMachine` and `WorkspaceStateMachine`
- NO direct Firestore writes outside state machines
- Follow STEEL COMMANDMENTS in `CLAUDE.md`

**Development Commands**:
- `make unit-tests` - Run test suite
- `make check` - Static checks
- `make format` - Format code
- `make run` - Start local services (Firestore Emulator)

# Coding

- Avoid duplication of code, search and check existing code
- Write code aware of environments, never mock data for dev or prod.
- When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation.
- Keep all temporary scripts in `SCRIPTS` folder in the workspace root.
- Keep the codebase very clean and organized
- Avoid having files over 300 lines of code. Suggest refactoring at that point.
- Never add stubbing or fake data patterns to code that affects the dev or prod environments.
- Always look for existing code to iterate on instead of creating new code.
- Do not drastically change the patterns before trying to iterate on existing patterns.
- Always think about what other methods and areas of code might be affected by code changes.
- Always verify current folder when you use relative folder paths, especially in scripts or commands.

# Debugging

- If issue is hard to fix OR code is highly concurrent: create a sequence diagram of what happens, temporary enable tracing in code and logs, review what exactly is happening. Make implicit to become explicit. Some assumptions are incorrect.

# Testing

- Write thorough tests for all major functionality, the minimal coverage is 80%, all tests must succeed, all tests are isolated and idempotent.
- MUST use scenario testing (explain step-by-step scenario, setup and expectations in the comment in the beginning of the test) for high complex or high level code (services, orchestrators) and pre-setup repositories or mocks.
- MUST always mock all EXTERNAL calls (Http, Any Client, SQL, etc.) and ONLY in unit tests. Do not mock regular classes that can be created and pre-configured. Write code that is easily mockable.
- MUST ensure 1 sec test timeouts via attributes or configuration on EACH test to early detect external calls.
- Always kill all existing servers that may have been started previously.
- MUST create sequence diagram with all parties involved for each complex or scenario test to clearly show responsibilities.
- Use Playwright MCP for testing as the first step.

# Context Files

- `CLAUDE.md` - Business context, STEEL COMMANDMENTS
- `docs/ARCHITECTURE.md` - Architecture of the project (ASCII, avoid Mermaid)
- `agents/IMPLEMENTATION.md` - Implementation status (use references, don't repeat code)
- Dependencies: `backend/pyproject.toml`
- Tech stack: `pyproject.toml`, `Dockerfile`
- Project structure: use IDE file tree

ALWAYS start with reading `docs/ARCHITECTURE.md` and `agents/IMPLEMENTATION.md`
ALWAYS update those after EACH task with very brief key points.

</CRITICAL>

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.