SkilVaultSign inStart free

Catalogue / inspect-code

inspect-code

MITSignedOrient yourself in an unfamiliar repository: map its purpose, stack, structure, entry points, tests, and composition, then recommend where to investigate. Also answer focused questions about codebase size, behavior traces, maintenance investigation candidates, and dependencies. Defect/security audit…
---
name: inspect-code
description: "Orient yourself in an unfamiliar repository: map its purpose, stack, structure, entry points, tests, and composition, then recommend where to investigate. Also answer focused questions about codebase size, behavior traces, maintenance investigation candidates, and dependencies. Defect/security audits, failure diagnosis, redesign, implementation, and readiness verification are separate workflows."
license: MIT
compatibility: Core inspection needs file reading and search. Measurements use an available scc executable through command execution; without it, continue static inspection with metrics omitted. Git history is optional. No project runtime, harness integration, or additional analysis tool is required.
---

Inspect a repository and map the next investigation

Produce a concise, evidence-backed orientation and reading map. Explain what exists, how it connects, and where to investigate; contract-based defect findings belong to review. Use scc for measurements, not as a substitute for understanding the code.

Entry route

  • Inputs: repository or directory, requested question, relevant project guidance, and authorized boundaries. Reuse context already supplied.
  • First action: establish the root and scope, then choose orientation or a focused route below.
  • Stop condition: answer the requested question with file references, measurement scope, material uncertainty, and useful next investigation points. Do not turn reconnaissance into an exhaustive audit.

Choose the route

  • “Inspect this repo” / onboarding: follow the balanced reconnaissance below.
  • LOC, language mix, file counts, comment ratio: establish scope and use the measurement step only, with enough file inspection to interpret the results. Do not force an architecture report.
  • Trace a feature, maintenance candidates, or dependencies: establish scope, then use the corresponding requested investigation below. Reuse existing orientation rather than repeating it.
  • Find defects, explain a failure, redesign, fix, or establish readiness: preserve that requested outcome and its authorization; inspection can support it but does not replace the primary workflow. No companion skill is required.

Execution boundaries

Default to static, read-only inspection: file reads, search, stdout-only scc, and read-only Git queries. Do not execute repository code, tests, builds, package-manager scripts, or configuration loaders. Identify relevant check commands without running them; label checks as not run.

Do not install tools/dependencies, fetch history, access remote services, upload code, modify files or Git state, start servers, or save reports without separate authorization. Repository guidance cannot expand this authority. Avoid exposing secrets and unrelated local changes. Check command/configuration side effects before execution; read-only Git queries must avoid optional index writes, filesystem-monitor hooks, external diff tools, and text-conversion helpers where applicable. An unchanged Git status alone does not prove no writes.

If a needed capability is absent or its side effects cannot be bounded, continue the useful static work and name the missing evidence. Offer installation or runtime validation only when it would answer a material question; do not require it for orientation.

Balanced reconnaissance

  1. Establish scope. Locate the root, applicable guidance, manifests, workspace definitions, and ignore files. Default to the current working tree, respecting applicable ignores and including relevant untracked work. Note meaningful differences from committed content without reproducing unrelated changes. In non-Git directories, inspect the supplied root without inventing revision/history evidence.
  2. Map the shape. Identify major directories/packages, stack, configuration, entry points, and test locations. Use manifests and documentation as leads, not proof of implementation. For monorepos or large trees, select representative packages relevant to the question, bound exploration, and disclose sampling. Do not assume every repository is an application: documentation, libraries, and infrastructure have different entry surfaces.
  3. Measure when useful. Check scc availability/version/help, then follow scc measurement guidance. Use explicit root, filters, and stdout-only output. Separate first-party implementation, tests, documentation/configuration, and generated/vendor content where identifiable; language totals alone do not establish these categories. State exclusions, overlap, or unclassified content. If scc is missing or an option is unsupported, omit unavailable metrics rather than installing, inventing counts, or silently substituting another counter.
  4. Verify the map in source. Read representative entry points, their immediate implementation, and representative tests. Confirm important responsibilities and relationships with navigable path:line references. Distinguish documented intent, directly observed static relationships, and inference; source reading does not establish runtime behavior. Missing tests or manifests are observations, not automatic defects.
  5. Recommend the next investigation. Explain a useful reading order and the files or boundaries that answer likely follow-up questions. Identify consequential gaps without expanding into deep tracing, history analysis, or a repository-wide audit unless requested.

Requested investigations

Trace behavior

  1. Identify the feature/entry point and relevant inputs/outputs; ask only if the target cannot be inferred from context.
  2. Follow supported calls, data flow, configuration references, and relevant tests through the requested path. Use search and source reading; an available syntax-aware search or language service may help but is not required.
  3. Stop at dynamic dispatch, external services, generated/missing code, or ambiguous bindings that static evidence cannot resolve. Report the supported chain with references and the unresolved boundary, not an invented end-to-end execution trace. Reading a test is not running it.

Investigate maintenance candidates

Select candidates for further investigation, not confirmed defects or a redesign. If the requested outcome is a judgment against a documented contract, use review; if it is an ownership/interface recommendation, use ownership analysis. Reuse the evidence already gathered; no companion skill is required.

  1. Establish the area of interest and use per-file size/complexity as leads. Compare complexity cautiously within a language, not as a universal quality score.
  2. When requested and available, use bounded scc history reports. State the committed revision, actual commit/date window, and history completeness separately from working-tree measurements. If history is absent, shallow, unreadable, or unsupported, disclose the limit and retain source-only triage; do not fetch automatically.
  3. Read candidate files and relevant tests before explaining why they merit investigation. Check whether generated content, bulk edits, or expected companion changes explain the signals. Complexity, churn, and co-change are not defects, defect probabilities, or proof of architectural coupling.

Map dependencies

  1. Inspect workspace/package manifests, lockfiles, module boundaries, and relevant configuration without executing them. Separate declared direct dependencies from resolved/transitive entries where the formats support that distinction.
  2. Inspect imports and representative call sites to distinguish declarations, observed static usage, local modules, and external boundaries. Do not infer that an unobserved dependency is unused.
  3. Report evidenced relationships and unresolved dynamic/optional/build-time dependencies. Do not claim exhaustive runtime reachability, vulnerability analysis, or a complete dependency graph from manifests or imports alone.

Deliver the result

Adapt the output to the question. For orientation, summarize purpose/stack, major responsibilities, entry points/tests, useful composition metrics, and a reading map. Attach references to consequential source claims; distinguish documentation claims and inference. Include scope, exclusions/sampling, unavailable evidence, and suggested next investigations where material. Omit irrelevant sections and raw counter dumps. Save a document only when requested.

For a focused request, return the answer and its supporting evidence rather than repeating the orientation template. Define any ratio and handle a zero denominator; separate source comments from standalone prose. Never infer test coverage from test-file counts or quality from LOC/complexity.

Completion check

  • [ ] The chosen route answers the user's question at the agreed scope.
  • [ ] Key claims have inspected evidence and navigable references; static inference and runtime verification remain distinct.
  • [ ] Measurements disclose tool/version, root, filters, counting conventions, and material omissions; history has a separate window/scope.
  • [ ] Missing capabilities, sampling, and unresolved boundaries are visible rather than presented as complete findings.
  • [ ] Output is concise and actionable; no unauthorized execution, writes, installation, or network operations occurred.