Helper skill for working with ExperienceSkill objects in Go SDK codebases. Provides guidance on using the ExperienceSkill model's constructors, getters, setters, and field checkers.
A helper skill for working with the `ExperienceSkill` model in Go SDK codebases. This model represents experience duration in months and is typically auto-generated from OpenAPI/Swagger specifications.
This skill helps you understand and work with the `ExperienceSkill` Go struct, including:
When a user asks about the `ExperienceSkill` model or needs to work with experience tracking in a Go SDK:
1. **Explain the Model Structure**
- The `ExperienceSkill` struct has one field: `ExperienceInMonth` (pointer to int32)
- It's an optional field with a default value of 0
- Being a pointer allows distinguishing between "not set" and "set to zero"
2. **Guide Constructor Usage**
- Use `NewExperienceSkill()` for a basic instance with defaults
- Use `NewExperienceSkillWithDefaults()` for explicit default value assignment
- Example: `skill := NewExperienceSkill()`
3. **Demonstrate Field Access Patterns**
- **Get value**: Use `GetExperienceInMonth()` - returns int32 (zero if nil)
- **Get with nil check**: Use `GetExperienceInMonthOk()` - returns (value, wasSet bool)
- **Set value**: Use `SetExperienceInMonth(months)` - accepts int32
- **Check if set**: Use `HasExperienceInMonth()` - returns bool
4. **Provide Code Examples**
```go
// Create a new experience skill
skill := NewExperienceSkill()
// Set experience to 24 months
skill.SetExperienceInMonth(24)
// Check if the field was set
if skill.HasExperienceInMonth() {
months := skill.GetExperienceInMonth()
fmt.Printf("Experience: %d months\n", months)
}
// Safe access with nil check
if months, ok := skill.GetExperienceInMonthOk(); ok {
fmt.Printf("Experience is set to: %d\n", *months)
}
```
5. **Explain Common Patterns**
- This is typically part of a larger API client SDK
- The model is often used in request/response payloads
- Links to model list, API list, and README suggest it's part of auto-generated documentation
- Optional fields use pointers to distinguish between "not provided" and "zero value"
6. **Handle Related Questions**
- If user needs to work with other models, check the linked documentation
- If integrating with an API, look for the API endpoints documentation
- If troubleshooting, check the README for SDK setup and usage
**Scenario 1**: "How do I create an ExperienceSkill with 36 months?"
```go
skill := NewExperienceSkill()
skill.SetExperienceInMonth(36)
```
**Scenario 2**: "How do I check if experience was provided in the API response?"
```go
if skill.HasExperienceInMonth() {
months := skill.GetExperienceInMonth()
// Process the value
} else {
// Field was not set in the response
}
```
**Scenario 3**: "What's the difference between the two constructors?"
Both create a valid `ExperienceSkill` instance. `NewExperienceSkill()` is the standard constructor, while `NewExperienceSkillWithDefaults()` explicitly ensures all fields with defaults are initialized. In practice, they behave the same for this model.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/go-sdk-experience-skill-helper/raw