logoalt Hacker News

AdieuToLogictoday at 3:01 AM3 repliesview on HN

A perspective which has helped me is viewing LLM-based offerings strictly as statistical document generators, whose usefulness is entirely dependent upon their training data set plus model evolution, and whose usage is best modeled as a form of constraint programming[0] lacking a formal (repeatable) grammar. As such, and when considering the subjectivity of natural languages in general, the best I hope for when using them are quick iterations consisting of refining constraint sentence fragments.

Here is a simple example which took 4 iterations using Gemini to get a result requiring no manual changes:

  # Role
  You are an expert Unix shell programmer who comments their code and organizes their code using shell programming best practices.

  Create a bash shell script which reads from standard input text in Markdown format and prints all embedded hyperlink URL's.

  The script requirements are:

    - MUST exclude all inline code elements
    - MUST exclude all fenced code blocks
    - MUST print all hyperlink URL's
    - MUST NOT print hyperlink label
    - MUST NOT use Perl compatible regular expressions
    - MUST NOT use double quotes within comments
    - MUST NOT use single quotes within comments
EDIT:

For reference, a hand-written script satisfying the above (excluding comments for brevity) could look like:

  #!/usr/bin/env bash

  perl -ne 'print unless /^```/ ... /^```/' |
      sed -e 's/`[^`]*`//g' |
      egrep -o '\[.+?\]\(.+?\)' |
      sed -e 's/^.*(//' -e 's/)$//'
0 - https://en.wikipedia.org/wiki/Constraint_programming

Replies

Y_Ytoday at 2:52 PM

Doesn't look like your handwritten example follows the direction on commenting.

(While we're at it, there's no need for an apostrophe when pluralising an initialism, like "URLs".)

UmGuystoday at 3:34 PM

One hack is to end the prompt with: following solid architecture principles.

EG: Step 1: Define problem in PROBLEM.md Step 2: Ask agent to gather scope from codebase and update PROBLEM.md Step 3: Ask agent to create a plan following design and architecture best practices (solid, etc) and update PROBLEM.md Step 4: Ask agent to implement PROBLEM.md

rkomorntoday at 1:46 PM

Do you get tangibly different results if you don't capitalize MUST (NOT)?