AI-Powered Code Templating Framework
LangGang combines the power of LangChain, LangGraph, Cookiecutter, Copier, and Maven Archetypes to create an intelligent code scaffolding system. Transform developer workflows with AI-assisted template generation and multi-framework integration.
- Multiple Template Systems: Support for Cookiecutter, Copier, and Maven Archetypes
- LangChain Integration: AI-powered template selection and generation
- LangGraph Workflows: Multi-step code generation with state management
- MCP Protocol: Model Context Protocol servers for AI assistant integration
- Documentation Access: Built-in MCP servers for LangChain/LangGraph docs
- LLM CLI Integration: MCP tools for executing Gemini, Codex, OpenAI, and Anthropic CLI commands
- Harness CI/CD: Automated pipeline configuration
- Claude Code & Copilot: Enhanced IDE integration with agents and skills
- Installation
- Quick Start
- Template Types
- MCP Integration
- LangChain & LangGraph
- AI Assistant Integration
- Development
- Documentation
- Contributing
- Python 3.9 or higher
- Maven 3.x (for Maven archetypes)
- Git
# Clone the repository
git clone https://github.com/markus41/LangGang.git
cd LangGang
# Install dependencies
pip install -r requirements.txt
# Or install as a package
pip install -e .# Install with development dependencies
pip install -r requirements.txt
pip install -e ".[dev]"from langgang.mcp_server import LangGangMCPServer
# Initialize server
server = LangGangMCPServer()
# List available templates
templates = server.list_templates()
print(templates)
# Generate from Cookiecutter template
result = server.generate_from_cookiecutter(
template_name="python-langchain-project",
output_dir="./my-project",
context={
"project_name": "My AI App",
"author": "Your Name",
"use_langchain": "y"
}
)from langgang.langchain_integration import get_langgang_tools
# Get LangChain tools for template generation
tools = get_langgang_tools()
# Use with LangChain agents
from langchain.agents import AgentExecutor
# ... create agent with toolsfrom langgang.langgraph_integration import create_template_generation_graph
# Create workflow graph
graph = create_template_generation_graph()
# Run workflow
result = graph.invoke({
"project_description": "Python Flask API with authentication"
})Located in templates/cookiecutter/
Features:
- Python-based templating with Jinja2
- Rich filter support
- Best for Python projects and data science
Example:
# Using cookiecutter CLI
cookiecutter templates/cookiecutter/python-langchain-project/
# Using LangGang
python -c "from langgang.mcp_server import LangGangMCPServer; \
server = LangGangMCPServer(); \
server.generate_from_cookiecutter('python-langchain-project', './output', {})"Located in templates/copier/
Features:
- Modern templating with update support
- YAML configuration
- Best for projects that evolve with templates
Example:
# Using copier CLI
copier copy templates/copier/langgraph-agent/ ./my-agent
# Using LangGang
python -c "from langgang.mcp_server import LangGangMCPServer; \
server = LangGangMCPServer(); \
server.generate_from_copier('langgraph-agent', './output', {})"Located in templates/maven/
Features:
- Java/JVM project templating
- Standard Maven conventions
- Best for enterprise Java applications
Example:
# Using Maven CLI
mvn archetype:generate \
-DarchetypeGroupId=com.langgang \
-DarchetypeArtifactId=langchain-java-archetype
# Using LangGang
python -c "from langgang.mcp_server import LangGangMCPServer; \
server = LangGangMCPServer(); \
server.generate_from_maven_archetype('langchain-java-archetype', './output', {})"LangGang provides Model Context Protocol (MCP) servers for AI assistant integration.
-
Template Generation Server (
langgang.mcp_server)- Generate code from templates
- List available templates
- Support for all template types
-
Documentation Server (
langgang.docs_mcp_server)- Search LangChain documentation
- Search LangGraph documentation
- Get code examples
- List available documentation
-
LLM CLI Server (
langgang.llm_cli_mcp_server)- Execute Gemini CLI commands
- Execute Codex CLI commands
- Execute OpenAI CLI commands
- Execute Anthropic CLI commands
- Convenience methods for common operations (chat, generate)
- Automatic CLI availability detection
MCP servers are configured in mcp-config.json:
{
"mcpServers": {
"langgang-templates": {
"command": "python",
"args": ["-m", "langgang.mcp_server"]
},
"langchain-docs": {
"command": "python",
"args": ["-m", "langgang.docs_mcp_server"]
}
}
}# Start template generation server
python -m langgang.mcp_server
# Start documentation server
python -m langgang.docs_mcp_server
# Start LLM CLI server
python -m langgang.llm_cli_mcp_serverThe LLM CLI MCP server allows agents to execute CLI commands for various LLM providers:
from langgang.llm_cli_mcp_server import LLMCliMCPServer
server = LLMCliMCPServer()
# Check available CLIs
clis = server.list_available_clis()
print(clis) # {"gemini": True, "codex": False, ...}
# Execute Gemini chat
result = server.gemini_chat(
prompt="Explain LangChain",
model="gemini-pro",
temperature=0.7
)
# Execute Codex generate
result = server.codex_generate(
prompt="Create a Python function",
model="gpt-4"
)
# Execute custom CLI command
result = server.execute_gemini_cli(
command="chat",
args=["--model", "gemini-1.5-pro", "Your prompt here"]
)Security: All commands are sanitized to prevent command injection attacks.
LangGang provides LangChain tools for template generation:
from langgang.langchain_integration import (
TemplateGenerationTool,
ListTemplatesTool,
get_langgang_tools
)
# Use individual tools
list_tool = ListTemplatesTool()
result = list_tool._run()
gen_tool = TemplateGenerationTool()
result = gen_tool._run(
template_type="cookiecutter",
template_name="python-langchain-project",
output_directory="./output",
context={"project_name": "My App"}
)
# Or get all tools at once
tools = get_langgang_tools()Multi-step template generation workflows:
from langgang.langgraph_integration import create_template_generation_graph
# Create workflow
graph = create_template_generation_graph()
# Execute workflow
result = graph.invoke({
"project_description": "FastAPI application with authentication",
"context_variables": {
"project_name": "my_api",
"author": "Developer"
}
})Workflow Steps:
- Analyze requirements
- Select appropriate template
- Gather context variables
- Generate code
- Validate output
LangGang includes extensive Claude Code configurations in .claude/:
- Agents: Specialized agents for template generation, LangChain development, MCP development, and CI/CD
- MCPs: MCP server configurations
- Skills: Reusable skills for common tasks
- Slash Commands: Quick commands for template operations
Using Claude Code:
# Claude Code automatically loads configurations from .claude/
# See .claude/claude.md for full documentationCopilot configurations in .copilot/:
- Agents: Context-aware coding assistants
- Extensions: Workspace-specific Copilot extensions
- Code Patterns: Templates and snippets
Using GitHub Copilot:
# Copilot automatically uses configurations from .copilot/
# See .copilot/copilot.md for full documentationLangGang/
βββ .claude/ # Claude Code configurations
β βββ agents/ # Specialized agents
β βββ mcps/ # MCP configurations
β βββ skills/ # Reusable skills
β βββ slash-commands/ # Quick commands
β βββ claude.md # Claude documentation
βββ .copilot/ # GitHub Copilot configurations
β βββ agents/ # Copilot agents
β βββ extensions/ # Copilot extensions
β βββ copilot.md # Copilot documentation
βββ .harness/ # Harness CI/CD pipelines
βββ langgang/ # Main Python package
β βββ __init__.py
β βββ mcp_server.py
β βββ docs_mcp_server.py
β βββ langchain_integration.py
β βββ langgraph_integration.py
βββ templates/ # Template collections
β βββ cookiecutter/
β βββ copier/
β βββ maven/
βββ tests/ # Test suite
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=langgang --cov-report=html
# Run specific test file
pytest tests/test_mcp_server.py -v# Format code
black langgang/
# Lint code
ruff check langgang/
# Type checking
mypy langgang/LangGang uses pre-commit hooks to ensure code quality and consistency. Hooks automatically run on git commit to:
- Format code with Black
- Lint and fix issues with Ruff (including naming conventions)
- Type check with mypy
- Run tests to ensure repo works
- Check for security issues with Bandit
- Validate file formats (YAML, JSON, TOML)
Installation:
# Install pre-commit (if not already installed)
pip install pre-commit
# Install git hooks
pre-commit install
# Or use the convenience script
./scripts/install-hooks.sh # Linux/Mac
./scripts/install-hooks.ps1 # Windows PowerShellManual execution:
# Run hooks on all files
pre-commit run --all-files
# Run specific hook
pre-commit run ruff --all-filesNaming Conventions: The hooks enforce consistent naming:
- Functions/Methods:
snake_case - Classes:
PascalCase - Constants:
UPPER_SNAKE_CASE - Private functions/methods:
_leading_underscore - Variables:
snake_case
See pyproject.toml for full configuration.
LangGang uses Harness for CI/CD. Pipeline configuration is in .harness/:
pipeline.yaml: Main CI/CD pipelinetrigger.yaml: PR and push triggers
- LangChain Documentation
- LangGraph Documentation
- Cookiecutter Documentation
- Copier Documentation
- Maven Archetypes
- MCP Protocol
.claude/claude.md: Claude Code integration guide.copilot/copilot.md: GitHub Copilot integration guide- API documentation: Generated from docstrings
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Run tests and linting
- Submit a pull request
- Follow PEP 8 for Python code
- Use type hints everywhere
- Add docstrings to all public APIs
- Write tests for new features
- Keep commits focused and atomic
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain team for the amazing framework
- Cookiecutter and Copier communities
- Maven project for archetype system
- Model Context Protocol creators
Made with β€οΈ by the LangGang community