bigpowers / rules
danielvm-git/bigpowers/.cursor/rules/map-codebase.mdc
Derives the tech-stack doc from scratch by scanning the codebase — analyzes stack, architecture, and gray areas (error handling, API shapes) and persists findings into specs/tech-architecture/tech-stack.md. Run when the tech doc doesn't exist yet; use survey-context to consume it once it does.
Cursor rule240 starsChanged 32 days ago
What's in it
- Map Codebase
- Process
- 1. Identify Core Stack & Dependencies
- 2. Map High-Level Architecture
- 3. Analyze "Gray Areas" (The "How")
- 4. Identify Planning "Signals"
- 5. Persist to specs/tech-architecture/tech-stack.md
- When to Use
--- description: "Derives the tech-stack doc from scratch by scanning the codebase — analyzes stack, architecture, and gray areas (error handling, API shapes) and persists findings into specs/tech-architecture/tech-stack.md. Run when the tech doc doesn't exist yet; use survey-context to consume it once it does." alwaysApply: false --- # Map Codebase Perform a deep architectural and structural analysis of the codebase. Unlike `survey-context` which identifies "where we are", `map-codebase` identifies "what we are dealing with" and "how things are done". > **Use this vs survey-context:** `map-codebase` BUILDS the tech-stack doc by scanning the codebase from scratch. `survey-context` READS existing specs/tech-architecture docs without re-deriving them. Run `map-codebase` when `specs/tech-architecture/tech-stack.md` doesn't exist yet; run `survey-context` when it does. > **HARD GATE** — Cold analysis only. Do NOT assume architectural patterns without reading the code. If the codebase structure surprises you, call out the delta. ## Process ### 1. Identify Core Stack & Dependencies - Scan `package.json`, `Cargo.toml`, `requirements.txt`, etc. - Identify primary framework, runtime, and critical libraries (ORM, Auth, State, UI). - Note version constraints and any deprecated or unusual dependencies. ### 2. Map High-Level Architecture - Identify the entry points (CLI, Web, API). - Map the primary data flow (e.g., Controller → Service → Repository). - Identify where business logic lives vs. where I/O lives. - Look for established patterns (e.g., hexagonal, layered, feature-folders). ### 3. Analyze "Gray Areas" (The "How") Search for patterns and anti-patterns in these categories: - **Error Handling:** Are exceptions caught early or bubbled? Is there a global error handler? Are error messages structured? - **API Shapes:** Is it REST, GraphQL, or RPC? What is the casing (camelCase, snake_case)? How are responses structured? - **Type Safety:** Is it strictly typed? Are there many `any` or `unsafe` blocks? Are interfaces used for DIP? - **Observability:** Is there structured logging? Are there health checks? Where do logs go? - **Testing:** What is the test coverage strategy? Are mocks used? Where do tests live? ### 4. Identify Planning "Signals" Look for signals that will influence upcoming plans: - **Consistency Gaps:** "Half the project uses async/await, the other half uses Promises." - **Debt Hotspots:** "The `AuthManager` is 1500 lines and handles both JWT and session logic." - **Integration Points:** "We need to talk to the Stripe API, but there's no wrapper yet." - **Conventions:** "The team always uses functional components over classes." ### 5. Persist to specs/tech-architecture/tech-stack.md Compile all findings into `specs/tech-architecture/tech-stack.md`. This file serves as the project's "Long-Term Memory". ```markdown # Project Context ## Stack - [Framework/Language] - [Key Libraries] ## Architecture - [Pattern Description] - [Data Flow] ## Conventions (Observed) - [Error Handling Pattern] - [API Design] - [Type System] ## Signals / Active Considerations - [Gap 1] - [Hotspot 2] ``` ## When to Use - When first joining a project. - Before a major refactor or architectural change. - When `survey-context` reveals a lack of domain knowledge. - To refresh `specs/tech-architecture/tech-stack.md` after significant changes.
More agent context in danielvm-git/bigpowers
165 other files this repository gives its agents, the first 60 shown.
AGENTS.md
CLAUDE.md
Cursor rule
- .cursor/rules/align-grid.mdc
- .cursor/rules/assess-impact.mdc
- .cursor/rules/audit-code.mdc
- .cursor/rules/audit-plan.mdc
- .cursor/rules/build-epic.mdc
- .cursor/rules/change-request.mdc
- .cursor/rules/commit-message.mdc
- .cursor/rules/compose-workflow.mdc
- .cursor/rules/context7-mcp.mdc
- .cursor/rules/craft-skill.mdc
- .cursor/rules/deepen-architecture.mdc
- .cursor/rules/define-language.mdc
- .cursor/rules/define-success.mdc
- .cursor/rules/delegate-task.mdc
- .cursor/rules/deploy.mdc
- .cursor/rules/design-interface.mdc
- .cursor/rules/develop-tdd.mdc
- .cursor/rules/diagnose-root.mdc
- .cursor/rules/diagnose-stall.mdc
- .cursor/rules/dispatch-agents.mdc
- .cursor/rules/edit-document.mdc
- .cursor/rules/elaborate-spec.mdc
- .cursor/rules/enforce-first.mdc
- .cursor/rules/evolve-skill.mdc
- .cursor/rules/execute-plan.mdc
- .cursor/rules/extract-design.mdc
- .cursor/rules/find-way.mdc
- .cursor/rules/fix-bug.mdc
- .cursor/rules/gate-trace.mdc
- .cursor/rules/generate-allure-report.mdc
- .cursor/rules/grill-me.mdc
- .cursor/rules/grill-with-docs.mdc
- .cursor/rules/guard-git.mdc
- .cursor/rules/harden-vps.mdc
- .cursor/rules/hook-commits.mdc
- .cursor/rules/inspect-quality.mdc
- .cursor/rules/investigate-bug.mdc
- .cursor/rules/kickoff-branch.mdc
- .cursor/rules/maintain-wiki.mdc
- .cursor/rules/migrate-spec.mdc
- .cursor/rules/model-domain.mdc
- .cursor/rules/orchestrate-project.mdc
- .cursor/rules/organize-workspace.mdc
- .cursor/rules/plan-refactor.mdc
- .cursor/rules/plan-release.mdc
- .cursor/rules/plan-tests.mdc
- .cursor/rules/plan-work.mdc
- .cursor/rules/publish-package.mdc
- .cursor/rules/quick-fix.mdc
- .cursor/rules/release-branch.mdc
- .cursor/rules/request-review.mdc
- .cursor/rules/research-first.mdc
- .cursor/rules/reset-baseline.mdc
- .cursor/rules/respond-review.mdc
- .cursor/rules/run-benchmark.mdc
- .cursor/rules/run-evals.mdc
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

