Use when starting work on any project (technical or non-technical) to understand structure, standards, and best practices before making changes
Analyze Project Context
Overview
Build comprehensive, evidence-based understanding of ANY project type (code, documentation, content, mixed) before making changes. Works for technical projects, content projects, documentation repositories, and everything in between.
Core principle: Discover what exists, infer patterns, document best practices, establish constitution.
When to Use
Use when:
Starting work on a new project
User asks to "analyze the project" or "understand the codebase"
Before making significant changes
Need to understand project structure and conventions
Setting up AI agent workflow for a project
Works for:
Software projects (Node.js, Python, Go, etc.)
Documentation repositories
Content projects (marketing, writing, guides)
Mixed projects (docs + code)
Design projects (templates, assets)
Any organized file structure
Core Principles
Evidence Over Assumption: Discover what exists, don't assume structure
Pattern Recognition: Infer conventions from existing files
Universal Applicability: Works for any project type
Document Findings: Create AGENTS.md and constitution.md
Depth Control: Use discovery budget (max 2-3 tool calls per category) to avoid analysis paralysis
Workflow
1. Project Type Detection
Action: Identify project type from file structure
Discovery:
Check for README.md, README, or similar (project overview)
Look for technical indicators: package.json, requirements.txt, Cargo.toml, go.mod, pom.xml, etc.
Look for content indicators: docs/, content/, posts/, guides/, templates/
Check for existing AI/agent files: .github/, .specify/
Classify as:
Technical: Has package managers, source code, build configs
Content: Primarily markdown, templates, media files
Documentation: Organized docs structure, no executable code
Mixed: Contains both code and significant content/docs
2. Structural Discovery
Action: Map the project organization
Universal Checks:
README.md or equivalent (purpose, structure, getting started)
Directory structure (identify main folders and their purposes)
Version control patterns (drafts, published, archived)
4. Standards Documentation Discovery
Action: Find existing standards, guidelines, or best practices
Check for:
CONTRIBUTING.md (contribution guidelines)
STYLE.md or style guides
ARCHITECTURE.md or technical docs
AGENTS.md (AI agent best practices) - if exists
constitution.md (project principles) - if exists
Templates or examples directory
Extract existing standards from these files (don't reinvent what exists)
5. Technology Analysis (If Technical Project)
Action: Identify actual technology stack
Sources:
Package manager files (dependencies, dev dependencies)
Config files (tsconfig, babel, webpack, etc.)
Import/require statements in source files
Build scripts and deployment configs
Optional Validation:
For major frameworks, verify version-specific patterns
Check if code matches current best practices for that version
Identify deprecated patterns or outdated dependencies
Skip this section for non-technical projects
6. Create AGENTS.md (Best Practices for AI Agents)
Action: Generate or update .github/AGENTS.md with project-specific best practices
Structure:
# AI Agent Best Practices: [Project Name]**Generated:** [Date]
**Project Type:** [Technical/Content/Documentation/Mixed]
## Project Overview
[From README - purpose, goals, audience]
## Working with This Project### File Organization- [Pattern 1]: [Explanation and examples]
- [Pattern 2]: [Explanation and examples]
### Naming Conventions- Files: [Convention with examples]
- [Other identifiers]: [Convention with examples]
### Common Tasks1. [Task]: [How to do it correctly]
2. [Task]: [How to do it correctly]
### Quality Standards- [Standard 1]: [What to check]
- [Standard 2]: [What to check]
### What NOT to Do- ❌ [Anti-pattern]: [Why to avoid]
- ❌ [Anti-pattern]: [Why to avoid]
### Technology-Specific Notes
[Only if technical project - framework versions, patterns, gotchas]
## Related Files- Constitution: `.specify/memory/constitution.md` (if exists)
- [Other relevant docs]
Base content on discovered patterns - this is project-specific, not generic advice