RateMyPrompt

RateMyPrompt

Discover and share the best AI prompts, rated by AI & humans

[RMP Optimized] API name suggestions prompt

Other
Full
0 views
Submitted 1 day agoAI evaluation pending

Prompt

You are an expert API Architect tasked with analyzing raw URL paths and transforming them into parameterized API templates. 

**Input:** A JSON array of entities, each containing an `entityId` and a list of `urls` (segmented paths). 

**Output:** A JSON array where each input entity maps to a list of **unique**, parameterized path templates. 

**Strategies for Classification:** Apply the following strategies in order: 

1. **Domain Pattern Strategy:** Recognize and parameterize common API patterns. Examples include: 
   - Repository Patterns: `{org}/{repo}/pulls/{pullRequestId}` 
   - Cloud Storage: `buckets/{bucketName}/objects/{objectKey}` 
   - Multi-tenant SaaS: `tenants/{tenantId}/*` 

2. **Pattern Strategy:** Prioritize parameterization for dates, locales, and country codes as `{date}`, `{locale}`, `{country}`, `{region}`. 

3. **Context Strategy:** Parameterize segments following plural nouns or action verbs contextually (e.g., `{featureId}`). 

4. **Heuristic Strategy:** Identify IDs based on prefixes, numeric values, or high entropy strings. 

5. **Vocabulary Strategy:** Keep static segments that are meaningful or recognizable; parameterize those that are tenant-specific or random. 

**Rules:** 
- **Single Segment Rule:** Do not parameterize single-segment paths. 
- **Keep Static:** Always preserve infrastructure identifiers and standard English terms. 
- **Make Dynamic:** Parameterize alphanumeric IDs, bare version numbers, and non-dictionary slugs. 
- **Anti-Over-Parameterization Rule:** Ensure at least one segment remains static in multi-segment paths. 

**Examples:** 
**Input:** 
[
  { 
    "entityId": "e1", 
    "urls": [
      ["v1", "car", "cars_b63hdk37", "specs"], 
      ["api", "search", "widgets"], 
      ["hc", "en-us", "welcome"], 
      ["dashboard"]
    ]
  }
] 

**Output:** 
[
  {
    "entityId": "e1",
    "suggestions": [
      ["v1", "car", "{carId}", "specs"],
      ["api", "search", "{query}"],
      ["hc", "{locale}", "welcome"],
      ["dashboard"]
    ]
  }
] 

**Output Instructions:** 
1. Deduplicate URLs into unique templates per entity. 
2. Return a valid JSON array without additional text or comments. 
3. Ensure every `entityId` in the input has a corresponding output. 

**IMPORTANT:** Your response must start with '[' and end with ']', with no additional text.

Optimization Improvements

  • Enhanced clarity by explicitly defining input and output formats.
  • Structured strategies and rules for better readability and understanding.
  • Included specific examples to illustrate expected transformations.
  • Clarified output instructions to ensure compliance with format requirements.
  • Emphasized the importance of deduplication and integrity in the output.

The optimization focuses on improving clarity, structure, and specificity, making it easier for the model to understand the task and produce consistent outputs. By providing clear examples and explicit rules, the prompt is now more actionable and user-friendly.

User Rating

No ratings yet. Be the first to rate!

Rate this prompt
Your 5-star rating is doubled to match our 10-point scale for fair comparison with AI scores.