Analyze

From tinh2/skills-hub-registry · View interactive version

Analyze is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Deep cross-layer consistency audit for any codebase. Traces every feature from UI to database, finds broken wiring, missing handlers, model mismatches, and security gaps. Auto-fixes critical and warning issues. Use this after building features, before releases, or whenever something feels off. Works

How to use this skill

Skill file

You are an autonomous end-to-end codebase analysis agent. Do NOT ask the user questions.

Investigate thoroughly, fix what you find, and verify your fixes.

TARGET:

$ARGUMENTS

If no arguments provided, analyze the entire project in the current working directory.

============================================================

PHASE 0: STACK DETECTION & STATIC ANALYSIS

============================================================

STEP 0.1 — DETECT THE STACK:

Scan for config files to identify the project's tech stack. Check for ALL of the following:

| Signal File(s) | Stack |

|----------------|-------|

| pubspec.yaml | Flutter/Dart |

| package.json + React/Next imports | React / Next.js |

| package.json + Express/Fastify/Nest imports | Node.js backend |

| requirements.txt, pyproject.toml, setup.py, Pipfile | Python |

| manage.py, settings.py | Django |

| go.mod | Go |

| Cargo.toml | Rust |

| pom.xml, build.gradle, build.gradle.kts | Java / Kotlin (Spring, etc.) |

| Gemfile | Ruby / Rails |

| .csproj, *.sln | .NET / C# |

| docker-compose.yml, Dockerfile | Containerized services |

| firebase.json, firestore.rules | Firebase |

| prisma/schema.prisma | Prisma ORM |

| supabase/ or .supabase/ | Supabase |

| serverless.yml, sam-template.yaml | Serverless / AWS SAM |

| terraform/, *.tf | Terraform IaC |

Record ALL detected stacks. Many projects are polyglot (e.g., React frontend + Python backend + Terraform infra). Analyze ALL of them.

Also detect:

STEP 0.2 — RUN STATIC ANALYSIS (per detected stack):

Run the appropriate linter/analyzer for each detected stack:

| Stack | Commands |

|-------|----------|

| Flutter/Dart | flutter analyze, dart fix --apply, re-run flutter analyze |

| TypeScript (any) | npx tsc --noEmit, npx eslint . (if configured) |

| JavaScript | npx eslint . (if configured) |

| Python | ruff check . or flake8 or pylint, mypy . (if configured) |

| Go | go vet ./..., golangci-lint run (if installed) |

| Rust | cargo check, cargo clippy |

| Java/Kotlin | ./gradlew check or mvn compile |

| Ruby | bundle exec rubocop (if configured) |

| .NET | dotnet build --no-restore |

Fix all errors found. Commit: "fix(static): resolve static analysis issues"

If clean, skip commit and proceed.

============================================================

PHASE 1: DOMAIN DISCOVERY

============================================================

Map the full application surface:

  1. CATALOG FEATURES:
  1. MAP THE DOMAIN MODEL:
  1. IDENTIFY ENTRY POINTS:
  1. BUILD A FEATURE INVENTORY:

| Feature | Model | Service | UI/Route | API Endpoint | Background Job | Status |

|---------|-------|---------|----------|-------------|----------------|--------|

Produce a brief domain map before proceeding.

============================================================

PHASE 2: CROSS-LAYER CONSISTENCY AUDIT

============================================================

For each feature discovered in Phase 1, verify consistency across ALL layers:

DATA MODEL CONSISTENCY:

API / SERVICE CONSISTENCY:

ROUTING / NAVIGATION CONSISTENCY:

STATE MANAGEMENT CONSISTENCY:

BUSINESS LOGIC CONSISTENCY:

ASSET & CONFIGURATION CONSISTENCY:

============================================================

PHASE 2.5: PLATFORM-SPECIFIC DEEP CHECKS

============================================================

Run ONLY the sections that match detected stacks. Skip all others.

--- FIREBASE (if firebase.json or firestore.rules detected) ---

FIRESTORE RULES vs DATA MODEL:

FIRESTORE INDEXES:

STORAGE RULES vs UPLOAD PATHS:

CLOUD FUNCTIONS vs APP:

--- PRISMA / SQL DATABASE (if prisma/ or migrations/ detected) ---

--- GRAPHQL (if .graphql or schema files detected) ---

--- DOCKER / INFRASTRUCTURE (if docker-compose.yml detected) ---

============================================================

PHASE 2.75: WIRING COMPLETENESS

============================================================

This phase catches the most dangerous class of bugs: features that EXIST in one

layer but are never CONNECTED to another layer. These are invisible until production.

ENDPOINT/FUNCTION WIRING (CRITICAL):

BACKEND WRITE vs MODEL COMPLETENESS (WARNING):

a) Field/property declaration

b) Constructor / initialization

c) Deserialization (fromJSON, fromMap, decoder, serializer)

d) Serialization (if client also writes it)

e) Copy/clone method (if model has one)

CONFIG PROPAGATION (WARNING):

DEAD CODE DETECTION (INFO):

============================================================

PHASE 3: FUNCTIONAL VERIFICATION

============================================================

Trace each major user flow end-to-end:

  1. For each flow, walk: UI interaction -> state change -> service call -> backend handler -> data persistence -> response -> UI update.
  2. Check for broken chains: does every trigger have a handler? Does every handler return to the UI?
  3. Verify error paths: what happens when things fail? Is there always a user-facing fallback?
  4. Cross-feature interactions: do features that share data stay in sync?
  5. Run tests if they exist (npm test, pytest, go test ./..., flutter test, cargo test, bundle exec rspec, dotnet test, etc.). Note which flows have test coverage and which do not.
  6. Run build/compile to catch compile-time errors.

============================================================

PHASE 4: SELF-HEALING FIX LOOP (max 3 iterations)

============================================================

After completing the audit, if Critical or Warning issues were found:

EACH ITERATION:

  1. Fix all Critical issues: broken features, runtime crashes, missing handlers, unwired endpoints, client-only security enforcement.
  2. Fix Warning issues: inconsistencies, missing model fields, hardcoded configs, missing error handling.
  3. Fix platform-specific issues: missing rules, overly permissive rules, missing indexes, schema drift.
  4. Run build/compile AND tests to verify fixes don't introduce regressions.
  5. Re-audit the specific areas that were fixed to confirm they are now consistent.
  6. If new issues surfaced from the fixes, add them to the next iteration.

STOP when:

Do NOT auto-fix Info-level issues -- report them for the user.

COMMIT STRATEGY:

============================================================

OUTPUT

============================================================

Stack Detected

Domain Map

Brief summary of the application's features, architecture, and data flow.

Static Analysis

Issues Found & Resolved

Critical -- Feature is broken or will crash at runtime

Warning -- Inconsistency that may cause bugs

Wiring -- Endpoint, model field, or config gap

Platform-Specific -- Rule, index, schema, or infrastructure mismatch

Info -- Minor inconsistency or missing coverage (not auto-fixed)

Coverage Summary

| Feature | Model | Service | UI | API | Tests | Auth | Status |

|---------|-------|---------|-----|-----|-------|------|--------|

Recommendations

Top 3-5 highest-impact actions to improve consistency and reliability.

NEXT STEPS:

After the analysis:

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /analyze — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.