This document describes the repository organization, configuration files, and directory conventions for the Spec Kit codebase. It covers the Python package structure, dependency management, testing setup, and where different types of artifacts are stored.
For information about setting up your local development environment, see Local Development Setup. For details on how to test changes to templates and commands, see Testing Template and Command Changes.
The Spec Kit repository is organized around four primary concerns: the Python CLI tool, workflow templates, helper scripts, and the extension system. The structure supports both development of the CLI and packaging of templates for distribution.
Sources: pyproject.toml1-54 CONTRIBUTING.md58-63
The Specify CLI is a Python package distributed via PyPI, structured according to modern Python packaging standards with src/ layout.
The pyproject.toml file defines the package metadata, dependencies, and tool configurations:
| Section | Purpose | Key Values |
|---|---|---|
[project] | Package metadata | name = "specify-cli", version = "0.1.0", requires-python = ">=3.11" |
[project.dependencies] | Runtime dependencies | typer, rich, httpx[socks], platformdirs, readchar, pyyaml, packaging |
[project.scripts] | CLI entry points | specify = "specify_cli:main" |
[build-system] | Build backend | hatchling |
[tool.hatch.build.targets.wheel] | Package structure | packages = ["src/specify_cli"] |
[project.optional-dependencies] | Test dependencies | pytest>=7.0, pytest-cov>=4.0 |
[tool.pytest.ini_options] | Test configuration | Test paths, patterns, and options |
[tool.coverage.*] | Coverage configuration | Source paths, report format |
Sources: pyproject.toml1-54
Sources: pyproject.toml18-26 CHANGELOG.md14-28 CHANGELOG.md30-42
The AGENT_CONFIG dictionary in src/specify_cli/__init__.py serves as the single source of truth for all supported AI agents. Each entry defines agent-specific metadata:
Key Fields:
cli_tool: Command-line executable name for validationagent_type: Either "cli" or "ide" for prerequisite checkingcommands_dir: Directory where agent command files are storedconfig_file: Agent context file name (e.g., CLAUDE.md, AGENTS.md)format: Either "markdown" or "toml" for command file formatSources: CHANGELOG.md68-77 Diagram 4 from system overview
The templates/ directory contains reusable templates that are packaged into release artifacts and copied to user projects during specify init.
Command Template Structure: Each command template file contains YAML frontmatter followed by the command prompt:
Sources: CHANGELOG.md183-189 spec-driven.md73-104
The scripts/ directory contains cross-platform helper scripts that automate workflow tasks. Each script has both Bash and PowerShell implementations:
| Script Pair | Purpose |
|---|---|
create-new-feature.sh / .ps1 | Determines next feature number, creates branch and spec directory |
update-agent-context.sh / .ps1 | Parses plan.md and updates agent context files with tech stack |
check-prerequisites.sh / .ps1 | Validates Git installation and agent CLI tools |
Common Script Pattern:
--short-name, --description)Sources: CHANGELOG.md144-161 CHANGELOG.md240-241
The memory/ directory contains the constitution and architectural principles:
memory/
└── constitution.md # The 9 Articles of Development
The constitution defines immutable architectural principles enforced throughout the workflow. It is referenced by the /speckit.plan command to validate implementation plans against articles like:
Sources: spec-driven.md273-406 Diagram 6 from system overview
The extension system uses a well-defined directory layout within .specify/extensions/:
Each extension contains an extension.yml manifest with:
| Field | Required | Description |
|---|---|---|
id | Yes | Unique identifier (e.g., "jira") |
version | Yes | Semantic version (e.g., "1.0.0") |
name | Yes | Display name |
description | Yes | Short description |
author | Yes | Author name |
commands | Yes | List of command definitions with name, description, template |
hooks | No | Lifecycle hooks with event, message, condition |
config | No | Default configuration values |
requires | No | Minimum Spec Kit version |
Sources: CHANGELOG.md14-28 CHANGELOG.md78-87
The extension system resolves configuration through a four-layer cascade implemented by the ConfigManager class:
Sources: CHANGELOG.md78-87
When specify init runs, it creates agent-specific directories based on the selected agent. These directories are created in the project root and follow each agent's conventions:
| Agent | Commands Directory | Config File | Format |
|---|---|---|---|
| Claude Code | .claude/commands/ | CLAUDE.md | Markdown |
| Gemini CLI | .gemini/commands/ | GEMINI.md | TOML |
| GitHub Copilot | .github/agents/ | AGENTS.md | Markdown |
| Cursor | .cursor/commands/ | CURSOR.md | Markdown |
| Windsurf | .windsurf/workflows/ | WINDSURF.md | Markdown |
| Qwen Code | .qwen/commands/ | QWEN.md | TOML |
| Codex | .codex/commands/ | AGENTS.md | Markdown |
| ... | (14+ agents total) | ... | ... |
Markdown Format (Most Agents):
TOML Format (Gemini, Qwen):
Sources: Diagram 4 from system overview, CHANGELOG.md68-77
The .github/workflows/ directory contains CI/CD pipelines:
Each release package contains:
spec-kit-template-{agent}-{script}-v{version}.zip
├── .specify/
│ ├── templates/ # Command templates
│ ├── scripts/ # Helper scripts (bash or ps1)
│ └── memory/ # Constitution
├── .{agent}/ # Agent-specific directory
│ └── commands/ # Generated command files
└── {AGENT}.md # Agent context file
Sources: Diagram 5 from system overview, CHANGELOG.md124-131
The testing setup is configured in pyproject.toml and uses pytest with coverage reporting.
tests/
├── test_extensions.py # Extension system tests
├── test_catalog.py # Extension catalog tests
└── fixtures/ # Test data and mocks
Test Coverage: As of version 0.1.0, the extension module has 83% test coverage with 39 total tests.
Sources: pyproject.toml33-52 CHANGELOG.md115-118 CONTRIBUTING.md39-55
The package requires these runtime dependencies (pyproject.toml6-15):
| Package | Purpose |
|---|---|
typer | CLI framework with command routing and argument parsing |
rich | Terminal formatting, tables, progress bars |
httpx[socks] | HTTP client with SOCKS proxy support for GitHub API |
platformdirs | Cross-platform directory paths for cache/config |
readchar | Interactive selection UI with arrow keys |
truststore | SSL certificate validation |
pyyaml>=6.0 | YAML parsing for extension manifests and config |
packaging>=23.0 | Semantic version comparison for extensions |
For local development and testing (pyproject.toml27-31):
| Package | Purpose |
|---|---|
pytest>=7.0 | Test framework |
pytest-cov>=4.0 | Coverage reporting plugin |
Sources: pyproject.toml6-31 CONTRIBUTING.md8-14
Version information is stored in two locations:
version = "0.1.0"## [0.1.0] - 2026-01-28When a new release is created:
get-next-version.sh determines the next semantic version based on Git tagscheck-release-exists.sh verifies the version doesn't already existupdate-version.sh updates pyproject.toml3generate-release-notes.sh compiles entries from CHANGELOG.mdcreate-github-release.sh publishes to GitHub Releases with all 32 packagesThe project follows Semantic Versioning 2.0.0:
Sources: CHANGELOG.md1-9 Diagram 5 from system overview
The central configuration file defining the Python package, dependencies, and tool configurations. See Python Package Structure section above for detailed breakdown.
Location: pyproject.toml (repository root)
Sources: pyproject.toml1-54
Key patterns for ignored files:
# Python
__pycache__/
*.pyc
.pytest_cache/
.coverage
htmlcov/
# Build artifacts
dist/
build/
*.egg-info/
# Extension local config
.specify/extensions/*/local-config.yml
# Agent directories (recommended to add)
.claude/
.gemini/
.cursor/
.github/agents/
Note: Users are warned to add agent directories to .gitignore to prevent accidental credential leakage, as some agents may store auth tokens in these directories.
Sources: CHANGELOG.md221-227
Provides a pre-configured development environment with Docker:
Location: .devcontainer/devcontainer.json
Includes:
Usage:
Sources: CONTRIBUTING.md16-31
Key Conventions:
src/specify_cli/ with proper package structuretemplates/, copied to .specify/templates/ in user projectsscripts/, copied to .specify/scripts/memory/, copied to .specify/memory/.specify/extensions/{extension-id}/.claude/, .github/agents/, etc.)specs/{feature-number}-{feature-name}/Sources: All sections above, Diagram 1 from system overview
Refresh this wiki