| name | scan-project-backend |
| description | Backend scan/architecture discovery skill for the backend/ subtree. Use before backend implementation/review/refactor to build a reusable, evidence-based architecture snapshot (facts, inferences, unknowns) without changing production behavior. |
scan-project-backend
Frontmatter
- Skill type: Backend scan / architecture discovery
- Primary scope:
backend/ subtree only
- Primary artifact:
backend/docs/backend-project-architecture.md
- Core method: Repository evidence first; no unsupported claims
- Non-goals: Refactor design, implementation planning, code fixes
Description
This skill performs a backend-only repository scan and produces a stable architecture snapshot that later backend tasks can reuse directly.
The skill must:
- collect evidence from files/commands,
- separate
Confirmed facts / Inferred facts / Unknowns (REQUIRES CONFIRMATION),
- persist the result in a backend architecture document.
Purpose
Build a repeatable factual snapshot of the backend architecture under backend/ so future backend implementation/review/refactor work does not need full re-discovery.
When to Use
Use this skill when at least one is true:
- Starting backend implementation/review/refactor in an unfamiliar or partially familiar codebase.
- Backend structure/command map is unclear or outdated.
- A reusable architecture baseline is needed for future AI turns.
- You need evidence-backed architecture context before giving technical recommendations.
When Not to Use
Do not use this skill when:
- Task is a tiny single-file bug fix with clear local context.
- Task is pure code editing without architecture discovery need.
- Task is non-backend scope (
frontend/, infra-only, docs-only outside backend architecture context).
- Repository does not use
backend/ as backend root and user did not ask to adapt scan scope.
If backend/ is missing or clearly not the backend root:
- stop broad scanning,
- report
Unknowns (REQUIRES CONFIRMATION),
- ask for the correct backend root before continuing.
Assumptions
backend/ is intended backend subtree unless evidence disproves it.
- Scan is evidence-collection work, not production behavior change.
- Commands are run from repo root by default; backend mode is equivalent with adjusted paths.
- Environment limitations may exist; failures must be recorded, not hidden.
Required Inputs
Minimum inputs (read if present):
AGENTS.md (repo root)
backend/AGENTS.md
backend/pom.xml
backend/mvnw (or evidence it is absent)
backend/src/main/**
backend/src/test/**
backend/docs/**
- Existing
backend/docs/backend-project-architecture.md (if present)
- Skill references/templates under
backend/.agents/skills/scan-project-backend/
Input Fallback Rules
If an expected input is missing, do not fail the whole scan by default.
- Missing
backend/AGENTS.md or root AGENTS.md:
- continue with available rules,
- record missing governance source in
Unknowns.
- Missing
pom.xml or mvnw:
- do not invent build commands,
- record command-map confidence as reduced.
- Missing
src/test:
- do not infer “no tests exist globally”,
- record scope-limited finding only.
- Missing
backend/docs/ or target artifact:
- create target artifact if allowed by task; otherwise report as follow-up.
- Missing
references/ or templates/ files:
- continue with core scan workflow,
- use inline default structure defined in this SKILL,
- mark reference/template gap in
Unknowns.
Evidence Collection Rules
- Every major claim must map to file-path evidence or command output.
- If evidence is indirect, mark as
Inferred facts and state inference basis.
- If no evidence is available, mark as
Unknowns (REQUIRES CONFIRMATION).
- Do not treat common conventions as confirmed project behavior.
- Do not treat missing files as architecture defects without explicit evidence.
- Evidence commands are for discovery only; avoid hidden design conclusions.
Minimum Evidence Commands
Run minimal commands needed; choose one execution mode.
Command Availability Rule
- Prefer
rg for file discovery.
- If
rg is unavailable, fallback to find + sed/head patterns.
- Record fallback usage in output.
Mode A: Repo Root Mode (preferred)
find backend -name AGENTS.md -print
find backend -maxdepth 3 -type f | rg 'pom.xml|mvnw|application.*yml|README|docs'
find backend/src/main/java -maxdepth 5 -type d
find backend/src/test/java -maxdepth 5 -type d
rg --files backend/src/main/java | head -n 80
rg --files backend/src/test/java | head -n 80
Mode B: backend/ Mode (equivalent)
find . -name AGENTS.md -print
find . -maxdepth 3 -type f | rg 'pom.xml|mvnw|application.*yml|README|docs'
find src/main/java -maxdepth 5 -type d
find src/test/java -maxdepth 5 -type d
rg --files src/main/java | head -n 80
rg --files src/test/java | head -n 80
Command Failure Handling
For each failed command, record:
- command string,
- failure reason (tool missing / path missing / permission / timeout),
- impact on confidence,
- whether a fallback command was attempted.
Do not abort entire scan unless zero meaningful evidence can be collected.
Execution Modes
- Quick scan (default): minimal evidence commands + key file reads.
- Deep scan (only when task needs it): targeted deeper reads for boundaries/conventions.
Selection rule:
- If user asks architecture baseline only → Quick scan.
- If user asks review/refactor preparation across modules → Deep scan.
Steps
Execute in order.
Step 1: Guardrails & Scope
Input: AGENTS files, user request.
Action:
- identify applicable rules and precedence,
- confirm scan boundary is
backend/.
Output:
- scope statement,
- applicable rule list.
Step 2: Structural Evidence Collection
Input: backend source tree.
Action:
- map package/module layout from actual directories/files,
- identify major layers and infrastructure modules only when evidenced.
Output:
- backend module map (factual).
Step 3: Command Map Extraction
Input: pom.xml, mvnw, backend docs/scripts.
Action:
- capture only explicit runnable commands discovered in repository,
- separate confirmed vs unconfirmed commands.
Output:
- command map with confidence tags.
Step 4: Boundary & Data Surface Mapping
Input: controller/service/repository/entity/config evidence.
Action:
- identify API boundaries, data/persistence touchpoints, cross-cutting concerns.
Output:
- boundary map with evidence references.
Step 5: Architecture Classification
Input: structure + boundaries evidence.
Action:
- classify architecture style using explicit rules (below),
- if evidence is insufficient, output
Insufficient evidence.
Output:
- classification + rationale.
Step 6: Convention Compliance Check
Input: repository layout and docs evidence.
Action:
- evaluate convention checks with strict statuses.
Output:
- compliance table (
Pass | Partial | Fail | Insufficient evidence).
Step 7: Persistent Artifact Update
Input: all scan outputs.
Action:
- create/update
backend/docs/backend-project-architecture.md,
- preserve stable headings and prior useful content,
- avoid unnecessary full rewrite.
Output:
- updated architecture snapshot artifact.
Step 8: Miss-Check & Final Verification
Input: summary + artifact draft.
Action:
- run verification checklist,
- ensure unknowns are explicit where confidence is limited.
Output:
- final chat summary + artifact consistency confirmation.
Classification Rules
Allowed outcomes:
Layered monolith
Domain-modular monolith
Microservices-oriented split
Insufficient evidence
Decision criteria (must cite evidence):
- Layered monolith: dominant technical layers (controller/service/repository etc.) under one deployable backend project.
- Domain-modular monolith: clear domain packages/modules each containing multiple layers.
- Microservices-oriented split: evidence of independently structured service modules/projects or strong service-boundary separation.
- Insufficient evidence: any case where above cannot be proven.
Rule: never force a classification when evidence is weak.
Convention Compliance Rules
Each check must be scored using:
Pass: clear evidence meets rule.
Partial: some evidence meets rule but notable gaps or inconsistencies exist.
Fail: clear evidence violates rule.
Insufficient evidence: cannot evaluate from available evidence.
Minimum checks:
- Maven standard layout presence.
- Backend package-root consistency.
- Controller → Service → Repository layering evidence.
- Resources/config discoverability (
src/main/resources, config files).
- Test layout discoverability (
src/test).
- Backend command discoverability (
mvnw, docs, scripts).
- Backend docs discoverability (
backend/docs, backend README if present).
Required Outputs
1) Chat Summary (stable headings)
Use exactly these headings for reuse stability:
Summary
Confirmed facts
Inferred facts
Unknowns (REQUIRES CONFIRMATION)
Command map
Architecture classification
Convention compliance
Risks and follow-ups
Confidence
2) Persistent Artifact
Target: backend/docs/backend-project-architecture.md
If template exists (templates/backend-project-architecture-template.md):
- follow template structure.
If template missing:
- use the same stable headings listed above,
- include evidence references inline.
Output Contract (for downstream AI reuse)
- Keep section order stable.
- Keep terminology stable (
Confirmed, Inferred, Unknowns).
- Include command list with execution mode and failures.
- Include explicit confidence level (
High | Medium | Low) + reason.
- Keep entries concise and evidence-addressable.
- Do not mix recommendations into factual sections; place optional suggestions under follow-ups only.
Progressive Disclosure / Context Efficiency
- Core output (always include): stable headings + key findings + command map + confidence.
- Optional references (include only when needed):
- pattern comparisons,
- extended file inventories,
- deep convention notes.
- Avoid dumping large raw listings unless explicitly requested.
Boundaries
- Do not modify production code during scan.
- Do not infer versions/topology/profiles without direct evidence.
- Do not convert scan into refactor or redesign proposal.
- Do not auto-complete missing command maps from habits or memory.
- Do not treat absent files as defects without context.
- Keep scan minimal but sufficient for factual architecture understanding.
Failure / Missing Evidence Handling
When evidence is incomplete:
- continue with available evidence,
- downgrade confidence,
- add explicit unknowns,
- list exact missing evidence and why missing,
- provide targeted follow-up checks (not broad redesign suggestions).
If no meaningful evidence is collectible, output:
- summary of attempted commands/paths,
- explicit block reason,
Confidence: Low,
REQUIRES CONFIRMATION question for next action.
Verification Checklist
Before handoff, verify all items:
- Scope is backend-only and stated explicitly.
- Every major claim is tagged as Confirmed/Inferred/Unknown.
- No inferred item is written as confirmed fact.
- Failed commands and impacts are documented.
- Classification is evidence-backed or marked
Insufficient evidence.
- Convention checks use only allowed statuses.
- Persistent artifact exists/updated with stable headings.
- Existing architecture doc content was not needlessly overwritten.
- Final output includes files changed, commands run, results, and remaining risks.