Style DNA Ghostwriter
Style DNA Ghostwriter
Изучите неписаные соглашения кодовой базы. Пишите код, который выглядит как родной.
Проблема
Стилистические руководства и линтеры проверяют только те правила, которые команда удосужилась записать. Остальная часть реальной индивидуальности кодовой базы — как обрабатываются ошибки, как структурируются компоненты, отдаётся ли предпочтение стрелочным функциям или объявлениям, как используются утилиты Tailwind или CSS-модули, насколько подробными на самом деле являются докстринги — живёт только в самом коде. ИИ-генерируемый код игнорирует всё это и по умолчанию использует общий, академический стиль, который как раз и выдаёт его как чужеродный.
Style DNA Ghostwriter решает эту проблему, изучая соглашения так, как это сделал бы новый опытный инженер: читая код, а не вики-страницу, которую никто не обновлял.
$ style-dna analyze ./my_web_app
Analyzed 42 files from './my_web_app' (0 Python, 42 Web).
Style profile saved to: style_profile.json
## Web Conventions
- Detected frameworks/tools: Next.js, React, Tailwind CSS, TypeScript.
### JavaScript / TypeScript
- Use single quotes for JS/TS strings.
- Omit semicolons at end of statements.
- Prefer arrow functions (`const fn = () => {}`).
- Prefer named exports.
- Use path aliases (`@/...`) for imports instead of deep relative paths.
- Prefer `interface` over `type` for object shapes in TypeScript.
### React / Next.js
- Next.js routing: App Router (`app/`).
- Define React components as arrow functions (`const Button = () => ...`).
- Component file naming: PascalCase.
- ~40% of components use 'use client' directive.
- State management: zustand.
### CSS / Styling
- Styling approach: Tailwind CSS utility classes.
- Uses CSS custom properties (`var(--token-name)`) for design tokens.
- Preferred color format: HSL.Related MCP server: Coding Standards MCP Server
Работает с любым агентом кодирования
Одна команда подключает извлечённый стиль ко всем агентам, которые использует ваша команда — без плагинов, без настройки под каждый инструмент:
style-dna initЭто записывает правила непосредственно в файлы соглашений, которые агенты уже читают при запуске сессии:
Файл | Автоматически читается |
| Google Antigravity & Gemini Code Assist |
| Claude Code |
| Google Antigravity, Codex, OpenCode и инструменты, следующие стандарту AGENTS |
| Cursor |
| Windsurf |
| GitHub Copilot |
Для агентов, использующих Model Context Protocol (Claude Code, Cursor и
другие), style-dna init также выводит готовую к вставке конфигурацию MCP, чтобы
агент мог получать правила в реальном времени, а не из статического файла:
{
"mcpServers": {
"style-dna": {
"command": "style-dna",
"args": ["mcp"]
}
}
}Доступные инструменты MCP: analyze_repo, get_style_rules, refresh_style_profile.
Что извлекается
Стек / Категория | Извлекаемые сигналы |
Python | Стиль регистра функций/переменных, частота использования приватных префиксов ( |
JavaScript / TypeScript | Точки с запятой ( |
React / Next.js | App Router ( |
CSS и стилизация | Tailwind CSS vs CSS Modules ( |
HTML | Стиль отступов (2 пробела / 4 пробела / табуляция), стиль кавычек в атрибутах ( |
Как это работает
analyzeобходит кодовую базу и анализирует каждый исходный файл без внешних бинарных зависимостей или компиляторов. Подключаемый набор специализированных экстракторов обрабатывает деревья разбора и токены исходного кода для созданияStyleProfile— структурированного, версионируемого слепка, сохраняемого какstyle_profile.json.initзапускаетanalyze, затем внедряет этот профиль в стандартные файлы соглашений агентов (CLAUDE.md,AGENTS.md,.cursorrulesи т.д.), обрамлённые чистыми маркерами обновления (<!-- style-dna:start -->...<!-- style-dna:end -->).generate(опционально) превращает профиль в системный промпт и напрямую вызывает API Claude для команд, которые хотят получать сгенерированный код из терминала.
style-dna-ghostwriter/
├── style_dna/
│ ├── analyzer.py # multi-language codebase scanner
│ ├── profile.py # StyleProfile data model + save/load + multi-stack rules
│ ├── generator.py # profile -> system prompt -> Claude API call
│ ├── mcp_server.py # MCP server exposing tools for agents
│ ├── conventions.py # upserts rules into CLAUDE.md/AGENTS.md/.cursorrules/etc.
│ ├── cli.py # `style-dna` CLI (init, analyze, show, generate, mcp)
│ └── extractors/ # Python, JS/TS, React/Next.js, CSS/Tailwind, HTML
├── examples/
│ ├── sample_repo/ # Python test fixture
│ └── sample_web_repo/ # Next.js 14 + React TSX + Tailwind test fixture
└── tests/ # Complete test suiteУстановка
# Core only (zero external dependencies):
pip install -e .
# With MCP server support:
pip install -e ".[mcp]"
# With direct Claude code generation support:
pip install -e ".[generate]"
# All features:
pip install -e ".[all]"Использование
# One-shot setup for any repo (Python, React, Next.js, etc.):
style-dna init
# Inspect codebase style rules:
style-dna analyze ./my_repo --out style_profile.json
style-dna show style_profile.json
style-dna show style_profile.json --format json
# Direct generation (requires ANTHROPIC_API_KEY):
export ANTHROPIC_API_KEY=sk-...
style-dna generate style_profile.json \
"Write a React component that displays a product card with add to cart button" \
--out ProductCard.tsxВ качестве библиотеки Python:
from style_dna import analyze_codebase
from style_dna.generator import generate_code
profile = analyze_codebase("./my_repo")
code = generate_code(profile, "Add a custom hook to manage user favorites")Тестирование
pip install -e ".[dev]"
python -m pytest tests/ -vЛицензия
Выпущено под лицензией MIT.
Создано Kaifazad — kaifazad.in
This server cannot be deployed
Maintenance
Related MCP Connectors
Serves your design system and coding standards to coding agents, so they stop guessing.
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Repo intel for AI coding agents: overview, PRs, contributors, hot files, CI, deps. Remote MCP.
Zero-install security baseline for AI coding agents — OWASP/CWE-cited rules over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceCode linting and style checking tools for AI agents, exposed as an MCP server. Supports style checks, naming conventions, complexity analysis, dead code detection, and import analysis.41 npmMIT
- FlicenseNot gradedqualityDmaintenanceAutomatically enforces team coding standards in AI-assisted development by providing an MCP server that AI assistants can query for language-specific standards, style guides, and best practices.-
- AlicenseNot gradedqualityDmaintenanceProvides a CLI and MCP server for scanning repositories to generate evidence-backed, project-specific instruction files for AI coding assistants, ensuring AI behavior aligns with existing codebase conventions.1 npm15Apache 2.0
- AlicenseNot gradedqualityDmaintenanceScans your source code using AST analysis to detect coding conventions, error handling, API patterns, and more, then generates a CONVENTIONS.md file to help AI agents follow your project's style.MIT