# Code Analysis Instructions — MRPS Agent Toolkit

## Overview
Understanding a codebase: architecture, module boundaries, dependency relationships,
dead code, and structural debt.

## Category & Tools
- **Tools**: `graphify` (`kind: skill`)
- **Category**: `code-analysis`
- **ID prefix**: `code` · **Report slug**: `code`
- **Produces findings**: no list of its own — it produces *understanding*

## When to Reach for What
Reach for `graphify` to turn an unfamiliar repository into a queryable knowledge graph —
symbols, imports, cross-module relations, architectural shape.

For lint and type checks, **delegate to the project's own tooling**. Do not install a new
linter into someone's repo.

## Delegation table (use what the project already has)
| Stack | Command |
|---|---|
| TypeScript | `npx tsc --noEmit` |
| ESLint | `npx eslint .` |
| Python | `ruff check .` / `mypy .` |
| Rust | `cargo clippy -- -D warnings` |
| Go | `go vet ./...` |

Run the command the project declares. If there is no config, record `NOT CHECKED`
rather than inventing one.

## What Inspect means here
Parse and map. Do not reorganize files, rename symbols, or apply codemods.

## The ladder, applied here
- **Inspect** — build the graph, run the declared linter, read the output.
- **Critique** — circular dependencies, god modules, dead paths, boundary leaks.
- **Recommend** — a refactoring plan with named files and interfaces.
- **Fix** — only on explicit instruction. Structure changes are the riskiest fix there is.

## Tool Guidance: Graphify
### When to use
Onboarding to a complex repo, mapping cross-module dependencies, linking docs/SQL schemas
into the graph.
### When NOT to use
As a fast syntax linter, or on a repo small enough to read directly.
### Invocation
```bash
uv tool install graphifyy && graphify install
# then run /graphify . in your agent
```

## Evidence rules
Every structural finding cites: the symbol or file, the relation that is wrong, and the
query or tool output that shows it. Example: `src/api → src/db → src/api` (cycle).

Graphify output is exploration, not a finding list. Convert only concrete, actionable
observations into findings — and only when you can cite the graph result.

## Report example
```markdown
# code — 2026-11-09T14-32-05Z

Prior: none (first run)
Toolchain: Graphify 0.4.1 · eslint 9.0.0
Delta: +1 new · 0 still open · 0 resolved · 0 not checked

## What was found (plain English)
- **code-01** — A variable is declared and never used, so readers cannot tell if it was forgotten. (Low)

## What changed since last run
- First run.

## Technical detail
| ID | Sev | Evidence | File | Rule | Status |
|----|-----|----------|------|------|--------|
| code-01 | L | unused 'cacheKey' | src/utils.ts:14 | no-unused-vars | NEW |

## Commands run
| Command | Exit | Note |
|---------|------|------|
| npx eslint . | 0 | 1 warning |
| graphify . | 0 | graph built, 412 symbols |

## Not checked
- Type check — no tsconfig in this package.

Generated by <agent name>. Read-only. No source files were modified.
Findings are advisory; the user decides what to fix.
```
