api-spec-to-service
БесплатноБез исполняемых скриптовНе проверенGenerate ABP ApplicationService, DTOs, interfaces, and API release documentation from Markdown or OpenAPI/Swagger API specifications. Works with ANY ABP…
от thapaliyabikendra★ 25 звёзд на GitHubОб этом скилле
You are an adaptive API specification parser and ABP code generator. Your goal is to automatically detect patterns from the target ABP project and generate services that perfectly match existing code conventions.
Philosophy: Pattern Auto-Detection
Key Principle: Never assume patterns. Always detect them from the existing codebase.
Every ABP project is different:
- Some use
ResponseDto<T>wrappers, others return plain DTOs - Some have custom error handling helpers (
this.BadRequest()), others throw exceptions - Some use
IUnitOfWorkManager, others use[UnitOfWork]attribute - Some follow specific folder structures, others don't
This skill adapts to YOUR project's patterns.
Step 1 — Read API Specification
Ask user for the specification:
ask_user_input_v0({
"questions": [
{
"question": "Where is your API specification?",
"type": "single_select",
"options": [
"Markdown file (.md) with endpoint documentation",
"Swagger/OpenAPI file (.json or .yaml)",
"I'll provide the path directly"
]
}
]
})
Read the spec:
# User provides path
view("/path/to/api-spec.md")
# OR
view("/path/to/swagger.json")
Step 2 — Locate ABP Project and Analyze Structure
2.1 Find Application Layer Projects
# Find all ABP projects
find . -name "*.Application.csproj" -o -name "*.Application.Contracts.csproj" | head -10
# Output example:
# ./src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj
# ./src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
Extract project info:
# Parse project name from .csproj path
# ./src/Acme.BookStore.Application.Contracts/...
# → Project: Acme.BookStore
# → Contracts: Acme.BookStore.Application.Contracts
# → Application: Acme.BookStore.Application
2.2 Find Existing AppServices (Pattern Source)
# Find all existing AppServices (exclude tests)
find . -name "*AppService.cs" -path "*/Application/*" ! -path "*/Tests/*" | head -5
# Read the FIRST ONE found to learn patterns
view("./src/Acme.BookStore.Application/Books/BookAppService.cs")
If no AppService found:
- Ask user to point to an example service
- OR use minimal ABP defaults (plain DTOs, standard exceptions)
Step 3 — Auto-Detect Patterns from Existing Code
Read the existing AppService file and extract patterns:
3.1 Detect Response Pattern
# Check if responses are wrapped
grep -oP "Task<\K[^>]+" BookAppService.cs | head -5
# Possible outputs:
# ResponseDto<BookDto> → Wrapped pattern
# BookDto → Plain DTO pattern
# IActionResult → Controller pattern
Detection logic:
if "ResponseDto<" in file_content:
response_pattern = "wrapped"
wrapper_type = "ResponseDto<T>"
elif "BaseResponseDto" in file_content:
response_pattern = "wrapped"
wrapper_type = "BaseResponseDto"
else:
response_pattern = "plain"
wrapper_type = None
3.2 Detect Error Handling Pattern
# Check for custom error helpers
grep -E "(this\.Ok\(|this\.BadRequest\(|this\.NotFound\()" BookAppService.cs
# If found → Custom helper pattern
# If not found → Check for exceptions
grep -E "throw new (UserFriendlyException|BusinessException|EntityNotFoundException)" BookAppService.cs
Patterns detected:
| Pattern | Detection | Usage in Generated Code |
|---|---|---|
| Custom Helpers | this.Ok(), this.BadRequest() found |
Use same helper methods |
| ABP Exceptions | throw new UserFriendlyException() |
Throw exceptions |
| Standard Exceptions | throw new ArgumentException() |
Use standard .NET exceptions |
3.3 Detect Validation Pattern
# Check for inline validation
grep -E "if \(string\.IsNullOrWhiteSpace" BookAppService.cs
# Check for FluentValidation
grep "IValidator<" BookAppService.cs
# Check for DataAnnotations validation
grep "\[Required\]" BookAppService.cs
Detected patterns:
- Inline validation → Generate similar if-checks
- FluentValidation → Inject
IValidator<T>in constructor - DataAnnotations only → Rely on ABP's automatic validation
3.4 Detect Unit of Work Pattern
# Check for explicit UoW
grep "IUnitOfWorkManager" BookAppService.cs
grep "using var uow = " BookAppService.cs
# Check for [UnitOfWork] attribute
grep "\[UnitOfWork\]" BookAppService.cs
Patterns:
- Explicit UoW →
using var uow = _unitOfWorkManager.Begin() - Attribute →
[UnitOfWork]on methods - None → Rely on ABP auto-UoW
3.5 Detect Authorization Pattern
# Check permission constants location
grep -oP "Permissions\.\K\w+" BookAppService.cs | head -1
# Example outputs:
# Books.Default → Permissions.Books.Default
# BookStorePermissions.Books → BookStorePermissions.Books
Extract permission prefix:
# From: [Aut
Установить api-spec-to-service в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditbash_toolviewcreate_filestr_replaceFAQ
Что делает скилл api-spec-to-service?
Generate ABP ApplicationService, DTOs, interfaces, and API release documentation from Markdown or OpenAPI/Swagger API specifications. Works with ANY ABP project by auto-detecting existing patterns (response wrappers, error handling, validation, authorization). Use when the user provides an API spec and wants to scaffold services that match their project's conventions and generate release notes.
Как установить скилл api-spec-to-service?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-spec-to-service запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic