How ixi-enki/spec-kit works
1. What this repository is
- This is the source for Spec Kit / Specify CLI, a Python-based command-line tool for spec-driven development.
- Its job is not to build an app itself, but to bootstrap and manage project artifacts for AI coding agents: specs, plans, tasks, templates, presets, extensions, integrations, and workflows.
2. Primary runtime boundary: the CLI package
- The executable logic lives under src/specify_cli/.
- This is the core runtime boundary where commands are parsed and routed into feature areas like initialization, integration management, preset/extension installation, and workflow handling.
- The package is organized around CLI concerns rather than domain application logic.
3. Core command surfaces
- src/specify_cli/commands/ contains the top-level command handlers:
- init for bootstrapping a new project
- integration for listing/installing agent integrations
- extension for extension management
- preset for preset management
- workflow for workflow-related actions
- These commands are the main entry points that orchestrate everything else in the repo.
4. Artifact generation and templating
- templates/, presets/, extensions/, and workflows/ store the content that gets materialized into user projects.
- The CLI resolves these assets at runtime and copies or merges them into target directories, especially .specify/ and agent-specific command locations.
- The docs emphasize a priority stack: project-local overrides → presets → extensions → core templates.
5. Spec-driven project model
- The repository’s architecture revolves around a staged workflow:
- constitution
- spec
- plan
- tasks
- implementation
- The templates in templates/commands/ and the preset/extension commands under presets/*/commands/ and extensions/*/commands/ encode that workflow as reusable artifacts for coding agents.
- This is the central product boundary: the CLI produces and maintains the files that guide downstream AI-assisted development.
6. Integration subsystem
- src/specify_cli/integrations/ contains a large catalog of agent-specific adapters.
- Each integration subpackage represents a supported AI coding agent or CLI environment, such as Copilot, Claude, Gemini, Cursor, Codex, Windsurf, and others.
- The integration layer is responsible for translating the generic Spec Kit workflow into the file layout and command style expected by each agent.
7. Catalog-driven extensibility
- catalogs.py, extensions.py, presets.py, and src/specify_cli/integrations/catalog.py suggest a registry/catalog model for discovering supported items.
- JSON catalog files in extensions/catalog.json, presets/catalog.json, integrations/catalog.json, and community variants drive what the CLI knows how to install or display.
- This gives the repo a data-driven architecture: supported integrations and community contributions are described in catalogs rather than hardcoded one-off logic.
8. Workflow engine
- src/specify_cli/workflows/ contains a separate workflow engine with steps such as command, prompt, shell, if_then, switch, while_loop, do_while, fan_out, fan_in, and gate.
- This is a distinct subsystem from the CLI command handlers: the CLI invokes workflows, and the engine coordinates execution flow and branching.
- The presence of expression handling and step types indicates an internal DSL-like orchestration layer for structured agent workflows.
9. Authentication and external service access
- src/specify_cli/authentication/ supports GitHub and Azure DevOps authentication flows.
- src/specify_cli/_github_http.py and src/specify_cli/authentication/http.py show that the tool talks to remote services over HTTP, most likely for catalog lookups, release-related operations, or service-backed actions.
- This is the primary network boundary in the repo.
10. Repository asset layout
- media/ holds product images and documentation assets.
- docs/ is a full documentation site built with DocFX (docs/docfx.json, docs/toc.yml), meaning docs are a first-class deliverable, not just README text.
- newsletters/, CHANGELOG.md, and governance files like CONTRIBUTING.md, SECURITY.md, and SUPPORT.md show that this is an externally consumed open-source tool with active release and community processes.
11. Automation and release pipeline
- .github/workflows/ contains CI/CD for linting, testing, docs publishing, releases, stale issue handling, and catalog assignment.
- The repo also includes release-process documentation and lock files for community extension/preset automation.
- This indicates a strong GitHub-centered maintenance model: code changes are validated in CI, docs are published, and release flows are automated.
12. Cross-platform scripting and bootstrap
- scripts/bash/ and scripts/powershell/ provide the same bootstrap/setup operations across Unix and Windows environments.
- .devcontainer/ adds a development container so contributors can work in a reproducible environment.
- These scripts are part of the install/bootstrap boundary used by init and by repo maintenance workflows.
13. Testing strategy
- tests/ is broad and architecture-revealing: there are dedicated tests for authentication, CLI behavior, integrations, extensions, presets, workflows, path traversal protection, and update hardening.
- The test layout mirrors the runtime subsystems, which suggests the intended architecture is modular and contract-driven rather than monolithic.
14. Overall architecture in one sentence
- Spec Kit is a catalog-driven Python CLI platform that manages specification artifacts and agent integrations through a layered system of templates, presets, extensions, and workflows, with strong documentation, CI, and cross-platform scripting support.
Main entry points: commands Commands · catalogs.py Catalogs · tests Tests · integrations Integrations
Components 19
CLI runtime
Python package that parses commands and orchestrates repo operations.
- Commands · Top-level command handlers for init, integration, extension, preset, and workflow.
src/specify_cli/commands - Core package · Shared CLI runtime, utilities, versioning, and app-facing helpers.
src/specify_cli - Engine · Executes step graphs, branching, loops, and expression-driven orchestration.
src/specify_cli/workflows/engine.py - Steps · Step implementations such as command, prompt, shell, gates, branches, and fan-in/out.
src/specify_cli/workflows/steps - Catalogs · Discovers supported presets, extensions, integrations, and workflows from catalogs.
src/specify_cli/catalogs.py
Artifact content
Materialized specs, templates, presets, extensions, and workflows.
- Asset layer · Resolves packaged templates and other bundled artifacts at runtime.
src/specify_cli/_assets.py - Templates · Core spec-driven command and document templates used to bootstrap projects.
templates - Presets · Reusable project setups that add commands, templates, and workflow conventions.
presets - Extensions · Installable feature packs that add commands, scripts, and config templates.
extensions - Workflow specs · Reusable workflow definitions and orchestration artifacts for agent-driven tasks.
workflows
Adapters
Agent integrations and external-service boundaries.
- Integrations · Base integration layer that maps the generic Spec Kit model onto agent-specific layouts.
src/specify_cli/integrations - Integration catalog · Catalog and manifest logic for supported agent integrations.
src/specify_cli/integrations/catalog.py - Agent adapters · Concrete adapters for Copilot, Claude, Gemini, Cursor, Codex, Windsurf, and others.
src/specify_cli/integrations/claude - Auth · Authentication flows for GitHub and Azure DevOps.
src/specify_cli/authentication - HTTP client · Remote HTTP access used by auth and service-backed CLI operations.
src/specify_cli/_github_http.py
Docs and ops
Documentation, automation, and contributor tooling.
- Docs site · DocFX-based documentation and reference site.
docs - CI/CD · GitHub workflows for linting, testing, docs, release, and community automation.
.github/workflows - Scripts · Cross-platform shell and PowerShell bootstrap/setup helpers.
scripts - Tests · Contract tests covering CLI, auth, integrations, presets, extensions, workflows, and hardening.
tests
Connections 24
- Commands → Core package: uses · Command handlers rely on shared CLI runtime and helpers.
- Commands → Asset layer: loads · Commands materialize packaged artifacts into target projects.
- Commands → Catalogs: consults · Commands look up supported items through registries.
- Commands → Engine: invokes · Workflow commands hand execution to the workflow runtime.
- Commands → Integrations: orchestrates · Integration-related commands route into adapter implementations.
- Asset layer → Templates: serves · Asset loader exposes core templates and command content.
- Catalogs → Presets: indexes · Registry data drives preset discovery and installation.
- Catalogs → Extensions: indexes · Registry data drives extension discovery and installation.
- Catalogs → Integration catalog: indexes · Registry data includes supported integrations and manifests.
- Catalogs → Workflow specs: indexes · Registry data also covers workflow packages.
- Presets → Templates: extends · Presets reuse and layer on top of core templates.
- Extensions → Templates: adds · Extensions contribute extra commands and templates.
- Workflow specs → Steps: defines · Workflow packages are built from reusable step primitives.
- Engine → Steps: executes · Engine interprets and runs the step implementations.
- Integrations → Agent adapters: specializes · Base adapter layer is concretized by agent-specific packages.
- Integrations → Integration catalog: registered by · Integration catalog exposes the available adapter set.
- Auth → HTTP client: uses · Authentication and service access flow through HTTP client code.
- CI/CD → Docs site: publishes · Documentation is built and published via GitHub workflows.
- CI/CD → Tests: runs · CI validates the repository through the test suite.
- Scripts → Commands: bootstraps · Setup scripts support initialization and maintenance flows.
- Tests → Commands: covers · CLI behavior is exercised by dedicated tests.
- Tests → Integrations: covers · Integration adapters have contract and matrix coverage.
- Tests → Engine: covers · Workflow orchestration behavior is tested directly.
- Tests → Auth: covers · Authentication flows and remote access are verified.