Skip to content

fullo/sustainable-code-skill-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Green Coding Skills — Agent Skills + MCP Tools

Skill Version MCP Tools CI License: MIT Agent Skills

A collection of Agent Skills and MCP tools that audit software projects for environmental sustainability, accessibility, and quality, then implement measurable improvements.

Commands

Command What it does
/gc-setup Full 9-phase sustainability audit (SCI, WSG, a11y, performance, testing, baselines)
/gc-dev Daily development companion — green check before commit, feature planning, PR review
/gc-measure-sci Measure SCI carbon intensity for a specific operation or endpoint
/gc-check-sustainability Quick sustainability check (WSG, green hosting, code patterns)
/gc-estimate-emissions Estimate CO2 emissions per page view or across a sitemap

What /gc-setup covers

When activated, the skill guides your AI agent through a 9-phase workflow:

  1. Explore — understand the codebase, stack, and architecture
  2. Energy & Carbon (SCI) — measure carbon intensity per operation using the Green Software Foundation SCI formula
  3. WSG Compliance — evaluate against all 80 W3C Web Sustainability Guidelines 1.0
  4. Accessibility — set up Lighthouse CI auditing with WCAG 2.1 AA thresholds
  5. Performance & Resource Efficiency — bundle size, lazy loading, caching, fonts, images
  6. Testing & Quality — test infrastructure, coverage, critical path tests
  7. Prioritize — rank actions by impact x feasibility (P0-P3)
  8. Establish Baselines — measurable targets for every dimension
  9. Sustainability-Aware CLAUDE.md — encode sustainability into the development workflow

Standards and tools

Area Standard / Tool
Carbon measurement SCI (Software Carbon Intensity)
SCI profiling (JS/TS) SCI Profiler — zero-dependency TypeScript library
SCI profiling (PHP) SCI Profiler PHP — zero-code-changes, framework-agnostic
Page emissions Sustainable Web Design (SWD) v4 model
Web sustainability W3C WSG 1.0 (80 guidelines)
Accessibility WCAG 2.1 AA via Lighthouse CI
Performance Lighthouse performance scores, bundle budgets
Green patterns Green Software Foundation patterns catalog
Static analysis Creedengo green code rules
CI energy tracking eco-ci-energy-estimation for pipeline measurement
Cloud carbon Cloud Carbon Footprint

Installation

Step 1 — Install the skills

Clone the repository and copy the skills into your project:

git clone https://github.com/fullo/sustainable-code-skill-setup.git ~/.gc-tools
cp -r ~/.gc-tools/skills-agent/* .claude/skills/

Or install globally (available across all projects):

git clone https://github.com/fullo/sustainable-code-skill-setup.git ~/.gc-tools
cp -r ~/.gc-tools/skills-agent/* ~/.claude/skills/

To update later:

cd ~/.gc-tools && git pull
cp -r skills-agent/* ~/.claude/skills/        # or .claude/skills/ for project-local

Your .claude/skills/ directory will contain:

.claude/skills/
  gc-setup/                             # Full 9-phase audit
    SKILL.md
    references/                         # 8 reference files loaded on-demand
  gc-measure-sci/                       # Quick SCI measurement
    SKILL.md
  gc-dev/                               # Daily dev companion
    SKILL.md
  gc-check-sustainability/              # Quick sustainability check
    SKILL.md
  gc-estimate-emissions/                # Page/sitemap emissions
    SKILL.md

Step 2 (optional) — Enable MCP tools

The MCP plugin gives your agent access to 8 sustainability measurement tools. This enhances the skills with real-time calculations but is not required — all skills include manual fallback instructions.

If you already cloned in Step 1, just build the MCP plugin:

cd ~/.gc-tools/mcp-plugin
npm install && npm run build

Then add to your project's .claude/settings.json (replace $HOME with your actual home directory path):

{
  "mcpServers": {
    "sustainable-code": {
      "command": "node",
      "args": ["/Users/yourname/.gc-tools/mcp-plugin/dist/index.js"]
    }
  }
}

Tip: Run echo $HOME to get your home directory path. For example, on macOS it's typically /Users/yourname, on Linux /home/yourname.

Verify the tools are working by restarting Claude Code and asking:

"Use the grid_carbon_intensity tool to check Italy's carbon intensity"

If the agent returns a gCO2eq/kWh value, the MCP server is working correctly.

MCP tools

Tool Used by Description
sci_calculate /gc-setup, /gc-measure-sci Compute SCI carbon intensity per functional unit
swd_estimate /gc-setup, /gc-estimate-emissions Estimate page-level CO2 via SWD v4 model
swd_batch /gc-setup, /gc-estimate-emissions Estimate emissions for multiple pages at once
check_green_hosting /gc-setup, /gc-check-sustainability Check if a domain uses green hosting
grid_carbon_intensity /gc-setup, /gc-measure-sci Look up grid carbon intensity by country
wsg_compliance_score /gc-setup, /gc-check-sustainability Score a WSG compliance JSON file
creedengo_check /gc-setup, /gc-check-sustainability Check source files against green code rules
sci_compare /gc-setup, /gc-measure-sci Compare two SCI measurements

File structure

sustainable-code-skill-setup/
  README.md                               # This file
  CONTRIBUTING.md                         # How to contribute
  LICENSE                                 # MIT
  skills-agent/                           # Copy this into .claude/skills/
    gc-setup/                             # /gc-setup — full 9-phase audit
      SKILL.md
      references/                         # 8 reference files loaded on-demand
    gc-dev/                               # /gc-dev — daily dev companion
      SKILL.md
    gc-measure-sci/                       # /gc-measure-sci — SCI measurement
      SKILL.md
    gc-check-sustainability/              # /gc-check-sustainability — quick check
      SKILL.md
    gc-estimate-emissions/                # /gc-estimate-emissions — page emissions
      SKILL.md
  examples/                               # Walkthroughs and reference docs
    01-first-audit.md                     # Full /gc-setup example
    02-measure-sci.md                     # SCI measurement example
    03-page-emissions.md                  # Page emissions example
    04-daily-workflow.md                  # Daily dev workflow
    05-mcp-tools-reference.md            # Complete MCP tools reference
    sample-wsg-compliance.json           # Sample WSG compliance file
  mcp-plugin/                             # MCP server (optional, Step 2)
    src/tools/                            # 8 tool implementations
    src/tools/__tests__/                  # Test suite (72 tests)
    src/lib/                              # Shared constants and types
  scripts/                                # Validation and CI helpers

Compatibility

This skill follows the Agent Skills open format and works with 30+ AI agents and tools, including:

Examples

The examples/ directory contains complete walkthroughs and reference documentation:

Example Description
First Audit Full /gc-setup walkthrough on a Next.js app
Measure SCI SCI measurement for an API endpoint (with and without MCP)
Page Emissions Single page and full sitemap emissions estimation
Daily Workflow How /gc-dev integrates into your development cycle
MCP Tools Reference Complete reference for all 8 MCP tools with parameters and examples

Development

See CONTRIBUTING.md for how to contribute, commit conventions, and data update procedures.

License

MIT

About

Agent Skill for sustainable software development — SCI carbon measurement, W3C WSG 1.0 compliance, accessibility auditing, and green coding practices

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors