Your AI Coding Partner — Clean Language
← All tutorials
first-steps6 min

Your AI Coding Partner

One of the things that makes Clean Language genuinely different is how well it works with AI. Not just paste code and ask questions — but a real, integrated setup where the AI knows the exact language spec, can verify your code, and catches mistakes before you even run anything.

Start the MCP server from your terminal:

cln mcp-server

If you're using VS Code with the Clean Language extension, it connects automatically. Once connected, the AI looks up the current API, checks the syntax, verifies the types — and hands you back working Clean Language code.

Adding require to your functions gives the AI precise information about what they expect:

functions:
    number average(list<number> values)
        require values.length() > 0
        number total = 0.0
        iterate v in values
            total = total + v
        return total / values.length().toNumber()

start:
    list<number> scores = [8.5, 9.0, 7.5]
    print(average(scores).toString())
8.333333333333332

The require tells anyone reading — human or AI — this function assumes the list is not empty. The AI won't generate code that calls average([]) and won't suggest removing the check.

Quick recap

  • cln mcp-server starts the AI integration — the VS Code extension starts it automatically
  • AI assistants with the MCP server know the real, current Clean Language spec
  • Describe what you want in plain language and get back spec-correct code
  • require in your functions gives the AI precise expectations to work from
  • You always review and own the code the AI generates
Copied!