News for hackers. Stuff that matters.
Re:6 Weeks of Claude Code by baq on Saturday August 02, 2025 @01:42PM (#44769629)
Fascinating since I found the recent Claude models untrustworthy for writing and editing SQL. E.g. it'd write conditions correctly, but not add parens around ANDs and ORs (which gemini pro then highlighted as a bug, correctly.)
Re:6 Weeks of Claude Code by CharlesW on Saturday August 02, 2025 @03:39PM (#44770702)
If you aren't already (1) telling Claude Code which flavor of SQL you want (there are several major dialects and many more minor ones) and (2) giving it access to up-to-date documentation via MCP (e.g. https://github.com/arabold/docs-mcp-server) so it has direct access to canonical docs for authoritative grounding and syntax references, you'll find that you get much better results by doing one or both of those things.
Re:6 Weeks of Claude Code by impure-aqua on Saturday August 02, 2025 @04:30PM (#44771136)
Documentation on features your SQL dialect supports and key requirements for your query are very important for incentivizing it to generate the output you want.

As a recent example, I am working on a Rust app with integrated DuckDB, and asked it to implement a scoring algorithm query (after chatting with it to generate a Markdown file "RFC" describing how the algorithm works.) It started the implementation with an absolute minimal SQL query that pulled all metrics for a given time window.

I questioned this rather than accepting the change, and it said its plan was to implement the more complex aggregation logic in Rust because 1) it's easier to interpret Rust branching logic than SQL statements (true) and 2) because not all SQL dialects include EXP(), STDDEV(), VAR() support which would be necessary to compute the metrics.

The former point actually seems like quite a reasonable bias to me, personally I find it harder to review complex aggregations in SQL than mentally traversing the path of data through a bunch of branches. But if you are familiar with DuckDB you know that 1) it does support these features and 2) the OLAP efficiency of DuckDB makes it a better choice for doing these aggregations in a performant way than iterating through the results in Rust, so the initial generated output is suboptimal.

I informed it of DuckDB's support for these operations and pointed out the performance consideration and it gladly generated the (long and certainly harder to interpret) SQL query, so it is clearly quite capable, just needs some prodding to go in the right direction.

Re:6 Weeks of Claude Code by msikora on Saturday August 02, 2025 @05:41PM (#44771828)
Haven't heard of docs-mcp-server, but there is the very popular Context7 with 23k Github stars and more active development:

https://github.com/upstash/context7

Re:6 Weeks of Claude Code by CharlesW on Saturday August 02, 2025 @06:09PM (#44772042)
Great suggestion, thank you!
Re:6 Weeks of Claude Code by risyachka on Saturday August 02, 2025 @03:01PM (#44770363)
I bet it highly depends on the work you do.

It is very useful for simpler tasks like writing tests, converting code bases etc where the hard part is already done.

When it comes to actually doing something hard - it is not very useful at least in my experience.

And if you do something even a bit niche - it is mostly useless and its faster do dig into topic on your own that try to have Claude implement it.

Re:6 Weeks of Claude Code by danielbln on Saturday August 02, 2025 @03:22PM (#44770560)
Even when I hand roll certain things, it still nice to have Claude Code take over any other grunt work that might come my way. And there are always yaks to shave, always.
Re:6 Weeks of Claude Code by UltraSane on Saturday August 02, 2025 @04:49PM (#44771322)
Claude Sonnet 4 is very good at generating Cypher queries for Neo4j
Re:6 Weeks of Claude Code by globalise83 on Saturday August 02, 2025 @05:41PM (#44771830)
Try getting Claude to write a style guideline based on some of your existing manually coded work and then see if it improves using that in context.
Re:6 Weeks of Claude Code by ako on Saturday August 02, 2025 @05:47PM (#44771871)
I found claude sonnet 4 really good at writing SQL if you give it a feedback loop with real data. It will research the problem, research the data, and improve queries until it finds a solution. And then it will optimize it, even optimize performance if you ask it to run explain plan or look at pg_stat_statemnts (postgres).
Re:6 Weeks of Claude Code by martinald on Saturday August 02, 2025 @07:47PM (#44772754)
It's outrageously good at performance optimization. There's been multiple really complex queries I've optimized with it that I'd been putting off for a long time. Claude code figured the exact indexes to add within seconds (not ones I would have got easily manually).
Re:6 Weeks of Claude Code by nojito on Saturday August 02, 2025 @07:53PM (#44772798)
The trick is to have it run it through sqlglot and correct the errors.
Re:6 Weeks of Claude Code by yakz on Sunday August 03, 2025 @10:32AM (#44776830)
This kind of thing is a key point. Tell Claude Code to build the project, run linters, run the tests, and fix the errors. This (in my experience) has a good chance of filtering out mistakes. Claude is fully capable of running all of the tools, reading the output, and iterating. Higher level mistakes will need code written in a way that is testable with tests that can catch them, although you probably want that anyway.