mcpbeat Sign in

Architecture Agent Skill

Use when you need to understand the Pyre or Pysa codebase architecture, find where specific functionality is implemented, or navigate the source directory structure. Use when working on OCaml code, debugging type checking or taint analysis issues, or exploring the codebase.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
7170
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/facebook/pyre-check --skill architecture

The instruction itself

5 sections, as written by the author

Pyre Architecture

Type Checking Pipeline

  • Python CLI (client/): Reads .pyre_configuration, determines flags, shells out to pyre.bin
  • Command dispatch (source/main.ml): Routes to Check, Analyze (Pysa), Infer, Server, CodeNavigation, or NoDaemonQuery
  • Parsing (source/menhir_parser/, source/cpython_parser/): Python source -> AST (source/ast/)
  • Environment building (source/analysis/): Populates global type environment in parallel. All sources added at once (not recursively following imports). Builds a layered environment chain: UnannotatedGlobalEnvironment -> ClassHierarchyEnvironment -> TypeAliasEnvironment -> AnnotatedGlobalEnvironment -> FunctionDefinitionEnvironment -> ErrorsEnvironment -> TypeEnvironment
  • Type checking (source/analysis/typeCheck.ml): Each function checked in parallel via control flow graph. Propagates parameter types through function body, checks compatibility at each operation. Never goes beyond function call boundaries.
  • Error reporting: Results collected and returned to CLI

Pysa (Taint Analysis) Pipeline

  • Analysis orchestrator (source/interprocedural_analyses/taint/taintAnalysis.ml): Main entrypoint of the analysis, runs the different analysis steps
  • PyrePysaApi (source/interprocedural/pyrePysaApi.ml): Provides an API to query a type checker (pyre or pyrefly)
  • Class Hierarchy Graph (source/interprocedural/classHierarchyGraph.ml): Builds a class hierarchy graph
  • Callables Shared Memory (source/interprocedural/callablesSharedMemory.ml): Builds a mapping from callables (functions and methods) to their AST and signature
  • Call Graph (source/interprocedural/callGraph.ml): Defines call graph data structures
  • Call Graph Builder (source/interprocedural/callGraphBuilder.ml): Builds call graphs for all callables
  • Model parsing (source/interprocedural_analyses/taint/modelParser.ml): Parses .pysa model files
  • Forward analysis (source/interprocedural_analyses/taint/forwardAnalysis.ml): Tracks taint from sources
  • Backward analysis (source/interprocedural_analyses/taint/backwardAnalysis.ml): Tracks taint to sinks
  • Configuration (source/interprocedural_analyses/taint/taintConfiguration.ml): Defines rules connecting sources to sinks
  • Global Fixpoint (source/interprocedural/fixpointAnalysis.ml): Implements a global fixpoint over callables
  • Model (source/interprocedural_analyses/taint/model.ml): Defines a summary of the taint behavior of a function, inferred during analysis

Key Source Directories

  • source/ast/: Python AST representation (Expression, Statement, Source, Location, Reference)
  • source/analysis/: Core type checker: type representation (type.ml), CFG, fixpoint, preprocessing, environments, type order, class hierarchy
  • source/interprocedural/: Interprocedural framework: call graph, dependency graph, override graph, fixpoint
  • source/interprocedural_analyses/taint/: Pysa taint analysis: sources, sinks, domains, models, rules, reporting
  • source/interprocedural_analyses/type_inference/: Interprocedural type inference
  • source/server/: Pyre daemon for incremental analysis
  • source/code_navigation_server/: IDE code navigation server
  • source/command/: OCaml CLI command implementations
  • source/buck_command/: Buck-specific commands
  • source/buck_integration/: Buck build system integration
  • source/service/: Shared memory management, scheduling
  • source/domains/: Abstract domain library (lattices for interprocedural analyses)
  • source/hack_parallel/: Shared memory and multi-worker infrastructure (forked from Hack)
  • source/saved_state/: Serialization for incremental analysis
  • client/: Python CLI (pyre command)
  • client/commands/: All user-facing commands (check, analyze, start, stop, infer, query, etc.)
  • client/configuration/: .pyre_configuration file parsing
  • client/language_server/: LSP protocol implementation
  • api/: Programmatic Python API for Pyre server
  • pyre_extensions/: Runtime Python helpers (none_throws, safe_cast, etc.)
  • tools/generate_taint_models/: Auto-generation of Pysa taint models
  • tools/typeshed_patcher/: Applies patches to bundled typeshed stubs
  • stubs/: Bundled typeshed with patching mechanism
  • facebook/: Meta-internal code (not open-sourced)

OCaml Conventions

  • Most types derive show, eq, compare, to_yojson via PPX derivers. For a type Module.t, Module.show gives a debug string.
  • Debug with Log.dump "format %s" value and run with pyre --noninteractive check
  • In Python test files, use pyre_dump(), pyre_dump_cfg(), pyre_dump_locations(), and reveal_type(x) to inspect Pyre's state

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×13

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

30k tokens scripts
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

37k tokens scripts
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

39k tokens
Vercel React Best Practices
by ratacat
×5

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

34k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

20k tokens
Using Git Worktrees
by ZhanlinCui
×4

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1k tokens

How to use it

Copy the folder

Take facebook/architecture from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.