astro-cta-injector
Skill15 starsChanged 12 months agoMITView on GitHub
Inject Call-to-Action blocks into Astro site content with intelligent placement strategies. Use when the user wants to add CTAs, newsletter signups, product promotions, or any content blocks to blog posts. Supports multiple placement strategies (end, after 50%, after 60%), content scoring for relevance, and dry-run preview.
In this repository4 other files it gives its agents.
- gsc-assistantSkill
- link-analyzerSkill
- pre-publish-post-assistantSkill
- seo-wordpress-managerSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Create a config.json in the skill directory:
- Distinctive: line 144
Backup creation: before any modifications
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Astro CTA Injector Skill
Purpose
This skill injects Call-to-Action (CTA) blocks into Astro site content. It supports:
- Multiple CTA types (newsletter, product, custom)
- Intelligent placement strategies
- Content-based relevance scoring
- Batch processing with preview
When to Use This Skill
- User asks to "add CTAs to blog posts"
- User wants to "inject newsletter signup" into content
- User mentions "add product promotion" to posts
- User needs to batch-add any type of content block to posts
- User wants to "add calls to action" to their Astro site
Prerequisites
- Astro site with content in
.astroor.mdfiles - Python 3.10+
- BeautifulSoup4 for HTML parsing
Configuration
Create a config.json in the skill directory:
{
"content_path": "./src/content/blog",
"file_patterns": ["*.astro", "*.md"],
"cta_types": {
"newsletter": {
"template": "newsletter.html",
"default_placement": "after-paragraph-50%",
"keywords": ["tip", "guide", "learn", "strategy"]
},
"product": {
"template": "product.html",
"default_placement": "end",
"keywords": ["productivity", "task", "habit", "goal"]
}
},
"output": {
"state_file": "./state/cta_injection_progress.json",
"backup_dir": "./backups",
"report_file": "./reports/cta_injection_report.md"
},
"dry_run": true
}Placement Strategies
| Strategy | Description | Best For |
end | After all content | Non-intrusive CTAs |
after-paragraph-50% | After 50% of paragraphs | Mid-content engagement |
after-paragraph-60% | After 60% of paragraphs | Later engagement |
after-heading | After first H2 | Early engagement |
before-conclusion | Before last paragraph | Strong finish |
CTA Templates
Templates are HTML files in the templates/ directory:
<!-- templates/newsletter.html -->
<aside class="cta-newsletter" data-cta-type="newsletter">
<h3>{{title}}</h3>
<p>{{description}}</p>
<form action="{{form_url}}" method="post">
<input type="email" placeholder="Your email" required />
<button type="submit">Subscribe</button>
</form>
</aside>Variables:
{{title}}- CTA headline{{description}}- CTA body text{{form_url}}- Form submission URL{{product_url}}- Product link{{image_url}}- Image source
Workflow
Step 1: Score Posts for Relevance
python scripts/score_posts.py --content-path ./src/content/blog --cta-type newsletterStep 2: Preview Injections
python scripts/preview_injection.py --input scored_posts.json --cta-type newsletterStep 3: Apply Injections
python scripts/inject_ctas.py --input scored_posts.json --cta-type newsletterInput Format
Scored posts JSON:
{
"posts": [
{
"file_path": "./src/content/blog/my-post.astro",
"title": "My Blog Post",
"relevance_score": 8.5,
"cta_type": "newsletter",
"placement": "after-paragraph-50%",
"cta_data": {
"title": "Get More Tips Like This",
"description": "Subscribe to my weekly newsletter"
}
}
]
}Scoring Algorithm
Posts are scored for CTA relevance based on:
- Keyword density - How many relevant keywords appear
- Content length - Longer posts = better candidates
- Topic match - Title and content topic alignment
- Existing CTAs - Skip posts that already have CTAs
Scores range from 0-10. Default threshold: 5.0
Safety Features
- Dry-run mode by default
- Backup creation before any modifications
- Duplicate detection - Won't inject if CTA already exists
- Rollback capability - Restore from backups
- Preview diffs - See exactly what will change
Example Usage
User: "Add a newsletter signup CTA to all my productivity-related blog posts"
Claude will:
- Scan content directory for posts
- Score posts for "newsletter" relevance using productivity keywords
- Generate CTA HTML from template
- Show preview of changes
- Ask for confirmation
- Inject CTAs into matching posts
- Report results
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

