Automates spec-driven development with a CLI. Enables operations teams to generate code, tests, and documentation from specifications. Integrates with Claude for agentic workflows and supports Go projects.
git clone https://github.com/ariel-frischer/autospec.gitAutomates spec-driven development with a CLI. Enables operations teams to generate code, tests, and documentation from specifications. Integrates with Claude for agentic workflows and supports Go projects.
[{"step":"Install the autospec CLI and Go tools","action":"Run `go install github.com/autospec/autospec@latest` and ensure Go 1.21+ is installed. Verify with `autospec --version` and `go version`.","tip":"Use Docker if you need a consistent environment: `docker run -it --rm -v $(pwd):/app autospec/cli autospec init`"},{"step":"Create or provide a specification file","action":"Write a YAML/JSON spec (e.g., `spec.yaml`) with endpoints, models, and validations. Example: `paths: /users: post: requestBody: User response: 201: User`","tip":"Use `autospec validate spec.yaml` to check your spec before generation"},{"step":"Generate the project structure","action":"Run `autospec generate spec.yaml --lang go --output ./my-api`. This creates the project skeleton with handlers, models, and tests.","tip":"Add `--mock` flag to generate mock implementations for repositories"},{"step":"Implement and test the logic","action":"Edit the generated files in `internal/`, then run `make test` to execute unit tests. Use `make lint` to enforce Go best practices.","tip":"For complex logic, use `autospec diff spec.yaml` to compare your implementation against the original spec"},{"step":"Generate documentation and verify","action":"Run `autospec docs spec.yaml --format openapi > api/swagger.yaml`. Check the docs with `make serve-docs` and validate with `swagger-cli validate api/swagger.yaml`.","tip":"Integrate with Claude by using the `autospec agent` command to get AI-driven code reviews of your implementation"}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/ariel-frischer/autospecCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate a Go project structure, implementation, tests, and documentation from the following specification: [SPECIFICATION]. Use the `autospec` CLI to scaffold the project, then implement the core logic in Go. Ensure the code follows Go best practices, includes unit tests with mocks, and generates Swagger/OpenAPI documentation. Verify the implementation matches the spec by running the tests and checking the generated docs.
### Generated Project Structure
```
my-api/
├── cmd/
│ └── server/
│ └── main.go # Entry point with HTTP server
├── internal/
│ ├── handlers/
│ │ └── user_handler.go # Implements /users endpoints
│ ├── models/
│ │ └── user.go # User domain model
│ ├── services/
│ │ └── user_service.go # Business logic layer
│ └── repositories/
│ └── user_repo.go # Mockable data access layer
├── pkg/
│ └── utils/
│ └── logger.go # Shared utilities
├── api/
│ └── swagger.yaml # Auto-generated OpenAPI spec
├── go.mod
├── go.sum
├── Makefile
└── README.md
```
### Implementation Details
1. **API Endpoints** (from spec):
- `GET /users` - List all users (paginated)
- `POST /users` - Create a new user
- `GET /users/{id}` - Get user by ID
- `PUT /users/{id}` - Update user
2. **Core Logic** (user_service.go):
```go
func (s *UserService) CreateUser(ctx context.Context, user *models.User) error {
if err := s.validateUser(user); err != nil {
return fmt.Errorf("validation failed: %w", err)
}
return s.repo.Create(ctx, user)
}
```
3. **Tests** (user_handler_test.go):
```go
func TestCreateUserHandler(t *testing.T) {
repo := &mocks.UserRepository{}
repo.On("Create", mock.Anything, mock.Anything).Return(nil)
handler := NewUserHandler(repo)
req := httptest.NewRequest("POST", "/users", strings.NewReader(`{"name":"Alice"}`))
w := httptest.NewRecorder()
handler.CreateUser(w, req)
assert.Equal(t, http.StatusCreated, w.Code)
repo.AssertExpectations(t)
}
```
4. **Generated Swagger Docs** (api/swagger.yaml):
```yaml
definitions:
User:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
email:
type: string
format: email
paths:
/users:
post:
summary: Create a new user
parameters:
- in: body
name: user
schema:
$ref: '#/definitions/User'
```
### Verification Results
- ✅ All unit tests pass (12/12)
- ✅ Mock repository properly validates inputs
- ✅ Swagger docs match implemented endpoints
- ✅ Go linting passes with `golangci-lint`
- ✅ Build succeeds with `go build ./...`
### Next Steps
1. Add database integration (replace mock repo)
2. Implement authentication middleware
3. Add CI/CD pipeline using the generated Makefile
4. Deploy to staging environmentAccess telematics data in trucking
Create and collaborate on interactive animations with powerful, user-friendly tools.
IronCalc is a spreadsheet engine and ecosystem
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan